diff options
author | Stephan Schwaer | 2015-08-03 16:43:29 +0200 |
---|---|---|
committer | Stephan Schwaer | 2015-08-03 16:43:29 +0200 |
commit | aa86c52338a0739d312bed03f5c9076225c474f1 (patch) | |
tree | 7a8e6abb2a57fe3b4a02265e492ac72224d275e4 /dozentenmodul/src/main/java/org/openslx | |
parent | [client] Minor tweaks (diff) | |
download | tutor-module-aa86c52338a0739d312bed03f5c9076225c474f1.tar.gz tutor-module-aa86c52338a0739d312bed03f5c9076225c474f1.tar.xz tutor-module-aa86c52338a0739d312bed03f5c9076225c474f1.zip |
[client] Removed the image details panel and added some info in image details window.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx')
5 files changed, 32 insertions, 93 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java index b6ccba23..8221cef5 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java @@ -9,7 +9,7 @@ import org.openslx.dozmod.util.FormatHelper; public class ImageTable extends ListTable<ImageSummaryRead> { private static String[] columnNames = - { "Name", "OS", "Verantwortlicher", "Letztes Update", "Größe" }; + { "Name", "OS", "Verantwortlicher", "Letztes Update", "Größe", "Version", "Vorlage" }; public ImageTable() { super(columnNames); @@ -28,6 +28,10 @@ public class ImageTable extends ListTable<ImageSummaryRead> { return FormatHelper.longDate(row.getUpdateTime()); if (columnIndex == 4) return row.getCurrentVersionId() == null ? "-" : FormatHelper.bytes(row.getFileSize(), false); + if (columnIndex == 5) + return row.getCurrentVersionId() == null ? "-" : row.getCurrentVersionId(); + if (columnIndex == 6) + return row.isTemplate ? "Ja" : "Nein"; throw new IndexOutOfBoundsException(); } 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 9d72f25a..05e1df76 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 @@ -109,7 +109,10 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout { lblUpdater.setUser(UserCache.find(image.getUpdaterId())); lblCreateTime.setText(FormatHelper.longDate(image.getCreateTime())); lblUpdateTime.setText(FormatHelper.longDate(image.getUpdateTime())); - + txtId.setText(image.getImageBaseId()); + txtVersion.setText(image.getCurrentVersionId()); + + List<OperatingSystem> osList = MetaDataCache.getOperatingSystems(); // all fine, lets sort it Collections.sort(osList, new Comparator<OperatingSystem>() { @@ -149,8 +152,11 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout { txtTitle.setEnabled(editable); txtDescription.setEnabled(editable); txtTags.setEnabled(editable); + txtVersion.setEnabled(editable); + txtId.setEnabled(editable); btnIsTemplate.setEnabled(editable); cboOperatingSystem.setEnabled(editable); + cboShareMode.setEnabled(editable); } /** 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 65084021..0c1c5815 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,24 +8,18 @@ import java.awt.event.MouseEvent; import java.util.List; import javax.swing.JFrame; -import javax.swing.JTextField; import javax.swing.RowFilter; import javax.swing.SwingUtilities; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; -import org.openslx.bwlp.thrift.iface.ImagePermissions; import org.openslx.bwlp.thrift.iface.ImageSummaryRead; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.window.layout.ImageListWindowLayout; import org.openslx.dozmod.gui.wizard.ImageWizard; import org.openslx.dozmod.thrift.ImageCache; -import org.openslx.dozmod.thrift.UserCache; -import org.openslx.dozmod.util.FormatHelper; import org.openslx.util.QuickTimer; import org.openslx.util.QuickTimer.Task; @@ -63,47 +57,7 @@ public class ImageListWindow extends ImageListWindowLayout { } }); - // Selection listener for the table to update the details panel when an image is clicked - imageTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - ImageSummaryRead image = imageTable.getSelectedItem(); - if (image == null) - return; - // Fill detail information fields - // Image name - setFieldText(imageSelectedNameLabel, image.getImageName()); - // id of the lecture - setFieldText(idInfo, image.getImageBaseId()); - // version of the image TODO last? current? - setFieldText(versionInfo, image.getCurrentVersionId()); - // last update of image - setFieldText(lastUpdateInfo, FormatHelper.longDate(image.getUpdateTime())); - // permissions of this image - ImagePermissions perms = image.getUserPermissions(); - if (perms == null) - perms = image.getDefaultPermissions(); - if (perms != null) - setFieldText(permissionInfo, perms.toString()); - // the owner of the selected lecture - setFieldText(ownerInfo, FormatHelper.userName(UserCache.find(image.getOwnerId()))); - // is it a template? - if (image.isTemplate) - templateInfo.setText("Ja"); - else - templateInfo.setText("Nein"); - - me.invalidate(); - me.validate(); - } - private void setFieldText(JTextField control, String content) { - if (content == null) { - control.setText("<null>"); - } else { - control.setText(content); - } - } - }); + imageTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java index 498c44f8..c0c32f71 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java @@ -43,6 +43,10 @@ public abstract class ImageDetailsWindowLayout extends JDialog { protected final JTextField txtTags; protected final JCheckBox btnIsTemplate; protected final JComboBox<ShareMode> cboShareMode; + + protected final JTextField txtId; + protected final JTextField txtVersion; + protected final JButton btnSaveChanges; protected final JButton btnClose; @@ -67,7 +71,6 @@ public abstract class ImageDetailsWindowLayout extends JDialog { // description txtDescription = new JTextArea(); infoPanel.add(new JLabel("Beschreibung"), GridPos.get(0, 1, false, false)); - infoPanel.add(new JScrollPane(txtDescription), GridPos.get(1, 1, true, false)); // owner @@ -119,6 +122,14 @@ public abstract class ImageDetailsWindowLayout extends JDialog { infoPanel.add(new JLabel("Vorlage"), GridPos.get(0, 10, false, false)); infoPanel.add(btnIsTemplate, GridPos.get(1, 10, true, false)); + txtVersion = new JTextField(); + infoPanel.add(new JLabel("Version"), GridPos.get(0, 11, false, false)); + infoPanel.add(txtVersion, GridPos.get(1, 11, true, false)); + + txtId = new JTextField(); + infoPanel.add(new JLabel("ID"), GridPos.get(0, 12, false, false)); + infoPanel.add(txtId, GridPos.get(1, 12, true, false)); + // finally add the infoPanel itself to the main view add(infoPanel, BorderLayout.CENTER); // button panel on the bottom 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 438e9795..1c21dbe2 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 @@ -1,19 +1,14 @@ package org.openslx.dozmod.gui.window.layout; import java.awt.BorderLayout; -import java.awt.Dimension; import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JSplitPane; import javax.swing.JTextField; -import javax.swing.border.TitledBorder; import org.apache.log4j.Logger; import org.openslx.dozmod.gui.control.table.ImageTable; @@ -33,11 +28,10 @@ public abstract class ImageListWindowLayout extends CompositePage { protected final static String downloadButtonLabel = "Download"; protected final static String backButtonLabel = "Zurück"; protected final static String tableGroupLabel = "Images"; - protected final static String vmInfoGroupLabel = "Detailinformationen"; protected final static String filterGroupLabel = "Filter"; // -------------------------------------- - // Left panel: search field, table and buttons + // search field, table and buttons protected JTextField searchTextField; protected ImageTable imageTable; protected JButton newButton; @@ -45,15 +39,7 @@ public abstract class ImageListWindowLayout extends CompositePage { protected JButton downloadButton; protected JButton backButton; - // -------------------------------------- - // Right panel: image details information - protected JTextField imageSelectedNameLabel; - protected JTextField idInfo; - protected JTextField versionInfo; - protected JTextField lastUpdateInfo; - protected JTextField permissionInfo; - protected JTextField ownerInfo; - protected JTextField templateInfo; + public ImageListWindowLayout() { super(new BorderLayout()); @@ -69,7 +55,7 @@ public abstract class ImageListWindowLayout extends CompositePage { add(infoPanel, BorderLayout.NORTH); // -------------------------------------- - // LEFT: List panel with the list of the images + // the panel for the table and search field JPanel listPanel = new JPanel(new BorderLayout()); // the search field searchTextField = new JTextField(); @@ -77,6 +63,9 @@ public abstract class ImageListWindowLayout extends CompositePage { // the actual table imageTable = new ImageTable(); listPanel.add(new JScrollPane(imageTable), BorderLayout.CENTER); + add(listPanel, BorderLayout.CENTER); + + // -------------------------------------- // the buttons at the bottom JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); @@ -90,32 +79,7 @@ public abstract class ImageListWindowLayout extends CompositePage { buttonPanel.add(backButton); listPanel.add(buttonPanel, BorderLayout.PAGE_END); - // -------------------------------------- - // RIGHT: Details panel for the selected image - final JPanel detailsPane = new JPanel(); - detailsPane.setLayout(new GridBagLayout()); - detailsPane.setBorder(new TitledBorder(vmInfoGroupLabel)); - detailsPane.setMaximumSize(new Dimension(400, Integer.MAX_VALUE)); - detailsPane.setMinimumSize(new Dimension(350, 0)); - detailsPane.setPreferredSize(detailsPane.getMinimumSize()); - // image name info - int row = 0; - imageSelectedNameLabel = createCaptionAndTextfield("Name", detailsPane, row++); - idInfo = createCaptionAndTextfield("ID", detailsPane, row++); - versionInfo = createCaptionAndTextfield("Version", detailsPane, row++); - lastUpdateInfo = createCaptionAndTextfield("Letztes Update", detailsPane, row++); - permissionInfo = createCaptionAndTextfield("Berechtigungen", detailsPane, row++); - ownerInfo = createCaptionAndTextfield("Besitzer", detailsPane, row++); - templateInfo = createCaptionAndTextfield("Vorlage", detailsPane, row++); - // For some reason without this the controls above are centered vertically - detailsPane.add(new JPanel(), GridPos.get(0, row++, 2, 1, true, true)); - // the actual layout of the whole window - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - splitPane.setLeftComponent(listPanel); - splitPane.setRightComponent(detailsPane); - // make the left panel grab the excess space - splitPane.setResizeWeight(1); - add(splitPane); + } public JTextField createCaptionAndTextfield(String captionString, JPanel group, int row) { JLabel caption = new JLabel(captionString); |