diff options
author | Jonathan Bauer | 2015-08-11 15:36:45 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-08-11 15:36:45 +0200 |
commit | 53f1e1b9eb6bf23525d88c28a63c52c143777fe5 (patch) | |
tree | 9f48f6bce1e45a4ceece48524b06aeb0aa24bbb6 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java | |
parent | [client] added combo and filter to filter imagelist for editable and own images. (diff) | |
download | tutor-module-53f1e1b9eb6bf23525d88c28a63c52c143777fe5.tar.gz tutor-module-53f1e1b9eb6bf23525d88c28a63c52c143777fe5.tar.xz tutor-module-53f1e1b9eb6bf23525d88c28a63c52c143777fe5.zip |
[client] lecture wizard quasi complete
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.java | 35 |
1 files changed, 34 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 340b320d..0e000011 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.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import javax.swing.JFileChooser; @@ -21,11 +22,12 @@ import javax.swing.event.DocumentListener; import org.apache.log4j.Logger; import org.apache.thrift.TException; +import org.openslx.bwlp.thrift.iface.ImageDetailsRead; import org.openslx.bwlp.thrift.iface.ImageSummaryRead; +import org.openslx.bwlp.thrift.iface.ImageVersionDetails; import org.openslx.bwlp.thrift.iface.TAuthorizationException; import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.bwlp.thrift.iface.TransferInformation; -import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.dozmod.filetransfer.DownloadTask; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.MainWindow; @@ -34,6 +36,7 @@ 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.gui.wizard.LectureWizard; import org.openslx.dozmod.thrift.ImageCache; import org.openslx.dozmod.thrift.Session; import org.openslx.dozmod.thrift.UserCache; @@ -82,6 +85,7 @@ public class ImageListWindow extends ImageListWindowLayout { if (e.getSource().equals(popupItemNewLecture)) { // TODO new lecture LOGGER.debug("New lecture clicked"); + startLectureWizard(); } if (e.getSource().equals(popupItemDownload)) { performImageDownload(); @@ -181,6 +185,14 @@ public class ImageListWindow extends ImageListWindowLayout { } }); + newLectureButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + startLectureWizard(); + + } + }); // return to mainMenu backButton.addActionListener(new ActionListener() { @Override @@ -191,6 +203,27 @@ public class ImageListWindow extends ImageListWindowLayout { } + private void startLectureWizard() { + // determine latest version of the selected image + final ImageSummaryRead image = getSelectedImage(); + if (image == null) return; + ImageDetailsRead idr; + try { + idr = ThriftManager.getSatClient().getImageDetails(Session.getSatelliteToken(), image.getImageBaseId()); + } catch (Exception e) { + LOGGER.debug("Failed to get image details read from image base id: ", e); + return; + } + + Iterator<ImageVersionDetails> it = idr.getVersions().iterator(); + ImageVersionDetails latest = it.next(); + while (it.hasNext()) { + ImageVersionDetails current = it.next(); + if (current.getCreateTime() > latest.getCreateTime()) + latest = current; + } + new LectureWizard(SwingUtilities.getWindowAncestor(this), latest).setVisible(true); + } private void refreshList(final boolean forceRefresh) { QuickTimer.scheduleOnce(new Task() { @Override |