diff options
| author | Simon Rettberg | 2015-09-30 18:28:17 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2015-09-30 18:28:17 +0200 |
| commit | 2cc0700d9634bd43a3c3b23a4a42a7a0ae811faa (patch) | |
| tree | 4d1ae2a28364c8b075b38edf7a2e273e05e9820d | |
| parent | [server] Fix detection of old imported users in DB (diff) | |
| parent | Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff) | |
| download | tutor-module-2cc0700d9634bd43a3c3b23a4a42a7a0ae811faa.tar.gz tutor-module-2cc0700d9634bd43a3c3b23a4a42a7a0ae811faa.tar.xz tutor-module-2cc0700d9634bd43a3c3b23a4a42a7a0ae811faa.zip | |
Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1
7 files changed, 77 insertions, 39 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java index af49cecf..33c51111 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java @@ -663,7 +663,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe */ private boolean safeClose() { if ((metadataChanged || permissionsChanged) - && !Gui.showMessageBox(me, "Änderungen werden verworfen, wollen Sie wirklich abbrechen?", + && !Gui.showMessageBox(me, "Änderungen werden verworfen, wollen Sie wirklich schließen?", MessageType.QUESTION_YESNO, null, null)) return false; dispose(); 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 9488a5ef..86f6468b 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 @@ -7,9 +7,12 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import javax.swing.AbstractAction; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JOptionPane; +import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -30,7 +33,6 @@ import org.openslx.dozmod.thrift.ThriftActions; import org.openslx.dozmod.thrift.ThriftActions.DeleteCallback; import org.openslx.dozmod.thrift.ThriftActions.DownloadCallback; - /** * Window with the list of available images. * Has filters for the images and buttons to create, edit and delete buttons. @@ -54,7 +56,7 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa * Popup menu items */ private final JMenuItem popupItemNewLecture = new JMenuItem("Neue Veranstaltung"); - private final JMenuItem popupItemEdit = new JMenuItem("Bearbeiten"); + private final JMenuItem popupItemEdit = new JMenuItem("Detailansicht"); private final JMenuItem popupItemDelete = new JMenuItem("Löschen"); private final JMenuItem popupItemDownload = new JMenuItem("Download"); @@ -185,6 +187,24 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa } }); + // Some keyboard shortcuts + imageTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( + KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "details"); + imageTable.getActionMap().put("details", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent ae) { + editButton.doClick(); + } + }); + imageTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( + KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete"); + imageTable.getActionMap().put("delete", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent ae) { + deleteButton.doClick(); + } + }); + updateAvailableOptions(null); } @@ -256,10 +276,10 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa return; ImageDetailsWindow.open((JFrame) SwingUtilities.getWindowAncestor(me), image.getImageBaseId(), new ImageUpdatedCallback() { - public void updated() { - imageListViewer.refreshList(true, 100); - } - }); + public void updated() { + imageListViewer.refreshList(true, 100); + } + }); } /** diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java index 5bce19b4..071697cd 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java @@ -155,11 +155,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if (metadataChanged && !Gui.showMessageBox(me, - "Änderungen werden verworfen, wollen Sie wirklich abbrechen?", - MessageType.QUESTION_YESNO, LOGGER, null)) - return; - dispose(); + safeClose(); } }); btnDownloadImage.addActionListener(new ActionListener() { @@ -181,10 +177,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements @Override public void userAdded(UserInfo user, UserListWindow window) { window.dispose(); - if (Gui.showMessageBox(me, - "Sind Sie sicher, dass sie die Besitzerrechte an " - + "einen anderen Account übertragen wollen?", - MessageType.QUESTION_YESNO, LOGGER, null)) + if (Gui.showMessageBox(me, "Sind Sie sicher, dass sie die Besitzerrechte an " + + "einen anderen Account übertragen wollen?", MessageType.QUESTION_YESNO, + LOGGER, null)) setLectureOwner(user); } }, "Besitzer festlegen", lecture.ownerId); @@ -274,7 +269,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements * 'image' * members to its metadata. This method will fetch the information from the * sat - * + * * @param lectureId the id of the lecture to be displayed */ public void setLecture(final String lectureId) { @@ -390,8 +385,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements cboVersions.setModel(new DefaultComboBoxModel<ImageVersionDetails>( versions.toArray(new ImageVersionDetails[versions.size()]))); - cboVersions.setSelectedItem( - new ImageVersionDetails(lecture.getImageVersionId(), 0, 0, 0, null, true, true, true, null)); + cboVersions.setSelectedItem(new ImageVersionDetails(lecture.getImageVersionId(), 0, 0, 0, null, true, + true, true, null)); } /** @@ -598,8 +593,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements changed = !txtTitle.getText().equals(lecture.getLectureName()) || !txtDescription.getText().equals(lecture.getDescription()) || !currentVersion.getVersionId().equals(lecture.getImageVersionId()) - || (DateTimeHelper.getDateFrom(startDate, startTime).getTime() / 1000L) != lecture - .getStartTime() + || (DateTimeHelper.getDateFrom(startDate, startTime).getTime() / 1000L) != lecture.getStartTime() || (DateTimeHelper.getDateFrom(endDate, endTime).getTime() / 1000L) != lecture.getEndTime() || chkAutoUpdate.isSelected() != lecture.autoUpdate || chkIsExam.isSelected() != lecture.isExam @@ -679,7 +673,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements */ private void safeClose() { if ((metadataChanged || permissionsChanged) - && !Gui.showMessageBox(me, "Änderungen werden verworfen, wollen Sie wirklich abbrechen?", + && !Gui.showMessageBox(me, "Änderungen werden verworfen, wollen Sie wirklich schließen?", MessageType.QUESTION_YESNO, null, null)) return; dispose(); 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 91693a09..b2ac8991 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 @@ -8,15 +8,19 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import javax.swing.AbstractAction; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JOptionPane; +import javax.swing.KeyStroke; import javax.swing.RowFilter; import javax.swing.SwingUtilities; import javax.swing.UIManager; @@ -132,7 +136,7 @@ public class LectureListWindow extends LectureListWindowLayout { * Popup menu items */ private JMenuItem popupItemNew = new JMenuItem("Neu"); - private JMenuItem popupItemEdit = new JMenuItem("Bearbeiten"); + private JMenuItem popupItemEdit = new JMenuItem("Detailansicht"); private JMenuItem popupItemLinked = new JMenuItem("Imagedetails anzeigen"); private JMenuItem popupItemDownload = new JMenuItem("Verlinktes Image herunterladen"); private JMenuItem popupItemDelete = new JMenuItem("Löschen"); @@ -321,6 +325,24 @@ public class LectureListWindow extends LectureListWindowLayout { filterCbo.setSelectedItem(FilterType.ALL); } updateAvailableOptions(null); + + // Some keyboard shortcuts + lectureTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( + KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "details"); + lectureTable.getActionMap().put("details", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent ae) { + editButton.doClick(); + } + }); + lectureTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( + KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete"); + lectureTable.getActionMap().put("delete", new AbstractAction() { + @Override + public void actionPerformed(ActionEvent ae) { + deleteButton.doClick(); + } + }); } /** @@ -331,9 +353,7 @@ public class LectureListWindow extends LectureListWindowLayout { private void updateAvailableOptions(LectureSummary lecture) { boolean edit = LecturePerms.canEdit(lecture); boolean admin = LecturePerms.canAdmin(lecture); - editButton.setEnabled(edit); deleteButton.setEnabled(admin); - popupItemEdit.setEnabled(edit); popupItemDelete.setEnabled(admin); } @@ -442,6 +462,8 @@ public class LectureListWindow extends LectureListWindowLayout { newButton.setEnabled(Session.canListImages()); popupItemNew.setEnabled(Session.canListImages()); popupItemLinked.setEnabled(Session.canListImages()); + popupItemEdit.setEnabled(Session.canListImages()); + editButton.setEnabled(Session.canListImages()); refreshList(false); } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java index 518e58ef..fc7d6ca4 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java @@ -14,8 +14,11 @@ import java.awt.event.WindowEvent; import java.util.Iterator; import java.util.List; +import javax.swing.AbstractAction; import javax.swing.DefaultComboBoxModel; +import javax.swing.JComponent; import javax.swing.JFrame; +import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import org.apache.log4j.Logger; @@ -73,7 +76,7 @@ public class LoginWindow extends LoginWindowLayout { private final String NO_PASSWORD = "Kein Passwort angegeben!"; private boolean forceCustomSatellite = false; - + private final KeyEventDispatcher satelliteShiftDispatcher = new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(KeyEvent event) { @@ -177,19 +180,16 @@ public class LoginWindow extends LoginWindowLayout { doLogin(); } }); - // add a key listener to the password field to trigger login - // when the user presses the ENTER key. - KeyAdapter loginOnEnter = new KeyAdapter() { + + // make enter key activate login + loginFormPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( + KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "login"); + loginFormPanel.getActionMap().put("login", new AbstractAction() { @Override - public void keyReleased(KeyEvent e) { - super.keyReleased(e); - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - loginButton.doClick(); - } + public void actionPerformed(ActionEvent ae) { + loginButton.doClick(); } - }; - passwordField.addKeyListener(loginOnEnter); - saveUsernameCheck.addKeyListener(loginOnEnter); + }); // finally check if we had a saved username String savedUsername = Config.getUsername(); 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 8d7e6aef..31f20a11 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 @@ -28,7 +28,7 @@ public abstract class LectureListWindowLayout extends CompositePage { private static final String infoTitleString = "Übersicht Veranstaltungen"; private static final String newButtonLabel = "Neue Veranstaltung"; - private static final String editButtonLabel = "Bearbeiten"; + private static final String editButtonLabel = "Detailansicht"; private static final String deleteButtonLabel = "Löschen"; private static final String switchViewButtonLabel = "Zu 'Images' wechseln"; private static final String filterPanelLabel = "Suchen"; diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java index 2d38201d..aec1a844 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java @@ -59,6 +59,7 @@ public abstract class LoginWindowLayout extends JDialog { protected final JPasswordField passwordField; protected final JCheckBox saveUsernameCheck; protected final JButton loginButton; + protected final JPanel loginFormPanel; /** * Create a new login composite @@ -98,7 +99,8 @@ public abstract class LoginWindowLayout extends JDialog { saveUsernameCheck = new JCheckBox("Benutzername speichern"); grid.add(makeLoginTypePanel()).expand(0.25, 1).fill(true, true); - grid.add(makeLoginFormPanel()).expand(0.75, 1).fill(true, true); + loginFormPanel = makeLoginFormPanel(); + grid.add(loginFormPanel).expand(0.75, 1).fill(true, true); grid.nextRow(); grid.finish(true); |
