translation-tool: remove Save btn; instead, auto-save when needed
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@670 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
5fddf1d8f1
commit
a9eaa3021e
1 changed files with 26 additions and 10 deletions
|
@ -54,13 +54,6 @@ public class TranslationTool extends JFrame
|
||||||
}});
|
}});
|
||||||
buttonPane.add(removeBtn);
|
buttonPane.add(removeBtn);
|
||||||
|
|
||||||
btn = new JButton("Save");
|
|
||||||
btn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
onSaveClicked();
|
|
||||||
}});
|
|
||||||
buttonPane.add(btn);
|
|
||||||
|
|
||||||
testBtn = new JButton("Test");
|
testBtn = new JButton("Test");
|
||||||
testBtn.addActionListener(new ActionListener() {
|
testBtn.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
@ -78,8 +71,19 @@ public class TranslationTool extends JFrame
|
||||||
updateButtonsEnabled();
|
updateButtonsEnabled();
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
public void windowClosing(WindowEvent evt) {
|
||||||
|
closeWindow();
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeWindow()
|
||||||
|
{
|
||||||
|
maybeSave();
|
||||||
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getMicropolisJarFile()
|
private File getMicropolisJarFile()
|
||||||
|
@ -99,6 +103,8 @@ public class TranslationTool extends JFrame
|
||||||
|
|
||||||
private void onTestClicked()
|
private void onTestClicked()
|
||||||
{
|
{
|
||||||
|
maybeSave();
|
||||||
|
|
||||||
String code = pickLocale(
|
String code = pickLocale(
|
||||||
"Which locale do you want to test?",
|
"Which locale do you want to test?",
|
||||||
"Test Locale"
|
"Test Locale"
|
||||||
|
@ -139,7 +145,7 @@ public class TranslationTool extends JFrame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSaveClicked()
|
private void maybeSave()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -156,6 +162,8 @@ public class TranslationTool extends JFrame
|
||||||
|
|
||||||
private void onAddLocaleClicked()
|
private void onAddLocaleClicked()
|
||||||
{
|
{
|
||||||
|
maybeSave();
|
||||||
|
|
||||||
Locale L = Locale.getDefault();
|
Locale L = Locale.getDefault();
|
||||||
|
|
||||||
JTextField langEntry = new JTextField(L.getLanguage());
|
JTextField langEntry = new JTextField(L.getLanguage());
|
||||||
|
@ -257,18 +265,26 @@ public class TranslationTool extends JFrame
|
||||||
|
|
||||||
private void onRemoveLocaleClicked()
|
private void onRemoveLocaleClicked()
|
||||||
{
|
{
|
||||||
|
maybeSave();
|
||||||
String code = pickLocale(
|
String code = pickLocale(
|
||||||
"Which locale do you want to remove?",
|
"Which locale do you want to remove?",
|
||||||
"Remove Locale"
|
"Remove Locale"
|
||||||
);
|
);
|
||||||
if (code != null) {
|
if (code != null) {
|
||||||
stringsModel.removeLocale(code.equals("C") ? null : code);
|
stringsModel.removeLocale(code);
|
||||||
updateButtonsEnabled();
|
updateButtonsEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSubmitClicked()
|
private void onSubmitClicked()
|
||||||
{
|
{
|
||||||
|
maybeSave();
|
||||||
|
String code = pickLocale(
|
||||||
|
"Which locale do you want to submit?",
|
||||||
|
"Submit Locale"
|
||||||
|
);
|
||||||
|
if (code == null) return;
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue