summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-08-13 15:45:10 +0200
committerSimon Rettberg2015-08-13 15:45:10 +0200
commit9693e1a8484cc7ab05e6d62bad7bfa561d4aa3d7 (patch)
treefc32e08b30d5643cf1bbd1753ec6f1cc076a8217 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java
parent[client] Fix positioning of Wizard (diff)
downloadtutor-module-9693e1a8484cc7ab05e6d62bad7bfa561d4aa3d7.tar.gz
tutor-module-9693e1a8484cc7ab05e6d62bad7bfa561d4aa3d7.tar.xz
tutor-module-9693e1a8484cc7ab05e6d62bad7bfa561d4aa3d7.zip
[client] Layout tweaks, Change owner feature
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java46
1 files changed, 24 insertions, 22 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java
index f7399beb..188eb3cd 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java
@@ -28,8 +28,14 @@ public class UserListWindow extends UserListWindowLayout {
private final static Logger LOGGER = Logger.getLogger(UserListWindow.class);
- public UserListWindow(final Frame modalParent, final UserAddedCallback callback) {
- super(modalParent);
+ private final UserListWindow me = this;
+
+ public interface UserAddedCallback {
+ public void userAdded(UserInfo user, UserListWindow window);
+ }
+
+ public UserListWindow(final Frame modalParent, final UserAddedCallback callback, String actionCaption) {
+ super(modalParent, actionCaption);
addWindowListener(new WindowAdapter() {
@Override
@@ -70,32 +76,28 @@ public class UserListWindow extends UserListWindowLayout {
RowFilter.regexFilter("(?i)" + searchUserField.getText()));
searchUserField.setForeground(UIManager.getColor("TextField.foreground"));
} catch (IllegalArgumentException ex) {
- // TODO set background color of search field to something redish
searchUserField.setForeground(Color.RED);
}
}
});
- // ActionListener for the two buttons
- final ActionListener al = new ActionListener() {
+ setButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- if ("Set".equals(e.getActionCommand())) {
- final UserInfo user = userTable.getSelectedItem();
- if (user == null)
- return;
- callback.userAdded(user);
- }
- if ("Cancel".equals(e.getActionCommand())) {
- setVisible(false);
- dispose();
- }
+ final UserInfo user = userTable.getSelectedItem();
+ if (user == null)
+ return;
+ callback.userAdded(user, me);
+ }
+ });
+
+ cancelButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ dispose();
}
- };
- setButton.setActionCommand("Set");
- setButton.addActionListener(al);
- cancelButton.setActionCommand("Cancel");
- cancelButton.addActionListener(al);
+ });
+
getRootPane().setDefaultButton(setButton);
userTable.addMouseListener(new MouseAdapter() {
@@ -109,7 +111,7 @@ public class UserListWindow extends UserListWindowLayout {
this.setLocationRelativeTo(modalParent);
}
- public static void open(Frame modalParent, final UserAddedCallback callback) {
- new UserListWindow(modalParent, callback).setVisible(true);
+ public static void open(Frame modalParent, UserAddedCallback callback, String actionCaption) {
+ new UserListWindow(modalParent, callback, actionCaption).setVisible(true);
}
}