summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
diff options
context:
space:
mode:
authorJonathan Bauer2015-09-07 14:54:44 +0200
committerJonathan Bauer2015-09-07 14:54:44 +0200
commit7c64cba8e3ec9ffd0dc5eb8b1ae18831bfc891cf (patch)
treeebb14a1f16427580039eeb4d85c1631104f988a1 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
parent[client] fix open folder (missing listener) (diff)
downloadtutor-module-7c64cba8e3ec9ffd0dc5eb8b1ae18831bfc891cf.tar.gz
tutor-module-7c64cba8e3ec9ffd0dc5eb8b1ae18831bfc891cf.tar.xz
tutor-module-7c64cba8e3ec9ffd0dc5eb8b1ae18831bfc891cf.zip
[client] ConfigWindow: when saved, change "Cancel" to "Close". If new changes, reset to "Cancel"
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java43
1 files changed, 20 insertions, 23 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
index 49c756af..ddea0789 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
@@ -21,7 +21,7 @@ import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.ThriftError;
import org.openslx.thrifthelper.ThriftManager;
-public class ConfigWindow extends ConfigWindowLayout implements UiFeedback {
+public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, ActionListener {
private final static Logger LOGGER = Logger.getLogger(ConfigWindow.class);
private SatelliteUserConfig userConfig = null;
@@ -44,14 +44,8 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback {
default:
break;
}
- final ActionListener reactiveListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- reactToInput();
- }
- };
- btnProxyNone.addActionListener(reactiveListener);
- btnProxyAuto.addActionListener(reactiveListener);
+ btnProxyNone.addActionListener(this);
+ btnProxyAuto.addActionListener(this);
// -- END PROXY --
// -- SAT USER CONFIG --
@@ -62,7 +56,7 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback {
} else {
btnSendMeMail.setSelected(false);
}
- btnSendMeMail.addActionListener(reactiveListener);
+ btnSendMeMail.addActionListener(this);
// -- END USER CONFIG --
// -- FONT CONFIG --
@@ -76,21 +70,20 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback {
});
// -- BOTTOM BUTTONS --
- btnSave.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- saveOptions();
- }
- });
-
- btnClose.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- dispose();
- }
- });
+ btnSave.addActionListener(this);
+ btnClose.addActionListener(this);
// -- END BOTTOM BUTTONS --
}
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Object source = e.getSource();
+ if (source == btnProxyAuto || source == btnProxyHttp || source == btnProxyNone || source == btnProxySocks)
+ reactToInput();
+ if (source == btnSave)
+ saveOptions();
+ if (source == btnClose)
+ dispose();
+ }
private void reactToInput() {
// our flag to en/disable the save button
boolean changed = false;
@@ -111,6 +104,8 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback {
// en/disable the save button
btnSave.setEnabled(changed);
+ if (changed)
+ btnClose.setText("Abbrechen");
}
private SatelliteUserConfig getSatUserConfig() {
SatelliteUserConfig userConfig = null;
@@ -157,6 +152,8 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback {
}
// let the user know he needs to restart for the changes to apply
Gui.showMessageBox(this, "Die Änderungen werden erst nach einem Programmneustart wirksam.", MessageType.INFO, LOGGER, null);
+ // "success" so change "Cancel" -> "Close"
+ btnClose.setText("Schließen");
}
public static boolean shouldBeShown() {
return true;