translations: merge in my older work on the translation tool

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@662 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-05-21 13:28:32 +00:00
parent 30a5b6d53c
commit 99756b5d0a
3 changed files with 12 additions and 21 deletions

View file

@ -23,6 +23,7 @@ import javax.swing.Timer;
import javax.swing.filechooser.FileNameExtensionFilter;
import micropolisj.engine.*;
import micropolisj.util.TranslationTool;
public class MainWindow extends JFrame
implements Micropolis.Listener, EarthquakeListener

View file

@ -1,17 +0,0 @@
package micropolisj.gui;
import java.awt.*;
import javax.swing.*;
public class TranslationTool extends JFrame
{
public TranslationTool()
{
JButton btn = new JButton("Hello World!");
add(btn, BorderLayout.CENTER);
pack();
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
}

View file

@ -16,13 +16,20 @@ public class TranslationTool extends JFrame
String lastVariant;
public TranslationTool()
throws IOException
{
setTitle("MicropolisJ Translation Tool");
try {
stringsModel = new StringsModel();
stringsModel.addLocale(null);
}
catch (IOException e) {
JOptionPane.showMessageDialog(this,
e, "Error", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
stringsTable = new JTable(stringsModel);
stringsTable.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()));
JScrollPane scrollPane = new JScrollPane(stringsTable);
@ -167,12 +174,12 @@ public class TranslationTool extends JFrame
static class StringsModel extends AbstractTableModel
{
StringInfo [] strings;
ArrayList<MyLocaleInfo> locales = new ArrayList<>();
ArrayList<MyLocaleInfo> locales = new ArrayList<MyLocaleInfo>();
static class MyLocaleInfo
{
String code;
HashMap<String,Properties> propsMap = new HashMap<>();
HashMap<String,Properties> propsMap = new HashMap<String,Properties>();
boolean dirty;
MyLocaleInfo(String code) {
@ -201,7 +208,7 @@ public class TranslationTool extends JFrame
StringsModel() throws IOException
{
ArrayList<StringInfo> ss = new ArrayList<>();
ArrayList<StringInfo> ss = new ArrayList<StringInfo>();
for (String f : FILES) {
loadStrings(f, ss);
}