diff options
author | Simon Rettberg | 2016-01-22 11:05:14 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-01-22 11:05:14 +0100 |
commit | 685f0889c761f0e9034522bbfe9b31044488a1a5 (patch) | |
tree | 241489dc28708ee2b1f884ee665748c9cb961058 /dozentenmodul/src/main/java/org | |
parent | [client] Fix LocationSelector layout, wrap tree in JScrollPane (diff) | |
download | tutor-module-685f0889c761f0e9034522bbfe9b31044488a1a5.tar.gz tutor-module-685f0889c761f0e9034522bbfe9b31044488a1a5.tar.xz tutor-module-685f0889c761f0e9034522bbfe9b31044488a1a5.zip |
[client] Collapse nodes with all children selected when clicking "Apply"
Diffstat (limited to 'dozentenmodul/src/main/java/org')
3 files changed, 16 insertions, 10 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java index de325cb4..20774530 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java @@ -279,7 +279,6 @@ public class LocationSelector extends JPanel { } // if all children were selected, remove them from the list if (allChildrenSelected) { - LOGGER.debug("EXCLUDING FROM: " + getPath(parent)); Enumeration<?> enumeration = parent.children(); while (enumeration.hasMoreElements()) { DefaultMutableTreeNode nod = (DefaultMutableTreeNode) enumeration.nextElement(); @@ -322,7 +321,6 @@ public class LocationSelector extends JPanel { */ private void setSelectionInternal(List<Integer> list) { if (list == null || list.isEmpty()) { - LOGGER.error("No list given for preselection!"); return; } // first, deselect everything diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java index 0db81df1..bbdac096 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java @@ -9,6 +9,7 @@ import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.Gui.GuiCallable; import org.openslx.dozmod.gui.control.JCheckBoxTree.CheckChangeEvent; import org.openslx.dozmod.gui.control.JCheckBoxTree.CheckChangeEventListener; +import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.gui.helper.UiFeedback; import org.openslx.dozmod.gui.window.layout.LocationSelectionWindowLayout; import org.openslx.dozmod.thrift.Session; @@ -51,6 +52,15 @@ public class LocationSelectionWindow extends LocationSelectionWindowLayout imple btnSaveChanges.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + List<Integer> tempIntList = locationSelector.getSelectedLocationsAsIds(); + if (tempIntList != null + && tempIntList.size() > Session.getSatelliteConfig().maxLocationsPerLecture) { + locationSelector.setSelectedLocationsAsIds(tempIntList); + locationSelector.collapseFullySelectedNodes(); + Gui.showMessageBox("Bitten reduzieren Sie die Anzahl gewählter Orte", + MessageType.WARNING, null, null); + return; + } apply = true; dispose(); } @@ -64,10 +74,8 @@ public class LocationSelectionWindow extends LocationSelectionWindowLayout imple if (tempIntList != null) { if (tempIntList.size() > Session.getSatelliteConfig().maxLocationsPerLecture) { // add error - btnSaveChanges.setEnabled(false); lblError.setText("Zu viele Orte ausgewählt!"); } else { - btnSaveChanges.setEnabled(true); lblError.setText(""); } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java index 0187dca6..57b859a4 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java @@ -9,12 +9,12 @@ import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JDialog; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.control.LocationSelector; +import org.openslx.dozmod.gui.control.QLabel; import org.openslx.dozmod.gui.control.WordWrapLabel; import org.openslx.dozmod.gui.helper.GridManager; @@ -24,10 +24,10 @@ public class LocationSelectionWindowLayout extends JDialog { * */ private static final long serialVersionUID = -7722131149214063979L; - protected LocationSelector locationSelector; - protected JButton btnSaveChanges; - protected JButton btnClose; - protected JLabel lblError; + protected final LocationSelector locationSelector; + protected final JButton btnSaveChanges; + protected final JButton btnClose; + protected final QLabel lblError; public LocationSelectionWindowLayout(Window modalParent, List<Integer> locationList, boolean limitToLocations) { @@ -47,7 +47,7 @@ public class LocationSelectionWindowLayout extends JDialog { // button panel on the bottom JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - lblError = new JLabel(); + lblError = new QLabel(); lblError.setForeground(Color.red); btnClose = new JButton("Abbrechen"); btnSaveChanges = new JButton("Übernehmen"); |