diff options
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java | 101 |
1 files changed, 51 insertions, 50 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 ec98ed6c..69e65e93 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 @@ -55,6 +55,56 @@ public class ImageListWindow extends ImageListWindowLayout { sorter.setSortKeys(list); jtable.setRowSorter(sorter); jtable.setModel(itm); + // SWING TABLE STUFF + jtable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + + @Override + public void valueChanged(ListSelectionEvent e) { + ImageTableModel model = (ImageTableModel) jtable.getModel(); + int rowIndex = jtable.getSelectedRow(); + ImageSummaryRead image = null; + if (rowIndex != -1) { + image = model.get(jtable.convertRowIndexToModel(jtable.getSelectedRow())); + LOGGER.debug(image.toString()); + } else { + LOGGER.error("No selection!"); + } + final ImageSummaryRead finalImage = image; + if (image == null) + return; + Gui.asyncExec(new Runnable() { + public void run() { + updateDetailPane(finalImage); + } + }); + } + }); + jtable.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + if (me.getClickCount() == 2) { + // your valueChanged overridden method + ImageTableModel model = (ImageTableModel) jtable.getModel(); + int rowIndex = jtable.getSelectedRow(); + ImageSummaryRead image = null; + if (rowIndex != -1) { + image = model.get(jtable.convertRowIndexToModel(rowIndex)); + LOGGER.debug(image.toString()); + } else { + LOGGER.error("No selection!"); + } + final ImageSummaryRead finalImage = image; + if (finalImage == null) + return; + Gui.asyncExec(new Runnable() { + public void run() { + ImageDetailsWindow popup = MainWindow.openPopup(ImageDetailsWindow.class, true, false); + if (popup != null) + popup.setImage(finalImage.getImageBaseId()); + } + }); + } + } + }); } }); // filter the objects in the table depending on the search field @@ -101,56 +151,7 @@ public class ImageListWindow extends ImageListWindowLayout { } }); - // SWING TABLE STUFF - jtable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(ListSelectionEvent e) { - ImageTableModel model = (ImageTableModel) jtable.getModel(); - int rowIndex = jtable.getSelectedRow(); - ImageSummaryRead image = null; - if (rowIndex != -1) { - image = model.get(jtable.convertRowIndexToModel(jtable.getSelectedRow())); - LOGGER.debug(image.toString()); - } else { - LOGGER.error("No selection!"); - } - final ImageSummaryRead finalImage = image; - if (image == null) - return; - Gui.asyncExec(new Runnable() { - public void run() { - updateDetailPane(finalImage); - } - }); - } - }); - jtable.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent me) { - if (me.getClickCount() == 2) { - // your valueChanged overridden method - ImageTableModel model = (ImageTableModel) jtable.getModel(); - int rowIndex = jtable.getSelectedRow(); - ImageSummaryRead image = null; - if (rowIndex != -1) { - image = model.get(jtable.convertRowIndexToModel(rowIndex)); - LOGGER.debug(image.toString()); - } else { - LOGGER.error("No selection!"); - } - final ImageSummaryRead finalImage = image; - if (finalImage == null) - return; - Gui.asyncExec(new Runnable() { - public void run() { - ImageDetailsWindow popup = MainWindow.openPopup(ImageDetailsWindow.class, true, false); - if (popup != null) - popup.setImage(finalImage.getImageBaseId()); - } - }); - } - } - }); + } |
