diff options
author | ralph isenmann | 2020-12-01 11:36:34 +0100 |
---|---|---|
committer | ralph isenmann | 2020-12-01 11:36:34 +0100 |
commit | 9a0e5282a3f7b120acbad321fe0431f8ffcc2eff (patch) | |
tree | d3bc792791935ff473a4e61b1f489bfb70338da8 /dozentenmodul/src/main | |
parent | [client] do not allow alter version or push to master-sat by user when editin... (diff) | |
download | tutor-module-9a0e5282a3f7b120acbad321fe0431f8ffcc2eff.tar.gz tutor-module-9a0e5282a3f7b120acbad321fe0431f8ffcc2eff.tar.xz tutor-module-9a0e5282a3f7b120acbad321fe0431f8ffcc2eff.zip |
[client] Refactoring
- rewrite visible text for usage, fix typos
- hide gui controls, which are not used in container context.
Diffstat (limited to 'dozentenmodul/src/main')
7 files changed, 51 insertions, 47 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ContainerBindMountConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ContainerBindMountConfigurator.java index c337dc03..302f43c1 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ContainerBindMountConfigurator.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ContainerBindMountConfigurator.java @@ -3,6 +3,7 @@ package org.openslx.dozmod.gui.configurator; import org.apache.log4j.Logger; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.changemonitor.GenericControlWindow; +import org.openslx.dozmod.gui.control.QLabel; import org.openslx.dozmod.gui.control.table.ContainerBindMountTable; import org.openslx.dozmod.gui.control.table.QScrollPane; import org.openslx.dozmod.gui.helper.GridManager; @@ -16,7 +17,8 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -public class ContainerBindMountConfigurator extends JPanel implements GenericControlWindow<List<ContainerBindMount>> { +public class ContainerBindMountConfigurator extends JPanel + implements GenericControlWindow<List<ContainerBindMount>> { private final Logger LOGGER = Logger.getLogger(ContainerBindMountConfigurator.class); private final ContainerBindMountTable bindMountTable; @@ -24,21 +26,32 @@ public class ContainerBindMountConfigurator extends JPanel implements GenericCon public ContainerBindMountConfigurator() { super(); - GridManager grid = new GridManager(this,3); + GridManager grid = new GridManager(this, 3, false); + QLabel lblBindMount = new QLabel("Bind Mount Configuration"); bindMountTable = new ContainerBindMountTable(); QScrollPane scrollPaneTable = new QScrollPane(bindMountTable); scrollPaneTable.setMinimumSize(Gui.getScaledDimension(0, 70)); scrollPaneTable.setPreferredSize(Gui.getScaledDimension(0, 70)); - grid.add(scrollPaneTable, 3).fill(true, true).expand(true, true); + grid.add(lblBindMount).fill(false, false); + grid.add(scrollPaneTable, 2).fill(true, false).expand(true, false); grid.nextRow(); + JPanel buttonPanel = new JPanel(); + GridManager gridButtonPanel = new GridManager(buttonPanel, 3); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); + buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); + JButton btnAddBindMount = new JButton("Add Bind Mount"); JButton btnDelBindMount = new JButton("Remove Bind Mount"); - grid.add(Box.createHorizontalBox()).fill(true, false).expand(true, false); - grid.add(btnAddBindMount); - grid.add(btnDelBindMount); - grid.nextRow(); - grid.finish(true); + + // add glue box to move Buttons to the right border. + buttonPanel.add(Box.createGlue()); + buttonPanel.add(btnAddBindMount); + buttonPanel.add(btnDelBindMount); + + grid.add(Box.createGlue()).fill(true, false); + grid.add(buttonPanel, 2).fill(true, false); + grid.finish(false); btnAddBindMount.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java index 6796e21a..170feba5 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java @@ -8,7 +8,7 @@ public class ContainerBindMountTable extends ListTable<ContainerBindMount> { public static final ListTableColumn COL_SOURCE = new ListTableColumn("SOURCE"); public static final ListTableColumn COL_TARGET = new ListTableColumn("TARGET"); - public static final ListTableColumn COL_OPTIONS = new ListTableColumn("OPTINONS"); + public static final ListTableColumn COL_OPTIONS = new ListTableColumn("OPTIONS"); public ContainerBindMountTable() { super(COL_SOURCE, COL_TARGET, COL_OPTIONS); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java index 799a6ccc..291bc7fa 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java @@ -32,7 +32,7 @@ public class ContainerUploadPageLayout extends WizardPage { */ public ContainerUploadPageLayout(Wizard wizard) { - super(wizard, "Neue VM anlegen"); + super(wizard, "Define a new Container Image"); setDescription("Please provide an Input for a Docker Image"); GridManager grid = new GridManager(this, 3, false); @@ -100,9 +100,7 @@ public class ContainerUploadPageLayout extends WizardPage { txtInfoText.setEditable(false); txtInfoText.setFocusable(false); txtInfoText.setOpaque(false); - txtInfoText.setText("In dieser Maske sind alle Infromationen zur Definition eines Container Images anzugeben. " - + "Weitere Informationen zur Verwendung von Contanier in bwLehrpool finden Sie unter " - + "https://gitlab.com/risenman/bwlehrpool-vmchooser-docker/"); + txtInfoText.setText("In dieser Maske sind alle Infromationen zur Definition eines Container Images anzugeben. "); grid.add(txtInfoText, 3).fill(true, false).expand(true, false); grid.nextRow(); 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 0923db0c..8de4fa9b 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 @@ -15,6 +15,7 @@ import javax.swing.*; @SuppressWarnings("serial") public abstract class ImageMetaDataPageLayout extends WizardPage { + protected final QLabel lblOperatingSystem; protected final JComboBox<OperatingSystem> cboOperatingSystem; protected final JTextArea txtDescription; protected final JTextArea startCommand; @@ -36,7 +37,7 @@ import javax.swing.*; GridManager grid = new GridManager(this, 2, false); - QLabel osCaption = new QLabel("Betriebssystem"); + lblOperatingSystem = new QLabel("Betriebssystem"); cboOperatingSystem = new ComboBox<>(Comparators.operatingSystem, new ComboBoxRenderer<OperatingSystem>() { @Override public String renderItem(OperatingSystem item) { @@ -46,7 +47,7 @@ import javax.swing.*; } }); cboOperatingSystem.setEditable(false); - grid.add(osCaption); + grid.add(lblOperatingSystem); grid.add(cboOperatingSystem); sCommandCaption = new QLabel("Startbefehl"); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageTypePageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageTypePageLayout.java index c92784b9..7dac1103 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageTypePageLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageTypePageLayout.java @@ -29,26 +29,22 @@ public abstract class ImageTypePageLayout extends WizardPage { txtInfoText.setEditable(false); txtInfoText.setFocusable(false); txtInfoText.setOpaque(false); - txtInfoText.setText("Haben Sie noch keine eigene Virtuelle Maschine erstellt," - + " können Sie sich in der Übersicht eine Virtuelle Maschine als Vorlage herunterladen," - + " diese an Ihre Bedürfnisse anpassen und anschließend über diesen Assistenten hochladen." - + "\n\nWenn Sie die VM einer bestehenden Veranstaltung aktualisieren möchten," - + " öffnen Sie die Detailansicht der bestehenden VM und wählen Sie 'Neue VM-Version hochladen'." - + " Dadurch bleiben bestehende Berechtigungen, sowie Verknüpfungen zu Veranstaltungen erhalten."); + txtInfoText.setText("Hier haben Sie die Möglichkeit ein neues Image als VM oder Container (Docker) " + + "zu definieren.\n\n" + + "Sie besitzen derzeit eine Entwicklungsstand der bwLehrpool Suite, in der sämtliche " + + "Funktionalitäten zur Erstellung und Verwaltung von Container Images in Entwicklung sind. " + + "Diese Funktionen können sich in späteren Versionen ändern und somit ihre erstellten Images " + + "inkompatibel machen."); grid.add(txtInfoText, 4).fill(true, false).expand(true, false); grid.nextRow(); grid.nextRow(); // -- New VM Pick-- btnNewVmImage = new JButton("New VM"); - grid.add(btnNewVmImage,2,2) - .fill(true,true) - .expand(true,true); + grid.add(btnNewVmImage, 2, 2).fill(true, true).expand(true, true); // -- New Docker-Image Pick-- btnNewDockerImage = new JButton("new Docker-Image"); - grid.add(btnNewDockerImage,2,2) - .fill(true,true) - .expand(true,true); + grid.add(btnNewDockerImage, 2, 2).fill(true, true).expand(true, true); grid.finish(false); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java index 3ce75f37..be96f283 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java @@ -26,6 +26,9 @@ import java.io.IOException; public class ContainerUploadPage extends ContainerUploadPageLayout { + // TODO: Add a Instruction for the new Container-Feature in bwLehrpool. + // TODO: Add link to instructions for Docker-Intetragtion at https://www.bwlehrpool.de/doku.php + private final Logger LOGGER = Logger.getLogger(ContainerUploadPage.class); /** @@ -124,8 +127,6 @@ public class ContainerUploadPage extends ContainerUploadPageLayout { fc.setAcceptAllFileFilterUsed(false); fc.addChoosableFileFilter(new DockerfileFilter()); - // TODO add Feature for MULTIPLE_HYPERVISORS - int action = fc.showOpenDialog(getDialog()); File file = fc.getSelectedFile(); @@ -230,9 +231,6 @@ public class ContainerUploadPage extends ContainerUploadPageLayout { } @Override protected boolean wantNextOrFinish() { - // are we creating a new image? then either: - // get the image name either auto filled by VmwareMetaData or by user - // get the image name from the image we are uploading a new version of state.name = existingImage != null ? existingImage.getImageName() : txtImageName.getText(); state.meta = createVmMeta(); 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 7b9dcd10..47408fd9 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 @@ -25,15 +25,15 @@ import java.util.List; /** * Page for setting the details of an image. */ -@SuppressWarnings("serial") -public class ImageMetaDataPage extends ImageMetaDataPageLayout { +@SuppressWarnings("serial") public class ImageMetaDataPage extends ImageMetaDataPageLayout { private final static Logger LOGGER = Logger.getLogger(ImageMetaDataPage.class); private UploadWizardState state; private final ContainerDefinition containerDefinition; - public ImageMetaDataPage(Wizard wizard, UploadWizardState uploadWizardState, ContainerDefinition containerDefinition) { + public ImageMetaDataPage(Wizard wizard, UploadWizardState uploadWizardState, + ContainerDefinition containerDefinition) { super(wizard); this.state = uploadWizardState; this.containerDefinition = containerDefinition; @@ -45,14 +45,12 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout { QuickTimer.scheduleOnce(new Task() { List<OperatingSystem> osList = null; - @Override - public void fire() { + @Override public void fire() { osList = MetaDataCache.getOperatingSystems(); // now send the organizations back to the LoginWindow // through populateIdpCombo() Gui.asyncExec(new Runnable() { - @Override - public void run() { + @Override public void run() { fillOsCombo(osList); } }); @@ -60,8 +58,7 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout { }); cboOperatingSystem.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { + @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { reactToUserInput(); } @@ -69,15 +66,13 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout { }); txtDescription.getDocument().addDocumentListener(new TextChangeListener() { - @Override - public void changed() { + @Override public void changed() { reactToUserInput(); } }); } - @Override - protected void onPageEnter() { + @Override protected void onPageEnter() { // Preselect OS if possible if (state.detectedOs != null) { cboOperatingSystem.setSelectedItem(state.detectedOs); @@ -91,8 +86,7 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout { reactToUserInput(); } - @Override - protected boolean wantNextOrFinish() { + @Override protected boolean wantNextOrFinish() { state.selectedOs = (OperatingSystem) cboOperatingSystem.getSelectedItem(); state.isTemplate = chkIsTemplate.isSelected(); state.isRestricted = chkLicenseRestricted.isSelected(); @@ -135,6 +129,10 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout { if (state.meta instanceof DockerMetaDataDummy) { bindMountConfigurator.setVisible(true); + // TODO we need Information about a OS in Container? Currently use "Other (32 Bit)" as default + lblOperatingSystem.setVisible(false); + cboOperatingSystem.setVisible(false); + // TODO do we need to check license restrictions in container? chkLicenseRestricted.setVisible(false); // TODO currently no Container Template! |