summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2019-04-04 16:30:37 +0200
committerJonathan Bauer2019-04-04 16:30:37 +0200
commit2d2d6d5ffdf35ac510659bf51e0086dcd6de63f3 (patch)
treefe5773314977d26532d94cebb77541be1f6c626d
parent[client] ldapfilter: remove grey text for predef (diff)
downloadtutor-module-2d2d6d5ffdf35ac510659bf51e0086dcd6de63f3.tar.gz
tutor-module-2d2d6d5ffdf35ac510659bf51e0086dcd6de63f3.tar.xz
tutor-module-2d2d6d5ffdf35ac510659bf51e0086dcd6de63f3.zip
[client] netrules: layout
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java35
1 files changed, 27 insertions, 8 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java
index 2c93bff8..32840913 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java
@@ -2,6 +2,7 @@ package org.openslx.dozmod.gui.configurator;
import java.awt.Color;
import java.awt.Dialog.ModalityType;
+import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
@@ -16,17 +17,21 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
+import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
+import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
+import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
@@ -195,27 +200,41 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
return;
}
final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this),
- "Regelsets auswählen", ModalityType.APPLICATION_MODAL);
+ "Auswahl", ModalityType.APPLICATION_MODAL);
JPanel pane = new JPanel();
+ pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
+ .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
+ pane.getActionMap().put("cancel", new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ dialog.dispose();
+ }
+ });
+ pane.setBorder(new EmptyBorder(new Insets(10, 5, 5, 10)));
dialog.setContentPane(pane);
- dialog.setMinimumSize(Gui.getScaledDimension(200, 300));
- GridManager grid = new GridManager(pane, 2, true, new Insets(2, 2, 2, 2));
+ Dimension dd = Gui.getScaledDimension(200, 150 + 15 * predefinedRules.size());
+ dialog.setMinimumSize(dd);
+ dialog.setPreferredSize(dd);
+ GridManager grid = new GridManager(pane, 3, true, new Insets(2, 2, 2, 2));
+ grid.add(new WordWrapLabel("Vordefinierte Regelsets:"), 3);
+ grid.nextRow();
final Map<ButtonModel, Integer> mapper = new HashMap<>();
for (PresetNetRule ruleSet : predefinedRules) {
JCheckBox button = new JCheckBox(ruleSet.displayName);
- grid.add(button, 2);
+ grid.add(button, 3);
grid.nextRow();
mapper.put(button.getModel(), ruleSet.ruleId);
if (lecture != null && lecture.presetNetworkExceptionIds != null && lecture.presetNetworkExceptionIds.contains(ruleSet.ruleId)) {
button.setSelected(true);
}
}
- grid.add(Box.createVerticalGlue(), 2);
+ grid.add(Box.createVerticalGlue(), 3).expand(true, true).fill(true, true);
grid.nextRow();
+ grid.add(Box.createHorizontalGlue()).expand(true, false).fill(true, false);
JButton btnCancel = new JButton("Abbrechen");
- JButton btnOk = new JButton("SPASCHAN");
- grid.add(btnCancel).anchor(GridBagConstraints.LINE_START);
- grid.add(btnOk).anchor(GridBagConstraints.LINE_END);
+ JButton btnOk = new JButton("Speichern");
+ grid.add(btnCancel);
+ grid.add(btnOk);
grid.finish(false);
btnCancel.addActionListener(new ActionListener() {
@Override