From db4fb00213fb1e96d9cdc843e6d7d1b8220cc4b2 Mon Sep 17 00:00:00 2001 From: ralph isenmann Date: Thu, 18 Nov 2021 09:45:38 +0100 Subject: update layout for image typ --- .../gui/wizard/layout/ImageTypePageLayout.java | 51 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) 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 d858882a..01558a60 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 @@ -1,11 +1,17 @@ package org.openslx.dozmod.gui.wizard.layout; +import org.openslx.dozmod.gui.Gui; +import org.openslx.dozmod.gui.control.QLabel; import org.openslx.dozmod.gui.helper.GridManager; import org.openslx.dozmod.gui.helper.I18n; import org.openslx.dozmod.gui.wizard.Wizard; import org.openslx.dozmod.gui.wizard.WizardPage; +import java.awt.GridBagConstraints; +import java.awt.event.MouseEvent; + import javax.swing.*; +import javax.swing.event.MouseInputAdapter; public abstract class ImageTypePageLayout extends WizardPage { @@ -26,9 +32,10 @@ public abstract class ImageTypePageLayout extends WizardPage { super(wizard, I18n.PAGE_LAYOUT.getString("ImageTypePageLayout.WizardPage.title")); setDescription(I18n.PAGE_LAYOUT.getString("ImageTypePageLayout.WizardPage.description")); - GridManager grid = new GridManager(this, 4, false); - // Choose between new vm or new docker-image + + // ##################################### + // Create the Components txtInfoText = new JTextArea(); txtInfoText.setBorder(BorderFactory.createTitledBorder(I18n.PAGE_LAYOUT.getString("ImageTypePageLayout.newVmInformation.border"))); txtInfoText.setLineWrap(true); @@ -37,20 +44,46 @@ public abstract class ImageTypePageLayout extends WizardPage { txtInfoText.setFocusable(false); txtInfoText.setOpaque(false); txtInfoText.setText(I18n.PAGE_LAYOUT.getString("ImageTypePageLayout.newVmInformation.text")); - grid.add(txtInfoText, 4).fill(true, false).expand(true, false); - grid.nextRow(); - grid.nextRow(); - + + QLabel lblVmImage = new QLabel(Gui.getScaledIconResource("/img/virtualization.png", + I18n.WINDOW_LAYOUT.getString("LectureList.Button.editLecture.description"), 48, this)); + + lblVmImage.addMouseListener(new MouseInputAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + rbtnNewVmImage.doClick(); + } + }); + QLabel lblDockerImage = new QLabel(Gui.getScaledIconResource("/img/docker-icon.png", + I18n.WINDOW_LAYOUT.getString("LectureList.Button.editLecture.description"), 48, this)); + lblDockerImage.addMouseListener(new MouseInputAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + rbtnNewDockerImage.doClick(); + } + }); rbtnNewVmImage = new JRadioButton(I18n.PAGE_LAYOUT.getString("ImageTypePageLayout.button.newVM")); - grid.add(rbtnNewVmImage, 2, 2).fill(true, true).expand(true, true); rbtnNewDockerImage = new JRadioButton(I18n.PAGE_LAYOUT.getString("ImageTypePageLayout.button.newDocker")); - grid.add(rbtnNewDockerImage, 2, 2).fill(true, true).expand(true, true); btgrpImageTyp = new ButtonGroup(); btgrpImageTyp.add(rbtnNewVmImage); btgrpImageTyp.add(rbtnNewDockerImage); - grid.finish(false); + + // ##################################### + // Create the Layout + GridManager grid = new GridManager(this, 2, false); + grid.add(txtInfoText, 2).fill(true, false).expand(true, false); + grid.nextRow(); + grid.nextRow(); + grid.add(lblVmImage).fill(true, true).expand(true, true); + grid.add(lblDockerImage).fill(true, true).expand(true, true); + grid.nextRow(); + // TODO how to center the radiotbns under the icon/lable? + grid.add(rbtnNewVmImage).fill(true, false); + grid.add(rbtnNewDockerImage).fill(true, false).expand(true, false).anchor(GridBagConstraints.CENTER); + grid.nextRow(); + grid.finish(true); } } -- cgit v1.2.3-55-g7522