diff options
8 files changed, 30 insertions, 35 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 0239e951..bb8c9408 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 @@ -14,6 +14,7 @@ import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.RowFilter; import javax.swing.UIManager; +import javax.swing.border.TitledBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -57,11 +58,12 @@ public class ImageListViewer extends JLabel { public ImageListViewer(){ super(); GridManager grid = new GridManager(this, 1); - + // -------------------------------------- // the panel for the table and search field // the search field and filter combo box JPanel filterPanel = new JPanel(); + filterPanel.setBorder(new TitledBorder("Suchen")); filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS)); searchTextField = new JTextField(); filterCbo = new JComboBox<FilterType>(); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java index 75d6eeab..e6a65bb8 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java @@ -176,10 +176,10 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa deleteBaseImage(imageTable.getSelectedItem()); } }); - backButton.addActionListener(new ActionListener() { + switchViewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - MainWindow.showPage(MainMenuWindow.class); + MainWindow.showPage(LectureListWindow.class); } }); @@ -219,13 +219,10 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa boolean isValid = item != null && item.getLatestVersionId() != null; boolean download = isValid && ImagePerms.canDownload(item); boolean link = isValid && ImagePerms.canLink(item); - boolean edit = ImagePerms.canEdit(item); boolean admin = ImagePerms.canAdmin(item); - editButton.setText(edit ? "Bearbeiten" : "Ansehen"); downloadButton.setEnabled(download); newLectureButton.setEnabled(link); deleteButton.setEnabled(admin); - popupItemEdit.setText(edit ? "Bearbeiten" : "Ansehen"); popupItemDownload.setEnabled(download); popupItemNewLecture.setEnabled(link); popupItemDelete.setEnabled(admin); 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 05de0bf7..ce455b5a 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 @@ -24,18 +24,14 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; -import org.openslx.bwlp.thrift.iface.ImageSummaryRead; -import org.openslx.bwlp.thrift.iface.ImageVersionDetails; import org.openslx.bwlp.thrift.iface.LectureSummary; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.gui.helper.PopupMenu; -import org.openslx.dozmod.gui.window.ImageDetailsWindow.ImageUpdatedCallback; import org.openslx.dozmod.gui.window.LectureDetailsWindow.LectureUpdatedCallback; import org.openslx.dozmod.gui.window.layout.LectureListWindowLayout; import org.openslx.dozmod.gui.wizard.LectureWizard; -import org.openslx.dozmod.permissions.ImagePerms; import org.openslx.dozmod.permissions.LecturePerms; import org.openslx.dozmod.thrift.Session; import org.openslx.dozmod.thrift.ThriftActions; @@ -88,10 +84,7 @@ public class LectureListWindow extends LectureListWindowLayout { newButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if (Gui.showMessageBox(me, "Um eine Veranstaltung zu erstellen, müssen Sie ein Image auswählen. Zur Imageauswahl wechseln?", - MessageType.QUESTION_YESNO, LOGGER, null)) { - MainWindow.showPage(ImageListWindow.class); - } + new LectureWizard(SwingUtilities.getWindowAncestor(me), null, null).setVisible(true); } }); @@ -111,10 +104,10 @@ public class LectureListWindow extends LectureListWindowLayout { }); // return to mainMenu - backButton.addActionListener(new ActionListener() { + switchViewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - MainWindow.showPage(MainMenuWindow.class); + MainWindow.showPage(ImageListWindow.class); } }); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java index 09bdebd0..a59a93ae 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; +import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -26,7 +27,7 @@ public abstract class ImageListWindowLayout extends CompositePage { protected final static String editButtonLabel = "Bearbeiten"; protected final static String downloadButtonLabel = "Download"; protected final static String deleteButtonLabel = "Löschen"; - protected final static String backButtonLabel = "Zurück"; + protected final static String switchViewButtonLabel = "Zu 'Veranstaltungen' wechseln"; // -------------------------------------- // search field, table and buttons @@ -36,10 +37,11 @@ public abstract class ImageListWindowLayout extends CompositePage { protected final JButton editButton; protected final JButton downloadButton; protected final JButton deleteButton; - protected final JButton backButton; + protected final JButton switchViewButton; public ImageListWindowLayout() { super(new BorderLayout()); + setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // -------------------------------------- // Info panel on the top with a search box @@ -57,13 +59,14 @@ public abstract class ImageListWindowLayout extends CompositePage { // -------------------------------------- // the buttons at the bottom JPanel buttonPanel = new JPanel(); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); newButton = new JButton(newButtonLabel); newLectureButton = new JButton(newLectureButtonLabel); deleteButton = new JButton(deleteButtonLabel); editButton = new JButton(editButtonLabel); downloadButton = new JButton(downloadButtonLabel); - backButton = new JButton(backButtonLabel); + switchViewButton = new JButton(switchViewButtonLabel); buttonPanel.add(newButton); buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); buttonPanel.add(newLectureButton); @@ -72,7 +75,7 @@ public abstract class ImageListWindowLayout extends CompositePage { buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); buttonPanel.add(deleteButton); buttonPanel.add(Box.createHorizontalGlue()); - buttonPanel.add(backButton); + buttonPanel.add(switchViewButton); add(buttonPanel, BorderLayout.PAGE_END); } 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 c7b02470..56b90542 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.BorderLayout; import java.awt.Font; import java.awt.GridBagLayout; @@ -24,8 +23,8 @@ public abstract class LectureListWindowLayout extends CompositePage { private static final String newButtonLabel = "Neu"; private static final String editButtonLabel = "Bearbeiten"; private static final String deleteButtonLabel = "Löschen"; - private static final String backButtonLabel = "Zurück"; - private static final String tableGroupLabel = "Veranstaltungen"; + private static final String switchViewButtonLabel = "Zu 'Images' wechseln"; + private static final String tableGroupLabel = "Suchen"; private static final String infoTextString = "Hier können Sie Veranstaltungen anlegen, bearbeiten und löschen."; protected final static String[] showOwnedLabel = {"Alle anzeigen", "Nur eigene Anzeigen", "Nur editierbare anzeigen", "Bald auslaufend"}; @@ -34,7 +33,7 @@ public abstract class LectureListWindowLayout extends CompositePage { protected JButton newButton; protected JButton deleteButton; protected JButton editButton; - protected JButton backButton; + protected JButton switchViewButton; protected JComboBox<String> filterCbo; @@ -99,8 +98,8 @@ public abstract class LectureListWindowLayout extends CompositePage { deleteButton = new JButton(deleteButtonLabel); buttonComposite.add(deleteButton); buttonComposite.add(Box.createHorizontalGlue()); - backButton = new JButton(backButtonLabel); - buttonComposite.add(backButton); + switchViewButton = new JButton(switchViewButtonLabel); + buttonComposite.add(switchViewButton); // -- end group for table -- add(infoComposite, GridPos.get(0, 0, 2, 1, true, false)); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java index f3cc2ca3..673e2387 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java @@ -28,23 +28,24 @@ public class LectureWizard extends Wizard implements UiFeedback { public final LectureWizardState state = new LectureWizardState(); /** - * Wizard for creating or editing a lecture + * Wizard for creating or editing a lecture. * + * @param parent window of this wizard + * @param image ImageSummaryRead of the image to link this lecture to, + * if this is null it will start add the LectureImageListPage to the wizard. * @param editExistingLecture whether to create new or edit existing lecture */ public LectureWizard(Window parent, ImageSummaryRead image, String imageVersionId) { super(parent); - // sanity check on the image - if (image == null || imageVersionId == null) { - throw new NullPointerException("LectureWizard needs ImageSummaryRead + imageVersionId!"); + if (image != null && imageVersionId != null) { + this.state.image = image; + this.state.imageVersionId = imageVersionId; } - this.state.image = image; - this.state.imageVersionId = imageVersionId; // create the shared object for all pages of the wizard addPage(new LectureCreationPage(this, state)); - if (true) + if (image == null && imageVersionId == null) addPage(new LectureImageListPage(this, state)); addPage(new LectureOptionsPage(this, state)); addPage(new LectureCustomPermissionPage(this, state)); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java index 4467137c..96d12951 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java @@ -19,6 +19,6 @@ public abstract class LectureImageListPageLayout extends WizardPage { imageListViewer = new ImageListViewer(); grid.add(imageListViewer).fill(true, true).expand(true, true); - grid.finish(true); + grid.finish(false); } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java index 3f47aa0d..98a2bde3 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java @@ -28,7 +28,7 @@ public class LectureCreationPage extends LectureCreationPageLayout { * Page for creating lectures */ public LectureCreationPage(Wizard wizard, LectureWizardState state) { - super(wizard, state.image.imageName); + super(wizard, state.image != null ? state.image.imageName : "Neu"); this.state = state; // listener for the text fields |
