summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java49
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java2
2 files changed, 37 insertions, 14 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 a780c1cb..0079ece2 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
@@ -1,7 +1,6 @@
package org.openslx.dozmod.gui.control;
import java.awt.Component;
-import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -11,12 +10,14 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
-import javax.swing.JCheckBox;
import javax.swing.JList;
import javax.swing.JPanel;
+import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import org.apache.log4j.Logger;
@@ -47,11 +48,17 @@ public class LocationSelector extends JPanel {
private JButton addButton = new JButton(">");
private JButton removeButton = new JButton("<");
private JButton removeAllButton = new JButton("<<");
+ private JRadioButton exclusivelyButton = new JRadioButton("Veranstaltung ausschließlich in den ausgewählten Räumen anzeigen");
+ private JRadioButton prioritizedButton = new JRadioButton("Veranstaltung mit höherer Priorität in den ausgewählten Räumen anzeigen");
- private JCheckBox onlyInSelection = new JCheckBox(
- "Veranstaltung ausschließlich in den ausgewählten Räumen anzeigen");
-
+ /**
+ * Flag for the initialization state
+ */
private boolean initDone = false;
+
+ /**
+ * List of ID's of locations to set the selection to when we finished initializing
+ */
private List<Integer> preselection;
/**
@@ -78,7 +85,7 @@ public class LocationSelector extends JPanel {
* @return true if checked, false otherwise
*/
public boolean getOnlyInSelection() {
- return onlyInSelection.isSelected();
+ return exclusivelyButton.isSelected();
}
/**
@@ -141,7 +148,7 @@ public class LocationSelector extends JPanel {
selectedLocationList.setCellRenderer(locationRenderer);
selectedLocationList.setModel(selectedLocationModel);
- // the listeners
+ // the listeners for lists
selectedLocationList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
@@ -176,6 +183,7 @@ public class LocationSelector extends JPanel {
}
});
+ // the listeners for the button panel in the middle
addAllButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -203,14 +211,18 @@ public class LocationSelector extends JPanel {
}
});
+ // the text header
grid.add(new QLabel("Verfügbare Räume"));
grid.skip();
grid.add(new QLabel("Ausgewählte Räume"));
grid.nextRow();
+
+ // the available location panel
JScrollPane availableScrollPane = new JScrollPane(availableLocationList);
- availableScrollPane.setPreferredSize(new Dimension(1, 1));
+ availableScrollPane.setPreferredSize(Gui.getScaledDimension(200, 150));
grid.add(availableScrollPane).fill(true, true).expand(true, true);
- // Vertical BoxLayout for buttons
+
+ // the middle button panel
JPanel buttonPanel = new JPanel();
GridManager buttonGrid = new GridManager(buttonPanel, 1);
buttonGrid.add(addAllButton).fill(true, false);
@@ -223,11 +235,23 @@ public class LocationSelector extends JPanel {
buttonGrid.nextRow();
buttonGrid.finish(true);
grid.add(buttonPanel).fill(false, false).expand(false, false);
+
+ // the selection location panel
JScrollPane selectionScrollPane = new JScrollPane(selectedLocationList);
- selectionScrollPane.setPreferredSize(new Dimension(1, 1));
+ selectionScrollPane.setPreferredSize(Gui.getScaledDimension(200, 150));
grid.add(selectionScrollPane).fill(true, true).expand(true, true);
grid.nextRow();
- grid.add(onlyInSelection, 3).fill(false, false).expand(false, false);
+
+ // the radio buttons, default is to show the lecture exclusively in the selected locations
+ exclusivelyButton.setSelected(true);
+ ButtonGroup group = new ButtonGroup();
+ group.add(exclusivelyButton);
+ group.add(prioritizedButton);
+ JPanel radioPanel = new JPanel();
+ radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.PAGE_AXIS));
+ radioPanel.add(exclusivelyButton);
+ radioPanel.add(prioritizedButton);
+ grid.add(radioPanel, 3);
grid.finish(true);
// initialise the data
@@ -235,8 +259,7 @@ public class LocationSelector extends JPanel {
}
/**
- * Async initialization of the data models by fetching the list of the
- * locations from the server
+ * Async fetching of the list of the locations from the server
*/
public void init() {
QuickTimer.scheduleOnce(new Task() {
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 979531ff..7eaf300e 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
@@ -30,7 +30,7 @@ public class LocationSelectionWindowLayout extends JDialog {
grid.nextRow();
grid.add(locationSelector).fill(true, true).expand(true, true);
grid.finish(false);
- setPreferredSize(Gui.getScaledDimension(520, 350));
+ setPreferredSize(Gui.getScaledDimension(600, 350));
pack();
Gui.centerShellOverShell(modalParent, this);
}