diff options
| author | Jonathan Bauer | 2015-07-10 17:02:15 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-07-10 17:02:15 +0200 |
| commit | 10d95036c06e16b06d7d70798587e4d7448df077 (patch) | |
| tree | 73cc8087bae13591ddb97daaf794a0c73ffefb06 | |
| parent | [client] fix missing setControl in ImageMetaDataPageLayout (diff) | |
| download | tutor-module-10d95036c06e16b06d7d70798587e4d7448df077.tar.gz tutor-module-10d95036c06e16b06d7d70798587e4d7448df077.tar.xz tutor-module-10d95036c06e16b06d7d70798587e4d7448df077.zip | |
[client] enable next button in ImageUploadPage only if text is written as Image Name
6 files changed, 30 insertions, 41 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java index e0f83b92..34b76bc7 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java @@ -14,7 +14,6 @@ import org.apache.log4j.PatternLayout; import org.apache.log4j.spi.LoggingEvent; import org.openslx.dozmod.gui.MainWindow; import org.openslx.dozmod.gui.helper.Gui; -import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.util.ProxyConfigurator; import org.openslx.thrifthelper.ThriftManager; 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 1cac417e..937ed86e 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 @@ -4,7 +4,7 @@ import org.eclipse.jface.wizard.Wizard; import org.openslx.dozmod.gui.wizard.page.ImageMetaDataPage; import org.openslx.dozmod.gui.wizard.page.ImageUploadPage; -public class ImageWizard extends Wizard{ +public class ImageWizard extends Wizard { protected ImageUploadPage imageUploadPage; protected ImageMetaDataPage imageMetaDataPage; @@ -40,9 +40,7 @@ public class ImageWizard extends Wizard{ @Override public boolean performFinish() { - // Print the result to the console - System.out.println(imageUploadPage.getText1()); - System.out.println(imageMetaDataPage.getImageDescription()); + // TODO actually try to upload the stuff return true; } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java index f48deb96..b39e8733 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java @@ -48,8 +48,6 @@ public abstract class ImageMetaDataPageLayout extends WizardPage { layout.numColumns = 2; GridData gd = new GridData(GridData.FILL_HORIZONTAL); - - Label osCaption = new Label(container, SWT.NONE); osCaption.setText("Betriebssystem:"); 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 f9386502..851e4b11 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 @@ -3,8 +3,6 @@ package org.openslx.dozmod.gui.wizard.layout; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; @@ -21,8 +19,6 @@ public abstract class ImageUploadPageLayout extends WizardPage { protected boolean editExistingImage; protected Button imageFileBrowseButton; - - /** * Page for uploading an imagefile * @param editExistingImage wether to edit existing image file or create new one @@ -34,52 +30,24 @@ public abstract class ImageUploadPageLayout extends WizardPage { this.editExistingImage = editExistingImage; } - - @Override public void createControl(Composite parent) { container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 2; - Label imageNameCaption= new Label(container, SWT.NONE); + Label imageNameCaption = new Label(container, SWT.NONE); imageNameCaption.setText("Name des Images"); - imageName = new Text(container, SWT.BORDER | SWT.SINGLE); - imageName.setText(""); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - imageName.setLayoutData(gd); + imageName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); imageName.setEnabled(!editExistingImage); - imageName.addKeyListener(new KeyListener() { - @Override - public void keyPressed(KeyEvent e) { - } - - @Override - public void keyReleased(KeyEvent e) { - if (!imageName.getText().isEmpty()) { - setPageComplete(true); - } else { - setPageComplete(false); - } - } - }); - Label imageFileCaption = new Label(container, SWT.NONE); imageFileCaption.setText("Imagefile:"); imageFileBrowseButton = new Button(container, SWT.PUSH); imageFileBrowseButton.setText("Browse"); - - // required to avoid an error in the system <-- TODO: WTF? setControl(container); } - - - public String getText1() { // TODO: ???????????? - return imageName.getText(); - } - } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java index 969a6c52..be1b7e07 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java @@ -4,4 +4,7 @@ import org.openslx.dozmod.gui.wizard.layout.ImageMetaDataPageLayout; public class ImageMetaDataPage extends ImageMetaDataPageLayout { + public ImageMetaDataPage() { + super(); + } } 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 617e7efc..9d308195 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 @@ -1,5 +1,8 @@ package org.openslx.dozmod.gui.wizard.page; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.widgets.Composite; import org.openslx.dozmod.gui.wizard.layout.ImageUploadPageLayout; public class ImageUploadPage extends ImageUploadPageLayout { @@ -8,4 +11,24 @@ public class ImageUploadPage extends ImageUploadPageLayout { super(editExistingImage); } + @Override + public void createControl(Composite parent) { + super.createControl(parent); + setPageComplete(false); + imageName.addKeyListener(new KeyListener() { + @Override + public void keyPressed(KeyEvent e) { + } + + @Override + public void keyReleased(KeyEvent e) { + getWizard().getContainer().updateButtons(); + } + }); + } + @Override + public boolean canFlipToNextPage() { + return !imageName.getText().isEmpty(); + } + } |
