diff options
| author | Stephan Schwaer | 2015-07-07 18:41:13 +0200 |
|---|---|---|
| committer | Stephan Schwaer | 2015-07-07 18:41:13 +0200 |
| commit | 6cdab2d80d7f614345a93f429a8c337fcd161f96 (patch) | |
| tree | cbe9f7929df0363ab744399ee99bcc52fa06bd0a /dozentenmodul/src/main/java/wizards/ImageUploadPage.java | |
| parent | [client] Adapt to changes in master-sync-shared/ThriftManager (diff) | |
| download | tutor-module-6cdab2d80d7f614345a93f429a8c337fcd161f96.tar.gz tutor-module-6cdab2d80d7f614345a93f429a8c337fcd161f96.tar.xz tutor-module-6cdab2d80d7f614345a93f429a8c337fcd161f96.zip | |
[client] Added imageWindowComposite and early stage of wizard for creating/editing images.
Diffstat (limited to 'dozentenmodul/src/main/java/wizards/ImageUploadPage.java')
| -rw-r--r-- | dozentenmodul/src/main/java/wizards/ImageUploadPage.java | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/wizards/ImageUploadPage.java b/dozentenmodul/src/main/java/wizards/ImageUploadPage.java new file mode 100644 index 00000000..b4f36589 --- /dev/null +++ b/dozentenmodul/src/main/java/wizards/ImageUploadPage.java @@ -0,0 +1,87 @@ +package wizards; + + +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; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + + + +public class ImageUploadPage extends WizardPage { + + protected Text imageName; + protected Composite container; + protected boolean editExistingImage; + protected Button imageFileBrowseButton; + + + + /** + * Page for uploading an imagefile + * @param editExistingImage wether to edit existing image file or create new one + */ + public ImageUploadPage(boolean editExistingImage) { + super("Eingabe Ihrer Daten"); + setTitle("Eingabe Ihrer Daten"); + setDescription("Geben Sie bitte einen aussagekräftigen Namen für das neue Image ein."); + 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); + 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.setEnabled(!editExistingImage); + System.out.println(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 + setControl(container); + setPageComplete(editExistingImage); + } + + + public String getText1() { + return imageName.getText(); + } + +} |
