summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2015-07-10 18:15:05 +0200
committerJonathan Bauer2015-07-10 18:15:05 +0200
commitc2096b9c5748c6d44fa97aa4ae51cfb933859265 (patch)
tree168c18ddb7ac359d2a5809e4ca5c5bc10996b739
parentMerge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff)
downloadtutor-module-c2096b9c5748c6d44fa97aa4ae51cfb933859265.tar.gz
tutor-module-c2096b9c5748c6d44fa97aa4ae51cfb933859265.tar.xz
tutor-module-c2096b9c5748c6d44fa97aa4ae51cfb933859265.zip
[client] fill combobox for OS in ImageMetaData using the MetaDataCache
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java12
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java51
3 files changed, 42 insertions, 24 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 937ed86e..dc25aad9 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
@@ -1,21 +1,23 @@
package org.openslx.dozmod.gui.wizard;
+import org.apache.log4j.Logger;
import org.eclipse.jface.wizard.Wizard;
+import org.openslx.dozmod.gui.MainWindow;
+import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.wizard.page.ImageMetaDataPage;
import org.openslx.dozmod.gui.wizard.page.ImageUploadPage;
public class ImageWizard extends Wizard {
+ private final static Logger LOGGER = Logger.getLogger(ImageWizard.class);
+
protected ImageUploadPage imageUploadPage;
protected ImageMetaDataPage imageMetaDataPage;
protected boolean editExistingImage;
-
-
-
/**
* Wizard for creating or editing an image
- * @param editExistingImage wether to create new or edit existing image
+ * @param editExistingImage whether to create new or edit existing image
*/
public ImageWizard(boolean editExistingImage) {
super();
@@ -40,7 +42,7 @@ public class ImageWizard extends Wizard {
@Override
public boolean performFinish() {
- // TODO actually try to upload the stuff
+ MainWindow.showMessageBox("Would try to upload now :)", MessageType.INFO, LOGGER, null);
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 b39e8733..67cfb045 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
@@ -51,7 +51,8 @@ public abstract class ImageMetaDataPageLayout extends WizardPage {
Label osCaption = new Label(container, SWT.NONE);
osCaption.setText("Betriebssystem:");
- osCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
+ osCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
+ osCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
Label descriptionCation = new Label(container, SWT.NONE);
descriptionCation.setText("Beschreibung:");
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 d79c109a..76336f24 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
@@ -3,15 +3,15 @@ package org.openslx.dozmod.gui.wizard.page;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.thrift.TException;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Composite;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
-import org.openslx.dozmod.gui.MainWindow;
-import org.openslx.dozmod.gui.helper.MessageType;
+import org.openslx.dozmod.gui.helper.Gui;
import org.openslx.dozmod.gui.wizard.layout.ImageMetaDataPageLayout;
-import org.openslx.thrifthelper.ThriftManager;
+import org.openslx.dozmod.thrift.MetaDataCache;
+import org.openslx.util.QuickTimer;
+import org.openslx.util.QuickTimer.Task;
public class ImageMetaDataPage extends ImageMetaDataPageLayout {
@@ -27,22 +27,22 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout {
super.createControl(parent);
// fetch the OS list
- List<OperatingSystem> osList = null;
- try {
- osList = ThriftManager.getSatClient().getOperatingSystems();
- } catch (TException e) {
- MainWindow.showMessageBox("Konnte die Liste der Betriebsysteme nicht holen!", MessageType.ERROR, LOGGER, e);
- return;
- }
+ QuickTimer.scheduleOnce(new Task() {
+ List<OperatingSystem> osList = null;
- for (OperatingSystem os : osList) {
- if (os.isSetOsName()) {
- osCombo.add(os.getOsName());
- osCombo.setData(os.osName, os);
+ @Override
+ public void fire() {
+ osList = MetaDataCache.getOperatingSystems();
+ // now send the organisations back to the LoginWindow
+ // through populateIdpCombo()
+ Gui.display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ fillOsCombo(osList);
+ }
+ });
}
- }
- // select the first one by default
- osCombo.select(0);
+ });
descriptionText.addKeyListener(new KeyListener() {
@Override
@@ -55,4 +55,19 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout {
}
});
}
+
+ /**
+ * @param osList list of OS's to fill the combo with
+ */
+ private void fillOsCombo(List<OperatingSystem> osList) {
+ LOGGER.debug("fillOsCombo called");
+ for (OperatingSystem os : osList) {
+ if (os.isSetOsName()) {
+ osCombo.add(os.getOsName());
+ osCombo.setData(os.osName, os);
+ }
+ }
+ // select the first one by default
+ osCombo.select(0);
+ }
}