summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
diff options
context:
space:
mode:
authorJonathan Bauer2015-08-10 14:39:28 +0200
committerJonathan Bauer2015-08-10 14:39:28 +0200
commit422f9918def4af46ace5f1413542eb4a93b263b2 (patch)
tree71efbceb5c0ab75da245b357a970775d4652d55b /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
parent[client] add "neue veran." button (diff)
downloadtutor-module-422f9918def4af46ace5f1413542eb4a93b263b2.tar.gz
tutor-module-422f9918def4af46ace5f1413542eb4a93b263b2.tar.xz
tutor-module-422f9918def4af46ace5f1413542eb4a93b263b2.zip
[client] functionless popup mnue in image list TODO functions :)
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java60
1 files changed, 59 insertions, 1 deletions
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 cd480ebe..dfe72ab7 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
@@ -8,6 +8,7 @@ import java.awt.event.MouseEvent;
import java.util.List;
import javax.swing.JFrame;
+import javax.swing.JMenuItem;
import javax.swing.RowFilter;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
@@ -22,6 +23,7 @@ import org.openslx.bwlp.thrift.iface.TNotFoundException;
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.layout.ImageListWindowLayout;
import org.openslx.dozmod.gui.wizard.ImageWizard;
import org.openslx.dozmod.thrift.ImageCache;
@@ -37,6 +39,11 @@ public class ImageListWindow extends ImageListWindowLayout {
public final ImageListWindow me = this;
+ private JMenuItem popupItemNew = new JMenuItem("Neu");
+ private JMenuItem popupItemNewLecture = new JMenuItem("Neue Veranstaltung");
+ private JMenuItem popupItemDelete = new JMenuItem("Löschen");
+ private JMenuItem popupItemDownload = new JMenuItem("Download");
+
public ImageListWindow() {
super();
@@ -66,15 +73,66 @@ public class ImageListWindow extends ImageListWindowLayout {
}
});
+ // Setup popup menu for the right panel
+ final PopupMenu pop = new PopupMenu(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource().equals(popupItemNew)) {
+ // TODO new lecture wizard with this image preset
+ LOGGER.debug("New image clicked");
+ }
+ if (e.getSource().equals(popupItemNewLecture)) {
+ // TODO new lecture
+ LOGGER.debug("New lecture clicked");
+ }
+ if (e.getSource().equals(popupItemDownload)) {
+ // Download
+ LOGGER.debug("Download image clicked");
+ }
+ if (e.getSource().equals(popupItemDelete)) {
+ // TODO delete that image
+ LOGGER.debug("Delete image clicked");
+ }
+ }
+ });
+
+ // add them to the popup menu
+ pop.addMenuItem(popupItemNew);
+ pop.addMenuItem(popupItemNewLecture);
+ pop.addMenuItem(popupItemDownload);
+ pop.addSeparator();
+ pop.addMenuItem(popupItemDelete);
imageTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
+ if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
final ImageSummaryRead image = getSelectedImage();
if (image == null) return;
ImageDetailsWindow.open((JFrame)SwingUtilities.getWindowAncestor(me), image.getImageBaseId());
}
+ processClick(e);
+ }
+ @Override
+ public void mousePressed(MouseEvent e) {
+ processClick(e);
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ processClick(e);
+ }
+
+ private void processClick(MouseEvent e) {
+ int r = imageTable.rowAtPoint(e.getPoint());
+ if (r >= 0 && r < imageTable.getRowCount()) {
+ // highlight the row and popup the menu
+ imageTable.setRowSelectionInterval(r, r);
+ if (e.isPopupTrigger()) {
+ pop.show(e.getComponent(), e.getX(), e.getY());
+ }
+ } else {
+ imageTable.clearSelection();
+ }
}
});
newButton.addActionListener(new ActionListener() {