From 30823441525a7137d98a47b18b2aca6e566cd818 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 16 Sep 2015 12:35:30 +0200 Subject: [client] Clean up satellite selection window --- .../window/layout/SatelliteListWindowLayout.java | 50 ++++++++++------------ 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout') diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java index cb1dc3a1..33a44e69 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java @@ -1,5 +1,6 @@ package org.openslx.dozmod.gui.window.layout; +import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Window; import java.util.HashMap; @@ -11,6 +12,7 @@ import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JDialog; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; @@ -21,49 +23,46 @@ import org.openslx.dozmod.gui.helper.GridManager; @SuppressWarnings("serial") public class SatelliteListWindowLayout extends JDialog { - protected final JButton exitButton; + protected final JButton nextButton; protected final JTextField customIpField; protected final JRadioButton radioCustomIp; - protected final JRadioButton[] satelliteButtons; - protected final int satCount; protected final HashMap radioToSat = new HashMap(); - protected final ButtonGroup btnGroup; - private static String title = "Liste an Satelliten"; + private static String title = "Satelliten-Server wählen"; protected SatelliteListWindowLayout(Window modalParent, List satList) { super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS); - - GridManager windowGrid = new GridManager(this, 1); JPanel radioPanel = new JPanel(); - radioPanel.setBorder(BorderFactory.createTitledBorder( "Satelliten Auswahl")); + radioPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); GridManager selectionPanelGrid = new GridManager(radioPanel, 2); - btnGroup = new ButtonGroup(); + ButtonGroup btnGroup = new ButtonGroup(); // --------------- radio buttons sat selection -------------------------------------- - satCount = satList.size(); - satelliteButtons = new JRadioButton[satCount]; + selectionPanelGrid.add(new JLabel("Vorgegebene Server"), 2); + selectionPanelGrid.nextRow(); // create the radioButtons, add them to the map, button group and the selection grid. - for (int index = 0; index < satCount; index++ ){ - satelliteButtons[index] = new JRadioButton(satList.get(index).getDisplayName()); - radioToSat.put(satelliteButtons[index], satList.get(index)); - btnGroup.add(satelliteButtons[index]); - selectionPanelGrid.add(satelliteButtons[index], 2).fill(true, false).expand(true, false); + for ( Satellite sat : satList ){ + JRadioButton radioButton = new JRadioButton(sat.getDisplayName()); + radioButton.setEnabled(sat.addressList != null && !sat.addressList.isEmpty()); + radioToSat.put(radioButton, sat); + btnGroup.add(radioButton); + selectionPanelGrid.add(radioButton, 2).fill(true, false).expand(true, false); selectionPanelGrid.nextRow(); } // --------------- end radio buttons for sat selection ------------------------------------ // --------------- custom ip button and field -------------------------------------- - radioCustomIp = new JRadioButton("Benutzerdefiniert"); + selectionPanelGrid.add(new JLabel("Server-Adresse selbst eingeben"), 2); + selectionPanelGrid.nextRow(); + radioCustomIp = new JRadioButton(""); btnGroup.add(radioCustomIp); - customIpField = new JTextField(); - customIpField.setPreferredSize(new Dimension(120, 25)); + customIpField = new JTextField(""); selectionPanelGrid.add(radioCustomIp).fill(true, false).expand(false, false); selectionPanelGrid.add(customIpField).fill(true, false).expand(true, false); selectionPanelGrid.nextRow(); - selectionPanelGrid.finish(true); // --------------- end custom ip field -------------------------------- + selectionPanelGrid.finish(false); // --------------- button panel -------------------------------------- JPanel buttonPane = new JPanel(); @@ -71,16 +70,13 @@ public class SatelliteListWindowLayout extends JDialog { buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); - exitButton = new JButton("Weiter"); - buttonPane.add(exitButton); + nextButton = new JButton("Weiter"); + buttonPane.add(nextButton); // --------------- end button panel ---------------------------------- // pack it all - windowGrid.add(radioPanel).fill(true, true).expand(true, true); - windowGrid.nextRow(); - windowGrid.add(buttonPane).fill(true, false).expand(true, false); - windowGrid.nextRow(); - windowGrid.finish(false); + getContentPane().add(radioPanel, BorderLayout.CENTER); + getContentPane().add(buttonPane, BorderLayout.PAGE_END); pack(); } } -- cgit v1.2.3-55-g7522