package org.openslx.dozmod.gui.wizard.layout; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JScrollPane; import javax.swing.JTextArea; import org.openslx.bwlp.thrift.iface.OperatingSystem; 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.control.QLabel; import org.openslx.dozmod.gui.helper.GridManager; import org.openslx.dozmod.gui.wizard.Wizard; import org.openslx.dozmod.gui.wizard.WizardPage; import org.openslx.thrifthelper.Comparators; @SuppressWarnings("serial") public abstract class ImageMetaDataPageLayout extends WizardPage { protected final JComboBox cboOperatingSystem; protected final JTextArea txtDescription; protected final JTextArea startCommand; protected final QLabel sCommandCaption; protected final JScrollPane startCommandPane; protected final JCheckBox chkLicenseRestricted; protected final JCheckBox chkIsTemplate; /** * wizard page for entering image data at creating or editing an image * * @param wizard */ public ImageMetaDataPageLayout(Wizard wizard) { super(wizard, "Metadaten"); setDescription("Geben Sie bitte einen aussagekräftigen Namen für die neue VM ein."); GridManager grid = new GridManager(this, 2, false); QLabel osCaption = new QLabel("Betriebssystem"); cboOperatingSystem = new ComboBox<>(Comparators.operatingSystem, new ComboBoxRenderer() { @Override public String renderItem(OperatingSystem item) { if (item == null) return null; return item.getOsName(); } }); cboOperatingSystem.setEditable(false); grid.add(osCaption); grid.add(cboOperatingSystem); sCommandCaption = new QLabel("Startbefehl"); startCommand = new JTextArea(1, 50); startCommand.setMinimumSize(Gui.getScaledDimension(0, 35)); startCommand.setLineWrap(true); startCommand.setWrapStyleWord(true); startCommandPane = new JScrollPane(startCommand, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); startCommandPane.setMinimumSize(startCommand.getMinimumSize()); grid.add(sCommandCaption); grid.add(startCommandPane).fill(true, false).expand(true, false); grid.nextRow(); QLabel descriptionCaption = new QLabel("Beschreibung"); txtDescription = new JTextArea(5, 50); txtDescription.setMinimumSize(Gui.getScaledDimension(0, 70)); txtDescription.setLineWrap(true); txtDescription.setWrapStyleWord(true); JScrollPane descPane = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descPane.setMinimumSize(txtDescription.getMinimumSize()); grid.add(descriptionCaption); grid.add(descPane).fill(true, false).expand(true, false); grid.nextRow(); chkLicenseRestricted = new JCheckBox("VM enthält lizenzpflichtige Software"); chkLicenseRestricted.setSelected(true); grid.add(chkLicenseRestricted, 2); grid.nextRow(); // -- end permissions group -- chkIsTemplate = new JCheckBox("Vorlage erstellen"); grid.add(chkIsTemplate, 2); grid.nextRow(); grid.finish(true); } public String getImageDescription() { return txtDescription.getText(); } }