diff options
| author | Jonathan Bauer | 2015-08-10 15:10:14 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-08-10 15:10:14 +0200 |
| commit | 6013bb59a21cdb4efde06a37a1fe1b4dd4e8a62c (patch) | |
| tree | 681729dad34264237006a258603a17408d41eb7d | |
| parent | Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff) | |
| download | tutor-module-6013bb59a21cdb4efde06a37a1fe1b4dd4e8a62c.tar.gz tutor-module-6013bb59a21cdb4efde06a37a1fe1b4dd4e8a62c.tar.xz tutor-module-6013bb59a21cdb4efde06a37a1fe1b4dd4e8a62c.zip | |
[client] removed right info pane for lecture. Added start/end date in table.
3 files changed, 18 insertions, 63 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java index 97e553bc..235f926d 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java @@ -7,10 +7,11 @@ import org.openslx.dozmod.util.FormatHelper; @SuppressWarnings("serial") public class LectureTable extends ListTable<LectureSummary> { - private static String[] columnNames = { "Name", "Verantwortlicher" }; + private static String[] columnNames = { "Name", "Verantwortlicher", "Startzeit", "Endzeit" }; + private static Class<?>[] columnClasses = { String.class, String.class, String.class, String.class }; public LectureTable() { - super(columnNames, null); + super(columnNames, columnClasses); } @Override @@ -20,6 +21,10 @@ public class LectureTable extends ListTable<LectureSummary> { return row.getLectureName(); if (columnIndex == 1) return FormatHelper.userName(UserCache.find(row.getOwnerId())); + if (columnIndex == 2) + return FormatHelper.longDate(row.getStartTime()); + if (columnIndex == 3) + return FormatHelper.longDate(row.getEndTime()); throw new IndexOutOfBoundsException(); } 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 eb4dc1ee..cf54c22a 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 @@ -1,5 +1,6 @@ package org.openslx.dozmod.gui.window; +import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -7,12 +8,11 @@ import java.awt.event.MouseEvent; import java.util.List; import javax.swing.JFrame; -import javax.swing.JTextField; +import javax.swing.RowFilter; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.LectureSummary; @@ -21,8 +21,6 @@ import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.window.layout.LectureListWindowLayout; import org.openslx.dozmod.gui.wizard.LectureWizard; import org.openslx.dozmod.thrift.LectureCache; -import org.openslx.dozmod.thrift.UserCache; -import org.openslx.dozmod.util.FormatHelper; import org.openslx.util.QuickTimer; import org.openslx.util.QuickTimer.Task; @@ -49,7 +47,14 @@ public class LectureListWindow extends LectureListWindowLayout { @Override public void changedUpdate(DocumentEvent e) { - // TODO: Set filter + // stuff + try { + lectureTable.getRowSorter().setRowFilter(RowFilter.regexFilter("(?i)"+searchTextField.getText(), 0, 1, 2)); + searchTextField.setForeground(UIManager.getColor("TextField.foreground")); + } catch (IllegalArgumentException ex) { + // TODO set background color of search field to something redish + searchTextField.setForeground(Color.RED); + } } }); @@ -65,39 +70,7 @@ public class LectureListWindow extends LectureListWindowLayout { } }); - lectureTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - final LectureSummary lecture = lectureTable.getSelectedItem(); - if (lecture == null) - return; - // Fill detail information fields - // Lecture name - setFieldText(lectureName, lecture.getLectureName()); - // id of the lecture - setFieldText(idInfo, lecture.getLectureId()); - // id of the image linked to the lecture - setFieldText(imageBaseId, lecture.getImageBaseId()); - // the owner of the selected lecture - setFieldText(ownerInfo, FormatHelper.userName(UserCache.find(lecture.getOwnerId()))); - // set the time, the lecture has last been used - lastusedInfo.setText(FormatHelper.longDate(lecture.getLastUsed())); - // set the start time of the lecture - startTime.setText(FormatHelper.longDate(lecture.getStartTime())); - // set the end time of the lecture - endTime.setText(FormatHelper.longDate(lecture.getEndTime())); - me.invalidate(); - me.validate(); - } - private void setFieldText(JTextField control, String content) { - if (content == null) { - control.setText("<null>"); - } else { - control.setText(content); - } - } - }); lectureTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { 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 87523519..230d92c6 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,6 +1,5 @@ package org.openslx.dozmod.gui.window.layout; -import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagLayout; @@ -89,30 +88,8 @@ public abstract class LectureListWindowLayout extends CompositePage { buttonComposite.add(backButton); // -- end group for table -- - // -- group for details of selected lecture -- - final JPanel vmInfoGroup = new JPanel(); - vmInfoGroup.setLayout(new GridBagLayout()); - vmInfoGroup.setBorder(new TitledBorder(vmInfoGroupLabel)); - vmInfoGroup.setMaximumSize(new Dimension(400, Integer.MAX_VALUE)); - vmInfoGroup.setMinimumSize(new Dimension(350, 0)); - vmInfoGroup.setPreferredSize(vmInfoGroup.getMinimumSize()); - // image name info - int row = 0; - lectureName = createCaptionAndTextfield("Name", vmInfoGroup, row++); - idInfo = createCaptionAndTextfield("UUID", vmInfoGroup, row++); - imageBaseId = createCaptionAndTextfield("Image", vmInfoGroup, row++); - lastusedInfo = createCaptionAndTextfield("Zuletzt genutzt", vmInfoGroup, row++); - permissionInfo = createCaptionAndTextfield("Berechtigungen", vmInfoGroup, row++); - startTime = createCaptionAndTextfield("Startzeit", vmInfoGroup, row++); - endTime = createCaptionAndTextfield("Endzeit", vmInfoGroup, row++); - ownerInfo = createCaptionAndTextfield("Besitzer", vmInfoGroup, row++); - // For some reason without this the controls above are centered vertically - vmInfoGroup.add(new JPanel(), GridPos.get(0, row++, 2, 1, true, true)); - // -- end group of details -- - add(infoComposite, GridPos.get(0, 0, 2, 1, true, false)); add(tableGroup, GridPos.get(0, 1, true, true)); - add(vmInfoGroup, GridPos.get(1, 1, false, true)); } public JTextField createCaptionAndTextfield(String captionString, JPanel group, int row) { |
