diff options
author | Jonathan Bauer | 2015-08-20 17:46:41 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-08-20 17:46:41 +0200 |
commit | e39eeb32b3c94a7ca8b52f4bec19500eba3cf6ff (patch) | |
tree | 5be55750a8a665a1d7b0a829bb6b9d73d06ebb69 /dozentenmodul/src | |
parent | [client] UpdateVersion: only needs ctrl-q if we have initiated a transfer (diff) | |
download | tutor-module-e39eeb32b3c94a7ca8b52f4bec19500eba3cf6ff.tar.gz tutor-module-e39eeb32b3c94a7ca8b52f4bec19500eba3cf6ff.tar.xz tutor-module-e39eeb32b3c94a7ca8b52f4bec19500eba3cf6ff.zip |
[client] save that one byte/int/bit :)
Diffstat (limited to 'dozentenmodul/src')
3 files changed, 10 insertions, 17 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java index 8e5dfecc..935e2bc7 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java @@ -33,7 +33,7 @@ public class ImageWizard extends Wizard implements UiFeedback { */ public ImageWizard(Window parent) { super(parent); - imageUploadPage = new ImageUploadPage(this, uploadWizardState, false, null); + imageUploadPage = new ImageUploadPage(this, uploadWizardState, null); imageMetaDataPage = new ImageMetaDataPage(this, uploadWizardState); imageCustomPermissionPage = new ImageCustomPermissionPage(this, uploadWizardState); addPage(imageUploadPage); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/UpdateWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/UpdateWizard.java index 82b04006..8eb6ca4e 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/UpdateWizard.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/UpdateWizard.java @@ -24,7 +24,7 @@ public class UpdateWizard extends Wizard implements UiFeedback { public UpdateWizard(final Window parent, final ImageDetailsRead image) { super(parent); - imageUploadPage = new ImageUploadPage(this, uploadWizardState, true, image); + imageUploadPage = new ImageUploadPage(this, uploadWizardState, image); addPage(imageUploadPage); } 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 e74e4adb..547e51e0 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 @@ -35,27 +35,20 @@ public class ImageUploadPage extends ImageUploadPageLayout { private UploadWizardState state; private String lastDetectedName = null; - private boolean updateExisting = false; private ImageDetailsRead existingImage = null; - public ImageUploadPage(Wizard wizard, UploadWizardState uploadWizardState, boolean updateExisting, final ImageDetailsRead existingImage) { + public ImageUploadPage(Wizard wizard, UploadWizardState uploadWizardState, final ImageDetailsRead existingImage) { super(wizard); setPageComplete(false); this.canComeBack = false; this.state = uploadWizardState; - this.updateExisting = updateExisting; this.existingImage = existingImage; - // safety check - if (updateExisting && existingImage == null) { - LOGGER.error("Wrong initialization of ImageUploadPage for updating an existing image!"); - return; - } - imageNameCaption.setVisible(!updateExisting); - imageNameTextField.setVisible(!updateExisting); + imageNameCaption.setVisible(existingImage == null); + imageNameTextField.setVisible(existingImage == null); // show the licenced software checkbox since we are uploading new version - softwareLicenseBox.setVisible(updateExisting); - softwareLicenseBox.setSelected(updateExisting); // TODO selected by default? + softwareLicenseBox.setVisible(existingImage != null); + softwareLicenseBox.setSelected(existingImage != null); // TODO selected by default? // Browse for *.vmx imageFileBrowseButton.addActionListener(new ActionListener() { @@ -135,7 +128,7 @@ public class ImageUploadPage extends ImageUploadPageLayout { // vmx ok, set it as our description file state.descriptionFile = file; - if (!updateExisting) { + if (existingImage == null) { // User didn't enter a name yet or didn't change it -> set String imageName = imageNameTextField.getText(); if (imageName.isEmpty() || imageName.equals(lastDetectedName)) { @@ -169,11 +162,11 @@ 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 = updateExisting ? + state.name = existingImage != null ? existingImage.getImageName() : imageNameTextField.getText(); // -- create image to get uuid -- - if (!updateExisting) { + if (existingImage == null) { if (state.uuid == null) { state.uuid = ThriftActions.createImage(JOptionPane.getFrameForComponent(this), state.name); if (state.uuid == null) |