diff options
author | Stephan Schwaer | 2015-09-21 17:07:35 +0200 |
---|---|---|
committer | Stephan Schwaer | 2015-09-21 17:07:35 +0200 |
commit | abebdab45ae45213396e9348f2866d118aac770e (patch) | |
tree | 5d75f55b36e65a57d36c211ae4eaa0a13039a254 | |
parent | [client] "Show image details" popup menu item in LectureListWindow (diff) | |
download | tutor-module-abebdab45ae45213396e9348f2866d118aac770e.tar.gz tutor-module-abebdab45ae45213396e9348f2866d118aac770e.tar.xz tutor-module-abebdab45ae45213396e9348f2866d118aac770e.zip |
[client] Show number of the items in the table in image- and lecture window.
4 files changed, 44 insertions, 9 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java index 089715dc..b52dbe44 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java @@ -10,6 +10,7 @@ import java.util.regex.PatternSyntaxException; import javax.swing.BoxLayout; import javax.swing.JComboBox; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; @@ -37,6 +38,7 @@ public class ImageListViewer extends QLabel { protected JTextField searchTextField; protected ImageTable imageTable; protected JComboBox<FilterType> filterCbo; + protected JLabel imageCountLabel; private final RowFilter<ListModel<ImageSummaryRead>, Integer> filterOwn = new RowFilter<ListModel<ImageSummaryRead>, Integer>() { public boolean include(Entry<? extends ListModel<ImageSummaryRead>, ? extends Integer> entry) { @@ -121,6 +123,13 @@ public class ImageListViewer extends QLabel { } filterPanel.add(searchTextField); filterPanel.add(filterCbo); + + // Panel for itemCount + JPanel imageCountPanel = new JPanel(); + imageCountLabel = new JLabel(); + imageCountPanel.add(new JLabel("Sichtbar:")); + imageCountPanel.add(imageCountLabel); + filterPanel.add(imageCountPanel); // the actual table imageTable = new ImageTable(); @@ -210,6 +219,7 @@ public class ImageListViewer extends QLabel { // for using multiple filters RowFilter<ListModel<ImageSummaryRead>, Integer> andFilters = RowFilter.andFilter(filters); imageTable.getRowSorter().setRowFilter(andFilters); + setImageCountLabel(imageTable.getRowCount()); } /** @@ -226,6 +236,7 @@ public class ImageListViewer extends QLabel { @Override public void run() { imageTable.setData(imageList, true); + setImageCountLabel(imageTable.getRowCount()); } }); } @@ -235,5 +246,9 @@ public class ImageListViewer extends QLabel { public ImageTable getImageTable() { return imageTable; } + + protected void setImageCountLabel(int i){ + imageCountLabel.setText(Integer.toString(i)); + } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java index 407bb047..5b082418 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java @@ -341,7 +341,7 @@ public class LectureListWindow extends LectureListWindowLayout { // filters from the combobox FilterType filterType = (FilterType) filterCbo.getSelectedItem(); - lectureTable.setHighlightOwn(filterType != FilterType.OWN); + lectureTable.setHighlightOwn(true); switch (filterType) { case ALL: // no additional filters @@ -368,6 +368,7 @@ public class LectureListWindow extends LectureListWindowLayout { // for using multiple filters RowFilter<ListModel<LectureSummary>, Integer> andFilters = RowFilter.andFilter(filters); lectureTable.getRowSorter().setRowFilter(andFilters); + setLectureCountLabel(lectureTable.getRowCount()); } private void refreshList(final boolean force) { @@ -379,6 +380,7 @@ public class LectureListWindow extends LectureListWindowLayout { @Override public void run() { lectureTable.setData(lectureList, true); + setLectureCountLabel(lectureTable.getRowCount()); } }); } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java index bdb16483..df552f5c 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/UserListWindow.java @@ -119,6 +119,11 @@ public class UserListWindow extends UserListWindowLayout implements UiFeedback { } } }); + + + int calcHeight = userTable.getRowCount() * 20; + setPreferredSize(Gui.getScaledDimension(400, (calcHeight > 350 && calcHeight < 600) ? calcHeight : 350)); + pack(); Gui.centerShellOverShell(modalParent, this); // this.setLocationRelativeTo(SwingUtilities.getWindowAncestor(modalParent)); } 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 25dcf6d1..ff73a20c 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 @@ -10,6 +10,7 @@ import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; @@ -40,6 +41,7 @@ public abstract class LectureListWindowLayout extends CompositePage { protected final JButton editButton; protected final JButton switchViewButton; protected final JComboBox<FilterType> filterCbo; + protected JLabel lectureCountLabel; protected final JTextField searchTextField; @@ -50,7 +52,7 @@ public abstract class LectureListWindowLayout extends CompositePage { setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); GridManager grid = new GridManager(this, 1); - + // --------- info group with title and text ------------------------- JPanel infoPanel = new JPanel(new BorderLayout()); QLabel infoTitle = new QLabel(infoTitleString); @@ -59,12 +61,12 @@ public abstract class LectureListWindowLayout extends CompositePage { infoPanel.add(infoTitle, BorderLayout.NORTH); infoPanel.add(infoText, BorderLayout.CENTER); // ---------------- end group of title ------------------------------ - - + + // ------------ panel for the table and filter ----------------------- JPanel tablePanel = new JPanel(); GridManager tableGrid = new GridManager(tablePanel, 1); - + // filterPanel with filter text field and filter combo JPanel filterPanel = new JPanel(); filterPanel.setBorder(new TitledBorder(filterPanelLabel)); @@ -76,10 +78,17 @@ public abstract class LectureListWindowLayout extends CompositePage { } filterPanel.add(searchTextField); filterPanel.add(filterCbo); - + + // Panel for itemCount + JPanel lectureCountPanel = new JPanel(); + lectureCountLabel = new JLabel(); + lectureCountPanel.add(new JLabel("Sichtbar:")); + lectureCountPanel.add(lectureCountLabel); + filterPanel.add(lectureCountPanel); + // the actual table lectureTable = new LectureTable(); - + tableGrid.add(filterPanel).fill(true, false).expand(true, false); tableGrid.nextRow(); JScrollPane jsp = new JScrollPane(lectureTable); @@ -106,15 +115,19 @@ public abstract class LectureListWindowLayout extends CompositePage { switchViewButton = new JButton(switchViewButtonLabel); 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); } + + protected void setLectureCountLabel(int i){ + lectureCountLabel.setText(Integer.toString(i)); + } } |