diff options
author | Victor Mocanu | 2016-10-31 12:32:12 +0100 |
---|---|---|
committer | Victor Mocanu | 2016-10-31 12:32:12 +0100 |
commit | 9c257071f181cce99d1fbbd1884fe2a676d3baec (patch) | |
tree | 1b27783c21cd6021089a01317d91d90e6e060010 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java | |
parent | [client] improved shift handling for custom sat on login (diff) | |
download | tutor-module-9c257071f181cce99d1fbbd1884fe2a676d3baec.tar.gz tutor-module-9c257071f181cce99d1fbbd1884fe2a676d3baec.tar.xz tutor-module-9c257071f181cce99d1fbbd1884fe2a676d3baec.zip |
[client] added simple vmx editor
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java new file mode 100644 index 00000000..621d6b56 --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java @@ -0,0 +1,151 @@ +package org.openslx.dozmod.gui.window.layout; + +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.Window; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; + +import org.openslx.dozmod.gui.Gui; +import org.openslx.dozmod.gui.control.ComboBox; +import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer; +import org.openslx.dozmod.gui.helper.GridManager; +import org.openslx.util.vm.VmwareMetaData.DDAcceleration; +import org.openslx.util.vm.VmwareMetaData.E0VirtDev; +import org.openslx.util.vm.VmwareMetaData.HWVersion; +import org.openslx.util.vm.VmwareMetaData.SoundCardType; + +@SuppressWarnings("serial") +public class VirtDropDownConfigEditorWindowLayout extends JDialog { + + private static String title = "VM-Konfiguration Editor"; + protected final JScrollPane pnlScrollPane; + protected final JEditorPane pnlEditor; + protected final JButton btnSave; + protected final JButton btnCancel; + protected final JButton btnMore; + protected final JComboBox<SoundCardType> cboSound; + protected final JComboBox<DDAcceleration> cbo3DAcceleration; + protected final JComboBox<HWVersion> cboHWVersion; + protected final JComboBox<E0VirtDev> cboE0VirtDev; + + protected VirtDropDownConfigEditorWindowLayout(Window modalParent) { + super(modalParent, title, + modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS); + + GridManager grid = new GridManager(this, 3, true, new Insets(2, 2, 2, 2)); + + /* + * extra JPanel for the Warning message + */ + JPanel pnlWarning = new JPanel(); + pnlWarning.setBorder(BorderFactory.createTitledBorder("WARNUNG")); + pnlWarning.add( + new JLabel("<html>Änderungen an der VM-Konfiguration können zu Funktionsstörungen führen." + + "<br>Benutzung auf eigene Gefahr!" + + "<br>Erweiterungen clicken um die alte interface zu benutzen</html>")); + + /* + * ComboBoxes - one for each device + */ + + // SoundBox + cboSound = new ComboBox<>(new ComboBoxRenderer<SoundCardType>() { + @Override + public String renderItem(SoundCardType item) { + return item.displayName; + } + }); + + for (SoundCardType i : SoundCardType.values()) { + cboSound.addItem(i); + } + + // 3D accelerationBox + cbo3DAcceleration = new ComboBox<>(new ComboBoxRenderer<DDAcceleration>() { + @Override + public String renderItem(DDAcceleration item) { + return item.displayName; + } + }); + + for (DDAcceleration i : DDAcceleration.values()) { + cbo3DAcceleration.addItem(i); + } + + // HardwareVersioBox + cboHWVersion = new ComboBox<>(new ComboBoxRenderer<HWVersion>() { + @Override + public String renderItem(HWVersion item) { + return item.displayName; + } + }); + + for (HWVersion i : HWVersion.values()) { + cboHWVersion.addItem(i); + } + + // HardwareVersioBox + cboE0VirtDev = new ComboBox<>(new ComboBoxRenderer<E0VirtDev>() { + @Override + public String renderItem(E0VirtDev item) { + return item.displayName; + } + }); + + for (E0VirtDev i : E0VirtDev.values()) { + cboE0VirtDev.addItem(i); + } + + pnlEditor = new JEditorPane("text/plain", null); + pnlScrollPane = new JScrollPane(pnlEditor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + + grid.add(pnlWarning, 3).fill(true, false).expand(true, false); + grid.nextRow(); + grid.add(new JLabel("Soundkarte")).fill(true, false).expand(false, false); + grid.add(new JLabel(" ")).fill(false, false).expand(false, false); + grid.add(cboSound).fill(true, false).expand(false, false); + grid.nextRow(); + grid.add(new JLabel("3D-Beschleunigung")).fill(true, false).expand(false, false); + grid.add(new JLabel(" ")).fill(false, false).expand(false, false); + grid.add(cbo3DAcceleration).fill(true, false).expand(true, false); + grid.nextRow(); + grid.add(new JLabel("Hardware Version Nummer")).fill(true, false).expand(false, false); + grid.add(new JLabel(" ")).fill(false, false).expand(false, false); + grid.add(cboHWVersion).fill(true, false).expand(true, false); + grid.nextRow(); + grid.add(new JLabel("Virtuelle Netzwerkkarte")).fill(true, false).expand(false, false); + grid.add(new JLabel(" ")).fill(false, false).expand(false, false); + grid.add(cboE0VirtDev).fill(true, false).expand(true, false); + grid.nextRow(); + + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); + buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + buttonPane.add(Box.createHorizontalGlue()); + btnMore = new JButton("Erweiterungen"); + buttonPane.add(btnMore); + buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); + btnCancel = new JButton("Abbrechen"); + buttonPane.add(btnCancel); + buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); + btnSave = new JButton("Speichern"); + buttonPane.add(btnSave); + grid.add(buttonPane, 3).fill(true, false).expand(true, false); + grid.finish(false); + + setPreferredSize(Gui.getScaledDimension(850, 250)); + setMinimumSize(Gui.getScaledDimension(550, 300)); + Gui.centerShellOverShell(modalParent, this); + } +} |