From ac5c00e6ea7b6b7ac93a4b27506c92e5fb05c3b9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 12 Aug 2015 14:47:38 +0200 Subject: [client] Adapt ImageUploadPageLayout to GridManager --- .../gui/wizard/layout/ImageUploadPageLayout.java | 34 +++++++--------------- .../dozmod/gui/wizard/page/ImageUploadPage.java | 3 -- 2 files changed, 11 insertions(+), 26 deletions(-) (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod') diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java index 6ae5ae5b..ff1e3f1d 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java @@ -1,16 +1,12 @@ package org.openslx.dozmod.gui.wizard.layout; -import java.awt.Dimension; -import java.awt.GridBagLayout; import java.awt.event.KeyEvent; -import javax.swing.Box; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTextField; -import org.openslx.dozmod.gui.control.BlockProgressBar; -import org.openslx.dozmod.gui.helper.GridPos; +import org.openslx.dozmod.gui.helper.GridManager; import org.openslx.dozmod.gui.wizard.Wizard; import org.openslx.dozmod.gui.wizard.WizardPage; @@ -20,20 +16,14 @@ public abstract class ImageUploadPageLayout extends WizardPage { protected JTextField imageNameTextField; protected JButton imageFileBrowseButton; protected JTextField imageFileTextField; - protected BlockProgressBar blockProgressBar; /** * Page for uploading an imagefile - * - * @param wizard - * - * @param editExistingImage wether to edit existing image file or create new - * one */ public ImageUploadPageLayout(Wizard wizard) { super(wizard, "Neue VM anlegen"); setDescription("Bitte wählen Sie eine virtuelle Maschine zum Hochladen aus."); - setLayout(new GridBagLayout()); + GridManager grid = new GridManager(this, 3, false); // -- Browse for VM -- JLabel imageFileCaption = new JLabel("Virtuelle Maschine"); @@ -41,21 +31,19 @@ public abstract class ImageUploadPageLayout extends WizardPage { imageFileTextField.setEditable(false); imageFileBrowseButton = new JButton("Browse"); imageFileBrowseButton.setMnemonic(KeyEvent.VK_B); - add(imageFileCaption, GridPos.get(0, 0)); - add(imageFileTextField, GridPos.get(1, 0, true, false)); - add(imageFileBrowseButton, GridPos.get(2, 0)); + grid.add(imageFileCaption); + grid.add(imageFileTextField).fill(true, false).expand(true, false); + grid.add(imageFileBrowseButton); + grid.nextRow(); // -- Name -- JLabel imageNameCaption = new JLabel("Name des Images"); imageNameTextField = new JTextField(); - add(imageNameCaption, GridPos.get(0, 1)); - add(imageNameTextField, GridPos.get(1, 1, 2, 1, true, false)); + grid.add(imageNameCaption); + grid.add(imageNameTextField, 2, 1).fill(true, false).expand(true, false); + grid.nextRow(); + + grid.finish(true); - blockProgressBar = new BlockProgressBar(null); - blockProgressBar.setPreferredSize(new Dimension(200, 50)); - blockProgressBar.setMinimumSize(blockProgressBar.getPreferredSize()); - add(blockProgressBar, GridPos.get(0, 2, 3, 1, true, false)); - - add(Box.createVerticalGlue(), GridPos.get(0, 3, 3, 1, true, true)); } } 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 4802256b..4b84d8be 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 @@ -61,7 +61,6 @@ public class ImageUploadPage extends ImageUploadPageLayout { } }); - blockProgressBar.setVisible(false); imageFileBrowseButton.requestFocus(); } @@ -217,8 +216,6 @@ public class ImageUploadPage extends ImageUploadPageLayout { return false; } MainWindow.addUpload(state); - // -- check image creation -- - blockProgressBar.setVisible(true); return true; } } -- cgit v1.2.3-55-g7522