summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java76
1 files changed, 38 insertions, 38 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
index d01b7200..42a50418 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/panel/ContainerPanel.java
@@ -26,7 +26,7 @@ public class ContainerPanel extends JPanel {
*/
private static final long serialVersionUID = -3335320345960410582L;
- // TODO Set the height of txtContainerRecipe to a proper Value
+ // TODO Set the height of txtContainerRecipe to a proper Value
public static final String IMAGE_CONTEXT = "IMAGE";
public static final String CONTAINER_CONTEXT = "CONTAINER";
@@ -53,19 +53,15 @@ public class ContainerPanel extends JPanel {
pnlContainerMeta = new JPanel();
GridManager grdContainerMeta = new GridManager(pnlContainerMeta, 3);
- QLabel lblContainerRunOpt = new QLabel(
- I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.label"));
- lblContainerRunOpt.setToolTipText(
- I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.tooltip"));
+ QLabel lblContainerRunOpt = new QLabel(I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.label"));
+ lblContainerRunOpt.setToolTipText(I18n.PANEL.getString("ContainerPanel.ContainerStartOptions.tooltip"));
txtContainerRun = new JTextField();
grdContainerMeta.add(lblContainerRunOpt);
grdContainerMeta.add(txtContainerRun, 2).fill(true, false).expand(true, false);
grdContainerMeta.nextRow();
- QLabel lblContainerRunCommand = new QLabel(
- I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.label"));
- lblContainerRunCommand.setToolTipText(
- I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.tooltip"));
+ QLabel lblContainerRunCommand = new QLabel(I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.label"));
+ lblContainerRunCommand.setToolTipText(I18n.PANEL.getString("ContainerPanel.ContainerRunCommand.tooltip"));
txtContainerRunCommand = new JTextField();
grdContainerMeta.add(lblContainerRunCommand);
grdContainerMeta.add(txtContainerRunCommand, 2).fill(true, false).expand(true, false);
@@ -77,8 +73,7 @@ public class ContainerPanel extends JPanel {
GridManager grdContainer = new GridManager(this, 2, false, new Insets(8, 2, 8, 2));
- QLabel lblContainerImageName = new QLabel(
- I18n.PANEL.getString("ContainerPanel.Label.ImageName.text"));
+ QLabel lblContainerImageName = new QLabel(I18n.PANEL.getString("ContainerPanel.Label.ImageName.text"));
grdContainer.add(lblContainerImageName);
txtContainerImageName = new JTextField();
grdContainer.add(txtContainerImageName, 1).fill(true, false).expand(true, false);
@@ -90,8 +85,7 @@ public class ContainerPanel extends JPanel {
scrollableTextArea.setPreferredSize(Gui.getScaledDimension(0, 200));
grdContainer.add(scrollableTextArea, 2).fill(true, true).expand(true, true);
- lblContainerImageType = new QLabel(
- I18n.PANEL.getString("ContainerPanel.Label.ContainerImageType.text"));
+ lblContainerImageType = new QLabel(I18n.PANEL.getString("ContainerPanel.Label.ContainerImageType.text"));
cboContainerImageType = ContainerPanel.createContainerImageTypeCBO();
grdContainer.add(lblContainerImageType);
grdContainer.add(cboContainerImageType).fill(true, false).expand(true, false);
@@ -102,24 +96,26 @@ public class ContainerPanel extends JPanel {
}
/**
- * Retrieves Container specific details for the currently displayed lecture and disables gui elements for
- * the specific context.
+ * Retrieves Container specific details for the currently displayed lecture and
+ * disables gui elements for the specific context.
*
- * @param satelliteToken The satelliteToken from which the information are retrieved.
- * @param image The ImageDetailsRead which has general information about Image (name, type, version, etc.)
+ * @param satelliteToken The satelliteToken from which the information are
+ * retrieved.
+ * @param image The ImageDetailsRead which has general information
+ * about Image (name, type, version, etc.)
* @param context In which context this Panel ist used (Image or Lecture)
*/
public void init(String satelliteToken, ImageDetailsRead image, String context) {
try {
byte[] rawVirtConfig;
- ByteBuffer byteBuffer = ThriftManager.getSatClient()
- .getImageVersionVirtConfig(satelliteToken, image.getLatestVersionId());
+ ByteBuffer byteBuffer = ThriftManager.getSatClient().getImageVersionVirtConfig(satelliteToken,
+ image.getLatestVersionId());
rawVirtConfig = ThriftUtil.unwrapByteBuffer(byteBuffer);
containerDefinition = ContainerDefinition.fromByteArray(rawVirtConfig);
} catch (TException e) {
- LOGGER.error("Failed to retrieve virtualizer config for image version " + "'"
- + image.getLatestVersionId() + ", see trace: ", e);
+ LOGGER.error("Failed to retrieve virtualizer config for image version " + "'" + image.getLatestVersionId()
+ + ", see trace: ", e);
}
txtContainerImageName.setText(image.imageName);
@@ -156,17 +152,22 @@ public class ContainerPanel extends JPanel {
private void initImageDetails() {
+ // TODO currently no support for different containerImageType
+ lblContainerImageType.setVisible(false);
+ cboContainerImageType.setEditable(false);
+ cboContainerImageType.setVisible(false);
+
cboContainerImageType.setSelectedItem(containerDefinition.getContainerMeta().getImageType());
if (containerDefinition.getContainerMeta().getImageType() == ContainerMeta.ContainerImageType.DATA) {
- // do not allowed to change type if it is data
+ // do not allow changing type if it is data
cboContainerImageType.setEnabled(false);
- }
- else {
- // do not allow to switch type to data after creation
+ } else {
+ // do not allow switching type to data after creation
cboContainerImageType.removeItem(ContainerMeta.ContainerImageType.DATA);
}
- // currently do not allow user to change the Image Repository or Dockerfile in the suite.
+ // currently, do not allow user to change the Image Repository or Dockerfile in
+ // the suite.
txtContainerRecipe.setEnabled(false);
// do not show container specific input options
@@ -187,9 +188,8 @@ public class ContainerPanel extends JPanel {
public void addToChangeMonitor(DialogChangeMonitor changeMonitor) {
if (isFirstTime) {
- changeMonitor.add(txtContainerRecipe)
- .addConstraint(new DialogChangeMonitor.TextNotEmptyConstraint(
- I18n.PANEL.getString("ContainerPanel.Constraint.NoEmptyDockerfile.text")));
+ changeMonitor.add(txtContainerRecipe).addConstraint(new DialogChangeMonitor.TextNotEmptyConstraint(
+ I18n.PANEL.getString("ContainerPanel.Constraint.NoEmptyDockerfile.text")));
changeMonitor.add(txtContainerRun);
changeMonitor.add(txtContainerRunCommand);
changeMonitor.add(bindMountConfigurator);
@@ -203,7 +203,8 @@ public class ContainerPanel extends JPanel {
*
* @param satelliteToken for current session to communicate with Sat.
* @param image of the image version, which will be updated.
- * @return Returns true uf upload successfully finished, false if error occurred.
+ * @return Returns true uf upload successfully finished, false if error
+ * occurred.
*/
public boolean saveChanges(String satelliteToken, ImageDetailsRead image) {
@@ -219,9 +220,8 @@ public class ContainerPanel extends JPanel {
if (!newConDev.equals(containerDefinition)) {
LOGGER.info("Update Container Definition");
try {
- ThriftManager.getSatClient()
- .setImageVersionVirtConfig(satelliteToken, image.getLatestVersionId(),
- newConDev.toByteBuffer());
+ ThriftManager.getSatClient().setImageVersionVirtConfig(satelliteToken, image.getLatestVersionId(),
+ newConDev.toByteBuffer());
} catch (TException e) {
LOGGER.error("Upload new ContainerDefinition failed", e);
return false;
@@ -230,17 +230,18 @@ public class ContainerPanel extends JPanel {
return true;
}
- public static ComboBox<ContainerMeta.ContainerImageType> createContainerImageTypeCBO (){
+ public static ComboBox<ContainerMeta.ContainerImageType> createContainerImageTypeCBO() {
ComboBox<ContainerMeta.ContainerImageType> cbo = new ComboBox<>(
new ComboBox.ComboBoxRenderer<ContainerMeta.ContainerImageType>() {
- @Override public String renderItem(ContainerMeta.ContainerImageType item) {
- switch (item){
+ @Override
+ public String renderItem(ContainerMeta.ContainerImageType item) {
+ switch (item) {
case LECTURE:
return "Pool";
case BATCH:
return "Pool/Cluster";
case DATA:
- return "Daten";
+ return I18n.PANEL.getString("ContainerPanel.ContainerImageType.Item.label");
default:
return "";
}
@@ -253,4 +254,3 @@ public class ContainerPanel extends JPanel {
return cbo;
}
}
-