summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
diff options
context:
space:
mode:
authorStephan Schwaer2015-08-31 17:28:42 +0200
committerStephan Schwaer2015-08-31 17:28:42 +0200
commit893d0b2057e94461bf6ac6ebb14e238dbc3f7010 (patch)
treefc00b1512f66afaeb68a3977e7a0a9dc52f5f32a /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
parent[client] slightly improved user info message when deleting a basis image in I... (diff)
downloadtutor-module-893d0b2057e94461bf6ac6ebb14e238dbc3f7010.tar.gz
tutor-module-893d0b2057e94461bf6ac6ebb14e238dbc3f7010.tar.xz
tutor-module-893d0b2057e94461bf6ac6ebb14e238dbc3f7010.zip
[client] several layout fixes, added some comments.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java88
1 files changed, 47 insertions, 41 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
index b7104ece..0d9be1c4 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
@@ -1,5 +1,7 @@
package org.openslx.dozmod.gui.window.layout;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagLayout;
@@ -16,8 +18,9 @@ import javax.swing.border.TitledBorder;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.table.LectureTable;
import org.openslx.dozmod.gui.helper.CompositePage;
-import org.openslx.dozmod.gui.helper.GridPos;
+import org.openslx.dozmod.gui.helper.GridManager;
+@SuppressWarnings("serial")
public abstract class LectureListWindowLayout extends CompositePage {
private static final String infoTitleString = "Übersicht Veranstaltungen";
@@ -56,22 +59,22 @@ public abstract class LectureListWindowLayout extends CompositePage {
super(new GridBagLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- // -- info group with title and text --
- JPanel infoComposite = new JPanel();
- infoComposite.setLayout(new BoxLayout(infoComposite, BoxLayout.PAGE_AXIS));
- // title of the info group in bold
+ GridManager grid = new GridManager(this, 1);
+
+ // --------- info group with title and text -------------------------
+ JPanel infoPanel = new JPanel(new BorderLayout());
QLabel infoTitle = new QLabel(infoTitleString);
infoTitle.setFont(infoTitle.getFont().deriveFont(Font.BOLD));
- // the infotext
QLabel infoText = new QLabel(infoTextString);
- infoComposite.add(infoTitle);
- infoComposite.add(infoText);
- // -- end group of title --
-
- // -- group for the table --
+ infoPanel.add(infoTitle, BorderLayout.NORTH);
+ infoPanel.add(infoText, BorderLayout.CENTER);
+ // ---------------- end group of title ------------------------------
+
+
+ // ------------ panel for the table and filter -----------------------
JPanel tablePanel = new JPanel();
- tablePanel.setLayout(new GridBagLayout());
- tablePanel.setPreferredSize(tablePanel.getMinimumSize());
+ GridManager tableGrid = new GridManager(tablePanel, 1);
+
// filterPanel with filter text field and filter combo
JPanel filterPanel = new JPanel();
filterPanel.setBorder(new TitledBorder(filterPanelLabel));
@@ -83,40 +86,43 @@ public abstract class LectureListWindowLayout extends CompositePage {
}
filterPanel.add(searchTextField);
filterPanel.add(filterCbo);
- tablePanel.add(filterPanel, GridPos.get(0, 0, true, false));
- // table
+
+ // the actual table
lectureTable = new LectureTable();
- tablePanel.add(new JScrollPane(lectureTable), GridPos.get(0, 1, true, true));
-
- // create, modify and delete buttons
- JPanel buttonComposite = new JPanel();
- buttonComposite.setLayout(new BoxLayout(buttonComposite, BoxLayout.LINE_AXIS));
- buttonComposite.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- tablePanel.add(buttonComposite, GridPos.get(0, 2, true, false));
+
+ tableGrid.add(filterPanel).fill(true, false).expand(true, false);
+ tableGrid.nextRow();
+ tableGrid.add(new JScrollPane(lectureTable)).fill(true, true).expand(true, true);
+ tableGrid.nextRow();
+ tableGrid.finish(false);
+ // ---------- end for table group -----------------------------
+
+ // ---------- button panel --------------------------------------
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
+ buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
newButton = new JButton(newButtonLabel);
- buttonComposite.add(newButton);
+ buttonPanel.add(newButton);
+ buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
editButton = new JButton(editButtonLabel);
- buttonComposite.add(editButton);
+ buttonPanel.add(editButton);
+ buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
deleteButton = new JButton(deleteButtonLabel);
- buttonComposite.add(deleteButton);
- buttonComposite.add(Box.createHorizontalGlue());
+ buttonPanel.add(deleteButton);
+ buttonPanel.add(Box.createHorizontalGlue());
switchViewButton = new JButton(switchViewButtonLabel);
- buttonComposite.add(switchViewButton);
- // -- end group for table --
-
- add(infoComposite, GridPos.get(0, 0, 2, 1, true, false));
- add(tablePanel, GridPos.get(0, 1, true, true));
- }
-
- public JTextField createCaptionAndTextfield(String captionString, JPanel group, int row) {
- QLabel caption = new QLabel(captionString);
- JTextField textField = new JTextField();
- textField.setEditable(false);
- caption.setText(captionString);
- group.add(caption, GridPos.get(0, row));
- group.add(textField, GridPos.get(1, row, true, false));
- return textField;
+ buttonPanel.add(switchViewButton);
+ // ----------------- end group for table -------------------------
+
+ grid.add(infoPanel).fill(true, false).expand(true, false);
+ grid.nextRow();
+ grid.add(tablePanel).fill(true, true).expand(true, true);
+ grid.nextRow();
+ grid.add(buttonPanel).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ grid.finish(false);
}
}