summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
authorJonathan Bauer2015-08-27 17:31:42 +0200
committerJonathan Bauer2015-08-27 17:31:42 +0200
commit5b308f74bb2309b8b85419dc679a76ff7dbb4eb2 (patch)
treedb9708202dbc52282f5a479411ace4340718262e /dozentenmodul
parent[client] fix lectures details multiple open (diff)
parent[client] Change color of wizard message for warnings and errors (diff)
downloadtutor-module-5b308f74bb2309b8b85419dc679a76ff7dbb4eb2.tar.gz
tutor-module-5b308f74bb2309b8b85419dc679a76ff7dbb4eb2.tar.xz
tutor-module-5b308f74bb2309b8b85419dc679a76ff7dbb4eb2.zip
Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1
Diffstat (limited to 'dozentenmodul')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java15
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java17
3 files changed, 29 insertions, 10 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java
index c1a2c361..c86e384d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java
@@ -10,11 +10,13 @@ import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
+import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
@@ -22,13 +24,17 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.helper.GridManager;
@SuppressWarnings("serial")
public abstract class Wizard extends JDialog {
+ private static final Logger LOGGER = Logger.getLogger(Wizard.class);
+
private final JLabel titleLabel;
private final JLabel messageLabel;
private final List<WizardPage> pages = new ArrayList<>();
@@ -169,6 +175,7 @@ public abstract class Wizard extends JDialog {
titleLabel.setText(pageTitle);
messageLabel.setText(pageDesc);
messageLabel.setIcon(page.getMessageIcon());
+ messageLabel.setForeground(page.getMessageColor());
messageLabel.validate();
setTitle(getWindowTitle() + " - " + pageTitle);
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java
index 3468ee83..ec77de90 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java
@@ -1,5 +1,6 @@
package org.openslx.dozmod.gui.wizard;
+import java.awt.Color;
import java.awt.Dialog;
import javax.swing.Icon;
@@ -9,6 +10,8 @@ import javax.swing.UIManager;
@SuppressWarnings("serial")
public abstract class WizardPage extends JPanel {
+ private static final Color WARNING_COLOR = new Color(200, 100, 0);
+
private final String title;
private String description = null;
@@ -125,8 +128,16 @@ public abstract class WizardPage extends JPanel {
if (message == null)
return null;
if (isError)
- return (Icon) UIManager.get("OptionPane.errorIcon");
- return (Icon) UIManager.get("OptionPane.warningIcon");
+ return UIManager.getIcon("OptionPane.errorIcon");
+ return UIManager.getIcon("OptionPane.warningIcon");
+ }
+
+ public Color getMessageColor() {
+ if (message == null)
+ return Color.BLACK;
+ if (isError)
+ return Color.RED;
+ return WARNING_COLOR;
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
index 985544c8..47c5b8d1 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
@@ -38,7 +38,8 @@ public class ImageUploadPage extends ImageUploadPageLayout {
private String lastDetectedName = null;
private ImageDetailsRead existingImage = null;
- public ImageUploadPage(Wizard wizard, UploadWizardState uploadWizardState, final ImageDetailsRead existingImage) {
+ public ImageUploadPage(Wizard wizard, UploadWizardState uploadWizardState,
+ final ImageDetailsRead existingImage) {
super(wizard);
setPageComplete(false);
this.canComeBack = false;
@@ -121,7 +122,7 @@ public class ImageUploadPage extends ImageUploadPageLayout {
if (vmDiskFileInfo.canRead()) {
state.diskFile = vmDiskFileInfo;
} else {
- setErrorMessage("'" + vmDiskFileInfo.getPath() + "' kann nicht gelesen werden!");
+ setErrorMessage("'" + vmDiskFileInfo.getName() + "' kann nicht gelesen werden!");
setPageComplete(false);
return;
}
@@ -134,7 +135,7 @@ public class ImageUploadPage extends ImageUploadPageLayout {
String imageName = imageNameTextField.getText();
if (imageName.isEmpty() || imageName.equals(lastDetectedName)) {
imageNameTextField.setText(state.meta.getDisplayName());
- }
+ }
}
lastDetectedName = state.meta.getDisplayName();
state.detectedOs = state.meta.getOs();
@@ -163,8 +164,7 @@ public class ImageUploadPage extends ImageUploadPageLayout {
// are we creating a new image? then either:
// get the image name either auto filled by VmwareMetaData or by user
// get the image name from the image we are uploading a new version of
- state.name = existingImage != null ?
- existingImage.getImageName() : imageNameTextField.getText();
+ state.name = existingImage != null ? existingImage.getImageName() : imageNameTextField.getText();
// -- create image to get uuid --
if (existingImage == null) {
@@ -172,7 +172,7 @@ public class ImageUploadPage extends ImageUploadPageLayout {
state.uuid = ThriftActions.createImage(JOptionPane.getFrameForComponent(this), state.name);
if (state.uuid == null)
return false;
-
+
imageNameTextField.setEnabled(false);
imageFileBrowseButton.setEnabled(false);
imageFileTextField.setEnabled(false);
@@ -182,8 +182,9 @@ public class ImageUploadPage extends ImageUploadPageLayout {
}
// -- request upload for that uuid --
if (state.transferInformation == null) {
- state.transferInformation = ThriftActions.requestVersionUpload(JOptionPane.getFrameForComponent(this),
- state.uuid, state.diskFile.length(), null, state.meta.getFilteredDefinition());
+ state.transferInformation = ThriftActions.requestVersionUpload(
+ JOptionPane.getFrameForComponent(this), state.uuid, state.diskFile.length(), null,
+ state.meta.getFilteredDefinition());
if (state.transferInformation == null)
return false;
}