summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/GraphicalCertHandler.java20
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java61
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/DownloadPanel.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/PassiveUploadPanel.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/TransferPanel.java15
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UpdatePanel.java13
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UploadPanel.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ContainerBindMountConfigurator.java112
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ImagePermissionConfigurator.java7
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java30
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LecturePermissionConfigurator.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java71
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetshareConfigurator.java54
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java39
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java53
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/PersonLabel.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java28
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java16
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePublishedTable.java17
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java34
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageVersionTable.java19
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java19
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ListTable.java36
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/NetshareTable.java20
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/UserTable.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ExpiryDateChooser.java8
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java53
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/Language.java18
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java14
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UTF8Control.java54
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/BwIdmLinkWindow.java18
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java29
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ContainerBindMountWindow.java78
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java9
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java407
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java23
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureChangeImage.java9
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java54
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java89
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java47
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/SatelliteListWindow.java4
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtConfigEditorWindow.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java23
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ConfigWindowLayout.java86
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ContainerBindMountWindowLayout.java69
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java12
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java156
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java39
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImagePublishedWindowLayout.java22
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureChangeImageLayout.java14
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java102
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java54
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java8
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java42
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java26
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java15
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/UserListWindowLayout.java11
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtConfigEditorWindowLayout.java14
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtDropDownConfigEditorWindowLayout.java36
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java186
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageUpdateWizard.java47
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java75
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java116
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageCustomPermissionPageLayout.java25
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java38
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageOvfConversionPageLayout.java78
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageTypePageLayout.java52
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java24
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadSummaryPageLayout.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java13
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java19
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java5
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java20
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureRestrictionPageLayout.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java260
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java57
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java231
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageTypePage.java35
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java119
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadSummaryPage.java24
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java27
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java3
94 files changed, 2840 insertions, 1049 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/GraphicalCertHandler.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/GraphicalCertHandler.java
index 99c03373..c1432614 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/GraphicalCertHandler.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/GraphicalCertHandler.java
@@ -15,6 +15,7 @@ import javax.net.ssl.X509TrustManager;
import org.apache.log4j.Logger;
import org.openslx.dozmod.authentication.FingerprintManager;
import org.openslx.dozmod.gui.Gui.GuiCallable;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
public class GraphicalCertHandler {
@@ -34,9 +35,8 @@ public class GraphicalCertHandler {
@Override
public Boolean run() {
return Gui.showMessageBox(null,
- "Der Satellit besitzt kein Zertifikat. Verschlüsselte Verbindung nicht möglich.\n\n"
- + "Möchten Sie trotzdem fortfahren?", MessageType.WARNING, LOGGER,
- null);
+ I18n.GUI.getString("GraphicalCertHandler.Message.warning.noCertificate"),
+ MessageType.WARNING, LOGGER, null);
}
});
if (ret)
@@ -76,11 +76,8 @@ public class GraphicalCertHandler {
return;
}
// Known, mismatch, panic!
- question = "!!! ALARM !!!! ALARM !!!\n\n" + "Der Fingerabdruck von " + address
- + " hat sich verändert.\n" + "Erwartet: "
- + new BigInteger(expectedFingerprint).toString(16) + "\n" + "Vorgefunden: "
- + actualFingerprintReadable + "\n\n"
- + "Möchten Sie trotzdem zu diesem Satelliten verbinden?";
+ question = I18n.GUI.getString("GraphicalCertHandler.Message.yesNo.fingerprintChanged", address,
+ new BigInteger(expectedFingerprint).toString(16), actualFingerprintReadable);
}
// Some question needs to be asked
Boolean userOk = Gui.syncExec(new GuiCallable<Boolean>() {
@@ -112,13 +109,16 @@ public class GraphicalCertHandler {
try {
ctx = SSLContext.getInstance("TLSv1.2");
} catch (NoSuchAlgorithmException e) {
- Gui.asyncMessageBox("Could not get TLSv1.2 SSL context", MessageType.ERROR, LOGGER, e);
+ Gui.asyncMessageBox(I18n.GUI.getString("GraphicalCertHandler.Message.error.couldNotGetSSLContext"),
+ MessageType.ERROR, LOGGER, e);
}
if (ctx != null) {
try {
ctx.init(null, new TrustManager[] { new GuiTrustManager() }, null);
} catch (KeyManagementException e) {
- Gui.asyncMessageBox("Could not initialize TLSv1.2 SSL context", MessageType.ERROR, LOGGER, e);
+ Gui.asyncMessageBox(
+ I18n.GUI.getString("GraphicalCertHandler.Message.error.couldNotInitializeSSLContext"),
+ MessageType.ERROR, LOGGER, e);
ctx = null;
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
index 6a9997d9..f65c650d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
@@ -48,12 +48,7 @@ import org.openslx.dozmod.gui.activity.PassiveUploadPanel;
import org.openslx.dozmod.gui.activity.UpdatePanel;
import org.openslx.dozmod.gui.activity.UploadPanel;
import org.openslx.dozmod.gui.control.QLabel;
-import org.openslx.dozmod.gui.helper.CompositePage;
-import org.openslx.dozmod.gui.helper.DebugWindow;
-import org.openslx.dozmod.gui.helper.GridManager;
-import org.openslx.dozmod.gui.helper.MessageType;
-import org.openslx.dozmod.gui.helper.QuitNotification;
-import org.openslx.dozmod.gui.helper.UiFeedback;
+import org.openslx.dozmod.gui.helper.*;
import org.openslx.dozmod.gui.window.CheckUpdateWindow;
import org.openslx.dozmod.gui.window.ConfigWindow;
import org.openslx.dozmod.gui.window.DisclaimerWindow;
@@ -169,8 +164,10 @@ public abstract class MainWindow {
});
// Set up thrift error message displaying
- ThriftManager.setMasterErrorCallback(new GuiErrorCallback(mainWindow, "dem " + Branding.getServiceName() + "-Zentralserver"));
- ThriftManager.setSatelliteErrorCallback(new GuiErrorCallback(mainWindow, "dem Satellitenserver"));
+ ThriftManager.setMasterErrorCallback(new GuiErrorCallback(mainWindow,
+ I18n.GUI.getString("MainWindow.GuiErrorCallback.master.serverString", Branding.getServiceName())));
+ ThriftManager.setSatelliteErrorCallback(new GuiErrorCallback(mainWindow,
+ I18n.GUI.getString("MainWindow.GuiErrorCallback.satellite.serverString")));
// Same for config errors
Config.setErrorCallback(new Config.ErrorCallback() {
@@ -179,7 +176,8 @@ public abstract class MainWindow {
Gui.asyncExec(new Runnable() {
@Override
public void run() {
- Gui.showMessageBox(mainWindow, "Konnte Programmeinstellungen nicht speichern",
+ Gui.showMessageBox(mainWindow,
+ I18n.GUI.getString("MainWindow.Message.warning.couldNotSaveConfig"),
MessageType.WARNING, LOGGER, t);
}
});
@@ -324,7 +322,7 @@ public abstract class MainWindow {
}
}
if (!keepOpen
- || Gui.showMessageBox(mainWindow, "Möchten Sie das Programm wirklich beenden?",
+ || Gui.showMessageBox(mainWindow, I18n.GUI.getString("MainWindow.Message.yesNo.applicationQuit"),
MessageType.QUESTION_YESNO, null, null)) {
if (windows == null) {
windows = Window.getWindows();
@@ -424,42 +422,43 @@ public abstract class MainWindow {
JMenuBar menuBar = new JMenuBar();
mainWindow.setJMenuBar(menuBar);
- JMenu cascadeSessionMenu = new JMenu("Sitzung");
+ JMenu cascadeSessionMenu = new JMenu(I18n.GUI.getString("MainWindow.Menu.session.s"));
menuBar.add(cascadeSessionMenu);
- JMenuItem configItem = new JMenuItem("Einstellungen");
+ JMenuItem configItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.config.text"));
cascadeSessionMenu.add(configItem);
- JMenuItem logDirItem = new JMenuItem("Logverzeichnis öffnen");
+ JMenuItem logDirItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.logDir.text"));
cascadeSessionMenu.add(logDirItem);
cascadeSessionMenu.addSeparator();
- JMenuItem logoutItem = new JMenuItem("Abmelden und beenden");
+ JMenuItem logoutItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.logout.text"));
cascadeSessionMenu.add(logoutItem);
- JMenuItem exitItem = new JMenuItem("Beenden");
+ JMenuItem exitItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.exit.text"));
cascadeSessionMenu.add(exitItem);
- JMenu cascadeViewMenu = new JMenu("Ansicht");
+ JMenu cascadeViewMenu = new JMenu(I18n.GUI.getString("MainWindow.Menu.view.s"));
menuBar.add(cascadeViewMenu);
- JMenuItem homeItem = new JMenuItem("Startseite");
+ JMenuItem homeItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.home.text"));
cascadeViewMenu.add(homeItem);
- JMenuItem imagesItem = new JMenuItem("Virtuelle Maschinen");
+ JMenuItem imagesItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.images.text"));
cascadeViewMenu.add(imagesItem);
// Prevent switching to imageList when user is student
if (!Session.canListImages()) {
imagesItem.setEnabled(false);
+ homeItem.setEnabled(false);
}
- JMenuItem lecturesItem = new JMenuItem("Veranstaltungen");
+ JMenuItem lecturesItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.lectures.text"));
cascadeViewMenu.add(lecturesItem);
// the About menu button
- JMenu cascadeAboutMenu = new JMenu("Über");
+ JMenu cascadeAboutMenu = new JMenu(I18n.GUI.getString("MainWindow.Menu.about.s"));
menuBar.add(cascadeAboutMenu);
- JMenuItem disclaimerItem = new JMenuItem("Nutzungsvereinbarung");
- JMenuItem privacyNoticeItem = new JMenuItem("Datenschutzerklärung");
- JMenuItem virtualizerNoticeItem = new JMenuItem("Virtualisierer");
+ JMenuItem disclaimerItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.disclaimer.text"));
+ JMenuItem privacyNoticeItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.privacyNotice.text"));
+ JMenuItem virtualizerNoticeItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.virtualizer.text"));
JMenuItem wikiItem = new JMenuItem(Branding.getServiceFAQWebsite());
- JMenuItem updateCheckItem = new JMenuItem("Software-Aktualisierung");
+ JMenuItem updateCheckItem = new JMenuItem(I18n.GUI.getString("MainWindow.MenuItem.updateCheck.text"));
cascadeAboutMenu.add(disclaimerItem);
cascadeAboutMenu.add(privacyNoticeItem);
cascadeAboutMenu.add(virtualizerNoticeItem);
@@ -590,16 +589,8 @@ public abstract class MainWindow {
timeDiffChecked = true;
if (diffSecs > TimeUnit.MINUTES.toMillis(10)) {
Gui.asyncMessageBox(
- "ACHTUNG: Die Uhrzeit Ihres Computers weicht von der Uhrzeit auf dem Satellitenserver ab.\n"
- + "Bitte stellen Sie sicher, dass die Uhr Ihres Computers richtig gestellt ist.\n"
- + "Falls Ihre Sytemzeit korrekt gesetzt ist, ist möglicherweise die Uhrzeit auf\n"
- + "dem Satellitenserver nicht korrekt eingestellt.\n"
- + "In diesem Fall kann es - je nach Abweichung - zu unerwarteten Problemen mit den\n"
- + "Start- und Endzeiten von Veranstaltungen kommen. Kontaktieren Sie in diesem\n"
- + "Fall den zuständigen Administrator, damit die Uhrzeit auf dem Satellitenserver\n"
- + "korrigiert werden kann.\n\n" + "Ihr Computer: "
- + FormatHelper.longDate(now) + "\nSatellitenserver: "
- + FormatHelper.longDate(status.serverTime),
+ I18n.GUI.getString("MainWindow.Message.warning.incorrectTime",
+ FormatHelper.longDate(now), FormatHelper.longDate(status.serverTime)),
MessageType.WARNING, LOGGER, null);
}
}
@@ -631,7 +622,7 @@ public abstract class MainWindow {
public PleaseWait() {
GridManager grid = new GridManager(this, 3);
grid.add(Box.createHorizontalGlue()).expand(true, true);
- grid.add(new JLabel("Bitte warten, suche Proxy-Konfiguration..."))
+ grid.add(new JLabel(I18n.GUI.getString("MainWindow.Label.pleaseWait.text")))
.expand(false, true)
.fill(true, true);
grid.add(Box.createHorizontalGlue()).expand(true, true);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/DownloadPanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/DownloadPanel.java
index a9631097..2a9b2334 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/DownloadPanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/DownloadPanel.java
@@ -9,6 +9,7 @@ import org.openslx.bwlp.thrift.iface.TransferState;
import org.openslx.dozmod.filetransfer.DownloadTask;
import org.openslx.dozmod.filetransfer.TransferEvent;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.QuitNotification;
import org.openslx.dozmod.util.DesktopEnvironment;
@@ -24,7 +25,7 @@ public class DownloadPanel extends TransferPanel implements ActionListener, Quit
public DownloadPanel(String displayName, String diskFile, DownloadTask download) {
super(download, displayName, diskFile);
- btnOpenFolder = new JButton("Ordner öffnen");
+ btnOpenFolder = new JButton(I18n.ACTIVITY.getString("DownloadPanel.Button.openFolder.text"));
btnOpenFolder.setEnabled(false);
header.add(btnOpenFolder, 6);
btnOpenFolder.addActionListener(this);
@@ -37,7 +38,7 @@ public class DownloadPanel extends TransferPanel implements ActionListener, Quit
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnClose) {
if (!download.isCanceled()) {
- if (!Gui.showMessageBox(panel, "Wollen Sie diesen Transfer wirklich abbrechen?",
+ if (!Gui.showMessageBox(panel, I18n.ACTIVITY.getString("DownloadPanel.Message.yesNo.cancelTransfer"),
MessageType.QUESTION_YESNO, null, null))
return;
download.cancel();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/PassiveUploadPanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/PassiveUploadPanel.java
index 64e6b994..aa461286 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/PassiveUploadPanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/PassiveUploadPanel.java
@@ -5,6 +5,7 @@ import java.awt.event.ActionListener;
import org.apache.log4j.Logger;
import org.openslx.dozmod.filetransfer.TransferEventEmitter;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public class PassiveUploadPanel extends TransferPanel {
@@ -16,11 +17,11 @@ public class PassiveUploadPanel extends TransferPanel {
private final PassiveUploadPanel panel = this;
public PassiveUploadPanel(TransferEventEmitter state, String name) {
- super(state, name, "<Transfer zwischen Masterserver und Satellitenserver>");
+ super(state, name, I18n.ACTIVITY.getString("PassiveUploadPanel.TransferPanel.fileName"));
btnClose.addActionListener(new ButtonAction());
this.state = state;
state.addListener(this);
- btnClose.setText("Ausblenden");
+ btnClose.setText(I18n.ACTIVITY.getString("PassiveUploadPanel.Button.close.text"));
}
private class ButtonAction implements ActionListener {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/TransferPanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/TransferPanel.java
index 00ce10d3..eb752b30 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/TransferPanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/TransferPanel.java
@@ -17,6 +17,7 @@ import org.openslx.dozmod.filetransfer.TransferEventListener;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.BlockProgressBar;
import org.openslx.dozmod.gui.control.QLabel;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public abstract class TransferPanel extends ActivityPanel implements TransferEventListener {
@@ -56,7 +57,7 @@ public abstract class TransferPanel extends ActivityPanel implements TransferEve
// Header: [status] VM-Name ---- fileName [Button]
header = new JPanel();
header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
- lblStatus = new QLabel("Initialisiere");
+ lblStatus = new QLabel(I18n.ACTIVITY.getString("TransferPanel.TransferState.initialize"));
header.add(lblStatus);
header.add(Box.createHorizontalStrut(10));
QLabel vmName = new QLabel(displayName);
@@ -68,7 +69,7 @@ public abstract class TransferPanel extends ActivityPanel implements TransferEve
lblFilename.setMinimumSize(new Dimension(0, 0));
header.add(lblFilename);
header.add(Box.createHorizontalStrut(10));
- btnClose = new JButton("Abbrechen");
+ btnClose = new JButton(I18n.ACTIVITY.getString("TransferPanel.Button.close.text.0"));
header.add(btnClose);
add(header);
progressWrapper = new JPanel();
@@ -124,20 +125,20 @@ public abstract class TransferPanel extends ActivityPanel implements TransferEve
switch (event.state) {
case ERROR:
errorCountdown = 20;
- status = "Fehler";
+ status = I18n.ACTIVITY.getString("TransferPanel.TransferState.error");
if (transfer.isCanceled()) {
transfer.removeListener(panel);
}
break;
case FINISHED:
transferDone();
- status = "Beendet";
+ status = I18n.ACTIVITY.getString("TransferPanel.TransferState.finished");
break;
case IDLE:
- status = "Inaktiv";
+ status = I18n.ACTIVITY.getString("TransferPanel.TransferState.idle");
break;
case WORKING:
- status = "Übertragung läuft";
+ status = I18n.ACTIVITY.getString("TransferPanel.TransferState.working");
break;
default:
status = event.state.toString();
@@ -168,7 +169,7 @@ public abstract class TransferPanel extends ActivityPanel implements TransferEve
private void transferDone() {
transfer.removeListener(panel);
lblRemaining.setText("-");
- btnClose.setText("Schließen");
+ btnClose.setText(I18n.ACTIVITY.getString("TransferPanel.Button.close.text.1"));
lblFilename.setText("");
footer.setVisible(false);
progressWrapper.setVisible(false);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UpdatePanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UpdatePanel.java
index 41b53302..4c4c392b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UpdatePanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UpdatePanel.java
@@ -11,6 +11,7 @@ import javax.swing.SwingUtilities;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.QLabel;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.window.CheckUpdateWindow;
import org.openslx.dozmod.util.DesktopEnvironment;
import org.openslx.dozmod.util.DesktopEnvironment.Link;
@@ -40,12 +41,16 @@ public class UpdatePanel extends ActivityPanel implements ActionListener {
// Header: Neue Version verfügbar: <newVersion> [Button]
header = new JPanel();
header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
- lblInfo = new QLabel("Neue Version verfügbar: " + newVersion, Gui.getScaledIconResource("/img/upload-icon.png", "!", 32, this), QLabel.LEFT);
+ lblInfo = new QLabel(I18n.ACTIVITY.getString("UpdatePanel.Label.info.text", newVersion),
+ Gui.getScaledIconResource("/img/upload-icon.png", "!", 32, this), QLabel.LEFT);
header.add(lblInfo);
header.add(Box.createHorizontalGlue());
- btnLink = new JButton("Im Browser öffnen", Gui.getScaledIconResource("/img/download-icon.png", "!", 24, this));
- btnDetails = new JButton("Changelog", Gui.getScaledIconResource("/img/info-icon.png", "?", 24, this));
- btnClose = new JButton("Schließen", Gui.getScaledIconResource("/img/delete-icon.png", "X", 24, this));
+ btnLink = new JButton(I18n.ACTIVITY.getString("UpdatePanel.Button.link.text"),
+ Gui.getScaledIconResource("/img/download-icon.png", "!", 24, this));
+ btnDetails = new JButton(I18n.ACTIVITY.getString("UpdatePanel.Button.details.text"),
+ Gui.getScaledIconResource("/img/info-icon.png", "?", 24, this));
+ btnClose = new JButton(I18n.ACTIVITY.getString("UpdatePanel.Button.close.text"),
+ Gui.getScaledIconResource("/img/delete-icon.png", "X", 24, this));
btnLink.addActionListener(this);
btnClose.addActionListener(this);
header.add(btnLink);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UploadPanel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UploadPanel.java
index bc24758a..b9b106f6 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UploadPanel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/activity/UploadPanel.java
@@ -13,6 +13,7 @@ import org.openslx.bwlp.thrift.iface.TAuthorizationException;
import org.openslx.bwlp.thrift.iface.TInvalidTokenException;
import org.openslx.bwlp.thrift.iface.UploadOptions;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.QuitNotification;
import org.openslx.dozmod.state.UploadWizardState;
@@ -40,7 +41,7 @@ public class UploadPanel extends TransferPanel implements QuitNotification {
|| Session.getSatelliteConfig().serverSideCopy != SscMode.USER) {
chkServerSideCopy = null;
} else {
- chkServerSideCopy = new JCheckBox("ServerSide Copy");
+ chkServerSideCopy = new JCheckBox(I18n.ACTIVITY.getString("UploadPanel.CheckBox.serverSideCopy.text"));
footer.add(Box.createHorizontalStrut(15));
footer.add(chkServerSideCopy);
chkServerSideCopy.addActionListener(new SscToggle());
@@ -54,7 +55,7 @@ public class UploadPanel extends TransferPanel implements QuitNotification {
@Override
public void actionPerformed(ActionEvent e) {
if (!state.getUploadTask().isCanceled()) {
- if (!Gui.showMessageBox(panel, "Wollen Sie diesen Transfer wirklich abbrechen?",
+ if (!Gui.showMessageBox(panel, I18n.ACTIVITY.getString("UploadPanel.Message.yesNo.cancelTransfer"),
MessageType.QUESTION_YESNO, null, null))
return;
QuickTimer.scheduleOnce(new Task() {
@@ -84,7 +85,7 @@ public class UploadPanel extends TransferPanel implements QuitNotification {
} catch (TAuthorizationException | TInvalidTokenException e) {
dis = true;
} catch (TException e) {
- Gui.asyncMessageBox("Unerwarteter Fehler beim Setzen der Transferoptionen",
+ Gui.asyncMessageBox(I18n.ACTIVITY.getString("UploadPanel.Message.error.setUploadOptions"),
MessageType.ERROR, LOGGER, e);
}
final UploadOptions newOptions = newOpt;
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
new file mode 100644
index 00000000..d7e73e3d
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ContainerBindMountConfigurator.java
@@ -0,0 +1,112 @@
+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;
+import org.openslx.dozmod.gui.helper.I18n;
+import org.openslx.dozmod.gui.window.ContainerBindMountWindow;
+import org.openslx.dozmod.model.ContainerBindMount;
+
+import javax.swing.*;
+import javax.swing.event.ChangeListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContainerBindMountConfigurator extends JPanel
+ implements GenericControlWindow<List<ContainerBindMount>> {
+ private final Logger LOGGER = Logger.getLogger(ContainerBindMountConfigurator.class);
+
+ private final ContainerBindMountTable bindMountTable;
+
+ public ContainerBindMountConfigurator() {
+ super();
+
+ GridManager grid = new GridManager(this, 3, false);
+ QLabel lblBindMount = new QLabel(I18n.CONFIGURATOR.getString("ContainerBindMount.BindMount.text"));
+ bindMountTable = new ContainerBindMountTable();
+ QScrollPane scrollPaneTable = new QScrollPane(bindMountTable);
+ scrollPaneTable.setMinimumSize(Gui.getScaledDimension(0, 70));
+ scrollPaneTable.setPreferredSize(Gui.getScaledDimension(0, 70));
+ 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(I18n.CONFIGURATOR.getString("ContainerBindMount.Button.AddBindMount.text"));
+ JButton btnDelBindMount = new JButton(I18n.CONFIGURATOR.getString("ContainerBindMount.Button.DeleteBindMount.text"));
+
+ // 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) {
+ addBindMount();
+ }
+ });
+ btnDelBindMount.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ deleteBindMount();
+ }
+ });
+ }
+
+ private void addBindMount() {
+ ContainerBindMountWindow.open(SwingUtilities.getWindowAncestor(this), bindMountTable);
+ fireUserChangeEvent();
+ }
+
+ private void deleteBindMount() {
+ if (null == bindMountTable.getSelectedItem())
+ return;
+ List<ContainerBindMount> data = new ArrayList<>(bindMountTable.getData());
+ if (data.remove(bindMountTable.getSelectedItem()))
+ LOGGER.info("Bind Mount Entry Deleted");
+ bindMountTable.setData(data, true);
+ fireUserChangeEvent();
+ }
+
+ public void setData(List<ContainerBindMount> bindMountConfig, boolean sort) {
+ bindMountTable.setData(bindMountConfig, sort);
+ }
+
+ public List<ContainerBindMount> getData() {
+ return bindMountTable.getData();
+ }
+
+
+ /* ################################
+ For dialog change monitor
+ ################################### */
+
+ @Override public List<ContainerBindMount> getState() {
+ return bindMountTable.getData();
+ }
+
+ void fireUserChangeEvent() {
+ for (ChangeListener cl : listeners) {
+ cl.stateChanged(null);
+ }
+ }
+
+ private final List<ChangeListener> listeners = new ArrayList<>(1);
+
+ @Override public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ImagePermissionConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ImagePermissionConfigurator.java
index efba020c..cf082e27 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ImagePermissionConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/ImagePermissionConfigurator.java
@@ -33,6 +33,7 @@ import org.openslx.dozmod.gui.control.table.ImagePermissionTable;
import org.openslx.dozmod.gui.control.table.ImagePermissionTable.UserImagePermissions;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.window.UserListWindow;
import org.openslx.dozmod.gui.window.UserListWindow.UserAddedCallback;
import org.openslx.dozmod.thrift.cache.UserCache;
@@ -69,9 +70,9 @@ public class ImagePermissionConfigurator extends JPanel implements GenericContro
userButtonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
userButtonPane.setLayout(new BoxLayout(userButtonPane, BoxLayout.LINE_AXIS));
- btnAddUser = new JButton("Benutzer hinzufügen");
+ btnAddUser = new JButton(I18n.CONFIGURATOR.getString("ImagePermission.Button.addUser.text"));
userButtonPane.add(btnAddUser);
- btnRemoveUser = new JButton("Benutzer entfernen");
+ btnRemoveUser = new JButton(I18n.CONFIGURATOR.getString("ImagePermission.Button.removeUser.text"));
userButtonPane.add(btnRemoveUser);
userButtonPane.add(Box.createGlue());
@@ -105,7 +106,7 @@ public class ImagePermissionConfigurator extends JPanel implements GenericContro
permissionTable.setData(permissionList, false);
fireUserChangeEvent();
}
- }, "Hinzufügen", ownerId);
+ }, I18n.CONFIGURATOR.getString("ImagePermission.Button.addUser.caption"), ownerId);
}
});
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java
index 15959322..817289be 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LdapFilterConfigurator.java
@@ -29,6 +29,7 @@ import org.openslx.dozmod.gui.control.table.CheckListTable.Wrapper;
import org.openslx.dozmod.gui.control.table.LectureLdapFilterTable;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
@@ -63,7 +64,7 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
txtAttribute.setEnabled(editable);
txtValue.setEnabled(editable);
if (editable)
- btnAdd.setText("Ändern");
+ btnAdd.setText(I18n.CONFIGURATOR.getString("LdapFilter.Button.add.text.0"));
if (item == null) {
clearInputFields();
return;
@@ -82,7 +83,8 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
LdapFilter input = new LdapFilter();
input.attribute = txtAttribute.getText();
if (input.attribute == null || input.attribute.isEmpty()) {
- Gui.showMessageBox("Kein Attribut angegeben", MessageType.ERROR, null, null);
+ Gui.showMessageBox(I18n.CONFIGURATOR.getString("LdapFilter.Message.error.noAttribute"),
+ MessageType.ERROR, null, null);
return;
}
input.value = txtValue.getText();
@@ -97,7 +99,8 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
// creating a new one, either way add it to the list and update
// the table, if its not present already
if (oldList.contains(newEntry)) {
- Gui.showMessageBox("Eintrag bereits vorhanden", MessageType.ERROR, null, null);
+ Gui.showMessageBox(I18n.CONFIGURATOR.getString("LdapFilter.Message.error.entryAlreadyExists"),
+ MessageType.ERROR, null, null);
return;
}
// now decide whether to create a new entry or update existing one
@@ -143,7 +146,7 @@ public class LdapFilterConfigurator extends LdapFilterConfiguratorLayout {
btnDel.setEnabled(false);
txtAttribute.setText(null);
txtValue.setText(null);
- btnAdd.setText("Hinzufügen");
+ btnAdd.setText(I18n.CONFIGURATOR.getString("LdapFilter.Button.add.text.1"));
}
public List<LdapFilter> getState() {
@@ -205,11 +208,6 @@ class LdapFilterConfiguratorLayout extends JPanel {
private static final long serialVersionUID = 6479838641542743622L;
- private final static String HELPTEXT = "Geben Sie hier LDAP Filter ein, die die Sichtbarkeit"
- + " der Veranstaltung abhängig vom angemeldeten Benutzer einschränken. Eine Veranstaltung"
- + " ist sichtbar, sobald einer der angegebenen Filter zutrifft. Zusätzliche Raumbeschränkungen"
- + " greifen weiterhin.";
-
protected final LectureLdapFilterTable tblFilters = new LectureLdapFilterTable();
protected final JTextField txtAttribute, txtValue;
protected final JButton btnAdd, btnDel;
@@ -217,27 +215,29 @@ class LdapFilterConfiguratorLayout extends JPanel {
public LdapFilterConfiguratorLayout() {
GridManager grid = new GridManager(this, 1, true, new Insets(3, 3, 3, 3));
// top info panel
- grid.add(new WordWrapLabel(HELPTEXT)).fill(true, false).expand(true, false);
+ grid.add(new WordWrapLabel(I18n.CONFIGURATOR.getString("LdapFilter.Label.info.text")))
+ .fill(true, false).expand(true, false);
grid.nextRow();
// middle filter list
grid.add(new QScrollPane(tblFilters)).fill(true, true).expand(true, true);
grid.nextRow();
- btnDel = new JButton("Entfernen");
+ btnDel = new JButton(I18n.CONFIGURATOR.getString("LdapFilter.Button.delete.text"));
grid.add(btnDel).anchor(GridBagConstraints.EAST);
grid.nextRow();
JPanel pnlNewShare = new JPanel();
GridManager gridNewFilter = new GridManager(pnlNewShare, 3, true);
- pnlNewShare.setBorder(BorderFactory.createTitledBorder("Eigene Filter definieren"));
- gridNewFilter.add(new QLabel("Attribut"));
+ pnlNewShare.setBorder(BorderFactory.createTitledBorder(
+ I18n.CONFIGURATOR.getString("LdapFilter.TitledBorder.newShare.title")));
+ gridNewFilter.add(new QLabel(I18n.CONFIGURATOR.getString("LdapFilter.Label.attribute.text")));
txtAttribute = new JTextField();
gridNewFilter.add(txtAttribute, 2).fill(true, false).expand(true, false);
gridNewFilter.nextRow();
- gridNewFilter.add(new QLabel("Wert"));
+ gridNewFilter.add(new QLabel(I18n.CONFIGURATOR.getString("LdapFilter.Label.value.text")));
txtValue = new JTextField();
gridNewFilter.add(txtValue).fill(true, false).expand(true, false);
- btnAdd = new JButton("Hinzufügen");
+ btnAdd = new JButton(I18n.CONFIGURATOR.getString("LdapFilter.Button.add.text.1"));
gridNewFilter.add(btnAdd).anchor(GridBagConstraints.EAST);
gridNewFilter.nextRow();
gridNewFilter.finish(false);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LecturePermissionConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LecturePermissionConfigurator.java
index 5e4c1649..b659c3c9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LecturePermissionConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/LecturePermissionConfigurator.java
@@ -31,6 +31,7 @@ import org.openslx.dozmod.gui.control.table.LecturePermissionTable;
import org.openslx.dozmod.gui.control.table.LecturePermissionTable.UserLecturePermissions;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.window.UserListWindow;
import org.openslx.dozmod.gui.window.UserListWindow.UserAddedCallback;
@@ -76,9 +77,9 @@ public class LecturePermissionConfigurator extends JPanel implements GenericCont
userButtonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
userButtonPane.setLayout(new BoxLayout(userButtonPane, BoxLayout.LINE_AXIS));
- btnAddUser = new JButton("Benutzer hinzufügen");
+ btnAddUser = new JButton(I18n.CONFIGURATOR.getString("LecturePermission.Button.addUser.text"));
userButtonPane.add(btnAddUser);
- btnRemoveUser = new JButton("Benutzer entfernen");
+ btnRemoveUser = new JButton(I18n.CONFIGURATOR.getString("LecturePermission.Button.removeUser.text"));
userButtonPane.add(btnRemoveUser);
userButtonPane.add(Box.createGlue());
@@ -111,7 +112,7 @@ public class LecturePermissionConfigurator extends JPanel implements GenericCont
permissionTable.setData(permissionList, false);
fireUserChangeEvent();
}
- }, "Hinzufügen", ownerId);
+ }, I18n.CONFIGURATOR.getString("LecturePermission.Button.addUser.caption"), ownerId);
}
});
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java
index 3a0aabdd..8e11e484 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetrulesConfigurator.java
@@ -51,6 +51,7 @@ import org.openslx.dozmod.gui.changemonitor.GenericControlWindow;
import org.openslx.dozmod.gui.configurator.NetrulesConfigurator.StateWrapper;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
@@ -196,11 +197,13 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
private void showPresetSelector() {
if (predefinedRules == null) {
- Gui.showMessageBox("Wah wah wah! Null preset list", MessageType.ERROR, null, null);
+ Gui.showMessageBox(I18n.CONFIGURATOR.getString("NetRules.Message.error.noPredefinedRules"),
+ MessageType.ERROR, null, null);
return;
}
final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this),
- "Auswahl", ModalityType.APPLICATION_MODAL);
+ I18n.CONFIGURATOR.getString("NetRules.Dialog.dialog.title"),
+ ModalityType.APPLICATION_MODAL);
JPanel pane = new JPanel();
pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
@@ -216,7 +219,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
dialog.setMinimumSize(dd);
dialog.setPreferredSize(dd);
GridManager grid = new GridManager(pane, 3, true, new Insets(2, 2, 2, 2));
- grid.add(new WordWrapLabel("Vordefinierte Regelsets:"), 3);
+ grid.add(new WordWrapLabel(I18n.CONFIGURATOR.getString("NetRules.Label.predefinedRules.text")), 3);
grid.nextRow();
final Map<ButtonModel, Integer> mapper = new HashMap<>();
for (PresetNetRule ruleSet : predefinedRules) {
@@ -231,8 +234,8 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
grid.add(Box.createVerticalGlue(), 3).expand(true, true).fill(true, true);
grid.nextRow();
grid.add(Box.createHorizontalGlue()).expand(true, false).fill(true, false);
- JButton btnCancel = new JButton("Abbrechen");
- JButton btnOk = new JButton("Speichern");
+ JButton btnCancel = new JButton(I18n.CONFIGURATOR.getString("NetRules.Button.cancel.text"));
+ JButton btnOk = new JButton(I18n.CONFIGURATOR.getString("NetRules.Button.ok.text"));
grid.add(btnCancel);
grid.add(btnOk);
grid.finish(false);
@@ -386,9 +389,9 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
// log numbers for fields independently...
LOGGER.debug("Invalid number of fields! Expected 3, got: " + fields.length);
if (fields.length > 3) {
- errors.append("Zeile " + lineNo + ": Zu viele Felder.\n");
+ errors.append(I18n.CONFIGURATOR.getString("NetRules.Message.error.tooManyFields", lineNo));
} else {
- errors.append("Zeile " + lineNo + ": Zu wenig Felder.\n");
+ errors.append(I18n.CONFIGURATOR.getString("NetRules.Message.error.tooFewFields", lineNo));
}
invalid = true;
continue;
@@ -404,7 +407,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
if (!ruleDirection.equals("IN") && !ruleDirection.equals("OUT")) {
lineNo += addLine(newdoc, ruleLine, Color.RED, true);
LOGGER.debug("Invalid net direction! Expected 'in' or out'. Got: " + ruleDirection);
- errors.append("Zeile " + lineNo + ": Ungültige Richtung. Bitte nutzen Sie 'IN' bzw. 'OUT'.\n");
+ errors.append(I18n.CONFIGURATOR.getString("NetRules.Message.error.invalidNetDirection", lineNo));
invalid = true;
continue;
}
@@ -415,7 +418,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
if (port < 0 || port > 65535) {
lineNo += addLine(newdoc, ruleLine, Color.RED, true);
LOGGER.debug("Invalid port! Got: " + port);
- errors.append("Zeile " + lineNo + ": Ungültiger Port. Gültiger Bereich ist 0-65535.\n");
+ errors.append(I18n.CONFIGURATOR.getString("NetRules.Message.error.invalidPort", lineNo));
invalid = true;
continue;
}
@@ -429,7 +432,8 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
String checkRes = checkHostnameSimple(fields[0]);
if (checkRes != null) {
lineNo += addLine(newdoc, ruleLine, Color.RED, true);
- errors.append("Zeile " + lineNo + ": " + checkRes + "\n");
+ errors.append(I18n.CONFIGURATOR.getString("NetRules.Message.error.checkResWithLineNo",
+ lineNo, checkRes));
invalid = true;
continue;
}
@@ -442,10 +446,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
resetTabStops();
}
if (!silent && errors.length() != 0) {
- Gui.showMessageBox("Fehler beim Auswerten der angegebenen Netzwerkregeln.\n\n" + errors.toString()
- + "\nBitte geben Sie die Regeln zeilenweise im Format\n"
- + "<host> <port> <IN|OUT>\n"
- + "an.",
+ Gui.showMessageBox(I18n.CONFIGURATOR.getString("NetRules.Message.error.evaluatingNetRules", errors.toString()),
MessageType.ERROR, null, null);
}
if (invalid) {
@@ -486,7 +487,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
*/
private String checkHostnameSimple(String hostname) {
if (hostname.length() > 254) {
- return "Hostname ist zu lang.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.hostnameTooLong");
}
boolean allNumeric = true;
int netmask = -1;
@@ -495,7 +496,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
if (ls != -1) {
netmask = Util.parseInt(hostname.substring(ls + 1), -1);
if (netmask == -1) {
- return "Ungültige Netzmaske.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.invalidNetmask");
}
hostname = hostname.substring(0, ls);
}
@@ -509,18 +510,18 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
// v6
if ((hostname.startsWith(":") && !hostname.startsWith("::"))
|| (hostname.endsWith(":") && ! hostname.endsWith("::"))) {
- return "IPv6-Adresse darf nicht mit einem Doppelpunkt beginnen oder enden.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv6BeginOrEndWithColon");
}
int numCompressed = (hostname.length() - hostname.replace("::", "").length()) / 2;
if (numCompressed > 1) {
- return "IPv6-Adresse darf nicht mehr als einen komprimierten Teil enthalten.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv6MoreThanOneCompressedPart");
}
if (netmask > 128) {
- return "IPv6 Netzmaske kann nicht größer 128 Bit sein.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv6GreaterThan128Bits");
}
domainLabels = hostname.split(":");
if (domainLabels.length > 8) {
- return "IPv6-Adresse enthält zu viele Hextets."; // Yes it's called that apparently
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv6TooManyHextets"); // Yes it's called that apparently
}
for (String domainLabel : domainLabels) {
if (domainLabel.isEmpty())
@@ -528,26 +529,27 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
try {
int test = Integer.parseInt(domainLabel, 16);
if (test < 0 || test > 65535) {
- return "IPv6-Adresse enthält ungültiges Hextet.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv6InvalidHextet");
}
} catch (Exception e) {
- return "IPv6-Adresse enthält nicht-hexadezimale Zeichen.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv6NonHexadecimalCharacters");
}
}
if (!allNumeric
|| ((domainLabels.length == 8 || numCompressed > 0) && (netmask < -1 || netmask > 128))
|| (domainLabels.length < 8 && numCompressed == 0 && (netmask < 0 || netmask > 128))) {
- return "Fehlerhafte IPv6-Adresse/Netzmaske.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.incorrectIPv6AddressOrNetmask");
}
} else {
// v4 or hostname
if (netmask > 32) {
- return "IPv4 Netzmaske kann nicht größer 32 Bit sein.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.IPv4GreaterThan32Bits");
}
for (String domainLabel : domainLabels) {
if (domainLabel.length() > 63) {
// fail since domain level should be max 63 chars
- return "Domain-Ebene '" + domainLabel + "' länger als 63 Zeichen.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.domainLabelLongerThan63Characters",
+ domainLabel);
}
int i = Util.parseInt(domainLabel, -1);
if (i < 0 || i > 255) {
@@ -559,7 +561,7 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
if ((domainLabels.length == 4 && (netmask < -1 || netmask > 32))
|| domainLabels.length > 4
|| (domainLabels.length < 4 && (netmask < 0 || netmask > 32))) {
- return "Fehlerhafte IPv4-Adresse/Netzmaske.";
+ return I18n.CONFIGURATOR.getString("NetRules.Message.error.incorrectIPv4AddressOrNetmask");
}
}
}
@@ -574,13 +576,6 @@ public class NetrulesConfigurator extends NetrulesConfiguratorLayout implements
class NetrulesConfiguratorLayout extends JPanel {
private static final long serialVersionUID = 5266120380443817325L;
- private final static String STR_RULES_DESCRIPTION = "Wenn Sie den Internetzugriff deaktiviert haben,"
- + " können Sie hier Ausnahmen definieren (Whitelist)."
- + " Bitte definieren Sie Ihre Regeln im Format\n<host> <port> <in|out>.\n"
- + "Sie können Port 0 angeben, was sämtlichen TCP und UDP Ports eines Hosts entspricht.";
- private final static String STR_RULES_ADD = "Wenn Sie Internetzugriff aktivieren,"
- + " hat diese Liste den gegenteiligen Effekt (Blacklist).";
- private final static String STR_TITLE = "Netzwerkregeln";
protected final JTextPane tpNetworkRules;
protected final JButton btnCheckRules;
@@ -592,19 +587,19 @@ class NetrulesConfiguratorLayout extends JPanel {
new Insets(5, 5, 5, 5));
// middle panel for network rules
- this.setBorder(BorderFactory.createTitledBorder(STR_TITLE));
+ this.setBorder(BorderFactory.createTitledBorder(I18n.CONFIGURATOR.getString("NetRules.TitledBorder.title")));
tpNetworkRules = new JTextPane();
resetTabStops();
grid
- .add(new WordWrapLabel(STR_RULES_DESCRIPTION), 2)
+ .add(new WordWrapLabel(I18n.CONFIGURATOR.getString("NetRules.Label.description.text")), 2)
.fill(true, false).expand(true, false);
grid.nextRow();
grid
- .add(new WordWrapLabel(STR_RULES_ADD))
+ .add(new WordWrapLabel(I18n.CONFIGURATOR.getString("NetRules.Label.add.text")))
.fill(true, false).expand(true, false);
- btnCheckRules = new JButton("Regeln überprüfen");
+ btnCheckRules = new JButton(I18n.CONFIGURATOR.getString("NetRules.Button.checkRules.text"));
grid.add(btnCheckRules);
grid.nextRow();
@@ -614,7 +609,7 @@ class NetrulesConfiguratorLayout extends JPanel {
.fill(true, true).expand(true, true);
grid.nextRow();
- btnShowPresets = new JButton("Vordefinierte Regelsets...");
+ btnShowPresets = new JButton(I18n.CONFIGURATOR.getString("NetRules.Button.showPresets.text"));
grid.add(btnShowPresets, 2).anchor(GridBagConstraints.LINE_END);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetshareConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetshareConfigurator.java
index 77f2e381..95c45282 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetshareConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/NetshareConfigurator.java
@@ -38,6 +38,7 @@ import org.openslx.dozmod.gui.control.table.CheckListTable.Wrapper;
import org.openslx.dozmod.gui.control.table.NetshareTable;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.dozmod.util.FormatHelper;
@@ -79,7 +80,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
chkIsPrinter.setEnabled(editable);
chkShowPass.setEnabled(editable);
if (editable)
- btnAdd.setText("Ändern");
+ btnAdd.setText(I18n.CONFIGURATOR.getString("NetShare.Button.add.text.0"));
// clear the contents of the fields and return, if no share was selected.
if (item == null) {
@@ -145,7 +146,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
input.path = tfSharePath.getText();
if (input.path == null || input.path.isEmpty()) {
- lblError.setText("Kein Pfad angegeben!");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.noPath"));
return;
}
String inputShareName = tfShareName.getText();
@@ -156,7 +157,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
NetShareAuth inputNetShareAuth = cboNetshareAuth
.getItemAt(cboNetshareAuth.getSelectedIndex());
if (inputNetShareAuth == null) {
- lblError.setText("Kein Authentifizierungstyp angegeben!");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.noAuth"));
return;
}
input.auth = inputNetShareAuth;
@@ -170,7 +171,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
input.username = tfUsername.getText();
input.password = new String(tfPassword.getPassword());
if (input.username.isEmpty()) {
- lblError.setText("Kein Nutzername angegeben!");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.noUsername"));
return;
}
break;
@@ -179,7 +180,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
break;
}
if (input == null) {
- lblError.setText("Fehlerhafte Eingabe");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.incorrectInput"));
LOGGER.debug("Bad input, aborting.");
return;
}
@@ -189,7 +190,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
.getItemAt(cboNetshareMountPoint.getSelectedIndex());
if (!chkIsPrinter.isSelected()) {
if (inputMountPoint == null) {
- lblError.setText("Kein Laufwerk angegeben!");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.noMountPoint"));
return;
}
input.mountpoint = String.valueOf(inputMountPoint);
@@ -201,10 +202,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
// which we might want to implement one day...
if (input.password != null && !input.password.isEmpty()) {
if (!Gui.showMessageBox(
- "Das eingebene Passwort wird im Klartext gespeichert "
- + "und ist in der VM für jeden Nutzer sichtbar.\n"
- + "Verwenden Sie auf keinen Fall sicherheitskritische Passwörter!"
- + "\n\nMöchten Sie diesen Netzlaufwerk trotzdem hinzufügen?",
+ I18n.CONFIGURATOR.getString("NetShare.Message.yesNo.password"),
MessageType.QUESTION_YESNO, LOGGER, null)) {
return;
}
@@ -218,7 +216,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
if (oldEntry != null && oldList.contains(oldEntry)) {
// editing existing one, delete it from the internal data
if (!oldList.remove(oldEntry)) {
- lblError.setText("Änderung fehlgeschlagen!");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.changeFailed"));
LOGGER.error("Failed to remove selected share for replacement: " + oldEntry);
return;
}
@@ -228,7 +226,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
// creating a new one, either way add it to the list and update
// the table, if its not present already
if (oldList.contains(newEntry)) {
- lblError.setText("Existiert bereits!");
+ lblError.setText(I18n.CONFIGURATOR.getString("NetShare.Label.error.alreadyExists"));
LOGGER.error("Network share already in the list, aborting.");
return;
}
@@ -287,7 +285,7 @@ public class NetshareConfigurator extends NetshareConfiguratorLayout {
cboNetshareMountPoint.setSelectedItem(null);
chkIsPrinter.setSelected(false);
chkShowPass.setSelected(false);
- btnAdd.setText("Hinzufügen");
+ btnAdd.setText(I18n.CONFIGURATOR.getString("NetShare.Button.add.text.1"));
}
public List<NetShare> getState() {
@@ -335,10 +333,6 @@ class NetshareConfiguratorLayout extends JPanel {
private static final long serialVersionUID = 6479525981542743622L;
- private final static String txtNetshareDesc = "<html>Hier können Sie Netzlaufwerke angeben,"
- + " die automatisch beim Start der Veranstaltung eingebunden werden sollen."
- + " Der Platzhalter <em>%loginuser%</em> wird im Pfad durch den Loginnamen des Nutzers ersetzt.</html>";
-
protected final JLabel lblError;
protected final NetshareTable tblNetshare = new NetshareTable();
protected final JTextField tfSharePath, tfShareName, tfUsername;
@@ -369,7 +363,8 @@ class NetshareConfiguratorLayout extends JPanel {
public NetshareConfiguratorLayout() {
GridManager grid = new GridManager(this, 3, true, new Insets(3, 3, 3, 3));
// top info panel
- grid.add(new JLabel(txtNetshareDesc), 3).fill(true, false).expand(true, false);
+ grid.add(new JLabel(I18n.CONFIGURATOR.getString("NetShare.Label.description.text")), 3)
+ .fill(true, false).expand(true, false);
grid.nextRow();
// middle netshare list
grid.add(new QScrollPane(tblNetshare), 3).fill(true, true).expand(true, true);
@@ -377,17 +372,18 @@ class NetshareConfiguratorLayout extends JPanel {
JPanel pnlNewShare = new JPanel();
GridManager gridNewShare = new GridManager(pnlNewShare, 6, true, new Insets(0, 3, 0, 3));
- pnlNewShare.setBorder(BorderFactory.createTitledBorder("Eigenes Netzlaufwerk definieren"));
+ pnlNewShare.setBorder(BorderFactory.createTitledBorder(
+ I18n.CONFIGURATOR.getString("NetShare.TitledBorder.newShare.title")));
JPanel pnlSharePath = new JPanel();
pnlSharePath.setLayout(new BoxLayout(pnlSharePath, BoxLayout.LINE_AXIS));
- gridNewShare.add(new QLabel("Pfad"));
+ gridNewShare.add(new QLabel(I18n.CONFIGURATOR.getString("NetShare.Label.sharePath.text")));
tfSharePath = new JTextField();
pnlSharePath.add(tfSharePath);
pnlSharePath.add(Box.createGlue());
pnlSharePath.add(Box.createHorizontalStrut(5));
- chkIsPrinter = new JCheckBox("Drucker");
+ chkIsPrinter = new JCheckBox(I18n.CONFIGURATOR.getString("NetShare.CheckBox.isPrinter.text"));
pnlSharePath.add(chkIsPrinter);
pnlSharePath.add(Box.createHorizontalStrut(5));
gridNewShare.add(pnlSharePath, 5).fill(true, false).expand(true, false);
@@ -399,30 +395,30 @@ class NetshareConfiguratorLayout extends JPanel {
pnlShareName.setLayout(new BoxLayout(pnlShareName, BoxLayout.LINE_AXIS));
pnlShareName.add(tfShareName);
pnlShareName.add(Box.createHorizontalStrut(3));
- pnlShareName.add(new QLabel("Laufwerk"));
+ pnlShareName.add(new QLabel(I18n.CONFIGURATOR.getString("NetShare.Label.shareMountPoint.text")));
pnlShareName.add(Box.createHorizontalStrut(3));
pnlShareName.add(cboNetshareMountPoint);
- gridNewShare.add(new QLabel("Anzeigename"));
+ gridNewShare.add(new QLabel(I18n.CONFIGURATOR.getString("NetShare.Label.shareName.text")));
gridNewShare.add(pnlShareName, 5).fill(true, false).expand(true, false);
gridNewShare.nextRow();
- gridNewShare.add(new QLabel("Authentifizierung"));
+ gridNewShare.add(new QLabel(I18n.CONFIGURATOR.getString("NetShare.Label.shareAuth.text")));
gridNewShare.add(cboNetshareAuth, 5).fill(true, false).expand(true, false);
gridNewShare.nextRow();
- gridNewShare.add(new QLabel("Benutzername"));
+ gridNewShare.add(new QLabel(I18n.CONFIGURATOR.getString("NetShare.Label.username.text")));
tfUsername = new JTextField(20);
gridNewShare.add(tfUsername, 2).fill(true, false).expand(true, false);
- gridNewShare.add(new QLabel("Passwort"));
+ gridNewShare.add(new QLabel(I18n.CONFIGURATOR.getString("NetShare.Label.password.text")));
tfPassword = new JPasswordField(20);
gridNewShare.add(tfPassword, 2).fill(true, false).expand(true, false);
gridNewShare.nextRow();
- chkShowPass = new JCheckBox("Passwort anzeigen");
+ chkShowPass = new JCheckBox(I18n.CONFIGURATOR.getString("NetShare.CheckBox.showPassword.text"));
gridNewShare.add(Box.createGlue(), 5);
gridNewShare.add(chkShowPass).anchor(GridBagConstraints.EAST);
gridNewShare.nextRow();
grid.add(pnlNewShare, 3).fill(true, false).expand(true, false);
grid.nextRow();
- btnAdd = new JButton("Hinzufügen");
- btnDel = new JButton("Entfernen");
+ btnAdd = new JButton(I18n.CONFIGURATOR.getString("NetShare.Button.add.text.1"));
+ btnDel = new JButton(I18n.CONFIGURATOR.getString("NetShare.Button.delete.text"));
lblError = new QLabel("");
lblError.setForeground(Color.RED);
grid.add(lblError).fill(true, false).expand(true, false);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java
index 16267690..eadc7339 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java
@@ -41,6 +41,7 @@ import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
@@ -96,11 +97,12 @@ public class StartupConfigurator extends StartupConfiguratorLayout {
private void showRunscriptSelector() {
if (scripts == null) {
- Gui.showMessageBox("Wah wah wah! Null scripts", MessageType.ERROR, null, null);
+ Gui.showMessageBox(I18n.CONFIGURATOR.getString("Startup.Message.error.noScripts"),
+ MessageType.ERROR, null, null);
return;
}
final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this),
- "Auswahl", ModalityType.APPLICATION_MODAL);
+ I18n.CONFIGURATOR.getString("Startup.Dialog.title"), ModalityType.APPLICATION_MODAL);
JPanel pane = new JPanel();
pane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
@@ -116,7 +118,8 @@ public class StartupConfigurator extends StartupConfiguratorLayout {
dialog.setMinimumSize(dd);
dialog.setPreferredSize(dd);
GridManager grid = new GridManager(pane, 3, true, new Insets(2, 2, 2, 2));
- grid.add(new WordWrapLabel("Vordefinierte Startskripte:"), 3).fill(true, false);
+ grid.add(new WordWrapLabel(I18n.CONFIGURATOR.getString("Startup.Label.predefinedScripts.text")), 3)
+ .fill(true, false);
grid.nextRow();
final Map<ButtonModel, Integer> mapper = new HashMap<>();
boolean haveDisabled = false;
@@ -135,15 +138,14 @@ public class StartupConfigurator extends StartupConfiguratorLayout {
}
}
if (haveDisabled) {
- grid.add(new WordWrapLabel("Ausgegraute Elemente sind mit dem zur"
- + " Veranstaltung gehörendem Betriebssystem nicht kompatibel."), 3)
+ grid.add(new WordWrapLabel(I18n.CONFIGURATOR.getString("Startup.Label.greyedOutElements.text")), 3)
.fill(true, false);
grid.nextRow();
}
grid.add(Box.createVerticalGlue(), 3).expand(true, true).fill(true, true);
grid.nextRow();
- JButton btnCancel = new JButton("Abbrechen");
- JButton btnOk = new JButton("Speichern");
+ JButton btnCancel = new JButton(I18n.CONFIGURATOR.getString("Startup.Button.cancel.text"));
+ JButton btnOk = new JButton(I18n.CONFIGURATOR.getString("Startup.Button.ok.text"));
grid.add(Box.createHorizontalGlue()).expand(true, true).fill(true, true);
grid.add(btnCancel);
grid.add(btnOk);
@@ -386,8 +388,6 @@ class StartupConfiguratorLayout extends JPanel {
private static final long serialVersionUID = 648729071828404053L;
- private final static String RUN_SCRIPT_HELP = "Ein hier eingetragenes Skript wird nach dem Start"
- + " der VM automatisch ausgeführt.";
protected final QLabel lblError;
protected final JTextArea taRunScript;
protected final ComboBox<RunscriptType> cboRunscriptType;
@@ -397,7 +397,7 @@ class StartupConfiguratorLayout extends JPanel {
public StartupConfiguratorLayout() {
GridManager grid = new GridManager(this, 2, true, new Insets(5, 5, 5, 5));
- grid.add(new QLabel("Audio"));
+ grid.add(new QLabel(I18n.CONFIGURATOR.getString("Startup.Label.audio.text")));
cboSoundState = new ComboBox<>(new ComboBoxRenderer<SoundState>() {
@Override
public String renderItem(SoundState item) {
@@ -411,7 +411,7 @@ class StartupConfiguratorLayout extends JPanel {
grid.add(Box.createVerticalStrut(4), 2);
grid.nextRow();
- grid.add(new WordWrapLabel(RUN_SCRIPT_HELP, false, true), 2)
+ grid.add(new WordWrapLabel(I18n.CONFIGURATOR.getString("Startup.Label.description.text"), false, true), 2)
.fill(true, false).expand(true, false);
grid.nextRow();
@@ -427,7 +427,7 @@ class StartupConfiguratorLayout extends JPanel {
cboRunscriptType.setModel(new DefaultComboBoxModel<RunscriptType>(
RunscriptType.values()));
cboRunscriptType.setEditable(true);
- grid.add(new QLabel("Dateinamenserweiterung: ")).fill(false, false)
+ grid.add(new QLabel(I18n.CONFIGURATOR.getString("Startup.Label.scriptType.text"))).fill(false, false)
.expand(false, false);
grid.add(cboRunscriptType).fill(true, false)
.expand(true, false);
@@ -442,7 +442,7 @@ class StartupConfiguratorLayout extends JPanel {
}
});
cboRunscriptVisibility.setModel(new DefaultComboBoxModel<RunscriptVisibility>(RunscriptVisibility.values()));
- grid.add(new QLabel("Sichtbarkeit: ")).fill(false, false)
+ grid.add(new QLabel(I18n.CONFIGURATOR.getString("Startup.Label.visibility.text"))).fill(false, false)
.expand(false, false);
grid.add(cboRunscriptVisibility).fill(true, false)
.expand(true, false);
@@ -457,7 +457,7 @@ class StartupConfiguratorLayout extends JPanel {
grid.add(scpRunScript, 2).fill(true, true).expand(true, true);
grid.nextRow();
- btnPredefinedScripts = new JButton("Vordefinierte Skripte...");
+ btnPredefinedScripts = new JButton(I18n.CONFIGURATOR.getString("Startup.Button.predefinedScripts.text"));
grid.add(btnPredefinedScripts, 2).anchor(GridBagConstraints.LINE_END);
grid.nextRow();
@@ -475,7 +475,8 @@ class StartupConfiguratorLayout extends JPanel {
enum RunscriptType {
- SHELL("Shellskript", "sh"), BATCH("Windows-Batch", "bat");
+ SHELL(I18n.CONFIGURATOR.getString("Startup.ScriptType.shell"), "sh"),
+ BATCH(I18n.CONFIGURATOR.getString("Startup.ScriptType.batch"), "bat");
public final String displayName;
public final String extension;
@@ -492,7 +493,9 @@ enum RunscriptType {
}
enum RunscriptVisibility {
- NORMAL("Normal", 1), MINIMIZED("Minimiert", 2), HIDDEN("Versteckt", 0);
+ NORMAL(I18n.CONFIGURATOR.getString("Startup.ScriptVisibility.normal"), 1),
+ MINIMIZED(I18n.CONFIGURATOR.getString("Startup.ScriptVisibility.minimized"), 2),
+ HIDDEN(I18n.CONFIGURATOR.getString("Startup.ScriptVisibility.hidden"), 0);
public final String displayName;
public final int value;
@@ -504,7 +507,9 @@ enum RunscriptVisibility {
}
enum SoundState {
- DEFAULT("Vorgabe des Pools", -1), MUTED("Stummschalten", 1), UNMUTED("Aktivieren", 0);
+ DEFAULT(I18n.CONFIGURATOR.getString("Startup.SoundState.default"), -1),
+ MUTED(I18n.CONFIGURATOR.getString("Startup.SoundState.muted"), 1),
+ UNMUTED(I18n.CONFIGURATOR.getString("Startup.SoundState.unmuted"), 0);
public final String displayName;
public final int value;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java
index 7ef4a800..3d82e2c9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/ImageListViewer.java
@@ -8,13 +8,7 @@ import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import javax.swing.BoxLayout;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.RowFilter;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
@@ -25,6 +19,7 @@ import org.openslx.dozmod.gui.control.table.ImageTable;
import org.openslx.dozmod.gui.control.table.ListTable.ListModel;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.permissions.ImagePerms;
import org.openslx.dozmod.thrift.Session;
@@ -42,6 +37,7 @@ public class ImageListViewer extends QLabel {
protected JTextField txtSearch;
protected JComboBox<FilterType> cboFilter;
protected JLabel imageCountLabel;
+ protected JCheckBox chkSearchInDescription;
// image table
protected ImageTable imageTable;
@@ -81,6 +77,15 @@ public class ImageListViewer extends QLabel {
ImageSummaryRead image = imageTable.getModelRow(entry.getIdentifier());
if (searchFieldPattern.matcher(image.imageName).find())
return true;
+ if (chkSearchInDescription.isSelected()) {
+ String description = image.description;
+ if (description != null) {
+ if (searchFieldPattern.matcher(description).find())
+ return true;
+ } else {
+ LOGGER.debug("Description is null: cannot be searched in description");
+ }
+ }
UserInfo user = UserCache.find(image.ownerId);
if (user == null)
return false;
@@ -95,11 +100,11 @@ public class ImageListViewer extends QLabel {
};
public static enum FilterType {
- ALL("Alle anzeigen"),
- OWN("Nur eigene/zugewiesene anzeigen"),
- USABLE("Nur verwendbare/linkbare anzeigen"),
- EDITABLE("Nur editierbare anzeigen"),
- TEMPLATES("Nur Vorlagen zeigen");
+ ALL(I18n.CONTROL.getString("ImageListViewer.FilterType.all")),
+ OWN(I18n.CONTROL.getString("ImageListViewer.FilterType.own")),
+ USABLE(I18n.CONTROL.getString("ImageListViewer.FilterType.usable")),
+ EDITABLE(I18n.CONTROL.getString("ImageListViewer.FilterType.editable")),
+ TEMPLATES(I18n.CONTROL.getString("ImageListViewer.FilterType.templates"));
private final String name;
@@ -121,7 +126,8 @@ public class ImageListViewer extends QLabel {
// the panel for the table and search field
// the search field and filter combo box
JPanel filterPanel = new JPanel();
- filterPanel.setBorder(new TitledBorder("Suchen"));
+ filterPanel.setBorder(new TitledBorder(
+ I18n.CONTROL.getString("ImageListViewer.TitledBorder.filterPanel.title")));
filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS));
txtSearch = new JTextField();
cboFilter = new JComboBox<FilterType>();
@@ -131,10 +137,15 @@ public class ImageListViewer extends QLabel {
filterPanel.add(txtSearch);
filterPanel.add(cboFilter);
+ // search in description
+ chkSearchInDescription = new JCheckBox(
+ I18n.CONTROL.getString("ImageListViewer.CheckBox.searchInDescription.text"));
+ filterPanel.add(chkSearchInDescription);
+
// Panel for itemCount
JPanel imageCountPanel = new JPanel();
imageCountLabel = new JLabel();
- imageCountPanel.add(new JLabel("Sichtbar:"));
+ imageCountPanel.add(new JLabel(I18n.CONTROL.getString("ImageListViewer.Label.imageCount.text")));
imageCountPanel.add(imageCountLabel);
filterPanel.add(imageCountPanel);
grid.add(filterPanel).fill(true, false).expand(true, false);
@@ -159,7 +170,7 @@ public class ImageListViewer extends QLabel {
searchFieldPattern = null;
} else {
try {
- searchFieldPattern = Pattern.compile(str, Pattern.CASE_INSENSITIVE);
+ searchFieldPattern = Pattern.compile(str, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
txtSearch.setForeground(UIManager.getColor("TextField.foreground"));
} catch (PatternSyntaxException ex) {
txtSearch.setForeground(Color.RED);
@@ -176,6 +187,13 @@ public class ImageListViewer extends QLabel {
}
});
cboFilter.setSelectedItem(defaultFilter == null ? FilterType.USABLE : defaultFilter);
+
+ chkSearchInDescription.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ applyFilterOnTable();
+ }
+ });
}
/**
@@ -255,8 +273,11 @@ public class ImageListViewer extends QLabel {
public ImageTable getImageTable() {
return imageTable;
}
+ public JComboBox getCboFilter() {
+ return cboFilter;
+ }
- protected void setImageCountLabel(int i) {
+ protected void setImageCountLabel(final int i) {
imageCountLabel.setText(Integer.toString(i));
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java
index 863028f0..706a7d13 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/LocationSelector.java
@@ -26,6 +26,7 @@ import org.openslx.dozmod.gui.changemonitor.AbstractControlWrapper;
import org.openslx.dozmod.gui.changemonitor.DialogChangeMonitor;
import org.openslx.dozmod.gui.control.JCheckBoxTree.CheckChangeEventListener;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.thrifthelper.Comparators;
@@ -70,9 +71,9 @@ public class LocationSelector extends JPanel {
*/
public LocationSelector() {
btnLimitToLocations = new JRadioButton(
- "Veranstaltung ausschließlich in den ausgewählten Räumen anzeigen");
+ I18n.CONTROL.getString("LocationSelector.RadioButton.limitToLocations.text"));
btnPrioritizeInLocations = new JRadioButton(
- "Veranstaltung mit höherer Priorität in den ausgewählten Räumen anzeigen");
+ I18n.CONTROL.getString("LocationSelector.RadioButton.prioritizeInLocations.text"));
btnPrioritizeInLocations.setSelected(true);
grpLocationExclusive = new ButtonGroup();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/PersonLabel.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/PersonLabel.java
index 7c53bf96..9148ea4b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/PersonLabel.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/PersonLabel.java
@@ -10,6 +10,7 @@ import javax.swing.UIManager;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.gui.helper.ColorUtil;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.util.FormatHelper;
import org.openslx.dozmod.util.DesktopEnvironment;
@@ -73,7 +74,7 @@ public class PersonLabel extends QLabel {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
setForeground(UIManager.getColor("Label.foreground"));
} else {
- setToolTipText("Klicken, um eine Mail an diese Person zu senden");
+ setToolTipText(I18n.CONTROL.getString("PersonLabel.Label.toolTipText"));
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
setForeground(linkColor);
}
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
new file mode 100644
index 00000000..170feba5
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ContainerBindMountTable.java
@@ -0,0 +1,28 @@
+package org.openslx.dozmod.gui.control.table;
+
+import org.openslx.dozmod.model.ContainerBindMount;
+
+import java.util.ArrayList;
+
+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("OPTIONS");
+
+ public ContainerBindMountTable() {
+ super(COL_SOURCE, COL_TARGET, COL_OPTIONS);
+ // init with empty data list
+ this.setData(new ArrayList<ContainerBindMount>(), false);
+ }
+
+ @Override protected Object getValueAtInternal(ContainerBindMount item, ListTableColumn column) {
+ if (COL_SOURCE == column)
+ return item.getSource();
+ if (COL_TARGET == column)
+ return item.getTarget();
+ if (COL_OPTIONS == column)
+ return item.getOptions();
+ throw new IndexOutOfBoundsException();
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java
index a2d99355..c539c751 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePermissionTable.java
@@ -2,17 +2,23 @@ package org.openslx.dozmod.gui.control.table;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.dozmod.gui.control.table.ImagePermissionTable.UserImagePermissions;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.cache.UserCache;
import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class ImagePermissionTable extends ListTable<UserImagePermissions> {
- public static final ListTableColumn COL_USER = new ListTableColumn("Benutzer");
- public static final ListTableColumn COL_LINK = new ListTableColumn("Verlinken", Boolean.class);
- public static final ListTableColumn COL_DOWNLOAD = new ListTableColumn("Download", Boolean.class);
- public static final ListTableColumn COL_EDIT = new ListTableColumn("Bearbeiten", Boolean.class);
- public static final ListTableColumn COL_ADMIN = new ListTableColumn("Admin", Boolean.class);
+ public static final ListTableColumn COL_USER = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePermissionTable.ListTableColumn.user.colName"));
+ public static final ListTableColumn COL_LINK = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePermissionTable.ListTableColumn.link.colName"), Boolean.class);
+ public static final ListTableColumn COL_DOWNLOAD = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePermissionTable.ListTableColumn.download.colName"), Boolean.class);
+ public static final ListTableColumn COL_EDIT = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePermissionTable.ListTableColumn.edit.colName"), Boolean.class);
+ public static final ListTableColumn COL_ADMIN = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePermissionTable.ListTableColumn.admin.colName"), Boolean.class);
public ImagePermissionTable() {
super(COL_USER, COL_LINK, COL_DOWNLOAD, COL_EDIT, COL_ADMIN);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePublishedTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePublishedTable.java
index c25748c1..49b125b8 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePublishedTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImagePublishedTable.java
@@ -4,6 +4,7 @@ import java.util.Comparator;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Sorters;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.dozmod.thrift.cache.OrganizationCache;
@@ -17,11 +18,17 @@ public class ImagePublishedTable extends ListTable<ImageSummaryRead> {
// public static final ListTableColumn COL_USABLE = new ListTableColumn("Verwendbar", Boolean.class);
// public static final ListTableColumn COL_SIZE = new ListTableColumn("Größe", Long.class);
// public static final ListTableColumn COL_LASTCHANGE = new ListTableColumn("Geändert", Long.class);
- public static final ListTableColumn COL_NAME = new ListTableColumn("Name");
- public static final ListTableColumn COL_OS = new ListTableColumn("OS", Integer.class, Sorters.osNameById);
- public static final ListTableColumn COL_OWNER = new ListTableColumn("Besitzer", Sorters.userNameById);
- public static final ListTableColumn COL_UPLOADER = new ListTableColumn("Hochgeladen von", Sorters.userNameById);
- public static final ListTableColumn COL_ORG = new ListTableColumn("Organisation");
+ public static final ListTableColumn COL_NAME = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePublishedTable.ListTableColumn.name.colName"));
+ public static final ListTableColumn COL_OS = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePublishedTable.ListTableColumn.OS.colName"),
+ Integer.class, Sorters.osNameById);
+ public static final ListTableColumn COL_OWNER = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePublishedTable.ListTableColumn.owner.colName"), Sorters.userNameById);
+ public static final ListTableColumn COL_UPLOADER = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePublishedTable.ListTableColumn.uploader.colName"), Sorters.userNameById);
+ public static final ListTableColumn COL_ORG = new ListTableColumn(
+ I18n.CONTROL.getString("ImagePublishedTable.ListTableColumn.organization.colName"));
public ImagePublishedTable() {
super(new Comparator<ImageSummaryRead>() {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java
index 8829876c..9bf9b59e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageTable.java
@@ -6,6 +6,7 @@ import javax.swing.Icon;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Sorters;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.dozmod.thrift.cache.UserCache;
@@ -14,17 +15,28 @@ import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class ImageTable extends ListTable<ImageSummaryRead> {
- public static final ListTableColumn COL_TEMPLATE = new ListTableColumn("Vorlage", Boolean.class);
- public static final ListTableColumn COL_USABLE = new ListTableColumn("Verwendbar", Boolean.class);
- public static final ListTableColumn COL_SIZE = new ListTableColumn("Größe", Long.class);
- public static final ListTableColumn COL_LASTCHANGE = new ListTableColumn("Geändert", Long.class);
- public static final ListTableColumn COL_EXPIRING = new ListTableColumn("Ablaufdatum", Long.class);
- public static final ListTableColumn COL_OWNER = new ListTableColumn("Besitzer", Sorters.userNameById);
- public static final ListTableColumn COL_OS = new ListTableColumn("OS", Integer.class, Sorters.osNameById);
- public static final ListTableColumn COL_NAME = new ListTableColumn("Name");
- public static final ListTableColumn COL_HYPERVISOR = new ListTableColumn("", Icon.class);
- public static final ListTableColumn COL_VERSIONCOUNT = new ListTableColumn("Versionen", Integer.class);
- public static final ListTableColumn COL_TOTALSIZE = new ListTableColumn("Gesamtgröße", Long.class);
+ public static final ListTableColumn COL_TEMPLATE = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.template.colName"), Boolean.class);
+ public static final ListTableColumn COL_USABLE = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.usable.colName"), Boolean.class);
+ public static final ListTableColumn COL_SIZE = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.size.colName"), Long.class);
+ public static final ListTableColumn COL_LASTCHANGE = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.lastChange.colName"), Long.class);
+ public static final ListTableColumn COL_EXPIRING = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.expiring.colName"), Long.class);
+ public static final ListTableColumn COL_OWNER = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.owner.colName"), Sorters.userNameById);
+ public static final ListTableColumn COL_OS = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.OS.colName"), Integer.class, Sorters.osNameById);
+ public static final ListTableColumn COL_NAME = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.name.colName"));
+ public static final ListTableColumn COL_HYPERVISOR = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.hypervisor.colName"), Icon.class);
+ public static final ListTableColumn COL_VERSIONCOUNT = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.versionCount.colName"), Integer.class);
+ public static final ListTableColumn COL_TOTALSIZE = new ListTableColumn(
+ I18n.CONTROL.getString("ImageTable.ListTableColumn.totalSize.colName"), Long.class);
public ImageTable() {
super(new Comparator<ImageSummaryRead>() {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageVersionTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageVersionTable.java
index f69d3c47..ff783370 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageVersionTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ImageVersionTable.java
@@ -1,18 +1,25 @@
package org.openslx.dozmod.gui.control.table;
import org.openslx.bwlp.thrift.iface.ImageVersionDetails;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.cache.UserCache;
import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class ImageVersionTable extends ListTable<ImageVersionDetails> {
- public static final ListTableColumn COL_CREATED = new ListTableColumn("Erstellungszeitpunkt", Long.class);
- public static final ListTableColumn COL_EXPIRING = new ListTableColumn("Ablaufszeitpunkt", Long.class);
- public static final ListTableColumn COL_UPLOADER = new ListTableColumn("Ersteller");
- public static final ListTableColumn COL_VALID = new ListTableColumn("Verwendbar", Boolean.class);
- public static final ListTableColumn COL_SIZE = new ListTableColumn("Größe", Long.class);
- public static final ListTableColumn COL_ID = new ListTableColumn("Interne ID");
+ public static final ListTableColumn COL_CREATED = new ListTableColumn(
+ I18n.CONTROL.getString("ImageVersionTable.ListTableColumn.created.colName"), Long.class);
+ public static final ListTableColumn COL_EXPIRING = new ListTableColumn(
+ I18n.CONTROL.getString("ImageVersionTable.ListTableColumn.expiring.colName"), Long.class);
+ public static final ListTableColumn COL_UPLOADER = new ListTableColumn(
+ I18n.CONTROL.getString("ImageVersionTable.ListTableColumn.uploader.colName"));
+ public static final ListTableColumn COL_VALID = new ListTableColumn(
+ I18n.CONTROL.getString("ImageVersionTable.ListTableColumn.valid.colName"), Boolean.class);
+ public static final ListTableColumn COL_SIZE = new ListTableColumn(
+ I18n.CONTROL.getString("ImageVersionTable.ListTableColumn.size.colName"), Long.class);
+ public static final ListTableColumn COL_ID = new ListTableColumn(
+ I18n.CONTROL.getString("ImageVersionTable.ListTableColumn.ID.colName"));
public ImageVersionTable() {
super(COL_CREATED, COL_EXPIRING, COL_UPLOADER, COL_VALID, COL_SIZE, COL_ID);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java
index eb7b71dc..f037263e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureLdapFilterTable.java
@@ -1,13 +1,17 @@
package org.openslx.dozmod.gui.control.table;
import org.openslx.bwlp.thrift.iface.LdapFilter;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public class LectureLdapFilterTable extends CheckListTable<LdapFilter> {
- public static final ListTableColumn COL_TITLE = new ListTableColumn("Name");
- public static final ListTableColumn COL_ATTRIBUTE = new ListTableColumn("Attribut");
- public static final ListTableColumn COL_VALUE = new ListTableColumn("Wert");
+ public static final ListTableColumn COL_TITLE = new ListTableColumn(
+ I18n.CONTROL.getString("LectureLdapFilterTable.ListTableColumn.title.colName"));
+ public static final ListTableColumn COL_ATTRIBUTE = new ListTableColumn(
+ I18n.CONTROL.getString("LectureLdapFilterTable.ListTableColumn.attribute.colName"));
+ public static final ListTableColumn COL_VALUE = new ListTableColumn(
+ I18n.CONTROL.getString("LectureLdapFilterTable.ListTableColumn.value.colName"));
public LectureLdapFilterTable() {
super(COL_TITLE, COL_ATTRIBUTE, COL_VALUE);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java
index 9d8bd2a3..294123f8 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LecturePermissionTable.java
@@ -2,15 +2,19 @@ package org.openslx.dozmod.gui.control.table;
import org.openslx.bwlp.thrift.iface.LecturePermissions;
import org.openslx.dozmod.gui.control.table.LecturePermissionTable.UserLecturePermissions;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.cache.UserCache;
import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class LecturePermissionTable extends ListTable<UserLecturePermissions> {
- public static final ListTableColumn COL_USER = new ListTableColumn("Benutzer");
- public static final ListTableColumn COL_EDIT = new ListTableColumn("Bearbeiten", Boolean.class);
- public static final ListTableColumn COL_ADMIN = new ListTableColumn("Admin", Boolean.class);
+ public static final ListTableColumn COL_USER = new ListTableColumn(
+ I18n.CONTROL.getString("LecturePermissionTable.ListTableColumn.user.colName"));
+ public static final ListTableColumn COL_EDIT = new ListTableColumn(
+ I18n.CONTROL.getString("LecturePermissionTable.ListTableColumn.edit.colName"), Boolean.class);
+ public static final ListTableColumn COL_ADMIN = new ListTableColumn(
+ I18n.CONTROL.getString("LecturePermissionTable.ListTableColumn.admin.colName"), Boolean.class);
public LecturePermissionTable() {
super(COL_USER, COL_EDIT, COL_ADMIN);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java
index 054e94fc..46cf9552 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/LectureTable.java
@@ -8,6 +8,7 @@ import javax.swing.UIManager;
import org.openslx.bwlp.thrift.iface.LectureSummary;
import org.openslx.dozmod.gui.helper.ColorUtil;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.Sorters;
import org.openslx.dozmod.thrift.cache.UserCache;
@@ -16,12 +17,18 @@ import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class LectureTable extends ListTable<LectureSummary> {
- public static final ListTableColumn COL_NAME = new ListTableColumn("Name");
- public static final ListTableColumn COL_OWNER = new ListTableColumn("Besitzer", Sorters.userNameById);
- public static final ListTableColumn COL_STARTTIME = new ListTableColumn("Startdatum", Long.class);
- public static final ListTableColumn COL_ENDTIME = new ListTableColumn("Ablaufdatum", Long.class);
- public static final ListTableColumn COL_ENABLED = new ListTableColumn("Aktiviert", Boolean.class);
- public static final ListTableColumn COL_VALID = new ListTableColumn("VM gültig", Boolean.class);
+ public static final ListTableColumn COL_NAME = new ListTableColumn(
+ I18n.CONTROL.getString("LectureTable.ListTableColumn.name.colName"));
+ public static final ListTableColumn COL_OWNER = new ListTableColumn(
+ I18n.CONTROL.getString("LectureTable.ListTableColumn.owner.colName"), Sorters.userNameById);
+ public static final ListTableColumn COL_STARTTIME = new ListTableColumn(
+ I18n.CONTROL.getString("LectureTable.ListTableColumn.startTime.colName"), Long.class);
+ public static final ListTableColumn COL_ENDTIME = new ListTableColumn(
+ I18n.CONTROL.getString("LectureTable.ListTableColumn.endTime.colName"), Long.class);
+ public static final ListTableColumn COL_ENABLED = new ListTableColumn(
+ I18n.CONTROL.getString("LectureTable.ListTableColumn.enabled.colName"), Boolean.class);
+ public static final ListTableColumn COL_VALID = new ListTableColumn(
+ I18n.CONTROL.getString("LectureTable.ListTableColumn.valid.colName"), Boolean.class);
private final Font boldFont;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ListTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ListTable.java
index 47062258..8ac6441d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ListTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/ListTable.java
@@ -20,6 +20,7 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableRowSorter;
+import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.helper.TableColumnAdjuster;
@SuppressWarnings("serial")
@@ -71,6 +72,9 @@ public abstract class ListTable<T> extends JTable {
this.setDefaultEditor(Boolean.class, getDefaultEditor(Boolean.class));
this.setRowSelectionAllowed(true);
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ this.setRowHeight(this.getRowHeight() * Config.getFontScaling() / 100);
+ this.setOpaque(false);
+
sorter.addRowSorterListener(new RowSorterListener() {
@Override
public void sorterChanged(RowSorterEvent e) {
@@ -101,14 +105,14 @@ public abstract class ListTable<T> extends JTable {
}
return itemList;
}
-
+
public T getSelectedItem() {
int rowIndex = getSelectedRow();
if (rowIndex == -1)
return null;
return getViewRow(rowIndex);
}
-
+
public List<T> getData() {
if (model.data == null)
return null;
@@ -192,11 +196,11 @@ public abstract class ListTable<T> extends JTable {
* Called when rendering a column is being prepared. This is a good time to
* change the color or font for the given cell.
*
- * @param component The component representing the cell being rendered
- * @param row item of the row being rendered
+ * @param component The component representing the cell being rendered
+ * @param row item of the row being rendered
* @param listTableColumn column (model-based) of the cell being rendered
- * @param isSelected whether the row is currently selected
- * @return
+ * @param isSelected whether the row is currently selected
+ * @return
*/
public Component prepareRenderHook(Component component, T row, ListTableColumn listTableColumn,
boolean isSelected) {
@@ -209,7 +213,7 @@ public abstract class ListTable<T> extends JTable {
* displayable item. By default this is the identity function, returning the
* value as-is.
*
- * @param value Value to render
+ * @param value Value to render
* @param column Column index (model-based) being rendered
* @return Rendered version of value. This should match the column class
*/
@@ -222,7 +226,8 @@ public abstract class ListTable<T> extends JTable {
Component c = super.prepareRenderer(renderer, row, column);
T item = getViewRow(row);
if (c != null && item != null) {
- c = prepareRenderHook(c, item, model.getColumn(convertColumnIndexToModel(column)), isRowSelected(row));
+ c = prepareRenderHook(c, item, model.getColumn(convertColumnIndexToModel(column)),
+ isRowSelected(row));
}
return c;
}
@@ -275,12 +280,12 @@ public abstract class ListTable<T> extends JTable {
break;
}
}
-
+
@Override
public boolean isCellEditable(int row, int col) {
return columns[col].column.isEditable;
}
-
+
@Override
public void setValueAt(Object aValue, int row, int col) {
if (isCellEditable(row, col)) {
@@ -319,7 +324,7 @@ public abstract class ListTable<T> extends JTable {
return null;
return table.getValueAtInternal(item, columns[columnIndex].column);
}
-
+
public T getModelRow(int rowIndex) {
return table.getModelRow(rowIndex);
}
@@ -354,6 +359,8 @@ public abstract class ListTable<T> extends JTable {
value = modelValueToDisplayFormat(value, model.getColumn(convertColumnIndexToModel(column)));
}
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ // If selected the row should be opaque. Otherwise the selection background is not shown.
+ setOpaque(isSelected);
setBorder(null);
return this;
}
@@ -367,7 +374,7 @@ public abstract class ListTable<T> extends JTable {
if (value != null) {
value = modelValueToDisplayFormat(value, model.getColumn(convertColumnIndexToModel(column)));
}
- setIcon((Icon)value);
+ setIcon((Icon) value);
return this;
}
}
@@ -389,8 +396,9 @@ public abstract class ListTable<T> extends JTable {
public ListTableColumn(String colName, Class<?> colClass, Comparator<?> sortComparator) {
this(colName, colClass, sortComparator, false);
}
-
- public ListTableColumn(String colName, Class<?> colClass, Comparator<?> sortComparator, boolean isEditable) {
+
+ public ListTableColumn(String colName, Class<?> colClass, Comparator<?> sortComparator,
+ boolean isEditable) {
this.isEditable = isEditable;
this.colName = colName;
this.colClass = colClass;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/NetshareTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/NetshareTable.java
index 30994eae..3eb56748 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/NetshareTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/NetshareTable.java
@@ -3,19 +3,25 @@ package org.openslx.dozmod.gui.control.table;
import org.openslx.bwlp.thrift.iface.NetShare;
import org.openslx.bwlp.thrift.iface.NetShareAuth;
import org.openslx.dozmod.gui.configurator.NetshareConfigurator;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Sorters;
import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class NetshareTable extends CheckListTable<NetShare> {
- public static final ListTableColumn COL_NAME = new ListTableColumn("Name");
- public static final ListTableColumn COL_MOUNT = new ListTableColumn("Ziel");
- public static final ListTableColumn COL_PATH = new ListTableColumn("Pfad");
- public static final ListTableColumn COL_AUTH = new ListTableColumn("Authentifizierung",
- Sorters.netShareAuth);
- public static final ListTableColumn COL_USER = new ListTableColumn("Username");
- public static final ListTableColumn COL_PASSWORD = new ListTableColumn("Passwort");
+ public static final ListTableColumn COL_NAME = new ListTableColumn(
+ I18n.CONTROL.getString("NetShareTable.ListTableColumn.name.colName"));
+ public static final ListTableColumn COL_MOUNT = new ListTableColumn(
+ I18n.CONTROL.getString("NetShareTable.ListTableColumn.mount.colName"));
+ public static final ListTableColumn COL_PATH = new ListTableColumn(
+ I18n.CONTROL.getString("NetShareTable.ListTableColumn.path.colName"));
+ public static final ListTableColumn COL_AUTH = new ListTableColumn(
+ I18n.CONTROL.getString("NetShareTable.ListTableColumn.auth.colName"), Sorters.netShareAuth);
+ public static final ListTableColumn COL_USER = new ListTableColumn(
+ I18n.CONTROL.getString("NetShareTable.ListTableColumn.user.colName"));
+ public static final ListTableColumn COL_PASSWORD = new ListTableColumn(
+ I18n.CONTROL.getString("NetShareTable.ListTableColumn.password.colName"));
public NetshareTable() {
super(COL_NAME, COL_PATH, COL_MOUNT, COL_AUTH, COL_USER, COL_PASSWORD);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/UserTable.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/UserTable.java
index b227916e..000384fa 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/UserTable.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/control/table/UserTable.java
@@ -1,13 +1,16 @@
package org.openslx.dozmod.gui.control.table;
import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.util.FormatHelper;
@SuppressWarnings("serial")
public class UserTable extends ListTable<UserInfo> {
- public static final ListTableColumn COL_NAME = new ListTableColumn("Name");
- public static final ListTableColumn COL_MAIL = new ListTableColumn("Mail");
+ public static final ListTableColumn COL_NAME = new ListTableColumn(
+ I18n.CONTROL.getString("UserTable.ListTableColumn.name.colName"));
+ public static final ListTableColumn COL_MAIL = new ListTableColumn(
+ I18n.CONTROL.getString("UserTable.ListTableColumn.mail.colName"));
public UserTable() {
super(COL_NAME, COL_MAIL);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ExpiryDateChooser.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ExpiryDateChooser.java
index d77e6f9a..855757f9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ExpiryDateChooser.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ExpiryDateChooser.java
@@ -58,11 +58,11 @@ class ExpiryDateChooserWindow extends JPanel {
private final GridManager grdPane = new GridManager(pane, 3, true);
private final JSlider sldDaysToExtend = new JSlider(JSlider.HORIZONTAL);
private final QLabel lblNewDate = new QLabel();
- private final QLabel lblNewDateLabel = new QLabel("Neues Ablaufdatum: ");
+ private final QLabel lblNewDateLabel = new QLabel(I18n.HELPER.getString("ExpiryDateChooser.Label.newDate.text"));
private final Component parent;
public ExpiryDateChooserWindow(final Component parent) {
this.parent = parent;
- grdPane.add(new QLabel("Geben Sie ein um wieviele Tage diese Version(en) verlängert werden soll:"), 3)
+ grdPane.add(new QLabel(I18n.HELPER.getString("ExpiryDateChooser.Label.daysToExtend.text")), 3)
.fill(true, true)
.expand(true, true);
grdPane.nextRow();
@@ -91,8 +91,8 @@ class ExpiryDateChooserWindow extends JPanel {
}
});
sldDaysToExtend.setValue(DEFAULT_EXTENSION_DURATION);
- int ret = JOptionPane.showConfirmDialog(parent, pane, "Ablaufdatum verlängern",
- JOptionPane.OK_CANCEL_OPTION);
+ int ret = JOptionPane.showConfirmDialog(parent, pane,
+ I18n.HELPER.getString("ExpiryDateChooser.ConfirmDialog.ret.title"), JOptionPane.OK_CANCEL_OPTION);
if (ret != 0)
return -1;
return sldDaysToExtend.getValue();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java
new file mode 100644
index 00000000..7c76d870
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/I18n.java
@@ -0,0 +1,53 @@
+package org.openslx.dozmod.gui.helper;
+
+import org.apache.log4j.Logger;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+/**
+ * Helper enum for loading resource bundle files and getting values from them.
+ */
+public enum I18n {
+ ACTIVITY("activity"),
+ APP("app"),
+ CONFIGURATOR("configurator"),
+ CONTROL("control"),
+ HELPER("helper"),
+ GUI("gui"),
+ PAGE("page"),
+ PAGE_LAYOUT("page_layout"),
+ THRIFT("thrift"),
+ WINDOW("window"),
+ WINDOW_LAYOUT("window_layout"),
+ WIZARD("wizard");
+
+ /**
+ * Logger for this class
+ */
+ private final static Logger LOGGER = Logger.getLogger(I18n.class);
+
+ private final ResourceBundle resourceBundle;
+
+ I18n(String bundleFilename) {
+ String baseName = "i18n." + bundleFilename;
+ resourceBundle = ResourceBundle.getBundle(baseName, new UTF8Control());
+ }
+
+ /**
+ * Returns i18n value for a given key and format the output at the appropriate places for (a) given parameter(s).
+ * If no value found for the given key, return the key.
+ * @param key to get value
+ * @param params to get formatted output
+ * @return value represented by key or key on error
+ */
+ public String getString(String key, Object... params) {
+ try {
+ String value = resourceBundle.getString(key);
+ return MessageFormat.format(value, params);
+ } catch (Exception e) {
+ LOGGER.error("Could not find a value for the given key: " + key);
+ return key;
+ }
+ }
+} \ No newline at end of file
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/Language.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/Language.java
new file mode 100644
index 00000000..d038f292
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/Language.java
@@ -0,0 +1,18 @@
+package org.openslx.dozmod.gui.helper;
+
+/**
+ * List of available languages as an enum.
+ */
+public enum Language {
+ DE_DE(I18n.HELPER.getString("Language.german"), "de_DE"),
+ EN_US(I18n.HELPER.getString("Language.english"), "en_US"),
+ TR_TR(I18n.HELPER.getString("Language.turkish"), "tr_TR");
+
+ public final String displayName;
+ public final String value;
+
+ Language(String name, String value) {
+ this.displayName = name;
+ this.value = value;
+ }
+} \ No newline at end of file
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java
index 4ac0fbc8..0e0d2dc8 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/MessageType.java
@@ -5,13 +5,13 @@ import javax.swing.JOptionPane;
import org.apache.log4j.Level;
public enum MessageType {
- DEBUG(JOptionPane.INFORMATION_MESSAGE, -1, "Debug", Level.DEBUG),
- INFO(JOptionPane.INFORMATION_MESSAGE, -1, "Hinweis", Level.INFO),
- WARNING(JOptionPane.WARNING_MESSAGE, -1, "Warnung", Level.WARN),
- WARNING_RETRY(JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "Fehler", Level.ERROR),
- ERROR(JOptionPane.ERROR_MESSAGE, -1, "Fehler", Level.ERROR),
- ERROR_RETRY(JOptionPane.ERROR_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "Fehler", Level.ERROR),
- QUESTION_YESNO(JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, "Frage", Level.INFO);
+ DEBUG(JOptionPane.INFORMATION_MESSAGE, -1, I18n.HELPER.getString("MessageType.debug"), Level.DEBUG),
+ INFO(JOptionPane.INFORMATION_MESSAGE, -1, I18n.HELPER.getString("MessageType.info"), Level.INFO),
+ WARNING(JOptionPane.WARNING_MESSAGE, -1, I18n.HELPER.getString("MessageType.warning"), Level.WARN),
+ WARNING_RETRY(JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, I18n.HELPER.getString("MessageType.warningRetry"), Level.ERROR),
+ ERROR(JOptionPane.ERROR_MESSAGE, -1, I18n.HELPER.getString("MessageType.error"), Level.ERROR),
+ ERROR_RETRY(JOptionPane.ERROR_MESSAGE, JOptionPane.OK_CANCEL_OPTION, I18n.HELPER.getString("MessageType.errorRetry"), Level.ERROR),
+ QUESTION_YESNO(JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, I18n.HELPER.getString("MessageType.questionYesNo"), Level.INFO);
public final String title;
public final int optionPaneId;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UTF8Control.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UTF8Control.java
new file mode 100644
index 00000000..2f759323
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/UTF8Control.java
@@ -0,0 +1,54 @@
+package org.openslx.dozmod.gui.helper;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
+import java.util.Locale;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+
+/**
+ * Custom ResourceBundle.Control class to read properties files as UTF-8, where usually ISO-8859-1 is default.
+ */
+public class UTF8Control extends ResourceBundle.Control {
+
+ @Override
+ public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)
+ throws IllegalAccessException, InstantiationException, IOException {
+ if (!format.equals("java.properties")) {
+ return super.newBundle(baseName, locale, format, loader, reload);
+ }
+
+ String bundleName = toBundleName(baseName, locale);
+ String resourceName = toResourceName(bundleName, "properties");
+
+ ResourceBundle bundle = null;
+ InputStream stream = null;
+
+ if (reload) {
+ URL url = loader.getResource(resourceName);
+ if (url != null) {
+ URLConnection connection = url.openConnection();
+ if (connection != null) {
+ connection.setUseCaches(false);
+ stream = connection.getInputStream();
+ }
+ }
+ } else {
+ stream = loader.getResourceAsStream(resourceName);
+ }
+
+ if (stream != null) {
+ try {
+ bundle = new PropertyResourceBundle(new InputStreamReader(stream, StandardCharsets.UTF_8));
+ } finally {
+ stream.close();
+ }
+ }
+
+ return bundle;
+ }
+} \ No newline at end of file
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/BwIdmLinkWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/BwIdmLinkWindow.java
index d24378ab..04fc2beb 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/BwIdmLinkWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/BwIdmLinkWindow.java
@@ -21,6 +21,7 @@ import org.openslx.dozmod.Branding;
import org.openslx.dozmod.authentication.ShibbolethEcp;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.util.DesktopEnvironment;
@@ -29,11 +30,6 @@ import org.openslx.dozmod.util.DesktopEnvironment;
*/
@SuppressWarnings("serial")
public class BwIdmLinkWindow extends JDialog implements UiFeedback {
- private static final String title = "Registrierung erforderlich";
- private static final String infoText = "<html><body style='width:100%'>"
- + "Sie sind nicht bei " + Branding.getServiceName() + " registriert. "
- + "Bitte rufen Sie die angegebene Seite auf um sich zu registrieren und versuchen Sie es erneut."
- + "</body></html>";
protected JButton btnLink;
protected JButton OkButton;
@@ -44,8 +40,8 @@ public class BwIdmLinkWindow extends JDialog implements UiFeedback {
* Don't use this, use static function open instead!
*/
public BwIdmLinkWindow(Frame modalParent) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW.getString("BwIdmLink.Dialog.title"),
+ modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
final BwIdmLinkWindow me = this;
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
@@ -57,13 +53,13 @@ public class BwIdmLinkWindow extends JDialog implements UiFeedback {
GridManager grid = new GridManager(contentPanel, 1);
// infotext
- JLabel infoLabel = new JLabel(infoText);
- infoLabel.setBorder(BorderFactory.createTitledBorder("Hinweis"));
+ JLabel infoLabel = new JLabel(I18n.WINDOW.getString("BwIdmLink.Label.info.text", Branding.getServiceName()));
+ infoLabel.setBorder(BorderFactory.createTitledBorder(I18n.WINDOW.getString("BwIdmLink.Label.info.title")));
grid.add(infoLabel).fill(true, true).expand(true, true).anchor(GridBagConstraints.CENTER);
grid.nextRow();
// button for opening the link
- btnLink = new JButton("Seite im Browser öffnen");
+ btnLink = new JButton(I18n.WINDOW.getString("BwIdmLink.Button.link.text"));
btnLink.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -92,7 +88,7 @@ public class BwIdmLinkWindow extends JDialog implements UiFeedback {
bottomPane.add(Box.createHorizontalGlue());
// close/ok button
- OkButton = new JButton("Schließen");
+ OkButton = new JButton(I18n.WINDOW.getString("BwIdmLink.Button.ok.text"));
OkButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
index c8c0d9d0..15d26b92 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ConfigWindow.java
@@ -18,6 +18,8 @@ import org.openslx.dozmod.Config;
import org.openslx.dozmod.Config.ProxyMode;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
+import org.openslx.dozmod.gui.helper.I18n;
+import org.openslx.dozmod.gui.helper.Language;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.ConfigWindowLayout;
@@ -66,7 +68,7 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
chkSendMeMail.setSelected(false);
}
chkSendMeMail.addActionListener(this);
- lblYourAddress.setText("Ihre Adresse ist " + Session.getEMail());
+ lblYourAddress.setText(I18n.WINDOW.getString("Config.Label.yourAddress.text", Session.getEMail()));
}
// -- END USER CONFIG --
@@ -112,6 +114,15 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
sldConnections.setValue(Config.getTransferConnectionCount());
sldConnections.addChangeListener(changeListener);
+ // Language
+ for (Language language : Language.values()) {
+ if (language.value.equals(Config.getPreferredLanguage())) {
+ cboLanguage.setSelectedItem(language);
+ break;
+ }
+ }
+ cboLanguage.addActionListener(this);
+
// -- BOTTOM BUTTONS --
btnSave.addActionListener(this);
btnClose.addActionListener(this);
@@ -123,7 +134,7 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == btnProxyAuto || source == btnProxyHttp || source == btnProxyNone
- || source == btnProxySocks || source == chkSendMeMail) {
+ || source == btnProxySocks || source == chkSendMeMail || source == cboLanguage) {
reactToInput();
}
if (source == btnSave) {
@@ -140,6 +151,7 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
// first check our initial state
ProxyMode initMode = Config.getProxyMode();
int fontScaling = Config.getFontScaling();
+ Language newLanguage = (Language)cboLanguage.getSelectedItem();
// now check if the buttons represent another state
if (btnProxyNone.isSelected() && initMode != ProxyMode.NONE) {
@@ -154,6 +166,8 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
changed = true;
} else if (!selectedLookAndFeel.getToolTipText().equals(Config.getLookAndFeel())) {
changed = true;
+ } else if (!newLanguage.value.equals(Config.getPreferredLanguage())) {
+ changed = true;
}
// en/disable the save button
@@ -167,7 +181,7 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
userConfig = ThriftManager.getSatClient().getUserConfig(Session.getSatelliteToken());
} catch (TException e) {
ThriftError.showMessage(this, LOGGER, e,
- "Konnte die benutzerspezifische Konfiguration nicht vom Satelliten holen");
+ I18n.WINDOW.getString("Config.Message.error.couldNotGetUserConfFromSat"));
}
return userConfig;
}
@@ -181,7 +195,7 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
userConfig = config;
} catch (TException e) {
ThriftError.showMessage(this, LOGGER, e,
- "Konnte die benutzerspezifische Konfiguration nicht auf dem Satelliten speichern");
+ I18n.WINDOW.getString("Config.Message.error.couldNotSaveUserConfOnSat"));
return false;
}
return true;
@@ -221,9 +235,14 @@ public class ConfigWindow extends ConfigWindowLayout implements UiFeedback, Acti
Config.setLookAndFeel(selectedLookAndFeel.getToolTipText());
}
+ // save language
+ Language newLanguage = (Language)cboLanguage.getSelectedItem();
+ restartRequired = restartRequired || !newLanguage.value.equals(Config.getPreferredLanguage());
+ Config.setPreferredLanguage(newLanguage.value);
+
if (restartRequired) {
// let the user know he needs to restart for the changes to apply
- Gui.showMessageBox(this, "Die Änderungen werden erst nach einem Programmneustart wirksam.",
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Config.Message.info.restartNeededToApplyChanges"),
MessageType.INFO, null, null);
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ContainerBindMountWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ContainerBindMountWindow.java
new file mode 100644
index 00000000..a7c141fb
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ContainerBindMountWindow.java
@@ -0,0 +1,78 @@
+package org.openslx.dozmod.gui.window;
+
+import org.openslx.dozmod.gui.control.table.ContainerBindMountTable;
+import org.openslx.dozmod.gui.helper.TextChangeListener;
+import org.openslx.dozmod.gui.window.layout.ContainerBindMountWindowLayout;
+import org.openslx.dozmod.model.ContainerBindMount;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContainerBindMountWindow extends ContainerBindMountWindowLayout {
+
+ private ContainerBindMountTable bindMountTable;
+
+ public ContainerBindMountWindow(Window modalParent, ContainerBindMountTable bindMountTable) {
+ super(modalParent);
+
+ this.bindMountTable = bindMountTable;
+
+ this.btnSave.setEnabled(false);
+ this.btnSave.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ saveEntry();
+ }
+ });
+ this.btnCancel.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ dispose();
+ }
+ });
+ this.txtBmSource.getDocument().addDocumentListener(new TextChangeListener() {
+ @Override public void changed() {
+ isInputComplete();
+ }
+ });
+ this.txtBmTarget.getDocument().addDocumentListener(new TextChangeListener() {
+ @Override public void changed() {
+ isInputComplete();
+ }
+ });
+
+ }
+
+ // TODO add text if input not finished
+ private boolean isInputComplete() {
+ btnSave.setEnabled(false);
+ if (txtBmSource == null || txtBmSource.getText().isEmpty())
+ return false;
+ if (txtBmTarget == null || txtBmTarget.getText().isEmpty()) {
+ return false;
+ }
+ btnSave.setEnabled(true);
+ return true;
+ }
+
+ private void saveEntry() {
+ ContainerBindMount bindMount = new ContainerBindMount();
+ bindMount.setSource(this.txtBmSource.getText());
+ bindMount.setTarget(this.txtBmTarget.getText());
+ bindMount.setOptions(this.txtBmOptions.getText());
+
+ List<ContainerBindMount> oldData = bindMountTable.getData();
+ List<ContainerBindMount> data = new ArrayList<>(oldData);
+
+ data.add(bindMount);
+ bindMountTable.setData(data, true);
+ dispose();
+ }
+
+ public static void open(Window modalParent, ContainerBindMountTable bindMountTable) {
+ ContainerBindMountWindow win = new ContainerBindMountWindow(modalParent, bindMountTable);
+ win.setVisible(true);
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
index 94492d7f..09b22948 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/GenericNoticeWindow.java
@@ -13,6 +13,7 @@ import javax.swing.JScrollBar;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.GenericNoticeWindowLayout;
@@ -50,7 +51,7 @@ public abstract class GenericNoticeWindow extends GenericNoticeWindowLayout impl
});
if (!shouldBeShown) {
chkAgreeBox.setVisible(false);
- btnContinue.setText("Schließen");
+ btnContinue.setText(I18n.WINDOW.getString("GenericNotice.Button.continue.text"));
btnContinue.setEnabled(true);
} else {
disclaimerPanel.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
@@ -86,10 +87,8 @@ public abstract class GenericNoticeWindow extends GenericNoticeWindowLayout impl
*/
private void closeWindow() {
if (shouldBeShown) {
- if (Gui.showMessageBox(me,
- "Wenn diesen rechtlichen Hinweis nicht akzeptieren, können Sie die Software nicht verwenden! "
- + "Sind Sie sicher, dass sie abbrechen wollen?", MessageType.QUESTION_YESNO,
- LOGGER, null)) {
+ if (Gui.showMessageBox(me, I18n.WINDOW.getString("GenericNotice.Message.yesNo.closeWindow"),
+ MessageType.QUESTION_YESNO, LOGGER, null)) {
System.exit(ABORT);
}
} else {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
index f237e8bc..93d9d204 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
@@ -1,5 +1,7 @@
package org.openslx.dozmod.gui.window;
+import java.awt.*;
+import java.awt.event.*;
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@@ -15,12 +17,8 @@ import java.awt.event.WindowEvent;
import java.beans.Encoder;
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
+import java.util.*;
import java.util.List;
-import java.util.Map;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -40,31 +38,22 @@ import javax.swing.text.html.HTMLEditorKit;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
-import org.openslx.bwlp.thrift.iface.ImageBaseWrite;
-import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
-import org.openslx.bwlp.thrift.iface.ImagePermissions;
-import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
-import org.openslx.bwlp.thrift.iface.ImageVersionDetails;
-import org.openslx.bwlp.thrift.iface.LectureSummary;
-import org.openslx.bwlp.thrift.iface.OperatingSystem;
-import org.openslx.bwlp.thrift.iface.ShareMode;
-import org.openslx.bwlp.thrift.iface.UserInfo;
-import org.openslx.bwlp.thrift.iface.Virtualizer;
+import org.openslx.bwlp.thrift.iface.*;
import org.openslx.dozmod.Branding;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.changemonitor.AbstractControlWrapper;
import org.openslx.dozmod.gui.changemonitor.DialogChangeMonitor;
import org.openslx.dozmod.gui.changemonitor.DialogChangeMonitor.TextNotEmptyConstraint;
-import org.openslx.dozmod.gui.helper.DateTimeHelper;
-import org.openslx.dozmod.gui.helper.ExpiryDateChooser;
-import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.PopupMenu;
-import org.openslx.dozmod.gui.helper.UiFeedback;
+import org.openslx.dozmod.gui.helper.*;
import org.openslx.dozmod.gui.window.UserListWindow.UserAddedCallback;
import org.openslx.dozmod.gui.window.layout.ImageDetailsWindowLayout;
import org.openslx.dozmod.gui.wizard.ImageUpdateWizard;
import org.openslx.dozmod.gui.wizard.LectureWizard;
+import org.openslx.dozmod.model.ContainerBuildContextMethod;
+import org.openslx.dozmod.model.ContainerDefinition;
+import org.openslx.dozmod.model.ContainerMeta;
import org.openslx.dozmod.permissions.ImagePerms;
import org.openslx.dozmod.thrift.ImageDetailsActions;
import org.openslx.dozmod.thrift.Session;
@@ -86,11 +75,18 @@ import org.openslx.util.QuickTimer.Task;
import org.openslx.util.ThriftUtil;
import org.openslx.util.Util;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.*;
+
/**
* Window for displaying and editing the details of an image.
*/
-@SuppressWarnings("serial")
-public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFeedback {
+@SuppressWarnings("serial") public class ImageDetailsWindow extends ImageDetailsWindowLayout
+ implements UiFeedback {
private static final Logger LOGGER = Logger.getLogger(ImageDetailsWindow.class);
@@ -135,21 +131,23 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
/**
* Popup menu items
*/
- private final JMenuItem mnuNewLecture = new JMenuItem("Neue Veranstaltung");
- private final JMenuItem mnuDownload = new JMenuItem("Download");
- private final JMenuItem mnuVmConfig = new JMenuItem("VM-Konfiguration");
- private final JMenuItem mnuDelete = new JMenuItem("Löschen");
- private final JMenuItem mnuExtendExpiryDate = new JMenuItem("Ablaufzeitpunkt verlängern");
+ private final JMenuItem mnuNewLecture = new JMenuItem(I18n.WINDOW.getString("ImageDetails.MenuItem.newLecture.text"));
+ private final JMenuItem mnuDownload = new JMenuItem(I18n.WINDOW.getString("ImageDetails.MenuItem.download.text"));
+ private final JMenuItem mnuVmConfig = new JMenuItem(I18n.WINDOW.getString("ImageDetails.MenuItem.vmConfig.text"));
+ private final JMenuItem mnuDelete = new JMenuItem(I18n.WINDOW.getString("ImageDetails.MenuItem.delete.text"));
+ private final JMenuItem mnuExtendExpiryDate = new JMenuItem(I18n.WINDOW.getString("ImageDetails.MenuItem.extendExpirationDate.text"));
private DialogChangeMonitor changeMonitor;
private AbstractControlWrapper<?> changeListenerPermissions;
+ private ContainerDefinition containerDefinition = new ContainerDefinition();
+
/**
* Constructor
- *
+ *
* @param modalParent parent of this popup window
- * @param callback callback to be called when the image details have changed
+ * @param callback callback to be called when the image details have changed
*/
public ImageDetailsWindow(Frame modalParent, ImageUpdatedCallback callback,
ImageDetailsActions actionHandler) {
@@ -159,15 +157,13 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
// Set up change monitor
changeMonitor = new DialogChangeMonitor(new DialogChangeMonitor.Callback() {
- @Override
- public void validityChanged(String errorMessage) {
+ @Override public void validityChanged(String errorMessage) {
lblError.setText(errorMessage);
btnSaveChanges.setEnabled(changeMonitor.isValid() && changeMonitor.wasEverModified());
LOGGER.info("Valid: " + changeMonitor.isValid());
}
- @Override
- public void modificationChanged() {
+ @Override public void modificationChanged() {
btnSaveChanges.setEnabled(changeMonitor.isValid() && changeMonitor.wasEverModified());
LOGGER.info("Changed: " + changeMonitor.isCurrentlyModified());
}
@@ -175,45 +171,40 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
// Hook when user presses X (top right)
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent e) {
+ @Override public void windowClosing(WindowEvent e) {
safeClose();
}
});
- /**
+
+ /*
* Button listeners
*/
btnClose.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(ActionEvent e) {
safeClose();
}
});
btnSaveChanges.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(ActionEvent e) {
saveChanges();
}
});
btnUpdateImage.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(ActionEvent e) {
// FIXME: This will always discard all changes even if you cancel right away
new ImageUpdateWizard(me, image).setVisible(true);
- refresh(true);
+ refresh();
}
});
btnUploadToMaster.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(ActionEvent e) {
uploadToMaster();
}
});
btnShowLinkingLectures.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(ActionEvent e) {
if (safeClose()) {
LectureListWindow page = MainWindow.showPage(LectureListWindow.class);
page.filterByImageBaseId(image.imageBaseId);
@@ -223,20 +214,17 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
});
btnChangeOwner.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(ActionEvent e) {
UserListWindow.open(me, new UserAddedCallback() {
- @Override
- public void userAdded(UserInfo user, UserListWindow window) {
+ @Override public void userAdded(UserInfo user, UserListWindow window) {
window.dispose();
if (Gui.showMessageBox(me,
- "Sind Sie sicher, dass sie die Besitzerrechte an "
- + "einen anderen Benutzer übertragen wollen?",
+ I18n.WINDOW.getString("ImageDetails.Message.yesNo.changeOwner"),
MessageType.QUESTION_YESNO, LOGGER, null))
setImageOwner(user);
}
- }, "Besitzer festlegen", image.ownerId);
+ }, I18n.WINDOW.getString("ImageDetails.Button.changeOwner.caption"), image.ownerId);
}
});
@@ -338,7 +326,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
tblVersions.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- /**
+ /*
* Popup menu for the version table on the right side
*/
final PopupMenu pop = new PopupMenu(new ActionListener() {
@@ -348,7 +336,8 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
return;
if (e.getSource().equals(mnuNewLecture)) {
ImageSummaryRead summary = new ImageSummaryRead();
- summary.setImageName(image.getImageName()); // Maybe create a helper class/function some day that transforms all fields
+ summary.setImageName(
+ image.getImageName()); // Maybe create a helper class/function some day that transforms all fields
new LectureWizard(me, summary, selected.getVersionId()).setVisible(true);
}
if (e.getSource().equals(mnuDownload)) {
@@ -381,25 +370,22 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
tblVersions.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete");
tblVersions.getActionMap().put("delete", new AbstractAction() {
- @Override
- public void actionPerformed(ActionEvent ae) {
+ @Override public void actionPerformed(ActionEvent ae) {
if (ImagePerms.canEdit(image)) {
deleteVersions(tblVersions.getSelectedItems());
}
}
});
- /**
+ /*
* Mouse adapter for the version table
*/
final MouseAdapter ma = new MouseAdapter() {
- @Override
- public void mousePressed(MouseEvent e) {
+ @Override public void mousePressed(MouseEvent e) {
processClick(e);
}
- @Override
- public void mouseReleased(MouseEvent e) {
+ @Override public void mouseReleased(MouseEvent e) {
processClick(e);
}
@@ -428,11 +414,13 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
mnuNewLecture.setEnabled(
!multiSelection && selectedVersion.isValid && ImagePerms.canLink(image));
mnuDownload.setEnabled(!multiSelection && ImagePerms.canDownload(image));
- mnuVmConfig.setEnabled(!multiSelection && selectedVersion.isValid
- && ImagePerms.canEdit(image)); // Allow VMX edition for downloaded VMs for now
+ mnuVmConfig.setEnabled(
+ !multiSelection && selectedVersion.isValid && ImagePerms.canEdit(
+ image)); // Allow VMX edition for downloaded VMs for now
mnuDelete.setEnabled(ImagePerms.canEdit(image));
- mnuExtendExpiryDate.setEnabled(!multiSelection && (selectedVersion.isValid
- || Session.hasFeature(Feature.EXTEND_EXPIRED_VM)));
+ mnuExtendExpiryDate.setEnabled(
+ !multiSelection && (selectedVersion.isValid || Session.hasFeature(
+ Feature.EXTEND_EXPIRED_VM)));
pop.show(e.getComponent(), e.getX(), e.getY());
}
}
@@ -443,16 +431,18 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
tblVersions.addMouseListener(ma);
// add controls to change monitor to handle user actions
- changeMonitor.add(txtTitle).addConstraint(new TextNotEmptyConstraint("Name darf nicht leer sein"));
- changeMonitor.add(txtDescription)
- .addConstraint(new TextNotEmptyConstraint("Beschreibung darf nicht leer sein"));
+ changeMonitor.add(txtTitle).addConstraint(new TextNotEmptyConstraint(
+ I18n.WINDOW.getString("ImageDetails.TextField.title.error")));
+ changeMonitor.add(txtDescription).addConstraint(new TextNotEmptyConstraint(
+ I18n.WINDOW.getString("ImageDetails.TextField.description.error")));
changeMonitor.add(txtTags);
changeMonitor.addFixedCombo(cboOperatingSystem, Comparators.operatingSystem)
.addConstraint(new DialogChangeMonitor.ValidationConstraint<OperatingSystem>() {
public String checkStateValid(OperatingSystem userInput) {
- if (userInput != null && MetaDataCache.getOsById(userInput.osId) != null) // validating OS coming from the cache makes no sense?
+ if (userInput != null && MetaDataCache.getOsById(userInput.osId)
+ != null) // validating OS coming from the cache makes no sense?
return null;
- return "Ungültiges Betriebssystem ausgewählt!";
+ return I18n.WINDOW.getString("ImageDetails.ComboBox.OS.error");
}
});
changeMonitor.addFixedCombo(cboShareMode, null)
@@ -460,7 +450,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
public String checkStateValid(ShareMode userInput) {
if (userInput != null)
return null;
- return "Ungültiges Betriebssystem ausgewählt!";
+ return I18n.WINDOW.getString("ImageDetails.ComboBox.shareMode.error");
}
});
changeMonitor.add(chkIsTemplate);
@@ -472,8 +462,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
// update default permissions hook for the permission configurator to apply to newly added users
final ItemListener updateDefaultPermissionsListener = new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
+ @Override public void itemStateChanged(ItemEvent e) {
if (e.getSource() == chkDefaultPermLink)
image.defaultPermissions.link = chkDefaultPermLink.isSelected();
if (e.getSource() == chkDefaultPermDownload)
@@ -489,7 +478,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
chkDefaultPermEdit.addItemListener(updateDefaultPermissionsListener);
chkDefaultPermAdmin.addItemListener(updateDefaultPermissionsListener);
- /**
+ /*
* Initial state of GUI elements
*/
setFocusable(true);
@@ -507,8 +496,7 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
QuickTimer.scheduleOnce(new Task() {
ByteBuffer machineDescription = null;
- @Override
- public void fire() {
+ @Override public void fire() {
try {
machineDescription = ThriftManager.getSatClient()
.getImageVersionVirtConfig(Session.getSatelliteToken(), selected.versionId);
@@ -518,11 +506,11 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
return;
}
Gui.asyncExec(new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
if (machineDescription == null) {
- Gui.showMessageBox("Konnte VM-Konfiguration nicht abrufen.", MessageType.ERROR, LOGGER,
- null);
+ Gui.showMessageBox(
+ I18n.WINDOW.getString("ImageDetails.Message.error.couldNotRetrieveVMConfig"),
+ MessageType.ERROR, LOGGER, null);
return;
}
@@ -540,15 +528,55 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
});
}
+ /**
+ * Uploads ByteBuffer data to satellite server and stores it in ImageVersion.VirtConfig
+ * for the given imageVersionId.
+ *
+ * @param imageVersionId Id of the image version, which will be updated.
+ * @param data New virtConfig to store in database.
+ */
+ private void uploadContainerDef(final String imageVersionId, ByteBuffer data) {
+
+ try {
+ ThriftManager.getSatClient()
+ .setImageVersionVirtConfig(Session.getSatelliteToken(), imageVersionId, data);
+ } catch (TException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Loads binary file ImageVersion.VirtConfig from the Satellites Database.
+ *
+ * @param selected the selected Image Version. TODO: For now only just the latest Version.
+ */
+ private byte[] loadContainerDef(final ImageVersionDetails selected) {
+
+ byte[] rawVirtConfig = null;
+
+ try {
+ ByteBuffer byteBuffer = ThriftManager.getSatClient()
+ .getImageVersionVirtConfig(Session.getSatelliteToken(), selected.versionId);
+ rawVirtConfig = ThriftUtil.unwrapByteBuffer(byteBuffer);
+
+ } catch (TException e) {
+ LOGGER.error(
+ "Failed to retrieve virtualizer config for image version " + "'" + image.latestVersionId
+ + ", see trace: ", e);
+ }
+ return rawVirtConfig;
+ }
+
/********************************************************************************
- *
+ *
* Helper triggering the actual thrift calls
- *
+ *
********************************************************************************/
/**
- * Sets the image to the given imageBaseId. This will also trigger fill() which
- * will set the image details fields to the values represented by this image.
- *
+ * Sets the image to the given imageBaseId. This will also trigger fill()
+ * which will set the image details fields to the values represented by this
+ * image.
+ *
* @param imageBaseId the id of the image to be displayed
*/
public void setImage(final String imageBaseId) {
@@ -579,17 +607,18 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
/**
* Sets the owner of the selected image to the given user.
- *
+ *
* @param user UserInfo to set the owner to
*/
private void setImageOwner(final UserInfo user) {
if (!actionHandler.setImageOwner(image.getImageBaseId(), user)) {
return;
}
- Gui.showMessageBox(me, "Besitzrechte übertragen an " + FormatHelper.userName(user), MessageType.INFO, null,
- null);
+ Gui.showMessageBox(me,
+ I18n.WINDOW.getString("ImageDetails.Message.info.setImageOwner", FormatHelper.userName(user)),
+ MessageType.INFO, null, null);
makeEditable(false);
- refresh(true);
+ refresh();
}
/**
@@ -600,13 +629,13 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
// 04.2018: bail if we the user tries to publish a non-vmware image.
if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS) && !TConst.VIRT_VMWARE.equals(image.virtId)) {
Gui.showMessageBox(
- MetaDataCache.getVirtualizerById(image.virtId).virtName
- + " ist derzeit nicht für den öffentlichen Austausch freigegeben.",
+ I18n.WINDOW.getString("ImageDetails.Message.error.publishNonVMWareImage",
+ MetaDataCache.getVirtualizerById(image.virtId).virtName),
MessageType.ERROR, null, null);
return;
}
if (changeMonitor.isCurrentlyModified()) {
- if (Gui.showMessageBox("Sie haben unspeicherte Änderungen, wollen Sie diese erst speichern?",
+ if (Gui.showMessageBox(I18n.WINDOW.getString("ImageDetails.Message.yesNo.currentlyModified"),
MessageType.QUESTION_YESNO, null, null)) {
if (!saveChangesInternal()) {
return;
@@ -614,34 +643,29 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
}
}
// let the user confirm or abort
- if (!Gui.showMessageBox("Wollen Sie diese VM wirklich landesweit veröffentlichen?", MessageType.QUESTION_YESNO,
- null, null))
+ if (!Gui.showMessageBox(I18n.WINDOW.getString("ImageDetails.Message.yesNo.confirmOrAbort"),
+ MessageType.QUESTION_YESNO, null, null))
return;
// start upload to masterserver
QuickTimer.scheduleOnce(new Task() {
- @Override
- public void fire() {
+ @Override public void fire() {
final String transferId;
try {
- transferId = ThriftManager.getSatClient().publishImageVersion(Session.getSatelliteToken(),
- image.latestVersionId);
+ transferId = ThriftManager.getSatClient()
+ .publishImageVersion(Session.getSatelliteToken(), image.latestVersionId);
} catch (TException e1) {
- ThriftError.showMessage(me, LOGGER, e1, "Upload der VM auf den Masterserver fehlgeschlagen."
- + " Prüfen Sie, ob Sie bei der Registrierung dem landesweiten VM-Austausch zugestimmt haben.\n"
- + " Sie können dies hier überprüfen:\n"
- + DesktopEnvironment.Link.REGISTER_BWIDM.uri.toString() + "\n\n");
+ ThriftError.showMessage(me, LOGGER, e1,
+ I18n.WINDOW.getString("ImageDetails.Message.error.uploadFailed",
+ DesktopEnvironment.Link.REGISTER_BWIDM.uri.toString()));
return;
}
Gui.asyncExec(new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
MainWindow.addPassiveTransfer(transferId, image.imageName, true);
// Inform user
Gui.showMessageBox(ImageDetailsWindow.this,
- "Die Übertragung läuft direkt zwischen Satellitenserver und" + " dem "
- + Branding.getServiceName() + " Zentral-Server.\n" + "Wenn Sie die "
- + Branding.getApplicationName() + " schließen, wird der Transfer trotzdem"
- + "weiterlaufen.",
+ I18n.WINDOW.getString("ImageDetails.Message.info.passiveTransfer",
+ Branding.getServiceName(), Branding.getApplicationName()),
MessageType.INFO, null, null);
}
});
@@ -694,7 +718,8 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
actionHandler.updateImageBase(image.getImageBaseId(), ibw);
LOGGER.info("Successfully saved new metadata");
} catch (TException e) {
- ThriftError.showMessage(me, LOGGER, e, "Konnte aktualisierte Metadaten nicht an den Server übermitteln");
+ ThriftError.showMessage(me, LOGGER, e,
+ I18n.WINDOW.getString("ImageDetails.Message.error.saveChangesInternal"));
return false;
}
@@ -703,11 +728,44 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
return false;
}
}
+
+ // if image is container
+ // prepare to upload container definition to local satellite server.
+ // TODO
+ if (image.getVirtId().equals(TConst.VIRT_DOCKER))
+ saveContainerDefinition();
+
changeMonitor.reset();
return true;
}
/**
+ * If the user make changes and saves it this method will be executed.
+ * It makes a deep copy of the current containerDefinition to get all settings.
+ * After that, every user setting is set in that copy-object.
+ * If the copy-object and containerDefinition differ, the new settings will be uploaded.
+ */
+ private void saveContainerDefinition() {
+ // TODO do I really need this check? Maybe just get every setting and upload it.
+
+ ContainerDefinition newConDev = new ContainerDefinition(containerDefinition);
+
+ if (newConDev.getBuildContextMethod() == ContainerBuildContextMethod.FILE) {
+ newConDev.setContainerRecipe(txtContainerRecipe.getText());
+ }
+ // currently no update of the git url allowed
+
+ newConDev.getContainerMeta().setImageName(txtContainerImageName.getText());
+ newConDev.getContainerMeta().setRunOptions(txtContainerRun.getText());
+ newConDev.getContainerMeta().setBindMountConfig(bindMountConfigurator.getData());
+
+ if (!newConDev.equals(containerDefinition)) {
+ uploadContainerDef(image.versions.get(0).versionId, newConDev.toByteBuffer());
+ LOGGER.info("Upload new DockerDefinition");
+ }
+ }
+
+ /**
* Helper to save the custom user permissions (those not included in
* ImageBaseWrite).
*
@@ -719,7 +777,8 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
ctlImagePermissionConfigurator.getPermissions());
LOGGER.info("Successfully saved new custom permissions");
} catch (TException e) {
- ThriftError.showMessage(me, LOGGER, e, "Konnte geänderte Berechtigungen nicht an den Server übermitteln");
+ ThriftError.showMessage(me, LOGGER, e,
+ I18n.WINDOW.getString("ImageDetails.Message.error.saveCustomPermissions"));
return false;
}
return true;
@@ -732,7 +791,8 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
*/
private void performImageDownload(ImageVersionDetails selected) {
if (selected.getVersionId() == null) {
- Gui.showMessageBox(this, "Ausgewählte Version ist ungültig", MessageType.ERROR, null, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("ImageDetails.Message.error.performImageDownload"),
+ MessageType.ERROR, null, null);
return;
}
// using actionHandler here is not needed, as this ThriftAction works for
@@ -751,16 +811,15 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
if (version == null)
return;
actionHandler.deleteImageVersion(version, new DeleteCallback() {
- @Override
- public void isDeleted(boolean success) {
- refresh(success);
+ @Override public void isDeleted(boolean success) {
+ refresh();
}
});
}
/**
* Triggers the deletion of a list of versions.
- *
+ *
* @param versions to delete
*/
private void deleteVersions(List<ImageVersionDetails> versions) {
@@ -788,8 +847,8 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
}
int count = 0;
for (ImageVersionDetails img : versions) {
- long currentExpiryTime = img.expireTime < Util.unixTime() ? Util.unixTime() : img.expireTime;
- Date currentExpiryTimeAsDate = DateTimeHelper.endOfDay(new Date(currentExpiryTime * 1000l));
+ long currentExpiryTime = Math.max(img.expireTime, Util.unixTime());
+ Date currentExpiryTimeAsDate = DateTimeHelper.endOfDay(new Date(currentExpiryTime * 1000L));
if (daysToExtend == -1) {
daysToExtend = ExpiryDateChooser.askFutureExpiryDuration(this, currentExpiryTimeAsDate);
if (daysToExtend == -1)
@@ -797,29 +856,32 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
}
currentExpiryTimeAsDate = DateTimeHelper.addDaysTo(currentExpiryTimeAsDate, daysToExtend);
try {
- ThriftManager.getSatClient().setImageVersionExpiry(Session.getSatelliteToken(), img.versionId,
- currentExpiryTimeAsDate.getTime() / 1000L);
+ ThriftManager.getSatClient()
+ .setImageVersionExpiry(Session.getSatelliteToken(), img.versionId,
+ currentExpiryTimeAsDate.getTime() / 1000L);
count++;
} catch (TException e) {
ThriftError.showMessage(this, LOGGER, e,
- "Konnte Ablaufdatum der Version " + img.versionId + " nicht verlängern.");
+ I18n.WINDOW.getString("ImageDetails.Message.error.extendVersionExpiry", img.versionId));
}
}
if (count > 0) {
- Gui.showMessageBox(this, "Erfolgreich verlängerte Abbilder: " + count, MessageType.INFO, null, null);
- refresh(true);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("ImageDetails.Message.info.extendVersionExpiry", count),
+ MessageType.INFO, null, null);
+ refresh();
}
}
/********************************************************************************
- *
+ *
* General UI helpers
- *
+ *
********************************************************************************/
+
/**
- * @param forceRefresh
+ *
*/
- private void refresh(boolean forceRefresh) {
+ private void refresh() {
String baseId = image.getImageBaseId();
synchronized (me) {
image = null;
@@ -865,6 +927,45 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
if (virt != null)
lblVirtualizer.setText(virt.getVirtName());
+ if (TConst.VIRT_DOCKER.equals(image.getVirtId())) {
+ lblVirtualizer.setText(TConst.VIRT_DOCKER);
+ showContainerTab();
+
+ if (image.versions.isEmpty()) {
+ LOGGER.info("Close Window because no ImageVersions available!");
+ dispose();
+ return;
+ }
+ // TODO if only a single version is created an the user deletes it, next line will out of bounce!
+ containerDefinition = ContainerDefinition.fromByteArray(loadContainerDef(image.versions.get(0)));
+
+ ContainerMeta containerMeta = containerDefinition.getContainerMeta();
+ ContainerBuildContextMethod method = ContainerBuildContextMethod.fromInt(
+ containerMeta.getBuildContextMethod());
+
+ switch (method) {
+ case FILE:
+ txtContainerRecipe.setText(containerDefinition.getContainerRecipe());
+ break;
+ case GIT_REPOSITORY:
+ txtContainerRecipe.setText(containerMeta.getBuildContextUrl());
+ txtContainerRecipe.setEnabled(false);
+ break;
+ }
+
+ txtContainerImageName.setText(containerMeta.getImageName());
+ txtContainerRun.setText(containerMeta.getRunOptions());
+ bindMountConfigurator.setData(containerMeta.getBindMountConfig(), true);
+
+ changeMonitor.add(txtContainerRecipe).
+ addConstraint(new TextNotEmptyConstraint(I18n.WINDOW.getString("ImageDetails.Constraint.NoEmptyDockerfile.text")));
+ changeMonitor.add(txtContainerImageName)
+ .addConstraint(new TextNotEmptyConstraint(I18n.WINDOW.getString("ImageDetails.Constraint.NoEmptyName.text")));
+ changeMonitor.add(txtContainerRun)
+ .addConstraint(new TextNotEmptyConstraint(I18n.WINDOW.getString("ImageDetails.Constraint.NoEmptyRunOptions.text")));
+ changeMonitor.add(bindMountConfigurator);
+ }
+
// fill share mode combo, if not already done
if (cboShareMode.getItemCount() == 0) {
for (ShareMode mode : ShareMode.values()) {
@@ -913,14 +1014,14 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
/**
* Enables/disables the editable fields based on 'editable'
- *
+ *
* @param editable true to make fields editable, false otherwise.
*/
private void makeEditable(boolean editable) {
// always disable all buttons unless image's share mode is LOCAL or PUBLISH
- if (image != null)
+ if (image != null) {
editable &= image.shareMode == ShareMode.LOCAL || image.shareMode == ShareMode.PUBLISH;
-
+ }
// now do the regular permission check
editable = editable && (ImagePerms.canEdit(image) || ImagePerms.canAdmin(image));
txtTitle.setEditable(editable);
@@ -938,12 +1039,19 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
btnUpdateImage.setEnabled(editable);
if (actionHandler.isImagePublishSupported())
btnUploadToMaster.setEnabled(editable);
+
+ if (image != null && TConst.VIRT_DOCKER.equals(image.getVirtId())) {
+ // TODO Currently, do not allow user to upload a new version or share an Container Image.
+ btnUpdateImage.setEnabled(false);
+ btnUploadToMaster.setEnabled(false);
+ }
+
}
/**
* Opens a new ImageDetailsWindow showing the details of the image with ID =
* imageBaseId
- *
+ *
* @param modalParent parent of this window
* @param imageBaseId id of the image to set the details of
*/
@@ -954,18 +1062,13 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
win.setVisible(true);
}
- /*
- * *****************************************************************************
- * **
- *
+ /* *******************************************************************************
+ *
* Dialog class overrides
- *
- * *****************************************************************************
- * **
+ *
+ * *******************************************************************************
*/
- @SuppressWarnings("deprecation")
- @Override
- public void show() {
+ @SuppressWarnings("deprecation") @Override public void show() {
if (!isVisible()) {
pack();
MainWindow.centerShell(this);
@@ -973,22 +1076,17 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
super.show();
}
- /*
- * *****************************************************************************
- * **
- *
+ /* *******************************************************************************
+ *
* UIFeedback implementation
- *
- * *****************************************************************************
- * **
+ *
+ * *******************************************************************************
*/
- @Override
- public boolean wantConfirmQuit() {
+ @Override public boolean wantConfirmQuit() {
return changeMonitor.isCurrentlyModified();
}
- @Override
- public void escapePressed() {
+ @Override public void escapePressed() {
safeClose();
}
@@ -997,8 +1095,9 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
* confirmation if so
*/
private boolean safeClose() {
- if (changeMonitor.isCurrentlyModified() && !Gui.showMessageBox(me,
- "Änderungen werden verworfen, wollen Sie wirklich schließen?", MessageType.QUESTION_YESNO, null, null))
+ if (changeMonitor.isCurrentlyModified()
+ && !Gui.showMessageBox(me, I18n.WINDOW.getString("ImageDetails.Message.yesNo.safeClose"),
+ MessageType.QUESTION_YESNO, null, null))
return false;
dispose();
return true;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
index 50034bf0..9167565a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
@@ -24,6 +24,7 @@ import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.control.table.ImageTable;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.PopupMenu;
import org.openslx.dozmod.gui.window.ImageDetailsWindow.ImageUpdatedCallback;
@@ -62,10 +63,10 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
/**
* Popup menu items
*/
- private final JMenuItem popupItemNewLecture = new JMenuItem("Neue Veranstaltung");
- private final JMenuItem popupItemEdit = new JMenuItem("Detailansicht");
- private final JMenuItem popupItemDelete = new JMenuItem("Löschen");
- private final JMenuItem popupItemDownload = new JMenuItem("Download");
+ private final JMenuItem popupItemNewLecture = new JMenuItem(I18n.WINDOW.getString("ImageList.MenuItem.newLecture.text"));
+ private final JMenuItem popupItemEdit = new JMenuItem(I18n.WINDOW.getString("ImageList.MenuItem.edit.text"));
+ private final JMenuItem popupItemDelete = new JMenuItem(I18n.WINDOW.getString("ImageList.MenuItem.delete.text"));
+ private final JMenuItem popupItemDownload = new JMenuItem(I18n.WINDOW.getString("ImageList.MenuItem.download.text"));
/**
* Constructor
@@ -251,7 +252,7 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
if (image == null)
return false;
if (image.getLatestVersionId() == null) {
- Gui.showMessageBox(me, "Die gewählte VM besitzt keine gültige Image-Version",
+ Gui.showMessageBox(me, I18n.WINDOW.getString("ImageList.Message.error.hasLatestVersion"),
MessageType.ERROR, null, null);
return false;
}
@@ -276,7 +277,7 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
popupItemDownload.setEnabled(download);
popupItemNewLecture.setEnabled(link);
popupItemDelete.setEnabled(delete);
- btnEditDetails.setEnabled(selCount == 1);
+ btnEditDetails.setEnabled(selCount == 1);
btnShowPublishedImages.setEnabled(true);
}
@@ -379,7 +380,7 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
}
}
if (failedToDeleteAll) {
- Gui.showMessageBox("Folgende images konnten nicht gelöscht werden: " + builder.toString(),
+ Gui.showMessageBox(I18n.WINDOW.getString("ImageList.Message.info.deleteImages", builder.toString()),
MessageType.INFO, LOGGER, null);
}
ctlImageListViewer.refreshList(deletedAtLeastOne, 1000);
@@ -418,7 +419,11 @@ public class ImageListWindow extends ImageListWindowLayout implements DownloadCa
// we need to enable the "Show published images" button here, since we need to check
// Session.getSatApiVersion() which is not set when this class is instantiated
ctlImageListViewer.refreshList(false, 1);
- btnShowPublishedImages.setVisible(Session.isImagePublishSupported());
+ if(!Session.canListImages())
+ {
+ btnShowPublishedImages.setVisible(false);
+ } else {
+ btnShowPublishedImages.setVisible(Session.isImagePublishSupported());
+ }
}
-
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java
index b02b5cf7..079329c7 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImagePublishedWindow.java
@@ -31,6 +31,7 @@ import org.openslx.dozmod.Branding;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.control.table.ListTable.ListModel;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.gui.helper.UiFeedback;
@@ -113,15 +114,14 @@ public class ImagePublishedWindow extends ImagePublishedWindowLayout implements
transferToken = ThriftManager.getSatClient()
.requestImageReplication(Session.getSatelliteToken(), item.latestVersionId);
} catch (TException ex) {
- ThriftError.showMessage(me, LOGGER, ex, "Could not start download");
+ ThriftError.showMessage(me, LOGGER, ex,
+ I18n.WINDOW.getString("ImagePublished.Message.error.satDownload"));
return;
}
MainWindow.addPassiveTransfer(transferToken, item.imageName, false);
Gui.showMessageBox(ImagePublishedWindow.this,
- "Die Übertragung läuft direkt zwischen Satellitenserver und"
- + " dem " + Branding.getServiceName() + " Zentral-Server.\n"
- + "Wenn Sie die " + Branding.getApplicationName() + " schließen, wird der Transfer trotzdem"
- + "weiterlaufen.",
+ I18n.WINDOW.getString("ImagePublished.Message.info.satDownload", Branding.getServiceName(),
+ Branding.getApplicationName()),
MessageType.INFO, null, null);
}
});
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureChangeImage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureChangeImage.java
index a2654896..41532b6f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureChangeImage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureChangeImage.java
@@ -19,6 +19,7 @@ import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.changemonitor.DialogChangeMonitor;
import org.openslx.dozmod.gui.changemonitor.GenericControlWindow;
import org.openslx.dozmod.gui.control.table.ImageTable;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.LectureChangeImageLayout;
@@ -78,10 +79,12 @@ public class LectureChangeImage extends LectureChangeImageLayout implements UiFe
dispose();
} else {
if (!image.isValid) {
- Gui.showMessageBox(LectureChangeImage.this, "Ausgewählte VM ist ungültig!", MessageType.ERROR,
- LOGGER, null);
+ Gui.showMessageBox(LectureChangeImage.this,
+ I18n.WINDOW.getString("LectureChangeImage.Message.error.imageInvalid"),
+ MessageType.ERROR, LOGGER, null);
} else {
- Gui.showMessageBox(LectureChangeImage.this, "Keine Rechte zum Verlinken auf die ausgewählte VM.",
+ Gui.showMessageBox(LectureChangeImage.this,
+ I18n.WINDOW.getString("LectureChangeImage.Message.error.canNotLinkToVM"),
MessageType.ERROR, LOGGER, null);
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
index b0f9e5fc..dbbdec5e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
@@ -52,6 +52,7 @@ import org.openslx.dozmod.gui.changemonitor.DialogChangeMonitor.ValidationConstr
import org.openslx.dozmod.gui.configurator.NetrulesConfigurator.StateWrapper;
import org.openslx.dozmod.gui.configurator.StartupConfigurator.StartupSettings;
import org.openslx.dozmod.gui.helper.DateTimeHelper;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.UserListWindow.UserAddedCallback;
@@ -160,7 +161,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
public String checkStateValid(ImageVersionDetails userInput) {
if (userInput != null && userInput.isValid)
return null;
- return "Keine/Ungültige VM-Version ausgewählt";
+ return I18n.WINDOW.getString("LectureDetails.ComboBox.versions.error");
}
});
// Create constraint for date start/end
@@ -173,9 +174,10 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
Date start = DateTimeHelper.getDateFrom(dtpStartDate, spnStartTime);
Date end = DateTimeHelper.getDateFrom(dtpEndDate, spnEndTime);
if (!end.after(start))
- return "Enddatum darf nicht vor dem Startdatum liegen";
+ return I18n.WINDOW.getString("LectureDetails.Message.error.endAfterStart");
if (end.after(maxValidity))
- return "Enddatum liegt nach dem " + FormatHelper.shortDate(maxValidity);
+ return I18n.WINDOW.getString("LectureDetails.Message.error.endAfterMaxValidity",
+ FormatHelper.shortDate(maxValidity));
return null;
}
};
@@ -186,16 +188,16 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
changeMonitor.add(chkIsActive);
changeMonitor.add(chkCustomPermAdmin);
changeMonitor.add(chkCustomPermEdit);
- changeMonitor.add(txtTitle)
- .addConstraint(new TextNotEmptyConstraint("Veranstaltungsname darf nicht leer sein"));
- changeMonitor.add(txtDescription)
- .addConstraint(new TextNotEmptyConstraint("Beschreibung darf nicht leer sein"));
+ changeMonitor.add(txtTitle).addConstraint(new TextNotEmptyConstraint(
+ I18n.WINDOW.getString("LectureDetails.TextField.title.error")));
+ changeMonitor.add(txtDescription).addConstraint(new TextNotEmptyConstraint(
+ I18n.WINDOW.getString("LectureDetails.TextField.description.error")));
changeMonitor.add(dtpEndDate).addConstraint(dateRangeValidator);
changeMonitor.add(dtpStartDate).addConstraint(dateRangeValidator);
changeMonitor.add(spnEndTime).addConstraint(dateRangeValidator);
changeMonitor.add(spnStartTime).addConstraint(dateRangeValidator);
- changeMonitor.add(ctlNetrulesConfigurator)
- .addConstraint(new NotNullConstraint<StateWrapper>("Fehlerhafte Netzwerkregeln"));
+ changeMonitor.add(ctlNetrulesConfigurator).addConstraint(new NotNullConstraint<StateWrapper>(
+ I18n.WINDOW.getString("LectureDetails.NetRulesConfigurator.error")));
changeListenerPermissions = changeMonitor.add(ctlPermissionManager);
ctlLocationSelector.addToChangeMonitor(changeMonitor);
ctlRunscriptConfigurator.addToChangeMonitor(changeMonitor);
@@ -267,13 +269,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
@Override
public void userAdded(UserInfo user, UserListWindow window) {
window.dispose();
- if (Gui.showMessageBox(me,
- "Sind Sie sicher, dass sie die Besitzerrechte an "
- + "einen anderen Account übertragen wollen?",
+ if (Gui.showMessageBox(me, I18n.WINDOW.getString("LectureDetails.Message.yesNo.changeOwner"),
MessageType.QUESTION_YESNO, LOGGER, null))
setLectureOwner(user);
}
- }, "Besitzer festlegen", lecture.ownerId);
+ }, I18n.WINDOW.getString("LectureDetails.Button.changeOwner.caption"), lecture.ownerId);
}
});
@@ -497,7 +497,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// now enable the tabs the user can see given its permissions
toggleEditable(true);
// and always switch to the "About" tab
- pnlTabs.setSelectedIndex(pnlTabs.indexOfTab("Übersicht"));
+ pnlTabs.setSelectedIndex(pnlTabs.indexOfTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.info.title")));
setVisible(true);
changeMonitor.reset();
}
@@ -545,8 +545,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
return;
}
// success
- Gui.showMessageBox(me, "Besitzrechte übertragen an " + FormatHelper.userName(user), MessageType.INFO, null,
- null);
+ Gui.showMessageBox(me,
+ I18n.WINDOW.getString("LectureDetails.Message.info.setLectureOwner", FormatHelper.userName(user)),
+ MessageType.INFO, null, null);
toggleEditable(false);
String lectureId = lecture.getLectureId();
synchronized (me) {
@@ -561,7 +562,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
*/
private void performImageDownload() {
if (image == null) {
- Gui.showMessageBox(this, "VM ungültig.", MessageType.ERROR, null, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("LectureDetails.Message.error.imageInvalid"),
+ MessageType.ERROR, null, null);
return;
}
btnDownloadImage.setEnabled(false);
@@ -569,7 +571,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
for (ImageVersionDetails version : image.versions) {
if (version.versionId.equals(lecture.imageVersionId)) {
if (!version.isValid) {
- Gui.showMessageBox(this, "Ungültige VM-Version gewählt", MessageType.ERROR, null, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("LectureDetails.Message.error.imageVersionInvalid"),
+ MessageType.ERROR, null, null);
return;
}
versionSize = version.fileSize;
@@ -577,8 +580,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
}
if (versionSize == 0) {
- Gui.showMessageBox(this, "Fehler bei der Abfrage der Größe des VM-Abbildes.", MessageType.ERROR, null,
- null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("LectureDetails.Message.error.imageVersionFileSizeInvalid"),
+ MessageType.ERROR, null, null);
return;
}
ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), lecture.imageVersionId, image.imageName,
@@ -658,7 +661,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
LOGGER.info("Successfully saved new metadata");
} catch (TException e) {
ThriftError.showMessage(JOptionPane.getFrameForComponent(this), LOGGER, e,
- "Fehler beim Speichern der Veranstaltung!");
+ I18n.WINDOW.getString("LectureDetails.Message.error.saveChangesInternal"));
return false;
}
@@ -684,7 +687,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
return true;
} catch (TException e) {
ThriftError.showMessage(JOptionPane.getFrameForComponent(this), LOGGER, e,
- "Fehler beim Übertragen der Berechtigungen!");
+ I18n.WINDOW.getString("LectureDetails.Message.error.saveCustomPermissions"));
}
return false;
}
@@ -704,7 +707,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// analyse time stuff to see if its valid
if (end > start)
return true;
- String msg = "Start der Veranstaltung ist nach dem Enddatum!";
+ String msg = I18n.WINDOW.getString("LectureDetails.Message.error.isPeriodValid");
if (feedback) {
Gui.showMessageBox(me, msg, MessageType.ERROR, LOGGER, null);
}
@@ -790,8 +793,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* confirmation if so
*/
private void safeClose() {
- if (changeMonitor.isCurrentlyModified() && !Gui.showMessageBox(me,
- "Änderungen werden verworfen, wollen Sie wirklich schließen?", MessageType.QUESTION_YESNO, null, null))
+ if (changeMonitor.isCurrentlyModified()
+ && !Gui.showMessageBox(me, I18n.WINDOW.getString("LectureDetails.Message.yesNo.safeClose"),
+ MessageType.QUESTION_YESNO, null, null))
return;
synchronized (me) {
lecture = null;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
index 31ff7702..ff1a3635 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
@@ -35,6 +35,7 @@ import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.control.table.ListTable.ListModel;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.PopupMenu;
import org.openslx.dozmod.gui.helper.TextChangeListener;
@@ -65,32 +66,32 @@ public class LectureListWindow extends LectureListWindowLayout {
// Filter types as an enum
public enum FilterType {
- ALL("Alle anzeigen", null),
- OWN("Nur eigene/zugewiesene anzeigen", new RowFilter<ListModel<LectureSummary>, Integer>() {
+ ALL(I18n.WINDOW.getString("LectureList.FilterType.all"), null),
+ OWN(I18n.WINDOW.getString("LectureList.FilterType.own"), new RowFilter<ListModel<LectureSummary>, Integer>() {
public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) {
LectureSummary lecture = entry.getModel().getModelRow(entry.getIdentifier());
return lecture.userPermissions.admin || lecture.ownerId.equals(Session.getUserId());
}
}),
- ACTIVE("Nur aktive anzeigen", new RowFilter<ListModel<LectureSummary>, Integer>() {
+ ACTIVE(I18n.WINDOW.getString("LectureList.FilterType.active"), new RowFilter<ListModel<LectureSummary>, Integer>() {
public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) {
LectureSummary lecture = entry.getModel().getModelRow(entry.getIdentifier());
return lecture.isEnabled && lecture.endTime > Util.unixTime();
}
}),
- EDITABLE("Nur editierbare anzeigen", new RowFilter<ListModel<LectureSummary>, Integer>() {
+ EDITABLE(I18n.WINDOW.getString("LectureList.FilterType.editable"), new RowFilter<ListModel<LectureSummary>, Integer>() {
public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) {
LectureSummary lecture = entry.getModel().getModelRow(entry.getIdentifier());
return LecturePerms.canEdit(lecture);
}
}),
- EXPIRING("Bald auslaufende anzeigen", new RowFilter<ListModel<LectureSummary>, Integer>() {
+ EXPIRING(I18n.WINDOW.getString("LectureList.FilterType.expiring"), new RowFilter<ListModel<LectureSummary>, Integer>() {
public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) {
LectureSummary lecture = entry.getModel().getModelRow(entry.getIdentifier());
return Math.abs(lecture.endTime - Util.unixTime()) < 86400 * 7;
}
}),
- EXAMS("Prüfungsveranstaltungen anzeigen", new RowFilter<ListModel<LectureSummary>, Integer>() {
+ EXAMS(I18n.WINDOW.getString("LectureList.FilterType.exams"), new RowFilter<ListModel<LectureSummary>, Integer>() {
public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) {
LectureSummary lecture = entry.getModel().getModelRow(entry.getIdentifier());
return lecture.isExam;
@@ -119,6 +120,15 @@ public class LectureListWindow extends LectureListWindowLayout {
LectureSummary lecture = tblLectures.getModelRow(entry.getIdentifier());
if (searchFieldPattern.matcher(lecture.lectureName).find())
return true;
+ if (chkSearchInDescription.isSelected()) {
+ String description = lecture.description;
+ if (description != null) {
+ if (searchFieldPattern.matcher(description).find())
+ return true;
+ } else {
+ LOGGER.debug("Description is null: cannot be searched in description");
+ }
+ }
UserInfo user = UserCache.find(lecture.ownerId);
if (user == null)
return false;
@@ -135,11 +145,11 @@ public class LectureListWindow extends LectureListWindowLayout {
/**
* Popup menu items
*/
- private JMenuItem popupItemNew = new JMenuItem("Neu");
- private JMenuItem popupItemEdit = new JMenuItem("Detailansicht");
- private JMenuItem popupItemLinked = new JMenuItem("VM-Details anzeigen");
- private JMenuItem popupItemDownload = new JMenuItem("Verlinkte VM herunterladen");
- private JMenuItem popupItemDelete = new JMenuItem("Löschen");
+ private JMenuItem popupItemNew = new JMenuItem(I18n.WINDOW.getString("LectureList.MenuItem.new.text"));
+ private JMenuItem popupItemEdit = new JMenuItem(I18n.WINDOW.getString("LectureList.MenuItem.edit.text"));
+ private JMenuItem popupItemLinked = new JMenuItem(I18n.WINDOW.getString("LectureList.MenuItem.linked.text"));
+ private JMenuItem popupItemDownload = new JMenuItem(I18n.WINDOW.getString("LectureList.MenuItem.download.text"));
+ private JMenuItem popupItemDelete = new JMenuItem(I18n.WINDOW.getString("LectureList.MenuItem.delete.text"));
public LectureListWindow() {
super();
@@ -155,7 +165,7 @@ public class LectureListWindow extends LectureListWindowLayout {
searchFieldPattern = null;
} else {
try {
- searchFieldPattern = Pattern.compile(str, Pattern.CASE_INSENSITIVE);
+ searchFieldPattern = Pattern.compile(str, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
txtSearch.setForeground(UIManager.getColor("TextField.foreground"));
} catch (PatternSyntaxException ex) {
txtSearch.setForeground(Color.RED);
@@ -173,6 +183,13 @@ public class LectureListWindow extends LectureListWindowLayout {
}
});
+ chkSearchInDescription.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ applyFilterOnTable();
+ }
+ });
+
btnNewLecture.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -212,8 +229,7 @@ public class LectureListWindow extends LectureListWindowLayout {
if (lecture == null)
return;
if (e.getSource().equals(popupItemNew)) {
- if (Gui.showMessageBox(me, "Um eine Veranstaltung zu erstellen, "
- + "müssen Sie eine VM auswählen. Zur VM-Auswahl wechseln?",
+ if (Gui.showMessageBox(me, I18n.WINDOW.getString("LectureList.Message.yesNo.switchView"),
MessageType.QUESTION_YESNO, LOGGER, null)) {
MainWindow.showPage(ImageListWindow.class);
}
@@ -263,7 +279,8 @@ public class LectureListWindow extends LectureListWindowLayout {
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
if (!Session.canListImages()) {
- Gui.showMessageBox("Ihnen fehlen die benötigten Berechtigungen.", MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(I18n.WINDOW.getString("LectureList.Message.error.canNotListImages"),
+ MessageType.ERROR, LOGGER, null);
return;
}
openLectureDetails(tblLectures.getSelectedItem());
@@ -363,10 +380,14 @@ public class LectureListWindow extends LectureListWindowLayout {
btnEditLecture.setEnabled(Session.canListImages() && singleSelection);
btnDeleteLecture.setEnabled(admin || !singleSelection);
popupItemDelete.setEnabled(admin || !singleSelection);
- popupItemLinked.setEnabled(Session.canListImages() && singleSelection);
- popupItemDownload.setEnabled(Session.canListImages() && singleSelection);
- popupItemNew.setEnabled(Session.canListImages() && singleSelection);
+ popupItemDelete.setVisible(admin || !singleSelection);
+ popupItemLinked.setEnabled(Session.canListImages());
+ popupItemLinked.setVisible(Session.canListImages());
+ popupItemDownload.setEnabled(singleSelection);
+ popupItemNew.setEnabled(Session.canListImages());
+ popupItemNew.setVisible(Session.canListImages());
popupItemEdit.setEnabled(Session.canListImages() && singleSelection);
+ popupItemEdit.setVisible(Session.canListImages() && singleSelection);
}
/**
@@ -402,12 +423,13 @@ public class LectureListWindow extends LectureListWindowLayout {
for (LectureSummary lecture : fLectures.keySet()) {
builder.append("\n\n");
builder.append(lecture.lectureName + " \n" );
- builder.append("Begründung: " + fLectures.get(lecture).getLocalizedMessage());
+ builder.append(I18n.WINDOW.getString("LectureList.Message.error.deleteLecture",
+ fLectures.get(lecture).getLocalizedMessage()));
LOGGER.error("Couldn't delete lecture " + lecture.lectureName + ", reason:", fLectures.get(lecture) );
// TODO Should the exception be printed in the debugger or is this to much information?
}
- Gui.showMessageBox("Folgende Veranstaltungen konnten nicht gelöscht werden: "
- + builder.toString(), MessageType.INFO, LOGGER, null);
+ Gui.showMessageBox(I18n.WINDOW.getString("LectureList.Message.info.deleteLectures",
+ builder.toString()), MessageType.INFO, LOGGER, null);
}
}
});
@@ -472,6 +494,31 @@ public class LectureListWindow extends LectureListWindowLayout {
btnNewLecture.setEnabled(Session.canListImages());
updateAvailableOptions(null);
refreshList(false);
+
+ if (!Session.canListImages())
+ {
+ disableUnnecessaryButtonsForStudents();
+ }
+ }
+
+ /**
+ * This funtion disables all unnecessary buttons
+ * when Student is logged in.
+ */
+ public void disableUnnecessaryButtonsForStudents()
+ {
+ btnDeleteLecture.setVisible(false);
+ btnEditLecture.setVisible(false);
+ btnNewLecture.setVisible(false);
+ btnSwitchView.setVisible(false);
+
+ btnDeleteLecture.setEnabled(false);
+ btnEditLecture.setEnabled(false);
+ btnNewLecture.setEnabled(false);
+ btnSwitchView.setEnabled(false);
+
+ cboFilter.setVisible(false);
+ cboFilter.setEnabled(false);
}
public void filterByImageBaseId(final String imageBaseId) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java
index bf818cf5..b8eb653d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LocationSelectionWindow.java
@@ -9,6 +9,7 @@ import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.Gui.GuiCallable;
import org.openslx.dozmod.gui.control.JCheckBoxTree.CheckChangeEvent;
import org.openslx.dozmod.gui.control.JCheckBoxTree.CheckChangeEventListener;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.LocationSelectionWindowLayout;
@@ -56,7 +57,7 @@ public class LocationSelectionWindow extends LocationSelectionWindowLayout imple
if (tempIntList != null
&& tempIntList.size() > Session.getSatelliteConfig().maxLocationsPerLecture) {
ctlLocationSelector.setSelectedLocationsAsIds(tempIntList);
- Gui.showMessageBox("Bitten reduzieren Sie die Anzahl gewählter Orte",
+ Gui.showMessageBox(I18n.WINDOW.getString("LocationSelection.Message.warning.saveChanges"),
MessageType.WARNING, null, null);
return;
}
@@ -73,7 +74,7 @@ public class LocationSelectionWindow extends LocationSelectionWindowLayout imple
if (tempIntList != null) {
if (tempIntList.size() > Session.getSatelliteConfig().maxLocationsPerLecture) {
// add error
- lblError.setText("Zu viele Orte ausgewählt!");
+ lblError.setText(I18n.WINDOW.getString("LocationSelection.Message.error.locationSelector"));
} else {
lblError.setText("");
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
index a6601ea7..94ee10e4 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
@@ -36,6 +36,7 @@ import org.openslx.dozmod.authentication.TestAccountAuthenticator;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.activity.UpdatePanel;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.gui.window.layout.LoginWindowLayout;
@@ -74,9 +75,6 @@ public class LoginWindow extends LoginWindowLayout {
// authentication method to use for login attempts
protected LoginType loginType = null;
- // text constants
- private final String NO_USERNAME = "Kein Benutzername angegeben!";
- private final String NO_PASSWORD = "Kein Passwort angegeben!";
private boolean forceCustomSatellite = false;
@@ -298,12 +296,12 @@ public class LoginWindow extends LoginWindowLayout {
private void doLogin() {
// sanity check on loginType.
if (loginType == null) {
- Gui.showMessageBox(this, "Bitte wählen Sie eine Authentifizierungsart.", MessageType.ERROR,
- LOGGER, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Login.Message.error.noLoginType"),
+ MessageType.ERROR, LOGGER, null);
return;
}
if (loginType == LoginType.ECP && cboOrganization.getSelectedIndex() == -1) {
- Gui.showMessageBox(this, "Bitte wählen Sie ihre Organisation als 'Identity Provider'.",
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Login.Message.error.noOrganization"),
MessageType.ERROR, LOGGER, null);
cboOrganization.requestFocusInWindow();
return;
@@ -313,11 +311,11 @@ public class LoginWindow extends LoginWindowLayout {
final String password = String.copyValueOf(txtPassword.getPassword());
// login clicked, lets first read the fields
if (username.isEmpty()) {
- Gui.showMessageBox(this, NO_USERNAME, MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Login.Message.error.noUsername"), MessageType.ERROR, LOGGER, null);
return;
}
if (password.isEmpty()) {
- Gui.showMessageBox(this, NO_PASSWORD, MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Login.Message.error.noPassword"), MessageType.ERROR, LOGGER, null);
return;
}
@@ -342,30 +340,32 @@ public class LoginWindow extends LoginWindowLayout {
});
return;
case IDENTITY_PROVIDER_ERROR:
- Gui.showMessageBox(me, "IdP Error", MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(me, I18n.WINDOW.getString("Login.Message.error.authIdentityProvider"),
+ MessageType.ERROR, LOGGER, null);
break;
case SERVICE_PROVIDER_ERROR:
// here if we have t != null then we have not received a token
// if we have t, then the token is invalid.
- Gui.showMessageBox(me, "Invalid token from the service provider!", MessageType.ERROR,
- LOGGER, t);
+ Gui.showMessageBox(me, I18n.WINDOW.getString("Login.Message.error.authServiceProvider"),
+ MessageType.ERROR, LOGGER, t);
break;
case UNREGISTERED_ERROR:
LOGGER.error("User not registered!");
BwIdmLinkWindow.open((JFrame) SwingUtilities.getWindowAncestor(me));
break;
case INVALID_URL_ERROR:
- Gui.showMessageBox(me, "ECP Authenticator says: Invalid URL.", MessageType.ERROR, LOGGER,
- t);
+ Gui.showMessageBox(me, I18n.WINDOW.getString("Login.Message.error.authInvalidURL"),
+ MessageType.ERROR, LOGGER, t);
break;
case GENERIC_ERROR:
default:
if (t == null || !t.getClass().equals(RuntimeException.class)) {
- Gui.showMessageBox(me, "Internal error!", MessageType.ERROR, null, t);
+ Gui.showMessageBox(me, I18n.WINDOW.getString("Login.Message.error.authInternal"),
+ MessageType.ERROR, null, t);
} else {
- Gui.showMessageBox(me, "Der Masterserver hat den Loginversuch mit der"
- + " folgenden Nachricht abgewiesen:\n\n"
- + t.getMessage(), MessageType.ERROR, null, null);
+ Gui.showMessageBox(me,
+ I18n.WINDOW.getString("Login.Message.error.authMasterServer", t.getMessage()),
+ MessageType.ERROR, null, null);
}
break;
}
@@ -383,10 +383,12 @@ public class LoginWindow extends LoginWindowLayout {
authenticator = new TestAccountAuthenticator();
break;
case DIRECT_CONNECT:
- Gui.showMessageBox(this, "Not yet implemented", MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Login.Message.error.loginTypeDirectConnect"),
+ MessageType.ERROR, LOGGER, null);
return;
default:
- Gui.showMessageBox(this, "No login type selected!", MessageType.ERROR, LOGGER, null);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("Login.Message.error.loginTypeDefault"),
+ MessageType.ERROR, LOGGER, null);
return;
}
@@ -401,10 +403,11 @@ public class LoginWindow extends LoginWindowLayout {
authenticator.login(finalUsername, password, authenticatorCallback);
return;
} catch (TException e) {
- ThriftError.showMessage(LoginWindow.this, LOGGER, e, "Anmeldung fehlgeschlagen");
+ ThriftError.showMessage(LoginWindow.this, LOGGER, e,
+ I18n.WINDOW.getString("Login.Message.error.loginFailed"));
} catch (Exception e) {
- Gui.showMessageBox(LoginWindow.this, "Anmeldung fehlgeschlagen", MessageType.ERROR,
- LOGGER, e);
+ Gui.showMessageBox(LoginWindow.this, I18n.WINDOW.getString("Login.Message.error.loginFailed"),
+ MessageType.ERROR, LOGGER, e);
}
enableLogin(true);
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
index ef805799..32a9cd9e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
@@ -27,6 +27,7 @@ public class MainMenuWindow extends MainMenuWindowLayout {
MainWindow.showPage(LectureListWindow.class);
}
});
+
}
@Override
@@ -36,6 +37,12 @@ public class MainMenuWindow extends MainMenuWindowLayout {
@Override
public void requestShow() {
+ // here we need to check if the user is a student
+ // if so directly forward to lecturelist.
+ if(!Session.canListImages()) {
+ MainWindow.showPage(LectureListWindow.class);
+ }
+
btnShowVirtualMachines.setEnabled(Session.canListImages());
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/SatelliteListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/SatelliteListWindow.java
index e3f68295..2674dc9a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/SatelliteListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/SatelliteListWindow.java
@@ -17,6 +17,7 @@ import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.Gui.GuiCallable;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.SatelliteListWindowLayout;
@@ -108,7 +109,8 @@ public class SatelliteListWindow extends SatelliteListWindowLayout implements Ui
}
dispose();
} else {
- Gui.showMessageBox(rootPane, "Kein Satellit ausgewählt", MessageType.ERROR, null, null);
+ Gui.showMessageBox(rootPane, I18n.WINDOW.getString("SatelliteList.Message.error.noSatellite"),
+ MessageType.ERROR, null, null);
}
}
});
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtConfigEditorWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtConfigEditorWindow.java
index 36bea427..cb207d34 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtConfigEditorWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtConfigEditorWindow.java
@@ -15,6 +15,7 @@ import java.util.TreeSet;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.gui.helper.UiFeedback;
@@ -115,13 +116,13 @@ public class VirtConfigEditorWindow extends VirtConfigEditorWindowLayout impleme
if (!filteredSet.equals(unfilteredSet)) {
unfilteredSet.removeAll(filteredSet);
// not equals, means there was some invalid input
- String errorText = "Invalide Eingaben:\n";
+ String errorText = I18n.WINDOW.getString("VirtConfigEditor.Message.error.invalidInputTitle");
for (String s : unfilteredSet) {
errorText += s + "\n";
}
// TODO: Somehow this always triggers for vbox
errorText += System.lineSeparator()
- + "Wollen Sie trotzdem speichern? (Die invaliden Zeilen werden dabei automatisch gelöscht.)";
+ + I18n.WINDOW.getString("VirtConfigEditor.Message.error.invalidInputText");
if (!Gui.showMessageBox(errorText, MessageType.ERROR_RETRY, LOGGER, null))
return;
}
@@ -163,7 +164,7 @@ public class VirtConfigEditorWindow extends VirtConfigEditorWindowLayout impleme
private void safeClose() {
if (originalMachineDescription.equals(pnlEditor.getText()) || Gui.showMessageBox(me,
- "Ihre Änderungen, in diesem Fenster, werden verloren gehen, wollen Sie trotzdem abbrechen?",
+ I18n.WINDOW.getString("VirtConfigEditor.Message.yesNo.safeClose"),
MessageType.QUESTION_YESNO, null, null))
dispose();
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
index 072d648e..b6584b8e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtDropDownConfigEditorWindow.java
@@ -9,6 +9,7 @@ import java.nio.ByteBuffer;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.VirtDropDownConfigEditorWindowLayout;
@@ -187,8 +188,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
cboMaxUsbSpeed.setSelectedItem(usbSpeed);
} catch (IllegalArgumentException e) {
// TODO improve user message
- Gui.showMessageBox("Sie haben beim letzten Konfigurieren \n"
- + "einen falschen Eintrag eingespeichert. \n" + "Die VM wird nicht starten!",
+ Gui.showMessageBox(I18n.WINDOW.getString("VirtDropDownConfigEditor.Message.warning.initializeComboBoxes"),
MessageType.WARNING, null, e);
}
}
@@ -220,7 +220,7 @@ public class VirtDropDownConfigEditorWindow extends VirtDropDownConfigEditorWind
private void safeClose() {
if (!hasChanged() || Gui.showMessageBox(me,
- "Wollen Sie wirklich abbrechen?\n" + "Ihre Änderungen werden verworfen.",
+ I18n.WINDOW.getString("VirtDropDownConfigEditor.Message.yesNo.safeClose"),
MessageType.QUESTION_YESNO, null, null)) {
dispose();
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java
index 8667c944..017194b5 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java
@@ -15,14 +15,11 @@ import javax.swing.JTextArea;
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;
@SuppressWarnings("serial")
public abstract class CheckUpdateWindowLayout extends JDialog {
- private final static String title = "Version";
- private final static String noticeLabel = "Update";
- private final static String closeButtonLabel = "Schließen";
-
protected static JButton btnLink;
protected static JButton btnClose;
@@ -34,8 +31,8 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
protected final JTextArea txtChangelog;
public CheckUpdateWindowLayout(Window modalParent) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("CheckUpdate.Dialog.title"), modalParent != null
+ ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
setLayout(new BorderLayout());
setPreferredSize(Gui.getScaledDimension(680, 400));
@@ -47,13 +44,14 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
// information before the disclaimer
JPanel infoPanel = new JPanel();
GridManager infoGrid = new GridManager(infoPanel, 4);
- infoPanel.setBorder(BorderFactory.createTitledBorder(noticeLabel));
- infoGrid.add(new QLabel("Ihre Version"));
+ infoPanel.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("CheckUpdate.TitledBorder.infoPanel.title")));
+ infoGrid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("CheckUpdate.Label.localVersion.text")));
infoGrid.add(Box.createHorizontalStrut(10));
infoGrid.add(lblLocalVersion);
infoGrid.add(Box.createHorizontalGlue()).fill(true, false).expand(true, false);
infoGrid.nextRow();
- infoGrid.add(new QLabel("Aktuelle Version"));
+ infoGrid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("CheckUpdate.Label.remoteVersion.text")));
infoGrid.add(Box.createHorizontalStrut(10));
infoGrid.add(lblRemoteVersion);
infoGrid.add(Box.createHorizontalGlue()).fill(true, false).expand(true, false);
@@ -64,11 +62,12 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
txtChangelog.setWrapStyleWord(true);
JScrollPane changelogPanel = new JScrollPane(txtChangelog, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- changelogPanel.setBorder(BorderFactory.createTitledBorder("Changelog"));
+ changelogPanel.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("CheckUpdate.TitledBorder.changelogPanel.title")));
// checkbox for acknowledging the disclaimer
- btnLink = new JButton("Zum Download-Portal");
- btnClose = new JButton(closeButtonLabel);
+ btnLink = new JButton(I18n.WINDOW_LAYOUT.getString("CheckUpdate.Button.link.text"));
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("CheckUpdate.Button.close.text"));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.add(Box.createHorizontalGlue());
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ConfigWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ConfigWindowLayout.java
index bf37dc42..0dfe4c1e 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ConfigWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ConfigWindowLayout.java
@@ -4,32 +4,22 @@ import java.awt.BorderLayout;
import java.awt.Insets;
import java.awt.Window;
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.DefaultBoundedRangeModel;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JSlider;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
import org.openslx.dozmod.Branding;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.control.ComboBox;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
+import org.openslx.dozmod.gui.helper.Language;
@SuppressWarnings("serial")
public class ConfigWindowLayout extends JDialog {
- private static String title = Branding.getApplicationName() + " - Konfiguration";
-
protected final JRadioButton btnProxyNone;
protected final JRadioButton btnProxyAuto;
protected final JRadioButton btnProxySocks = null;
@@ -40,12 +30,14 @@ public class ConfigWindowLayout extends JDialog {
protected final JSlider sldConnections;
protected ButtonGroup btnGroupLookAndFeel = null;
+ protected final ComboBox<Language> cboLanguage;
+
protected final JButton btnSave;
protected final JButton btnClose;
public ConfigWindowLayout(Window modalParent) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("Config.Dialog.title", Branding.getApplicationName()),
+ modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
// regular layout as a helper for the whole page
getContentPane().setLayout(new BorderLayout());
@@ -57,22 +49,21 @@ public class ConfigWindowLayout extends JDialog {
GridManager grid = new GridManager(contentPanel, 1, false, new Insets(4, 3, 1, 3));
// mail config
- grid.add(new WordWrapLabel("E-Mail-Benachrichtigungen", true, false))
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.mailNotifications.text"), true, false))
.insets(headingInset)
.expand(true, false)
.fill(true, false);
- chkSendMeMail = new JCheckBox("Über VM- und Veranstaltungsänderungen per E-Mail informiert werden");
+ chkSendMeMail = new JCheckBox(I18n.WINDOW_LAYOUT.getString("Config.CheckBox.sendMeMail.text"));
grid.add(chkSendMeMail).fill(true, false).expand(true, false);
grid.add(
- new WordWrapLabel("Für diese Option muss der Server"
- + " für den Mailversand konfiguriert sein.", false, true))
+ new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.sendMeMail.text"), false, true))
.expand(true, false)
.fill(true, false);
lblYourAddress = new QLabel();
grid.add(lblYourAddress).fill(true, false).expand(true, false);
// proxy config
- grid.add(new WordWrapLabel("Proxyserver", true, false))
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.proxyConfig.text"), true, false))
.insets(headingInset)
.fill(true, false)
.expand(true, false);
@@ -80,8 +71,8 @@ public class ConfigWindowLayout extends JDialog {
radioGroupPanel.setLayout(new BoxLayout(radioGroupPanel, BoxLayout.LINE_AXIS));
// radio buttons
ButtonGroup radioGroup = new ButtonGroup();
- btnProxyNone = new JRadioButton("Keinen Proxy verwenden");
- btnProxyAuto = new JRadioButton("Automatisch nach Proxy suchen");
+ btnProxyNone = new JRadioButton(I18n.WINDOW_LAYOUT.getString("Config.RadioButton.proxyNone.text"));
+ btnProxyAuto = new JRadioButton(I18n.WINDOW_LAYOUT.getString("Config.RadioButton.proxyAuto.text"));
radioGroup.add(btnProxyNone);
radioGroup.add(btnProxyAuto);
radioGroupPanel.add(btnProxyNone);
@@ -89,12 +80,12 @@ public class ConfigWindowLayout extends JDialog {
grid.add(radioGroupPanel).expand(true, false).fill(true, false);
// font config
- grid.add(new WordWrapLabel("Schriftgröße (%)", true, false))
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.fontConfig.text"), true, false))
.insets(headingInset)
.fill(true, false)
.expand(true, false);
grid.add(
- new WordWrapLabel("Diese Funktion ist experimentell. Es kann zu Anzeigefehlern kommen.",
+ new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.fontConfigInfo.text"),
false, true))
.expand(true, false)
.fill(true, false);
@@ -110,14 +101,12 @@ public class ConfigWindowLayout extends JDialog {
grid.add(sldFontSize).fill(true, false).expand(true, false);
// look and feel
- grid.add(new WordWrapLabel("LookAndFeel", true, false))
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.lookAndFeel.text"),
+ true, false))
.insets(headingInset)
.fill(true, false)
.expand(true, false);
- grid.add(
- new WordWrapLabel("Hier können Sie die Darstellung der Oberfläche zwischen unterschiedlichen"
- + " 'LookAndFeels' umstellen.",
- false, true))
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.lookAndFeelInfo.text"), false, true))
.fill(true, false)
.expand(true, false);
JPanel lafGroupPanel = new JPanel();
@@ -133,16 +122,13 @@ public class ConfigWindowLayout extends JDialog {
grid.add(lafGroupPanel).expand(true, false).fill(true, false);
// Concurrent Connections
- grid.add(new WordWrapLabel("Verbindungen pro Transfer", true, false))
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.concurrentConnections.text"),
+ true, false))
.insets(headingInset)
.fill(true, false)
.expand(true, false);
grid.add(
- new WordWrapLabel("Im Normalfall werden beste Ergebnisse erzielt,"
- + " wenn die Einstellung auf 1 belassen wird. Falls die Übertragungsgeschwindigkeit"
- + " ihre Netzwerkanbindung nicht auslastet, probieren Sie den nächsthöheren"
- + " Wert. Zu hohe Werte können einen negativen Effekt auf die"
- + " Übertragungsgeschwindigkeit haben, und belasten den Satellitenserver stärker.",
+ new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.concurrentConnectionsInfo.text"),
false, true))
.fill(true, false)
.expand(true, false);
@@ -153,13 +139,33 @@ public class ConfigWindowLayout extends JDialog {
sldConnections.setPaintLabels(true);
grid.add(sldConnections).expand(true, false).fill(true, false);
+ // Language
+ grid.add(new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.language.text"),
+ true, false))
+ .insets(headingInset)
+ .fill(true, false)
+ .expand(true, false);
+ grid.add(
+ new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("Config.Label.languageInfo.text"),
+ false, true))
+ .fill(true, false)
+ .expand(true, false);
+ cboLanguage = new ComboBox<>(new ComboBox.ComboBoxRenderer<Language>() {
+ @Override
+ public String renderItem(Language item) {
+ return item.displayName;
+ }
+ });
+ cboLanguage.setModel(new DefaultComboBoxModel<>(Language.values()));
+ grid.add(cboLanguage).fill(true, false).expand(true, false);
+
// Finish
grid.finish(true);
// bottom button panel
JPanel buttonPanel = new JPanel();
- btnClose = new JButton("Schließen");
- btnSave = new JButton("Speichern");
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("Config.Button.close.text"));
+ btnSave = new JButton(I18n.WINDOW_LAYOUT.getString("Config.Button.save.text"));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.add(Box.createGlue());
@@ -167,7 +173,7 @@ public class ConfigWindowLayout extends JDialog {
buttonPanel.add(btnSave);
getContentPane().add(buttonPanel, BorderLayout.PAGE_END);
- setPreferredSize(Gui.getScaledDimension(500, 650));
+ setPreferredSize(Gui.getScaledDimension(500, 700));
}
-}
+} \ No newline at end of file
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ContainerBindMountWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ContainerBindMountWindowLayout.java
new file mode 100644
index 00000000..2e5432b8
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ContainerBindMountWindowLayout.java
@@ -0,0 +1,69 @@
+package org.openslx.dozmod.gui.window.layout;
+
+import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.control.QLabel;
+import org.openslx.dozmod.gui.helper.GridManager;
+
+import javax.swing.*;
+import java.awt.*;
+
+public class ContainerBindMountWindowLayout extends JDialog {
+
+ private static final String title = "Add Bind Mount";
+
+ protected final QLabel lblBmSource;
+ protected final JTextField txtBmSource;
+ protected final QLabel lblBmTarget;
+ protected final JTextField txtBmTarget;
+ protected final QLabel lblBmOptions;
+ protected final JTextField txtBmOptions;
+ protected final JButton btnSave;
+ protected final JButton btnCancel;
+
+ public ContainerBindMountWindowLayout(Window modalParent) {
+ super(modalParent, title,
+ modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
+
+ GridManager grid = new GridManager(this, 2, true, new Insets(2, 2, 2, 2));
+
+ lblBmSource = new QLabel("Source");
+ txtBmSource = new JTextField();
+
+ grid.add(lblBmSource);
+ grid.add(txtBmSource).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ lblBmTarget = new QLabel("Target");
+ txtBmTarget = new JTextField();
+ grid.add(lblBmTarget);
+ grid.add(txtBmTarget).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ lblBmOptions = new QLabel("Options");
+ txtBmOptions = new JTextField();
+ grid.add(lblBmOptions);
+ grid.add(txtBmOptions).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());
+ btnCancel = new JButton("Cancel");
+ buttonPane.add(btnCancel);
+ buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
+ btnSave = new JButton("Save");
+ buttonPane.add(btnSave);
+ grid.add(buttonPane, 2).fill(true, false).expand(true, false);
+ grid.finish(false);
+
+ //setPreferredSize(Gui.getScaledDimension(650, 350));
+
+ setSize(350, 150);
+ setResizable(false);
+ //setMinimumSize(Gui.getScaledDimension(550, 650));
+ if (modalParent != null) {
+ Gui.centerShellOverShell(modalParent, this);
+ }
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java
index bd28189a..9bbce4f1 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/GenericNoticeWindowLayout.java
@@ -17,19 +17,18 @@ import org.openslx.dozmod.Branding;
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;
@SuppressWarnings("serial")
public abstract class GenericNoticeWindowLayout extends JDialog {
- protected String info = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise:";
+ protected String info = I18n.WINDOW_LAYOUT.getString("GenericNotice.Label.noticePanel.text");
protected JTextArea notice;
protected JScrollPane disclaimerPanel;
- protected String checkboxText = "Ja, ich akzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen.";
+ protected String checkboxText = I18n.WINDOW_LAYOUT.getString("GenericNotice.CheckBox.agree.text");
private static String title = Branding.getApplicationName();
- private static String noticeLabel = "Hinweis";
- private static String continueButtonLabel = "Weiter";
// Buttons
protected final JCheckBox chkAgreeBox;
@@ -47,7 +46,8 @@ public abstract class GenericNoticeWindowLayout extends JDialog {
// information before the notice
QLabel noticePanel = new QLabel();
- noticePanel.setBorder(BorderFactory.createTitledBorder(noticeLabel));
+ noticePanel.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("GenericNotice.TitledBorder.noticePanel.title")));
noticePanel.setText(info);
// the disclaimer text box with scrolling functionality
@@ -67,7 +67,7 @@ public abstract class GenericNoticeWindowLayout extends JDialog {
// spacer
buttonPanel.add(Box.createHorizontalGlue());
// the continue button
- btnContinue = new JButton(continueButtonLabel);
+ btnContinue = new JButton(I18n.WINDOW_LAYOUT.getString("GenericNotice.Button.continue.text"));
btnContinue.setEnabled(false);
buttonPanel.add(btnContinue);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java
index 31332cf4..af73d32f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java
@@ -1,13 +1,6 @@
package org.openslx.dozmod.gui.window.layout;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.Insets;
-import java.awt.FlowLayout;
+import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.Box;
@@ -22,6 +15,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.StyledEditorKit;
import javax.swing.text.html.HTMLEditorKit;
@@ -29,6 +23,7 @@ import javax.swing.text.html.HTMLEditorKit;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.ShareMode;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.configurator.ContainerBindMountConfigurator;
import org.openslx.dozmod.gui.configurator.ImagePermissionConfigurator;
import org.openslx.dozmod.gui.control.ComboBox;
import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer;
@@ -37,16 +32,29 @@ import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.table.ImageVersionTable;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.thrifthelper.Comparators;
-@SuppressWarnings("serial")
-public abstract class ImageDetailsWindowLayout extends JDialog {
+import javax.swing.*;
+import java.awt.*;
+
+@SuppressWarnings("serial") public abstract class ImageDetailsWindowLayout extends JDialog {
private static final int ICON_SIZE_Y = 24;
+ private final String TAB_OVERVIEW_TITEL = I18n.WINDOW_LAYOUT.getString("ImageDetails.Tab.overview.title");
+ private final String TAB_VERSIONS_TITEL = I18n.WINDOW_LAYOUT.getString("ImageDetails.Tab.versions.title");
+ private final String TAB_PERMISSIONS_TITEL = I18n.WINDOW_LAYOUT.getString("ImageDetails.Tab.permissions.title");
+
protected final JTextField txtTitle;
protected final JEditorPane txtDescription;
+ private final JPanel pnlTabContainer;
+ protected final JTextArea txtContainerRecipe;
+ protected final JTextField txtContainerRun;
+ protected final JTextField txtContainerImageName;
+ protected ContainerBindMountConfigurator bindMountConfigurator;
+
protected QLabel lblError;
protected final PersonLabel lblOwner;
protected final JButton btnChangeOwner;
@@ -91,9 +99,6 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
protected ImagePermissionConfigurator ctlImagePermissionConfigurator;
- private static String infoTextDefPerms = "<html><body style='width:100%'>"
- + "Hier können Sie Rechte für nicht in der Liste angegebene Nutzer festlegen:" + "</body></html>";
-
public ImageDetailsWindowLayout(Frame modalParent) {
super(modalParent, "<init>", ModalityType.APPLICATION_MODAL);
setResizable(true);
@@ -161,7 +166,7 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
txtDescription.setEditorKit(kit);
txtDescription.setContentType("text/html");
- grid.add(new QLabel("Beschreibung")).anchor = GridBagConstraints.FIRST_LINE_START;
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.description.text"))).anchor = GridBagConstraints.FIRST_LINE_START;
JScrollPane jsp = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jsp.setMinimumSize(Gui.getScaledDimension(0, 110));
@@ -171,34 +176,33 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
// owner
lblOwner = new PersonLabel();
- btnChangeOwner = new JButton("Ändern");
- grid.add(new QLabel("Besitzer"));
+ btnChangeOwner = new JButton(I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.changeOwner.text"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.owner.text")));
grid.add(lblOwner).expand(true, false);
grid.add(btnChangeOwner).fill(true, false);
grid.nextRow();
// creation time
lblCreateTime = new QLabel();
- grid.add(new QLabel("Erstellt am"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.createTime.text")));
grid.add(lblCreateTime, 2);
grid.nextRow();
// last updater
lblUpdater = new PersonLabel();
- grid.add(new QLabel("Geändert durch"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.updater.text")));
grid.add(lblUpdater, 2);
grid.nextRow();
// last updated
lblUpdateTime = new QLabel();
- grid.add(new QLabel("Geändert am"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.updateTime.text")));
grid.add(lblUpdateTime, 2);
grid.nextRow();
cboOperatingSystem = new ComboBox<OperatingSystem>(Comparators.operatingSystem,
new ComboBoxRenderer<OperatingSystem>() {
- @Override
- public String renderItem(OperatingSystem item) {
+ @Override public String renderItem(OperatingSystem item) {
if (item == null)
return null;
return item.getOsName();
@@ -206,7 +210,7 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
});
cboOperatingSystem.setEditable(false);
- grid.add(new QLabel("Betriebssystem"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.OS.text")));
grid.add(cboOperatingSystem, 2).expand(true, false).fill(true, false);
grid.nextRow();
@@ -215,46 +219,46 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
// share mode
cboShareMode = new ComboBox<ShareMode>(new ComboBoxRenderer<ShareMode>() {
- @Override
- public String renderItem(ShareMode item) {
+ @Override public String renderItem(ShareMode item) {
if (item == null)
return "null";
return item.name();
}
});
- grid.add(new QLabel("Freigabemodus"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.shareMode.text")));
grid.add(cboShareMode, 2).expand(true, false).fill(true, false);
grid.nextRow();
// template
- chkIsTemplate = new JCheckBox("Vorlage");
+ chkIsTemplate = new JCheckBox(I18n.WINDOW_LAYOUT.getString("ImageDetails.CheckBox.isTemplate.text"));
grid.add(Box.createGlue());
grid.add(chkIsTemplate, 2);
grid.nextRow();
// version
txtVersion = new JTextField();
- grid.add(new QLabel("Versions-ID"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.version.text")));
grid.add(txtVersion, 2).expand(true, false).fill(true, false);
grid.nextRow();
// id
txtId = new JTextField();
txtId.setEditable(false);
- grid.add(new QLabel("VM-ID"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.ID.text")));
grid.add(txtId, 2).expand(true, false).fill(true, false);
grid.nextRow();
// virtualizer
lblVirtualizer = new QLabel();
- grid.add(new QLabel("Virtualisierer"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.virtualizer.text")));
grid.add(lblVirtualizer, 2).expand(true, false).fill(true, false);
grid.nextRow();
- grid.add(new QLabel("Veranstaltungen"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.linkedLectureCount.text")));
lblLinkedLectureCount = new QLabel();
grid.add(lblLinkedLectureCount).expand(true, false);
- btnShowLinkingLectures = new JButton("Anzeigen");
+ btnShowLinkingLectures = new JButton(
+ I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.showLinkingLectures.text"));
grid.add(btnShowLinkingLectures).fill(true, false);
grid.nextRow();
grid.add(Box.createVerticalGlue(), 3).expand(true, true).fill(true, true);
@@ -263,11 +267,14 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
JPanel buttonBar = new JPanel();
BoxLayout buttons = new BoxLayout(buttonBar, BoxLayout.LINE_AXIS);
buttonBar.setLayout(buttons);
- btnUpdateImage = new JButton("Neue VM-Version hochladen",
- Gui.getScaledIconResource("/img/upload-icon.png", "New VM", ICON_SIZE_Y, buttonBar));
+ btnUpdateImage = new JButton(I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.updateImage.text"),
+ Gui.getScaledIconResource("/img/upload-icon.png",
+ I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.updateImage.description"), ICON_SIZE_Y, buttonBar));
buttonBar.add(btnUpdateImage);
- btnUploadToMaster = new JButton("Landesweit veröffentlichen",
- Gui.getScaledIconResource("/img/publish-icon.png", "Publish VM", ICON_SIZE_Y, buttonBar));
+ btnUploadToMaster = new JButton(I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.uploadToMaster.text"),
+ Gui.getScaledIconResource("/img/publish-icon.png",
+ I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.uploadToMaster.description"),
+ ICON_SIZE_Y, buttonBar));
buttonBar.add(btnUploadToMaster);
grid.add(buttonBar, 3).fill(true, false).expand(true, false);
grid.nextRow();
@@ -299,12 +306,15 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
ctlImagePermissionConfigurator = new ImagePermissionConfigurator();
GridManager grdImagePermissionConfigurator = new GridManager(pnlTabPermissions, 1, false,
new Insets(8, 2, 8, 2));
- grdImagePermissionConfigurator.add(ctlImagePermissionConfigurator).fill(true, true).expand(true, true);
+ grdImagePermissionConfigurator.add(ctlImagePermissionConfigurator)
+ .fill(true, true)
+ .expand(true, true);
// Panel with the permissions for other users
JPanel defaultPermissionPane = new JPanel();
- defaultPermissionPane.setBorder(BorderFactory.createTitledBorder("Andere Nutzer"));
+ defaultPermissionPane.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("ImageDetails.TitledBorder.defaultPermissionPane.title")));
defaultPermissionPane.setLayout(new BoxLayout(defaultPermissionPane, BoxLayout.PAGE_AXIS));
- JLabel txtDefaultPerms = new JLabel(infoTextDefPerms);
+ JLabel txtDefaultPerms = new JLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.defaultPerms.text"));
JPanel txtDefaultPermsPanel = new JPanel();
// Panel + BoxLayout + Label = wordwrap
@@ -312,10 +322,10 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
txtDefaultPermsPanel.add(txtDefaultPerms);
JPanel defaultPermsSubPanel = new JPanel();
defaultPermsSubPanel.setLayout(new BoxLayout(defaultPermsSubPanel, BoxLayout.LINE_AXIS));
- chkDefaultPermAdmin = new JCheckBox("Admin");
- chkDefaultPermDownload = new JCheckBox("Download");
- chkDefaultPermEdit = new JCheckBox("Bearbeiten");
- chkDefaultPermLink = new JCheckBox("Verlinken");
+ chkDefaultPermAdmin = new JCheckBox(I18n.WINDOW_LAYOUT.getString("ImageDetails.CheckBox.permAdmin.text"));
+ chkDefaultPermDownload = new JCheckBox(I18n.WINDOW_LAYOUT.getString("ImageDetails.CheckBox.permDownload.text"));
+ chkDefaultPermEdit = new JCheckBox(I18n.WINDOW_LAYOUT.getString("ImageDetails.CheckBox.permEdit.text"));
+ chkDefaultPermLink = new JCheckBox(I18n.WINDOW_LAYOUT.getString("ImageDetails.CheckBox.permLink.text"));
defaultPermsSubPanel.add(chkDefaultPermLink);
defaultPermsSubPanel.add(chkDefaultPermDownload);
@@ -328,9 +338,47 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
grdImagePermissionConfigurator.add(defaultPermissionPane).fill(true, false).expand(false, false);
grdImagePermissionConfigurator.finish(false);
- /*
- * *****************************************************************************
- * **
+
+
+
+ /* *******************************************************************************
+ *
+ * Container panel
+ *
+ ********************************************************************************/
+ pnlTabContainer = new JPanel();
+ txtContainerRecipe = new JTextArea();
+ JScrollPane scrollableTextArea = new JScrollPane(txtContainerRecipe);
+ scrollableTextArea.setMinimumSize(Gui.getScaledDimension(0, 200));
+ scrollableTextArea.setPreferredSize(Gui.getScaledDimension(0, 200));
+
+ JPanel pnlContainerMeta = new JPanel();
+ GridManager grdContainerMeta = new GridManager(pnlContainerMeta, 3);
+
+ grdContainerMeta.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.ImageName.text")));
+ txtContainerImageName = new JTextField();
+ txtContainerImageName.setDocument(txtTitle.getDocument());
+ grdContainerMeta.add(txtContainerImageName, 2).fill(true, false).expand(true, false);
+ grdContainerMeta.nextRow();
+
+ grdContainerMeta.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImageDetails.Label.ContainerRunOptions.text")));
+ txtContainerRun = new JTextField();
+ grdContainerMeta.add(txtContainerRun, 2).fill(true, false).expand(true, false);
+ grdContainerMeta.nextRow();
+
+ bindMountConfigurator = new ContainerBindMountConfigurator();
+ grdContainerMeta.add(bindMountConfigurator, 3).fill(true, true).expand(true, true);
+ grdContainerMeta.finish(true);
+
+ GridManager grdContainer = new GridManager(pnlTabContainer, 1, false, new Insets(8, 2, 8, 2));
+ grdContainer.add(scrollableTextArea, 1).fill(true, true).expand(true, true);
+ grdContainer.add(pnlContainerMeta, 1).fill(true, true).expand(true, true);
+ //grdContainer.add(Box.createVerticalGlue()).fill(true, true).expand(true,true);
+ grdContainer.finish(true);
+
+
+
+ /* *******************************************************************************
*
* Bottom panel for buttons
*
@@ -338,8 +386,8 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
JPanel pnlButtons = new JPanel();
pnlButtons.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
pnlButtons.setLayout(new BoxLayout(pnlButtons, BoxLayout.LINE_AXIS));
- btnSaveChanges = new JButton("Speichern");
- btnClose = new JButton("Schließen");
+ btnSaveChanges = new JButton(I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.saveChanges.text"));
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("ImageDetails.Button.close.text"));
// user feedback slot
lblError = new QLabel("");
lblError.setForeground(Color.RED);
@@ -356,11 +404,17 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
*
********************************************************************************/
pnlTabs = new JTabbedPane();
- pnlTabs.addTab("Übersicht", pnlTabOverview);
- pnlTabs.addTab("VM-Versionen", pnlTabVersions);
- pnlTabs.addTab("Berechtigungen", pnlTabPermissions);
-
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("ImageDetails.Tab.overview.title"), pnlTabOverview);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("ImageDetails.Tab.versions.title"), pnlTabVersions);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("ImageDetails.Tab.permissions.title"), pnlTabPermissions);
+
add(pnlTabs, BorderLayout.CENTER);
add(pnlButtons, BorderLayout.PAGE_END);
}
+
+ protected void showContainerTab() {
+ pnlTabs.addTab("Container", pnlTabContainer);
+ // TODO currently, do not allow to alter the version of a container image.
+ pnlTabs.remove(pnlTabs.indexOfTab(TAB_VERSIONS_TITEL));
+ }
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
index 071a6312..67ed8ec9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
@@ -16,6 +16,7 @@ import org.openslx.dozmod.gui.control.ImageListViewer.FilterType;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.helper.CompositePage;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public abstract class ImageListWindowLayout extends CompositePage {
@@ -24,15 +25,15 @@ public abstract class ImageListWindowLayout extends CompositePage {
private static final int ICON_SIZE_Y = 24;
private final ImageListWindowLayout me = this;
- protected final static String infoTextString = "Hier können Sie Virtuelle Maschinen hochladen, herunterladen, bearbeiten und löschen.";
- protected final static String infoTitleString = "Übersicht Virtuelle Maschinen";
- protected final static String newButtonLabel = "Neue VM";
- protected final static String newLectureButtonLabel = "Neue Veranstaltung";
- protected final static String editButtonLabel = "Bearbeiten";
- protected final static String downloadButtonLabel = "Download";
- protected final static String deleteButtonLabel = "Löschen";
- protected final static String switchViewButtonLabel = "Veranstaltungen zeigen";
- protected final static String showPublishedImagesLabel = "Öffentliche VMs";
+ protected final static String infoTextString = I18n.WINDOW_LAYOUT.getString("ImageList.Label.title.text");
+ protected final static String infoTitleString = I18n.WINDOW_LAYOUT.getString("ImageList.Label.info.text");
+ protected final static String newButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.newVM.text");
+ protected final static String newLectureButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.newLecture.text");
+ protected final static String editButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.edit.text");
+ protected final static String downloadButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.download.text");
+ protected final static String deleteButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.delete.text");
+ protected final static String switchViewButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.switchView.text");
+ protected final static String showPublishedImagesLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.showPublishedImages.text");
// --------------------------------------
// search field, table and buttons
@@ -65,21 +66,23 @@ public abstract class ImageListWindowLayout extends CompositePage {
JPanel buttonPanel = new JPanel();
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
- btnNewVm = new JButton(newButtonLabel, Gui.getScaledIconResource("/img/new-vm-icon.png", "New VM",
- ICON_SIZE_Y, buttonPanel));
+ btnNewVm = new JButton(newButtonLabel, Gui.getScaledIconResource("/img/new-vm-icon.png",
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.newVM.description"), ICON_SIZE_Y, buttonPanel));
btnEditDetails = new JButton(editButtonLabel, Gui.getScaledIconResource("/img/edit-icon.png",
- "Edit VM", ICON_SIZE_Y, buttonPanel));
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.edit.description"), ICON_SIZE_Y, buttonPanel));
btnDelete = new JButton(deleteButtonLabel, Gui.getScaledIconResource("/img/delete-icon.png",
- "Delete VM", ICON_SIZE_Y, buttonPanel));
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.delete.description"), ICON_SIZE_Y, buttonPanel));
btnDownload = new JButton(downloadButtonLabel, Gui.getScaledIconResource("/img/download-icon.png",
- "New VM", ICON_SIZE_Y, buttonPanel));
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.download.description"), ICON_SIZE_Y, buttonPanel));
btnNewLecture = new JButton(newLectureButtonLabel, Gui.getScaledIconResource("/img/new-lecture-icon.png",
- "New Lecture", ICON_SIZE_Y, buttonPanel));
- btnShowPublishedImages = new JButton(showPublishedImagesLabel, Gui.getScaledIconResource("/img/published-vm-icon.png",
- "Published Lectures", ICON_SIZE_Y, buttonPanel));
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.newLecture.description"), ICON_SIZE_Y, buttonPanel));
+ btnShowPublishedImages = new JButton(showPublishedImagesLabel,
+ Gui.getScaledIconResource("/img/published-vm-icon.png",
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.showPublishedImages.description"),
+ ICON_SIZE_Y, buttonPanel));
btnShowPublishedImages.setVisible(false); // this gets enabled later when the API version can be queried
btnSwitchView = new JButton(switchViewButtonLabel, Gui.getScaledIconResource("/img/switch-icon.png",
- "Switch", ICON_SIZE_Y, buttonPanel));
+ I18n.WINDOW_LAYOUT.getString("ImageList.Button.switchView.description"), ICON_SIZE_Y, buttonPanel));
buttonPanel.add(btnNewVm);
buttonPanel.add(btnEditDetails);
buttonPanel.add(btnDelete);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImagePublishedWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImagePublishedWindowLayout.java
index 7202fac1..61dbf613 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImagePublishedWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImagePublishedWindowLayout.java
@@ -16,6 +16,7 @@ import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.table.ImagePublishedTable;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public class ImagePublishedWindowLayout extends JDialog {
@@ -28,18 +29,16 @@ public class ImagePublishedWindowLayout extends JDialog {
protected final JButton btnSatDownload;
protected final JButton btnClose;
- private static String title = "Öffentliche VMs";
-
protected ImagePublishedWindowLayout(Window modalParent) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("ImagePublished.Dialog.title"), modalParent != null
+ ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
GridManager grid = new GridManager(this, 1);
// --------------- filter field --------------------------------------
JPanel filterPanel = new JPanel();
filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS));
filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
- filterPanel.add(new QLabel("Suchen: "));
+ filterPanel.add(new QLabel(I18n.WINDOW_LAYOUT.getString("ImagePublished.Label.filterPanel.text")));
txtSearch = new JTextField();
filterPanel.add(txtSearch);
// --------------- end filter field --------------------------------
@@ -58,14 +57,17 @@ public class ImagePublishedWindowLayout extends JDialog {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
- btnDownload = new JButton("Herunterladen", Gui.getScaledIconResource("/img/download-icon.png",
- "Herunterladen", ICON_SIZE_Y, buttonPanel));
+ btnDownload = new JButton(I18n.WINDOW_LAYOUT.getString("ImagePublished.Button.download.text"),
+ Gui.getScaledIconResource("/img/download-icon.png",
+ I18n.WINDOW_LAYOUT.getString("ImagePublished.Button.download.description"), ICON_SIZE_Y, buttonPanel));
buttonPanel.add(btnDownload);
- btnSatDownload = new JButton("Auf Satellit herunterladen", Gui.getScaledIconResource("/img/download-to-sat-icon.png",
- "Auf Satellit herunterladen", ICON_SIZE_Y, buttonPanel));
+ btnSatDownload = new JButton(I18n.WINDOW_LAYOUT.getString("ImagePublished.Button.satDownload.text"),
+ Gui.getScaledIconResource("/img/download-to-sat-icon.png",
+ I18n.WINDOW_LAYOUT.getString("ImagePublished.Button.satDownload.description"),
+ ICON_SIZE_Y, buttonPanel));
buttonPanel.add(btnSatDownload);
buttonPanel.add(Box.createHorizontalGlue());
- btnClose = new JButton("Schließen");
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("ImagePublished.Button.close.text"));
buttonPanel.add(btnClose);
// --------------- end button panel ----------------------------------
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureChangeImageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureChangeImageLayout.java
index d24db283..a9948308 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureChangeImageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureChangeImageLayout.java
@@ -14,6 +14,7 @@ import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.ImageListViewer;
import org.openslx.dozmod.gui.control.ImageListViewer.FilterType;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
/**
* Layout for the ChangeLinkedImage of a lecture
@@ -34,14 +35,9 @@ public class LectureChangeImageLayout extends JDialog {
*/
protected final ImageListViewer imageListViewer;
- /**
- * The title of the window.
- */
- private static String title = "VM zum Verlinken auswählen";
-
protected LectureChangeImageLayout(Window modalParent) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("LectureChangeImage.Dialog.title"), modalParent != null
+ ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
// Panel to add everything into, needed for the border.
JPanel contentPanel = new JPanel();
@@ -56,10 +52,10 @@ public class LectureChangeImageLayout extends JDialog {
// Panel for the buttons at the bottom
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
- btnOk = new JButton("Übernehmen");
+ btnOk = new JButton(I18n.WINDOW_LAYOUT.getString("LectureChangeImage.Button.ok.text"));
buttonPane.add(Box.createGlue());
buttonPane.add(btnOk);
- btnClose = new JButton("Abbrechen");
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("LectureChangeImage.Button.close.text"));
buttonPane.add(btnClose);
// Put everything into the grid
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
index 113502d8..3a100edb 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
@@ -49,6 +49,7 @@ import org.openslx.dozmod.gui.control.QDatePickerImpl;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.dozmod.util.FormatHelper;
@@ -125,10 +126,10 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
public LectureDetailsWindowLayout(Frame modalParent) {
- super(modalParent, "Veranstaltungsdetails", ModalityType.APPLICATION_MODAL);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("LectureDetails.Dialog.title"), ModalityType.APPLICATION_MODAL);
setResizable(true);
setPreferredSize(Gui.getScaledDimension(570, 650));
- setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+ setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE );
setLayout(new BorderLayout());
((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@@ -144,41 +145,41 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
grdInfo.nextRow();
// lblOwner
lblOwnerInfo = new PersonLabel();
- grdInfo.add(new QLabel("Besitzer"));
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.owner.text")));
grdInfo.add(lblOwnerInfo, 2).expand(true, false);
grdInfo.nextRow();
// creation time
lblCreateTime = new QLabel();
- grdInfo.add(new QLabel("Erstellt am"));
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.createTime.text")));
grdInfo.add(lblCreateTime, 2);
grdInfo.nextRow();
// last updater
lblUpdater = new PersonLabel();
- grdInfo.add(new QLabel("Geändert durch"));
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.updater.text")));
grdInfo.add(lblUpdater, 2);
grdInfo.nextRow();
// last updated
lblUpdateTime = new QLabel();
- grdInfo.add(new QLabel("Geändert am"));
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.updateTime.text")));
grdInfo.add(lblUpdateTime, 2);
grdInfo.nextRow();
lblVersionInfo = new QLabel(); // UNUSED
lblImageNameInfo = new QLabel();
- grdInfo.add(new QLabel("Verknüpfte VM"), 2);
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.imageName.text")), 2);
grdInfo.add(lblImageNameInfo);
grdInfo.nextRow();
lblStartTime = new QLabel();
- grdInfo.add(new QLabel("Startdatum"), 2);
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.startTime.text")), 2);
grdInfo.add(lblStartTime);
grdInfo.nextRow();
lblEndTime = new QLabel();
- grdInfo.add(new QLabel("Enddatum"), 2);
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.endTime.text")), 2);
grdInfo.add(lblEndTime);
grdInfo.nextRow();
lblUseCount = new QLabel();
- grdInfo.add(new QLabel("Aufrufe"));
+ grdInfo.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.useCount.text")));
grdInfo.add(lblUseCount, 2);
grdInfo.finish(true);
@@ -188,7 +189,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
GridManager grdGeneral = new GridManager(pnlTabGeneral, 5, true, new Insets(3, 3, 3, 3));
// lecture title
txtTitle = new JTextField();
- grdGeneral.add(new QLabel("Name"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.title.text")));
grdGeneral.add(txtTitle, 4).expand(true, false).fill(true, false);
grdGeneral.nextRow();
@@ -240,7 +241,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
kit = new HTMLEditorKit();
txtDescription.setEditorKit(kit);
txtDescription.setContentType("text/html");
- grdGeneral.add(new QLabel("Beschreibung")).anchor(GridBagConstraints.FIRST_LINE_START);
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.description.text"))).anchor(GridBagConstraints.FIRST_LINE_START);
JScrollPane jsp = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jsp.setMinimumSize(Gui.getScaledDimension(450, 120));
@@ -253,14 +254,14 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
txtId = new JTextField();
txtId.setEditable(false);
txtId.setFont(txtId.getFont().deriveFont(Font.BOLD, txtId.getFont().getSize2D() * 0.66f));
- grdGeneral.add(new QLabel("ID"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.ID.text")));
grdGeneral.add(txtId, 4).expand(true, false).fill(true, false);
grdGeneral.nextRow();
// owner
lblOwner = new PersonLabel();
- btnChangeOwner = new JButton("Ändern");
- grdGeneral.add(new QLabel("Besitzer"));
+ btnChangeOwner = new JButton(I18n.WINDOW_LAYOUT.getString("LectureDetails.Button.changeOwner.text"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.owner.text")));
grdGeneral.add(lblOwner, 3).expand(true, false);
grdGeneral.add(btnChangeOwner).fill(true, false);
grdGeneral.nextRow();
@@ -268,17 +269,17 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
// linked image
// name
txtImageName = new QLabel();
- grdGeneral.add(new QLabel("Verknüpfte VM"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.imageName.text")));
grdGeneral.add(txtImageName, 3).expand(true, false);
// link button for image
- btnLinkImage = new JButton("Ändern");
+ btnLinkImage = new JButton(I18n.WINDOW_LAYOUT.getString("LectureDetails.Button.linkImage.text"));
grdGeneral.add(btnLinkImage).fill(true, false);
grdGeneral.nextRow();
// image version handling
// auto update
- chkAutoUpdate = new JCheckBox("Immer aktuellste Version verwenden");
+ chkAutoUpdate = new JCheckBox(I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.autoUpdate.text"));
// versions combo
cboVersions = new ComboBox<>(Comparators.imageVersionDetails,
new ComboBoxRenderer<ImageVersionDetails>() {
@@ -289,16 +290,18 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
if (item.isValid) {
return FormatHelper.longDate(item.getCreateTime());
} else {
- return FormatHelper.longDate(item.getCreateTime()) + " [ungültig]";
+ return FormatHelper.longDate(item.getCreateTime())
+ + I18n.WINDOW_LAYOUT.getString("LectureDetails.ComboBox.versionInvalid.text");
}
}
});
- btnDownloadImage = new JButton("Download");
- btnDownloadImage.setToolTipText("Momentan verwendete Version herunterladen");
+ btnDownloadImage = new JButton(I18n.WINDOW_LAYOUT.getString("LectureDetails.Button.downloadImage.text"));
+ btnDownloadImage.setToolTipText(
+ I18n.WINDOW_LAYOUT.getString("LectureDetails.Button.downloadImage.toolTipText"));
JPanel versionPanel = new JPanel(new BorderLayout());
versionPanel.add(cboVersions, BorderLayout.CENTER);
versionPanel.add(chkAutoUpdate, BorderLayout.SOUTH);
- grdGeneral.add(new QLabel("VM-Version"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.version.text")));
grdGeneral.add(versionPanel, 3);
grdGeneral.add(btnDownloadImage).fill(true, false);
grdGeneral.nextRow();
@@ -312,7 +315,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
startTimePanel.add(spnStartTime);
startTimePanel.setMinimumSize(startTimePanel.getPreferredSize());
startTimePanel.setMaximumSize(startTimePanel.getPreferredSize());
- grdGeneral.add(new QLabel("Startdatum"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.startTime.text")));
grdGeneral.add(startTimePanel, 4);
grdGeneral.nextRow();
@@ -325,12 +328,12 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
endTimePanel.add(spnEndTime);
endTimePanel.setMinimumSize(endTimePanel.getPreferredSize());
endTimePanel.setMaximumSize(endTimePanel.getPreferredSize());
- grdGeneral.add(new QLabel("Enddatum"));
+ grdGeneral.add(new QLabel(I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.endTime.text")));
grdGeneral.add(endTimePanel, 4);
grdGeneral.nextRow();
// lecture active
- chkIsActive = new JCheckBox("Veranstaltung aktiv");
+ chkIsActive = new JCheckBox(I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.isActive.text"));
grdGeneral.skip();
grdGeneral.add(chkIsActive, 4);
grdGeneral.nextRow();
@@ -343,14 +346,13 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
pnlTabNetrules = new JPanel();
GridManager grdNetrules = new GridManager(pnlTabNetrules, 1, true, new Insets(9, 4, 2, 4));
// "restrictions": internet access / usb access / exam
- chkHasInternetAccess = new JCheckBox("Netzwerk-/Internetzugriff zulassen");
+ chkHasInternetAccess = new JCheckBox(
+ I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.hasInternetAccess.text"));
grdNetrules.add(chkHasInternetAccess).expand(true, false).insets(firstInset);
grdNetrules.nextRow();
grdNetrules.add(
new WordWrapLabel(
- "Legen Sie hier fest, ob die Veranstaltung Zugriff zum Internet haben soll."
- + " In der Liste können Sie bestimmte Adressen und Services"
- + " ein- oder ausschließen.", false, true))
+ I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.hasInternetAccess.text"), false, true))
.fill(true, false)
.expand(true, false)
.insets(descriptionInset);
@@ -364,25 +366,24 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
pnlTabRestrictions = new JPanel();
GridManager grdRestrictions = new GridManager(pnlTabRestrictions, 2, true, new Insets(9, 4, 2, 4));
- chkHasUsbAccess = new JCheckBox("Externe Speichermedien zulassen");
+ chkHasUsbAccess = new JCheckBox(I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.hasUSBAccess.text"));
grdRestrictions.add(chkHasUsbAccess, 2);
grdRestrictions.nextRow();
grdRestrictions.add(
- new WordWrapLabel("Legen Sie hier fest, ob die Veranstaltung den Zugriff"
- + " auf Speichermedien (CD, USB, ...) erlauben soll", false, true), 2)
+ new WordWrapLabel(
+ I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.hasUSBAccess.text"), false, true), 2)
.fill(true, false)
.expand(true, false)
.insets(descriptionInset);
grdRestrictions.nextRow();
- chkIsExam = new JCheckBox("Prüfungsmodus");
+ chkIsExam = new JCheckBox(I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.isExam.text"));
grdRestrictions.add(chkIsExam, 2);
grdRestrictions.nextRow();
grdRestrictions.add(
new WordWrapLabel(
- "Markieren Sie diese Veranstaltung als E-Prüfung.\n"
- + "Die Veranstaltung wird nur dann startbar sein, wenn " + Branding.getServiceName() + " in den"
- + " Prüfungsmodus versetzt wird. Kontaktieren Sie dazu Ihren lokalen " + Branding.getServiceName() + "-Administrator.",
+ I18n.WINDOW_LAYOUT.getString("LectureDetails.Label.isExam.text",
+ Branding.getServiceName(), Branding.getServiceName()),
false, true), 2)
.fill(true, false)
.expand(true, false)
@@ -398,9 +399,10 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
pnlTabPermissions = new JPanel();
GridManager grdPermissions = new GridManager(pnlTabPermissions, 1, false);
JPanel defaultPermissionPane = new JPanel();
- defaultPermissionPane.setBorder(BorderFactory.createTitledBorder("Andere Nutzer"));
- chkCustomPermEdit = new JCheckBox("Bearbeiten");
- chkCustomPermAdmin = new JCheckBox("Admin");
+ defaultPermissionPane.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("LectureDetails.TitledBorder.defaultPermissionPane.title")));
+ chkCustomPermEdit = new JCheckBox(I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.permEdit.text"));
+ chkCustomPermAdmin = new JCheckBox(I18n.WINDOW_LAYOUT.getString("LectureDetails.CheckBox.permAdmin.text"));
defaultPermissionPane.add(chkCustomPermEdit);
defaultPermissionPane.add(chkCustomPermAdmin);
grdPermissions.add(ctlPermissionManager).fill(true, true).expand(true, true);
@@ -459,32 +461,32 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
********************************************************************************/
// finally build the tabbedPane and add it to the main view
pnlTabs = new JTabbedPane();
- pnlTabs.addTab("Übersicht", pnlTabInfo);
- pnlTabs.addTab("Allgemein", pnlTabGeneral);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.info.title"), pnlTabInfo);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.general.title"), pnlTabGeneral);
if (Session.isLectureRestrictionsSupported()) {
- pnlTabs.addTab("Beschränkungen", pnlTabRestrictions);
- pnlTabs.addTab("Firewall", pnlTabNetrules);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.restrictions.title"), pnlTabRestrictions);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.netRules.title"), pnlTabNetrules);
}
if (MetaDataCache.getLocations() != null && !MetaDataCache.getLocations().isEmpty()) {
- pnlTabs.addTab("Raumauswahl", pnlTabLocations);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.locations.title"), pnlTabLocations);
}
if (Session.isLectureRestrictionsSupported()) {
- pnlTabs.addTab("VM-Start", pnlTabRunscript);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.runScript.title"), pnlTabRunscript);
}
- pnlTabs.addTab("Berechtigungen", pnlTabPermissions);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.permissions.title"), pnlTabPermissions);
if (Session.hasFeature(Feature.NETWORK_SHARES)) {
- pnlTabs.addTab("Netzlaufwerke", pnlTabNetshare);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.netShare.title"), pnlTabNetshare);
}
if (Session.hasFeature(Feature.LECTURE_FILTER_LDAP)) {
- pnlTabs.addTab("LDAP-Filter", pnlTabLdapFilter);
+ pnlTabs.addTab(I18n.WINDOW_LAYOUT.getString("LectureDetails.Tab.ldapFilter.title"), pnlTabLdapFilter);
}
add(pnlTabs, BorderLayout.CENTER);
// usage counter + button panel on the bottom
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
- btnClose = new JButton("Schließen");
- btnSaveChanges = new JButton("Speichern");
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("LectureDetails.Button.close.text"));
+ btnSaveChanges = new JButton(I18n.WINDOW_LAYOUT.getString("LectureDetails.Button.saveChanges.text"));
lblError = new QLabel("");
lblError.setForeground(Color.RED);
buttonPanel.add(lblError);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
index 03847488..42fb8a2a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
@@ -4,15 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridBagLayout;
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.border.TitledBorder;
import org.openslx.dozmod.gui.Gui;
@@ -21,6 +13,7 @@ import org.openslx.dozmod.gui.control.table.LectureTable;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.CompositePage;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.window.LectureListWindow.FilterType;
@SuppressWarnings("serial")
@@ -28,14 +21,6 @@ public abstract class LectureListWindowLayout extends CompositePage {
private static final int ICON_SIZE_Y = 24;
- private static final String infoTitleString = "Übersicht Veranstaltungen";
- private static final String newButtonLabel = "Neue Veranstaltung";
- private static final String editButtonLabel = "Bearbeiten";
- private static final String deleteButtonLabel = "Löschen";
- private static final String switchViewButtonLabel = "VMs zeigen";
- private static final String filterPanelLabel = "Suchen";
- private static final String infoTextString = "Hier können Sie Veranstaltungen anlegen, bearbeiten und löschen.";
-
// buttons
protected final JButton btnNewLecture;
protected final JButton btnDeleteLecture;
@@ -43,6 +28,7 @@ public abstract class LectureListWindowLayout extends CompositePage {
protected final JButton btnSwitchView;
protected final JComboBox<FilterType> cboFilter;
protected final QLabel lblVisibleLectureCount;
+ protected final JCheckBox chkSearchInDescription;
protected final JTextField txtSearch;
@@ -56,9 +42,9 @@ public abstract class LectureListWindowLayout extends CompositePage {
// --------- info group with title and text -------------------------
JPanel infoPanel = new JPanel(new BorderLayout());
- QLabel infoTitle = new QLabel(infoTitleString);
+ QLabel infoTitle = new QLabel(I18n.WINDOW_LAYOUT.getString("LectureList.Label.title.text"));
infoTitle.setFont(infoTitle.getFont().deriveFont(Font.BOLD));
- QLabel infoText = new QLabel(infoTextString);
+ QLabel infoText = new QLabel(I18n.WINDOW_LAYOUT.getString("LectureList.Label.info.text"));
infoPanel.add(infoTitle, BorderLayout.NORTH);
infoPanel.add(infoText, BorderLayout.CENTER);
// ---------------- end group of title ------------------------------
@@ -69,7 +55,8 @@ public abstract class LectureListWindowLayout extends CompositePage {
// filterPanel with filter text field and filter combo
JPanel filterPanel = new JPanel();
- filterPanel.setBorder(new TitledBorder(filterPanelLabel));
+ filterPanel.setBorder(new TitledBorder(
+ I18n.WINDOW_LAYOUT.getString("LectureList.TitledBorder.filterPanel.title")));
filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS));
txtSearch = new JTextField();
cboFilter = new JComboBox<FilterType>();
@@ -79,10 +66,15 @@ public abstract class LectureListWindowLayout extends CompositePage {
filterPanel.add(txtSearch);
filterPanel.add(cboFilter);
+ // search in description
+ chkSearchInDescription = new JCheckBox(
+ I18n.WINDOW_LAYOUT.getString("LectureList.CheckBox.searchInDescription.text"));
+ filterPanel.add(chkSearchInDescription);
+
// Panel for itemCount
JPanel lectureCountPanel = new JPanel();
lblVisibleLectureCount = new QLabel();
- lectureCountPanel.add(new JLabel("Sichtbar:"));
+ lectureCountPanel.add(new JLabel(I18n.WINDOW_LAYOUT.getString("LectureList.Label.visibleLectureCount.text")));
lectureCountPanel.add(lblVisibleLectureCount);
filterPanel.add(lectureCountPanel);
@@ -104,10 +96,22 @@ public abstract class LectureListWindowLayout extends CompositePage {
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
- btnNewLecture = new JButton(newButtonLabel, Gui.getScaledIconResource("/img/new-lecture-icon.png", "New Lecture", ICON_SIZE_Y, buttonPanel));
- btnEditLecture = new JButton(editButtonLabel, Gui.getScaledIconResource("/img/edit-icon.png", "Edit Lecture", ICON_SIZE_Y, buttonPanel));
- btnDeleteLecture = new JButton(deleteButtonLabel, Gui.getScaledIconResource("/img/delete-icon.png", "Delete Lecture", ICON_SIZE_Y, buttonPanel));
- btnSwitchView = new JButton(switchViewButtonLabel, Gui.getScaledIconResource("/img/switch-icon.png", "Switch", ICON_SIZE_Y, buttonPanel));
+ btnNewLecture = new JButton(I18n.WINDOW_LAYOUT.getString("LectureList.Button.newLecture.text"),
+ Gui.getScaledIconResource("/img/new-lecture-icon.png",
+ I18n.WINDOW_LAYOUT.getString("LectureList.Button.newLecture.description"),
+ ICON_SIZE_Y, buttonPanel));
+ btnEditLecture = new JButton(I18n.WINDOW_LAYOUT.getString("LectureList.Button.editLecture.text"),
+ Gui.getScaledIconResource("/img/edit-icon.png",
+ I18n.WINDOW_LAYOUT.getString("LectureList.Button.editLecture.description"),
+ ICON_SIZE_Y, buttonPanel));
+ btnDeleteLecture = new JButton(I18n.WINDOW_LAYOUT.getString("LectureList.Button.deleteLecture.text"),
+ Gui.getScaledIconResource("/img/delete-icon.png",
+ I18n.WINDOW_LAYOUT.getString("LectureList.Button.deleteLecture.description"),
+ ICON_SIZE_Y, buttonPanel));
+ btnSwitchView = new JButton(I18n.WINDOW_LAYOUT.getString("LectureList.Button.switchView.text"),
+ Gui.getScaledIconResource("/img/switch-icon.png",
+ I18n.WINDOW_LAYOUT.getString("LectureList.Button.switchView.description"),
+ ICON_SIZE_Y, buttonPanel));
buttonPanel.add(btnNewLecture);
buttonPanel.add(btnEditLecture);
buttonPanel.add(Box.createHorizontalStrut(5));
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java
index f8640c19..2e44139b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LocationSelectionWindowLayout.java
@@ -17,6 +17,7 @@ import org.openslx.dozmod.gui.control.LocationSelector;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
public class LocationSelectionWindowLayout extends JDialog {
@@ -35,8 +36,7 @@ public class LocationSelectionWindowLayout extends JDialog {
getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
GridManager grid = new GridManager(this, 1);
- WordWrapLabel header = new WordWrapLabel(
- "Hier können Sie die Räume auswählen, in denen diese Veranstaltung sichtbar sein soll.");
+ WordWrapLabel header = new WordWrapLabel(I18n.WINDOW_LAYOUT.getString("LocationSelection.Label.info.text"));
ctlLocationSelector = new LocationSelector();
grid.add(header).fill(true, false).expand(true, false);
grid.nextRow();
@@ -49,8 +49,8 @@ public class LocationSelectionWindowLayout extends JDialog {
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
lblError = new QLabel();
lblError.setForeground(Color.RED);
- btnClose = new JButton("Abbrechen");
- btnSaveChanges = new JButton("Übernehmen");
+ btnClose = new JButton(I18n.WINDOW_LAYOUT.getString("LocationSelection.Button.close.text"));
+ btnSaveChanges = new JButton(I18n.WINDOW_LAYOUT.getString("LocationSelection.Button.saveChanges.text"));
buttonPanel.add(lblError);
buttonPanel.add(Box.createHorizontalGlue());
buttonPanel.add(btnClose);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java
index 0264da11..0486c616 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java
@@ -26,6 +26,7 @@ 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.helper.I18n;
import org.openslx.dozmod.util.ResourceLoader;
@SuppressWarnings("serial")
@@ -49,11 +50,6 @@ public abstract class LoginWindowLayout extends JDialog {
// authentication method to use for login attempts
protected LOGIN_TYPE loginType = null;
- private static final String TITLE = Branding.getApplicationName() + " - Login";
- private static final String AUTH_TYPE_LABEL = "Authentifizierungsart";
- private static final String LOGIN_FORM_LABEL = "Zugangsdaten";
- private static final String ADVANCED_LABEL = "Erweitert";
-
// login type panel
protected final JRadioButton[] rdoLoginType = new JRadioButton[3];
@@ -80,7 +76,8 @@ public abstract class LoginWindowLayout extends JDialog {
* The shell it should be added to
*/
public LoginWindowLayout(Frame modalParent) {
- super(modalParent, TITLE, ModalityType.APPLICATION_MODAL);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("Login.Dialog.title", Branding.getApplicationName()),
+ ModalityType.APPLICATION_MODAL);
setResizable(false);
GridManager grid = new GridManager(this, 2);
@@ -88,11 +85,12 @@ public abstract class LoginWindowLayout extends JDialog {
grid.add(new QLabel(getScaledLogo()), 2);
grid.nextRow();
- rdoLoginType[0] = new JRadioButton("Authentifizierung über " + Branding.getMasterServerIdm());
- rdoLoginType[1] = new JRadioButton("Test-Zugang mit festem Benutzer");
- rdoLoginType[2] = new JRadioButton("Direkter Zugang zum Satelliten");
- btnSettings = new JButton("Einstellungen");
- btnLogDir = new JButton("Logverzeichnis");
+ rdoLoginType[0] = new JRadioButton(
+ I18n.WINDOW_LAYOUT.getString("Login.RadioButton.loginType.text.0", Branding.getMasterServerIdm()));
+ rdoLoginType[1] = new JRadioButton(I18n.WINDOW_LAYOUT.getString("Login.RadioButton.loginType.text.1"));
+ rdoLoginType[2] = new JRadioButton(I18n.WINDOW_LAYOUT.getString("Login.RadioButton.loginType.text.2"));
+ btnSettings = new JButton(I18n.WINDOW_LAYOUT.getString("Login.Button.settings.text"));
+ btnLogDir = new JButton(I18n.WINDOW_LAYOUT.getString("Login.Button.logDir.text"));
cboOrganization = new ComboBox<>(new ComboBoxRenderer<Organization>() {
@Override
@@ -104,14 +102,14 @@ public abstract class LoginWindowLayout extends JDialog {
@Override
public String getEmptyText() {
- return "Wird geladen...";
+ return I18n.WINDOW_LAYOUT.getString("Login.ComboBox.organization.emptyText");
}
});
txtUsername = new JTextField();
txtPassword = new JPasswordField();
- btnLogin = new JButton("Login");
- chkSaveUsername = new JCheckBox("Benutzername speichern");
- btnOpenRegistration = new JButton("Registrieren");
+ btnLogin = new JButton(I18n.WINDOW_LAYOUT.getString("Login.Button.login.text"));
+ chkSaveUsername = new JCheckBox(I18n.WINDOW_LAYOUT.getString("Login.CheckBox.saveUsername.text"));
+ btnOpenRegistration = new JButton(I18n.WINDOW_LAYOUT.getString("Login.Button.openRegistration.text"));
pnlLoginType = makeLoginTypePanel();
grid.add(pnlLoginType).expand(0.25, 1).fill(true, true);
@@ -137,20 +135,21 @@ public abstract class LoginWindowLayout extends JDialog {
// login form panel
JPanel loginFormPanel = new JPanel();
- loginFormPanel.setBorder(new TitledBorder(LOGIN_FORM_LABEL));
+ loginFormPanel.setBorder(new TitledBorder(
+ I18n.WINDOW_LAYOUT.getString("Login.TitledBorder.loginFormPanel.title")));
GridManager grid = new GridManager(loginFormPanel, 4);
- grid.add(new QLabel("Identity Provider"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("Login.Label.organization.text")));
grid.add(cboOrganization, 3).expand(true, false).fill(true, false);
grid.nextRow();
// label + field for username
- grid.add(new QLabel("Benutzername"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("Login.Label.username.text")));
grid.add(txtUsername, 3).expand(true, false).fill(true, false);
grid.nextRow();
// label + field for password
- grid.add(new QLabel("Passwort"));
+ grid.add(new QLabel(I18n.WINDOW_LAYOUT.getString("Login.Label.password.text")));
grid.add(txtPassword, 3).expand(true, false).fill(true, false);
grid.nextRow();
@@ -166,7 +165,8 @@ public abstract class LoginWindowLayout extends JDialog {
private JPanel makeLoginTypePanel() {
JPanel loginTypePanel = new JPanel();
loginTypePanel.setLayout(new BoxLayout(loginTypePanel, BoxLayout.PAGE_AXIS));
- loginTypePanel.setBorder(new TitledBorder(AUTH_TYPE_LABEL));
+ loginTypePanel.setBorder(new TitledBorder(
+ I18n.WINDOW_LAYOUT.getString("Login.TitledBorder.loginTypePanel.title")));
ButtonGroup loginTypeButtonGroup = new ButtonGroup();
for (int i = 0; i < rdoLoginType.length; i++) {
loginTypeButtonGroup.add(rdoLoginType[i]);
@@ -179,7 +179,7 @@ public abstract class LoginWindowLayout extends JDialog {
private JPanel makeAdvancedPanel() {
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.LINE_AXIS));
- p.setBorder(new TitledBorder(ADVANCED_LABEL));
+ p.setBorder(new TitledBorder(I18n.WINDOW_LAYOUT.getString("Login.TitledBorder.advancedPanel.title")));
p.add(btnSettings);
p.add(btnLogDir);
return p;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java
index 88b49bae..8448659e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java
@@ -7,23 +7,16 @@ import javax.swing.JLabel;
import org.openslx.dozmod.Branding;
import org.openslx.dozmod.gui.helper.CompositePage;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.util.ResourceLoader;
@SuppressWarnings("serial")
public abstract class MainMenuWindowLayout extends CompositePage {
// text for info for the vms selection
- protected String vmInfo = "<html><b>Übersicht Virtueller Maschinen</b><br>"
- + "Zur Übersicht über die verfügbaren Virtuellen Maschinen wechseln.<br>Hier können Sie:<br><br>"
- + "1) Veranstaltungen auf Basis einer Virtuellen Maschine erstellen<br>"
- + "2) Neue Virtuelle Maschinen hochladen<br>"
- + "3) Virtuelle Maschinen herunterladen<br>"
- + "4) Virtuelle Maschinen bearbeiten und löschen</html>";
+ protected String vmInfo = I18n.WINDOW_LAYOUT.getString("MainMenu.Label.vmInfo.text");
// text for the info for the lecture selection
- protected String lecturesInfo = "<html><b>Übersicht Veranstaltungen</b><br>"
- + "Zur Übersicht über verfügbare Veranstaltungen wechseln.<br>Hier können Sie:<br><br>"
- + "1) Veranstaltungen bearbeiten oder löschen<br>"
- + "2) Zu Veranstaltungen gehörende Virtuelle Maschinen herunterladen<br>&nbsp;</html>";
+ protected String lecturesInfo = I18n.WINDOW_LAYOUT.getString("MainMenu.Label.lecturesInfo.text");
// buttons
protected final JLabel lblVirtualMachinesLogo;
@@ -32,17 +25,20 @@ public abstract class MainMenuWindowLayout extends CompositePage {
protected final JButton btnShowLectures;
public MainMenuWindowLayout() {
- this.setBorder(BorderFactory.createTitledBorder(Branding.getApplicationName() + " Hauptmenü"));
+ this.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("MainMenu.TitledBorder.title", Branding.getApplicationName())));
GridManager grid = new GridManager(this, 2);
- lblVirtualMachinesLogo = new JLabel(ResourceLoader.getIcon("/img/virtualization.png", "VM-Übersicht"));
+ lblVirtualMachinesLogo = new JLabel(ResourceLoader.getIcon("/img/virtualization.png",
+ I18n.WINDOW_LAYOUT.getString("MainMenu.Label.vmLogo.description")));
JLabel vmInfoLabel = new JLabel(vmInfo);
vmInfoLabel.setVerticalAlignment(JLabel.TOP);
- lblLectureLogo = new JLabel(ResourceLoader.getIcon("/img/lecture.png", "Veranstaltungen"));
+ lblLectureLogo = new JLabel(ResourceLoader.getIcon("/img/lecture.png",
+ I18n.WINDOW_LAYOUT.getString("MainMenu.Label.lecturesLogo.description")));
JLabel lecturesInfoLabel = new JLabel(lecturesInfo);
lecturesInfoLabel.setVerticalAlignment(JLabel.TOP);
- btnShowVirtualMachines = new JButton("Zu den VMs");
- btnShowLectures = new JButton("Zu den Veranstaltungen");
+ btnShowVirtualMachines = new JButton(I18n.WINDOW_LAYOUT.getString("MainMenu.Button.showVMs.text"));
+ btnShowLectures = new JButton(I18n.WINDOW_LAYOUT.getString("MainMenu.Button.showLectures.text"));
grid.add(lblVirtualMachinesLogo).fill(true, false).expand(true, false);
grid.add(lblLectureLogo).fill(true, false).expand(true, false);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java
index 2e28a4b9..457c39d3 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/SatelliteListWindowLayout.java
@@ -19,6 +19,7 @@ import javax.swing.JTextField;
import org.openslx.bwlp.thrift.iface.Satellite;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public class SatelliteListWindowLayout extends JDialog {
@@ -29,11 +30,9 @@ public class SatelliteListWindowLayout extends JDialog {
protected final JRadioButton rdoCusomAddress;
protected final Map<JRadioButton, Satellite> radioToSat = new HashMap<>();
- private static String title = "Satellitenserver wählen";
-
protected SatelliteListWindowLayout(Window modalParent, List<Satellite> satList) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("SatelliteList.Dialog.title"), modalParent != null
+ ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
JPanel radioPanel = new JPanel();
radioPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
GridManager selectionPanelGrid = new GridManager(radioPanel, 2);
@@ -41,7 +40,7 @@ public class SatelliteListWindowLayout extends JDialog {
// --------------- radio buttons sat selection --------------------------------------
if (satList != null && !satList.isEmpty()) {
- selectionPanelGrid.add(new JLabel("Vorgegebene Server"), 2);
+ selectionPanelGrid.add(new JLabel(I18n.WINDOW_LAYOUT.getString("SatelliteList.Label.satList.text")), 2);
selectionPanelGrid.nextRow();
// create the radioButtons, add them to the map, button group and the selection grid.
for (Satellite sat : satList) {
@@ -56,7 +55,7 @@ public class SatelliteListWindowLayout extends JDialog {
// --------------- end radio buttons for sat selection ------------------------------------
// --------------- custom ip button and field --------------------------------------
- selectionPanelGrid.add(new JLabel("Server-Adresse selbst eingeben"), 2);
+ selectionPanelGrid.add(new JLabel(I18n.WINDOW_LAYOUT.getString("SatelliteList.Label.customAddress.text")), 2);
selectionPanelGrid.nextRow();
rdoCusomAddress = new JRadioButton("");
btnGroup.add(rdoCusomAddress);
@@ -71,10 +70,10 @@ public class SatelliteListWindowLayout extends JDialog {
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 3, 3, 3));
- btnCancel = new JButton("Abbrechen");
+ btnCancel = new JButton(I18n.WINDOW_LAYOUT.getString("SatelliteList.Button.cancel.text"));
buttonPane.add(btnCancel);
buttonPane.add(Box.createHorizontalGlue());
- btnContinue = new JButton("Weiter");
+ btnContinue = new JButton(I18n.WINDOW_LAYOUT.getString("SatelliteList.Button.continue.text"));
buttonPane.add(btnContinue);
// --------------- end button panel ----------------------------------
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/UserListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/UserListWindowLayout.java
index 2cb55271..c82791d7 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/UserListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/UserListWindowLayout.java
@@ -17,6 +17,7 @@ import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.control.table.UserTable;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public class UserListWindowLayout extends JDialog {
@@ -27,11 +28,9 @@ public class UserListWindowLayout extends JDialog {
protected final JButton btnCancel;
protected final JTextField txtSearch;
- private static String title = "Benutzerliste";
-
protected UserListWindowLayout(Window modalParent, String buttonCaption) {
- super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
- : ModalityType.MODELESS);
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("UserList.Dialog.title"), modalParent != null
+ ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
GridManager grid = new GridManager(this, 1);
@@ -39,7 +38,7 @@ public class UserListWindowLayout extends JDialog {
JPanel filterPanel = new JPanel();
filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS));
filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
- filterPanel.add(new QLabel("Suchen: "));
+ filterPanel.add(new QLabel(I18n.WINDOW_LAYOUT.getString("UserList.Label.filterPanel.text")));
txtSearch = new JTextField();
filterPanel.add(txtSearch);
// --------------- end filter field --------------------------------
@@ -59,7 +58,7 @@ public class UserListWindowLayout extends JDialog {
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
- btnCancel = new JButton("Schließen");
+ btnCancel = new JButton(I18n.WINDOW_LAYOUT.getString("UserList.Button.cancel.text"));
buttonPane.add(btnCancel);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
btnConfirm = new JButton(buttonCaption);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtConfigEditorWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtConfigEditorWindowLayout.java
index c8cc7f62..cfa25564 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtConfigEditorWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtConfigEditorWindowLayout.java
@@ -16,25 +16,25 @@ import javax.swing.JScrollPane;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
@SuppressWarnings("serial")
public class VirtConfigEditorWindowLayout 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 VirtConfigEditorWindowLayout(Window modalParent) {
- super(modalParent, title,
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Dialog.title"),
modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
GridManager grid = new GridManager(this, 1, true, new Insets(2, 2, 2, 2));
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!</html>"));
+ pnlWarning.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.TitledBorder.pnlWarning.title")));
+ pnlWarning.add(new JLabel(I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Label.pnlWarning.text")));
pnlEditor = new JEditorPane("text/plain", null);
pnlScrollPane = new JScrollPane(pnlEditor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
@@ -47,10 +47,10 @@ public class VirtConfigEditorWindowLayout extends JDialog {
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
buttonPane.add(Box.createHorizontalGlue());
- btnCancel = new JButton("Abbrechen");
+ btnCancel = new JButton(I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Button.cancel.text"));
buttonPane.add(btnCancel);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
- btnSave = new JButton("Speichern");
+ btnSave = new JButton(I18n.WINDOW_LAYOUT.getString("VirtConfigEditor.Button.save.text"));
buttonPane.add(btnSave);
grid.add(buttonPane).fill(true, false).expand(true, false);
;
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
index d8200578..1703e77e 100644
--- 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
@@ -22,6 +22,7 @@ import org.openslx.dozmod.gui.control.ComboBox;
import org.openslx.dozmod.gui.control.ComboBox.ComboBoxRenderer;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.Session;
import org.openslx.sat.thrift.version.Feature;
import org.openslx.util.vm.VmMetaData.DDAcceleration;
@@ -33,7 +34,6 @@ import org.openslx.util.vm.VmMetaData.UsbSpeed;
@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;
@@ -46,7 +46,7 @@ public class VirtDropDownConfigEditorWindowLayout extends JDialog {
protected final JComboBox<UsbSpeed> cboMaxUsbSpeed;
protected VirtDropDownConfigEditorWindowLayout(Window modalParent) {
- super(modalParent, title,
+ super(modalParent, I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Dialog.title"),
modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
GridManager grid = new GridManager(getContentPane(), 2, true, new Insets(2, 2, 2, 2));
@@ -55,14 +55,11 @@ public class VirtDropDownConfigEditorWindowLayout extends JDialog {
* extra JPanel for the Warning message
*/
JPanel pnlWarning = new JPanel();
- pnlWarning.setBorder(BorderFactory.createTitledBorder("WARNUNG"));
+ pnlWarning.setBorder(BorderFactory.createTitledBorder(
+ I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.TitledBorder.pnlWarning.title")));
pnlWarning.setLayout(new BorderLayout());
- pnlWarning.add(new WordWrapLabel("Hier können Sie einige Einstellungen bzgl. der"
- + " verwendeten virtuallen Hardware ändern. Bitte beachten Sie,"
- + " dass Änderungen erfordern können, dass in der VM neue Treiber"
- + " vorhanden sein müssen. In diesem Fall ist es notwendig, dass"
- + " Sie die Änderung nach dem Herunterladen einer VM lokal"
- + " durchführen, die notwendigen Treiber installieren, und die VM wieder hochladen."),
+ pnlWarning.add(new WordWrapLabel(
+ I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Label.pnlWarning.text")),
BorderLayout.CENTER);
/*
@@ -113,20 +110,25 @@ public class VirtDropDownConfigEditorWindowLayout extends JDialog {
grid.add(pnlWarning, 2).fill(true, false).expand(true, false);
grid.nextRow();
- grid.add(new JLabel("Soundkarte")).fill(true, false).expand(false, false);
+ grid.add(new JLabel(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Label.sound.text")))
+ .fill(true, 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(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Label.3DAcceleration.text")))
+ .fill(true, false).expand(false, false);
grid.add(cbo3DAcceleration).fill(true, false).expand(true, false);
grid.nextRow();
- grid.add(new JLabel("VMWare HW-Version")).fill(true, false).expand(false, false);
+ grid.add(new JLabel(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Label.HWVersion.text")))
+ .fill(true, false).expand(false, false);
grid.add(cboHWVersion).fill(true, false).expand(true, false);
grid.nextRow();
- grid.add(new JLabel("Netzwerkkarte")).fill(true, false).expand(false, false);
+ grid.add(new JLabel(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Label.E0VirtDev.text")))
+ .fill(true, false).expand(false, false);
grid.add(cboE0VirtDev).fill(true, false).expand(true, false);
grid.nextRow();
if (Session.hasFeature(Feature.CONFIGURE_USB)) {
- grid.add(new JLabel("USB")).fill(true, false).expand(false, false);
+ grid.add(new JLabel(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Label.maxUSBSpeed.text")))
+ .fill(true, false).expand(false, false);
grid.add(cboMaxUsbSpeed).fill(true, false).expand(true, false);
grid.nextRow();
}
@@ -138,13 +140,13 @@ public class VirtDropDownConfigEditorWindowLayout extends JDialog {
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
buttonPane.add(Box.createHorizontalGlue());
- btnMore = new JButton("Expertenmodus");
+ btnMore = new JButton(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Button.more.text"));
buttonPane.add(btnMore);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
- btnCancel = new JButton("Abbrechen");
+ btnCancel = new JButton(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Button.cancel.text"));
buttonPane.add(btnCancel);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
- btnSave = new JButton("Speichern");
+ btnSave = new JButton(I18n.WINDOW_LAYOUT.getString("VirtDropDownConfigEditor.Button.save.text"));
buttonPane.add(btnSave);
grid.add(buttonPane, 2).fill(true, false).expand(true, false);
grid.finish(false);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
index 845c4e3f..cccabe00 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
@@ -1,73 +1,147 @@
package org.openslx.dozmod.gui.wizard;
-import java.awt.Window;
-
-import javax.swing.JOptionPane;
-
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImageBaseWrite;
import org.openslx.bwlp.thrift.iface.ImageVersionWrite;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.QuitNotification;
import org.openslx.dozmod.gui.helper.UiFeedback;
-import org.openslx.dozmod.gui.wizard.page.ImageCustomPermissionPage;
-import org.openslx.dozmod.gui.wizard.page.ImageMetaDataPage;
-import org.openslx.dozmod.gui.wizard.page.ImageUploadPage;
-import org.openslx.dozmod.gui.wizard.page.ImageUploadSummaryPage;
+import org.openslx.dozmod.gui.wizard.page.*;
+import org.openslx.dozmod.model.ContainerDefinition;
import org.openslx.dozmod.state.UploadWizardState;
-import org.openslx.dozmod.thrift.Session;
-import org.openslx.dozmod.thrift.ThriftActions;
-import org.openslx.dozmod.thrift.ThriftError;
+import org.openslx.dozmod.thrift.*;
import org.openslx.dozmod.thrift.UploadInitiator.GotUploadTokenCallback;
import org.openslx.thrifthelper.ThriftManager;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
+import org.openslx.util.vm.DockerMetaDataDummy;
-@SuppressWarnings("serial")
-public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotification {
+import javax.swing.*;
+import java.awt.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@SuppressWarnings("serial") public class ImageCreationWizard extends Wizard
+ implements UiFeedback, QuitNotification {
private final static Logger LOGGER = Logger.getLogger(ImageCreationWizard.class);
private final UploadWizardState state = new UploadWizardState();
- protected ImageUploadPage imageUploadPage;
- protected ImageMetaDataPage imageMetaDataPage;
- protected ImageCustomPermissionPage imageCustomPermissionPage;
+
+ private ContainerDefinition containerDefinition = new ContainerDefinition();
+
+ private List<WizardPage> currentPages = new ArrayList<>();
+
private boolean baseWritten = false;
private boolean permissionsWritten = false;
/**
* Wizard for creating or editing an image
- *
- * @param editExistingImage whether to create new or edit existing image
+ *
+ * @param parent whether to create new or edit existing image
*/
public ImageCreationWizard(Window parent) {
super(parent);
state.defaultPermissions = Session.getSatelliteConfig().defaultImagePermissions;
- imageUploadPage = new ImageUploadPage(this, state, null);
- imageMetaDataPage = new ImageMetaDataPage(this, state);
- imageCustomPermissionPage = new ImageCustomPermissionPage(this, state);
- addPage(imageUploadPage);
- addPage(imageMetaDataPage);
- addPage(imageCustomPermissionPage);
+ addPage(new ImageTypePage(this));
+ }
+
+ /**
+ * Adding Pages to the Wizard to create a virtual machine
+ */
+ public void doVmCreation() {
+
+ cleanCurrent();
+ state.imageUploadPage = new ImageUploadPage(this, state, null);
+ currentPages.add(state.imageUploadPage);
+ currentPages.add(new ImageMetaDataPage(this, state, null));
+ currentPages.add(new ImageCustomPermissionPage(this, state));
+ addPages();
+
+ state.conversionPage = new ImageOvfConversionPage(this, state);
+ addOutOfOrderPage(state.conversionPage);
+ }
+
+ /**
+ * Adding Pages to the Wizard to define a docker image
+ */
+ public void doDockerCreation() {
+ cleanCurrent();
+
+ currentPages.add(new ContainerUploadPage(this, state, containerDefinition));
+ currentPages.add(new ImageMetaDataPage(this, state, containerDefinition));
+ currentPages.add(new ImageCustomPermissionPage(this, state));
+ addPages();
+ }
+
+ private void addPages() {
+ for (WizardPage i : currentPages) {
+ addPage(i);
+ }
+ }
+
+ private void cleanCurrent() {
+ if (!currentPages.isEmpty()) {
+ removePages(currentPages);
+ currentPages = new ArrayList<WizardPage>();
+ }
}
@Override
public String getWindowTitle() {
- return "Neue VM erzeugen";
+ return I18n.WIZARD.getString("ImageCreation.Wizard.title");
}
- @Override
- public boolean wantFinish() {
+ /**
+ * initUpload will be called after a user finish the creation of a new ContainerDefinition.
+ * It creates the UploadInitiator with the collected information.
+ */
+ private void initUpload() {
+
+ if (state.uuid == null) {
+ state.uuid = ThriftActions.createImage(JOptionPane.getFrameForComponent(this), state.name);
+ if (state.uuid == null) {
+ // return false;
+ LOGGER.error("initUpload Failed: Count not get uuid!");
+ return;
+ }
+ }
+
+ // Create upload initiator that will manage requesting a token, hashing the
+ // file, connecting for upload...
+ if (state.upload == null) {
+ try {
+ state.upload = new UploadInitiator(state.uuid, state.diskFile,
+ state.meta.getFilteredDefinition());
+ } catch (WrappedException e) {
+ ThriftError.showMessage(this, LOGGER, e.exception, e.displayMessage);
+ // return false;
+ } catch (IOException e) {
+ Gui.showMessageBox(this, I18n.WIZARD.getString("ImageCreation.Message.error.UploadInitializationFailure"), MessageType.ERROR, LOGGER,
+ e);
+ // return false;
+ }
+ }
+ // Start the hash check now
+ state.upload.startHashing();
+ }
+
+ @Override public boolean wantFinish() {
+
+ if (state.meta instanceof DockerMetaDataDummy)
+ initUpload();
// since we only started the upload and created a "blank" image entry
// we can here do all the sanity checks on the fields of UploadWizardState
// and react accordingly.
// check state
if (!isStateValid()) {
// TODO: Show what went wrong
- Gui.showMessageBox(this, "Ein interner Fehler ist aufgetreten.\n\nDetails in der Logdatei.",
+ Gui.showMessageBox(this, I18n.WIZARD.getString("ImageCreation.Message.error.stateInvalid"),
MessageType.ERROR, null, null);
return false;
}
@@ -77,7 +151,7 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
ThriftActions.updateImageBase(state.uuid, imageBaseWriteFromState());
} catch (TException e) {
ThriftError.showMessage(null, LOGGER, e,
- "Konnte die Metadaten der VM nicht auf dem Satelliten speichern!");
+ I18n.WIZARD.getString("ImageCreation.Message.error.baseNotWritten"));
return false;
}
baseWritten = true;
@@ -88,7 +162,7 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
try {
ThriftActions.writeImagePermissions(state.uuid, state.permissionMap);
} catch (TException e) {
- Gui.showMessageBox(this, "Konnte die Berechtigungen nicht auf dem Satelliten speichern!",
+ Gui.showMessageBox(this, I18n.WIZARD.getString("ImageCreation.Message.error.permissionsNotWritten"),
MessageType.ERROR, null, null);
ThriftActions.deleteImageBase(JOptionPane.getFrameForComponent(this), state.uuid);
return false;
@@ -98,16 +172,15 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
}
state.upload.startUpload(new GotUploadTokenCallback() {
- @Override
- public void fire() {
+ @Override public void fire() {
// push version data
try {
- ThriftActions.updateImageVersion(state.upload.getToken(), new ImageVersionWrite(
- state.isRestricted));
+ ThriftActions.updateImageVersion(state.upload.getToken(),
+ new ImageVersionWrite(state.isRestricted));
} catch (TException e) {
if (state.isRestricted) {
- Gui.showMessageBox(null, "Unerwarteter Fehler beim Setzen der Option"
- + " 'Enthält lizenzpflichtige Software' für diese Virtuelle Maschine.",
+ Gui.showMessageBox(null,
+ I18n.WIZARD.getString("ImageCreation.Message.error.updateImageVersionFailed"),
MessageType.WARNING, LOGGER, e);
}
}
@@ -116,16 +189,15 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
return true;
}
- @Override
- public WizardPage performFinish() {
+ @Override public WizardPage performFinish() {
return new ImageUploadSummaryPage(this, state, true);
}
/**
* Checks the validity of the state
- *
+ *
* @return true if we have all the needed information in the state, false
- * otherwise
+ * otherwise
*/
private boolean isStateValid() {
// debug purposes
@@ -190,15 +262,34 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
}
@Override
+ protected final void doPrevious() {
+ if (outOfOrderPage != null) {
+ outOfOrderPage = null;
+ returnAfterOutOfOrderPage(state.imageUploadPage, state.conversionPage);
+ } else {
+ super.doPrevious();
+ }
+ }
+
+ @Override
+ public final void doNext() {
+ if (outOfOrderPage != null) {
+ outOfOrderPage = null;
+ returnAfterOutOfOrderPage(state.imageUploadPage, state.conversionPage);
+ } else {
+ super.doNext();
+ }
+ }
+
+ @Override
protected boolean onCancelRequest() {
if (state.uuid == null)
return true;
- boolean confirmed = Gui.showMessageBox(this, "Möchten Sie den Vorgang wirklich abbrechen?",
+ boolean confirmed = Gui.showMessageBox(this, I18n.WIZARD.getString("ImageCreation.Message.yesNo.cancelRequest"),
MessageType.QUESTION_YESNO, null, null);
if (confirmed) {
QuickTimer.scheduleOnce(new Task() {
- @Override
- public void fire() {
+ @Override public void fire() {
if (state.upload != null) {
state.upload.cancelError();
}
@@ -214,18 +305,15 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
return confirmed;
}
- @Override
- public boolean wantConfirmQuit() {
+ @Override public boolean wantConfirmQuit() {
return state.uuid != null;
}
- @Override
- public void escapePressed() {
+ @Override public void escapePressed() {
doCancel();
}
- @Override
- public void onApplicationQuit() {
+ @Override public void onApplicationQuit() {
if (state != null && state.upload != null) {
state.upload.cancelError();
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageUpdateWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageUpdateWizard.java
index b7f5370c..56624820 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageUpdateWizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageUpdateWizard.java
@@ -7,14 +7,18 @@ import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.bwlp.thrift.iface.ImageVersionWrite;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.QuitNotification;
import org.openslx.dozmod.gui.helper.UiFeedback;
+import org.openslx.dozmod.gui.wizard.page.ImageOvfConversionPage;
+import org.openslx.dozmod.gui.wizard.page.ContainerUploadPage;
import org.openslx.dozmod.gui.wizard.page.ImageUploadPage;
import org.openslx.dozmod.gui.wizard.page.ImageUploadSummaryPage;
import org.openslx.dozmod.state.UploadWizardState;
import org.openslx.dozmod.thrift.ThriftActions;
import org.openslx.dozmod.thrift.UploadInitiator.GotUploadTokenCallback;
+import org.openslx.thrifthelper.TConst;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
@@ -29,8 +33,20 @@ public class ImageUpdateWizard extends Wizard implements UiFeedback, QuitNotific
public ImageUpdateWizard(final Window parent, final ImageDetailsRead image) {
super(parent);
- imageUploadPage = new ImageUploadPage(this, state, image);
- addPage(imageUploadPage);
+ // TODO allow user to update the plain dockerfile
+ switch (image.virtId){
+ case TConst.VIRT_DOCKER:
+ addPage(new ContainerUploadPage(this,state, image));
+ break;
+ case TConst.VIRT_QEMU:
+ case TConst.VIRT_VIRTUALBOX:
+ case TConst.VIRT_VMWARE:
+ imageUploadPage = new ImageUploadPage(this, state, image);
+ addPage(imageUploadPage);
+ state.conversionPage = new ImageOvfConversionPage(this, state);
+ addOutOfOrderPage(state.conversionPage);
+ break;
+ }
}
@Override
@@ -49,8 +65,7 @@ public class ImageUpdateWizard extends Wizard implements UiFeedback, QuitNotific
if (state.isRestricted) {
Gui.showMessageBox(
null,
- "Unerwarteter Fehler beim Setzen der Option"
- + " 'Enthält lizenzpflichtige Software' für diese Virtuelle Maschine.",
+ I18n.WIZARD.getString("ImageUpdate.Message.error.updateImageVersionFailed"),
MessageType.WARNING, LOGGER, e);
}
}
@@ -70,7 +85,7 @@ public class ImageUpdateWizard extends Wizard implements UiFeedback, QuitNotific
protected boolean onCancelRequest() {
if (state.uuid == null)
return true;
- boolean confirmed = Gui.showMessageBox(this, "Möchten Sie den Vorgang wirklich abbrechen?",
+ boolean confirmed = Gui.showMessageBox(this, I18n.WIZARD.getString("ImageUpdate.Message.yesNo.cancelRequest"),
MessageType.QUESTION_YESNO, null, null);
if (confirmed && state.upload != null) {
QuickTimer.scheduleOnce(new Task() {
@@ -95,7 +110,7 @@ public class ImageUpdateWizard extends Wizard implements UiFeedback, QuitNotific
@Override
public String getWindowTitle() {
- return "Neue VM-Version";
+ return I18n.WIZARD.getString("ImageUpdate.Wizard.title");
}
@Override
@@ -105,4 +120,24 @@ public class ImageUpdateWizard extends Wizard implements UiFeedback, QuitNotific
}
}
+ @Override
+ protected final void doPrevious() {
+ if (outOfOrderPage != null) {
+ outOfOrderPage = null;
+ returnAfterOutOfOrderPage(imageUploadPage, state.conversionPage);
+ } else {
+ super.doPrevious();
+ }
+ }
+
+ @Override
+ public final void doNext() {
+ if (outOfOrderPage != null) {
+ outOfOrderPage = null;
+ returnAfterOutOfOrderPage(imageUploadPage, state.conversionPage);
+ } else {
+ super.doNext();
+ }
+ }
+
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java
index 577cd16e..a5b235a9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java
@@ -9,6 +9,7 @@ import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.LectureWrite;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.LectureListWindow;
@@ -61,12 +62,12 @@ public class LectureWizard extends Wizard implements UiFeedback {
@Override
public String getWindowTitle() {
- return "Neue Veranstaltung erzeugen";
+ return I18n.WIZARD.getString("Lecture.Wizard.title");
}
@Override
protected boolean onCancelRequest() {
- return Gui.showMessageBox(this, "Möchten Sie den Vorgang wirklich abbrechen?",
+ return Gui.showMessageBox(this, I18n.WIZARD.getString("Lecture.Message.yesNo.cancelRequest"),
MessageType.QUESTION_YESNO, null, null);
}
@@ -109,7 +110,7 @@ public class LectureWizard extends Wizard implements UiFeedback {
}
// all good, refresh cache and change to LectureList
- Gui.showMessageBox(this, "Veranstaltung erstellt!", MessageType.INFO, null, null);
+ Gui.showMessageBox(this, I18n.WIZARD.getString("Lecture.Message.info.finish"), MessageType.INFO, null, null);
LectureCache.get(true);
MainWindow.showPage(LectureListWindow.class);
return true;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java
index 6a5afa3f..2907ebc4 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/Wizard.java
@@ -25,6 +25,7 @@ import javax.swing.SwingConstants;
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.util.ResourceLoader;
@SuppressWarnings("serial")
@@ -39,6 +40,8 @@ public abstract class Wizard extends JDialog {
private int currentPage = -1;
private boolean needsLayout = true;
private boolean isCancelled = false;
+ // Reference if an out of order page is shown.
+ protected WizardPage outOfOrderPage = null;
private final JButton btnPrev;
private final JButton btnNext;
@@ -76,10 +79,10 @@ public abstract class Wizard extends JDialog {
footer.setLayout(new BoxLayout(footer, BoxLayout.LINE_AXIS));
footer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
footer.add(Box.createHorizontalGlue());
- btnPrev = new JButton("< Zurück");
- btnNext = new JButton("Weiter >");
- btnCancel = new JButton("Abbrechen");
- btnFinish = new JButton("Fertigstellen");
+ btnPrev = new JButton(I18n.WIZARD.getString("Wizard.Button.prev.text"));
+ btnNext = new JButton(I18n.WIZARD.getString("Wizard.Button.next.text"));
+ btnCancel = new JButton(I18n.WIZARD.getString("Wizard.Button.cancel.text"));
+ btnFinish = new JButton(I18n.WIZARD.getString("Wizard.Button.finish.text.0"));
footer.add(btnPrev);
footer.add(btnNext);
footer.add(Box.createRigidArea(new Dimension(10, 10)));
@@ -146,7 +149,7 @@ public abstract class Wizard extends JDialog {
super.show();
}
- private void showPage(int index) {
+ protected void showPage(int index) {
if (currentPage != -1) {
WizardPage old = getPage(currentPage);
old.onPageLeave();
@@ -161,6 +164,37 @@ public abstract class Wizard extends JDialog {
validate();
}
+ // Show an out of order page e.g. for converting an image
+ public void showOutOfOrderPage(WizardPage page) {
+ WizardPage old = getPage(currentPage);
+ outOfOrderPage = page;
+ old.onPageLeave();
+ old.setVisible(false);
+
+ page.onPageEnter();
+ page.setVisible(true);
+ updateHeader(page);
+ updateButtons(page);
+ validate();
+ }
+
+ // Show an out of order page e.g. for converting an image
+ /**
+ *
+ * @param NewPage to return to.
+ * @param OldPage that should be hidden.
+ */
+ public void returnAfterOutOfOrderPage(WizardPage newPage, WizardPage oldPage) {
+ oldPage.onPageLeave();
+ oldPage.setVisible(false);
+
+ newPage.onPageEnter();
+ newPage.setVisible(true);
+ updateHeader(newPage);
+ updateButtons(newPage);
+ validate();
+ }
+
void updateHeader(WizardPage page) {
if (!isPostFinish && (currentPage == -1 || getPage(currentPage) != page))
return;
@@ -172,7 +206,8 @@ public abstract class Wizard extends JDialog {
pageDesc = "";
titleLabel.setText(pageTitle);
messageLabel.setText(pageDesc);
- messageLabel.setIcon(ResourceLoader.getScaledIcon(page.getMessageIcon(), messageLabel.getHeight(), messageLabel));
+ messageLabel.setIcon(
+ ResourceLoader.getScaledIcon(page.getMessageIcon(), messageLabel.getHeight(), messageLabel));
messageLabel.setForeground(page.getMessageColor());
messageLabel.validate();
setTitle(getWindowTitle() + " - " + pageTitle);
@@ -188,6 +223,18 @@ public abstract class Wizard extends JDialog {
pages.add(page);
}
+ // For adding pages which are not in the normal linear flow
+ protected final void addOutOfOrderPage(WizardPage page) {
+ contentPanel.add(page);
+ page.setVisible(false);
+ }
+
+ protected final void removePages(List<WizardPage> currentPages) {
+ for (WizardPage i : currentPages) {
+ pages.remove(i);
+ }
+ }
+
protected void addSummaryPage(WizardPage page) {
postFinishPage = page;
}
@@ -207,6 +254,9 @@ public abstract class Wizard extends JDialog {
}
btnFinish.setEnabled(canFinish);
// State of next button
+ if (outOfOrderPage != null) {
+ btnNext.setEnabled(page.isComplete());
+ }
if (currentPage != -1 && getPage(currentPage) == page) {
btnNext.setEnabled(currentPage + 1 < pages.size() && page.isComplete());
btnPrev.setEnabled(currentPage > 0 && getPage(currentPage - 1).canComeBack);
@@ -232,7 +282,7 @@ public abstract class Wizard extends JDialog {
return isCancelled;
}
- public final void doNext() {
+ public void doNext() {
if (isPostFinish || !btnNext.isEnabled())
return;
if (currentPage + 1 < pages.size()) {
@@ -242,7 +292,11 @@ public abstract class Wizard extends JDialog {
}
}
- protected final void doPrevious() {
+ // protected void returnAfterOutOfOrderPage(int previousPage){
+ // showPage(previousPage);
+ // }
+
+ protected void doPrevious() {
if (isPostFinish || !btnPrev.isEnabled())
return;
if (currentPage > 0) {
@@ -259,6 +313,9 @@ public abstract class Wizard extends JDialog {
if (isPostFinish) {
postFinishPage.onPageLeave();
}
+ if (outOfOrderPage != null) {
+ outOfOrderPage.onPageLeave();
+ }
dispose();
}
}
@@ -286,7 +343,7 @@ public abstract class Wizard extends JDialog {
isPostFinish = true;
btnPrev.setVisible(false);
btnNext.setVisible(false);
- btnFinish.setText("Schließen");
+ btnFinish.setText(I18n.WIZARD.getString("Wizard.Button.finish.text.1"));
postFinishPage.setVisible(false);
contentPanel.add(postFinishPage);
showPage(-1);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java
index fc1da67f..b8be827a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/WizardPage.java
@@ -100,7 +100,7 @@ public abstract class WizardPage extends JPanel {
* Setters from derived classes
*/
- protected void setPageComplete(boolean b) {
+ public void setPageComplete(boolean b) {
if (isComplete == b)
return;
isComplete = b;
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
new file mode 100644
index 00000000..7d873264
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ContainerUploadPageLayout.java
@@ -0,0 +1,116 @@
+package org.openslx.dozmod.gui.wizard.layout;
+
+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 org.openslx.dozmod.model.ContainerBuildContextMethod;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class ContainerUploadPageLayout extends WizardPage {
+
+ protected final JTextField txtImageName;
+ protected final JButton btnBrowseForImage;
+ protected final JTextField txtImageFile;
+ protected final JCheckBox chkLicenseRestricted;
+ protected final QLabel lblImageName;
+ protected final JTextArea txtInfoText;
+
+ protected final JTextField txtContainerRun;
+ protected final QLabel lblContainerRun;
+
+ protected final JTabbedPane tpInput;
+ protected final JTextField txtGitRepo;
+
+ // TODO set proper Text labels
+
+ /**
+ * Page for uploading an imagefile
+ */
+ public ContainerUploadPageLayout(Wizard wizard) {
+
+ super(wizard, I18n.PAGE_LAYOUT.getString("ContainerUploadPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.description"));
+ GridManager grid = new GridManager(this, 3, false);
+
+ JPanel p1 = new JPanel();
+ p1.setVisible(true);
+ GridManager g1 = new GridManager(p1, 3, true, new Insets(5, 0, 5, 0));
+ QLabel imageFileCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.DockerFile.label"));
+ txtImageFile = new JTextField();
+ txtImageFile.setEditable(false);
+ btnBrowseForImage = new JButton(I18n.PAGE_LAYOUT.getString("ImageUpload.Button.browseForImage.text"));
+ btnBrowseForImage.setMnemonic(KeyEvent.VK_B);
+ g1.add(imageFileCaption);
+ g1.add(txtImageFile).fill(true, false).expand(true, false);
+ g1.add(btnBrowseForImage);
+ g1.finish(false);
+
+ JPanel p2 = new JPanel();
+ p2.setVisible(false);
+ GridManager g2 = new GridManager(p2, 2, true, new Insets(5, 0, 5, 0));
+ QLabel lblGitRepo = new QLabel(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.GitRepository.label"));
+ lblGitRepo.setToolTipText(I18n.PAGE_LAYOUT.getString(
+ "ContainerUploadPage.GitRepository.toolTipText"));
+ txtGitRepo = new JTextField();
+ txtGitRepo.setToolTipText(I18n.PAGE_LAYOUT.getString(
+ "ContainerUploadPage.GitRepository.toolTipText"));
+ g2.add(lblGitRepo);
+ g2.add(txtGitRepo).fill(true, false).expand(true, false);
+ g2.finish(false);
+
+ tpInput = new JTabbedPane();
+ tpInput.addTab("Dockerfile", p1);
+ tpInput.addTab("Git Repository", p2);
+ tpInput.setSelectedIndex(ContainerBuildContextMethod.FILE.ordinal());
+
+ grid.add(tpInput, 3).fill(true, false);
+
+ // Start as with Dockerfile as input!
+ tpInput.setSelectedIndex(0);
+
+ lblImageName = new QLabel(I18n.PAGE_LAYOUT.getString(
+ "ContainerUploadPage.ImageName.text"));
+ txtImageName = new JTextField();
+ grid.add(lblImageName);
+ grid.add(txtImageName, 2, 1).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ // -- Software license changed - shown only in UploadWizard --
+ chkLicenseRestricted = new JCheckBox(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.CheckBox.ContainsLicenseRestricted.text"));
+ chkLicenseRestricted.setVisible(false);
+ grid.skip();
+ grid.add(chkLicenseRestricted, 2, 1).fill(false, false).expand(true, false);
+ grid.nextRow();
+
+ lblContainerRun = new QLabel(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.ContainerStartOptions.label"));
+ lblContainerRun.setToolTipText(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.ContainerStartOptions.tooltip"));
+ txtContainerRun = new JTextField();
+ grid.add(lblContainerRun);
+ grid.add(txtContainerRun, 2, 1).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ grid.add(Box.createVerticalGlue(), 3).expand(true, true);
+ txtInfoText = new JTextArea();
+ txtInfoText.setBorder(BorderFactory.createTitledBorder(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.Infobox.label")));
+ txtInfoText.setLineWrap(true);
+ txtInfoText.setWrapStyleWord(true);
+ txtInfoText.setEditable(false);
+ txtInfoText.setFocusable(false);
+ txtInfoText.setOpaque(false);
+ txtInfoText.setText(I18n.PAGE_LAYOUT.getString("ContainerUploadPage.Infobox.text"));
+
+ grid.add(txtInfoText, 3).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ grid.finish(true);
+ }
+
+ protected ContainerBuildContextMethod getBuildContextMethod() {
+ return ContainerBuildContextMethod.fromInt(tpInput.getSelectedIndex());
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageCustomPermissionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageCustomPermissionPageLayout.java
index e833090b..c4e94f88 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageCustomPermissionPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageCustomPermissionPageLayout.java
@@ -10,6 +10,7 @@ import javax.swing.JPanel;
import org.openslx.dozmod.gui.configurator.ImagePermissionConfigurator;
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;
@@ -30,8 +31,8 @@ public class ImageCustomPermissionPageLayout extends WizardPage {
* @param wizard
*/
public ImageCustomPermissionPageLayout(Wizard wizard) {
- super(wizard, "Berechtigungen festlegen");
- setDescription("Legen Sie hier die gewünschten Berechtigungen fest.");
+ super(wizard, I18n.PAGE_LAYOUT.getString("ImageCustomPermission.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ImageCustomPermission.WizardPage.description"));
GridManager grid = new GridManager(this, 1, false);
// custom permissions
@@ -40,25 +41,29 @@ public class ImageCustomPermissionPageLayout extends WizardPage {
grid.nextRow();
// -- default permissions --
- JLabel defaultPermLabel = new JLabel("Standardberechtigungen");
+ JLabel defaultPermLabel = new JLabel(
+ I18n.PAGE_LAYOUT.getString("ImageCustomPermission.Label.defaultPerm.text"));
defaultPermLabel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
defaultPermLabel.setFont(defaultPermLabel.getFont().deriveFont(Font.BOLD));
grid.add(defaultPermLabel);
- JLabel defaultDescriptionLabel = new JLabel("<html><body style ='width:100%'> "
- + "Legen Sie hier die Berechtigungen für alle anderen (nicht in der Liste "
- + "angezeigten) Benutzer fest.</body></html>");
+ JLabel defaultDescriptionLabel = new JLabel(
+ I18n.PAGE_LAYOUT.getString("ImageCustomPermission.Label.defaultDesc.text"));
defaultDescriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
grid.add(defaultDescriptionLabel).fill(true, false).expand(true, false);
JPanel permissionsPanel = new JPanel();
permissionsPanel.setLayout(new BoxLayout(permissionsPanel, BoxLayout.LINE_AXIS));
- chkPermissionLink = new JCheckBox("Verlinken");
+ chkPermissionLink = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("ImageCustomPermission.CheckBox.permissionLink.text"));
chkPermissionLink.setSelected(true);
- chkPermissionRead = new JCheckBox("Download");
+ chkPermissionRead = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("ImageCustomPermission.CheckBox.permissionRead.text"));
chkPermissionRead.setSelected(true);
- chkPermissionEdit = new JCheckBox("Bearbeiten");
- chkPermissionAdmin = new JCheckBox("Admin");
+ chkPermissionEdit = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("ImageCustomPermission.CheckBox.permissionEdit.text"));
+ chkPermissionAdmin = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("ImageCustomPermission.CheckBox.permissionAdmin.text"));
permissionsPanel.add(chkPermissionLink);
permissionsPanel.add(chkPermissionRead);
permissionsPanel.add(chkPermissionEdit);
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 34b38395..68b680c8 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
@@ -14,17 +14,21 @@ import javax.swing.text.html.HTMLEditorKit;
import java.awt.Dimension;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.configurator.ContainerBindMountConfigurator;
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.helper.I18n;
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 {
+import javax.swing.*;
+@SuppressWarnings("serial") public abstract class ImageMetaDataPageLayout extends WizardPage {
+
+ protected final QLabel lblOperatingSystem;
protected final JComboBox<OperatingSystem> cboOperatingSystem;
protected final JEditorPane txtDescription;
protected final JTextArea startCommand;
@@ -43,18 +47,20 @@ public abstract class ImageMetaDataPageLayout extends WizardPage {
protected final HTMLEditorKit kit;
+ protected final ContainerBindMountConfigurator bindMountConfigurator;
+
/**
* wizard page for entering image data at creating or editing an image
- *
- * @param wizard
+ *
+ * @param wizard The Wizard-object, which this extended {@link WizardPage} belongs to.
*/
public ImageMetaDataPageLayout(Wizard wizard) {
- super(wizard, "Metadaten");
- setDescription("Geben Sie bitte einen aussagekräftigen Namen für die neue VM ein.");
+ super(wizard, I18n.PAGE_LAYOUT.getString("ImageMetaData.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ImageMetaData.WizardPage.description"));
GridManager grid = new GridManager(this, 3, false);
- QLabel osCaption = new QLabel("Betriebssystem");
+ lblOperatingSystem = new QLabel(I18n.PAGE_LAYOUT.getString("ImageMetaData.Label.OS.text"));
cboOperatingSystem = new ComboBox<>(Comparators.operatingSystem, new ComboBoxRenderer<OperatingSystem>() {
@Override
public String renderItem(OperatingSystem item) {
@@ -64,11 +70,11 @@ public abstract class ImageMetaDataPageLayout extends WizardPage {
}
});
cboOperatingSystem.setEditable(false);
- grid.add(osCaption);
+ grid.add(lblOperatingSystem);
grid.add(cboOperatingSystem, 2);
grid.nextRow();
- sCommandCaption = new QLabel("Startbefehl");
+ sCommandCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ImageMetaData.Label.startCommand.text"));
startCommand = new JTextArea(1, 50);
startCommand.setMinimumSize(Gui.getScaledDimension(0, 35));
startCommand.setLineWrap(true);
@@ -118,8 +124,9 @@ public abstract class ImageMetaDataPageLayout extends WizardPage {
grid.nextRow();
// description
- QLabel descriptionCaption = new QLabel("Beschreibung");
+ QLabel descriptionCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ImageMetaData.Label.description.text"));
txtDescription = new JEditorPane();
+ txtDescription.setMinimumSize(Gui.getScaledDimension(0, 70));
kit = new HTMLEditorKit();
txtDescription.setEditorKit(kit);
txtDescription.setContentType("text/html");
@@ -129,13 +136,20 @@ public abstract class ImageMetaDataPageLayout extends WizardPage {
grid.add(descPane, 2).fill(true, true).expand(true, true);
grid.nextRow();
- chkLicenseRestricted = new JCheckBox("VM enthält lizenzpflichtige Software");
+ chkLicenseRestricted = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("ImageMetaData.CheckBox.licenseRestricted.text"));
chkLicenseRestricted.setSelected(true);
grid.add(chkLicenseRestricted, 3);
grid.nextRow();
+ bindMountConfigurator = new ContainerBindMountConfigurator();
+ bindMountConfigurator.setVisible(false); // only visible in container context
+
+ grid.add(bindMountConfigurator, 2).fill(true, true).expand(true, true);
+ grid.nextRow();
+
// -- end permissions group --
- chkIsTemplate = new JCheckBox("Vorlage erstellen");
+ chkIsTemplate = new JCheckBox(I18n.PAGE_LAYOUT.getString("ImageMetaData.CheckBox.isTemplate.text"));
grid.add(chkIsTemplate, 3);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageOvfConversionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageOvfConversionPageLayout.java
new file mode 100644
index 00000000..7f42fd9d
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageOvfConversionPageLayout.java
@@ -0,0 +1,78 @@
+package org.openslx.dozmod.gui.wizard.layout;
+
+import java.awt.event.KeyEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JProgressBar;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+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;
+
+@SuppressWarnings("serial")
+public abstract class ImageOvfConversionPageLayout extends WizardPage {
+
+ public final JButton btnStartConversion;
+ protected final JTextArea txtInfoText;
+ protected final JProgressBar conversionProgressBar;
+ protected final JButton btnBrowseForOvftool;
+ protected final JTextField ovfToolFile;
+
+ /**
+ * Page converting an ovf to a vmx image.
+ */
+ public ImageOvfConversionPageLayout(Wizard wizard) {
+ super(wizard, I18n.PAGE_LAYOUT.getString("ImageOvfConversion.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ImageOvfConversion.WizardPage.description"));
+ GridManager grid = new GridManager(this, 3);
+
+ txtInfoText = new JTextArea();
+ txtInfoText.setBorder(BorderFactory.createTitledBorder("Hinweis"));
+ txtInfoText.setLineWrap(true);
+ txtInfoText.setWrapStyleWord(true);
+ txtInfoText.setEditable(false);
+ txtInfoText.setFocusable(false);
+ txtInfoText.setOpaque(false);
+ txtInfoText.setText(I18n.PAGE_LAYOUT.getString("ImageOvfConversion.WizardPage.InformationBox.text"));
+ grid.add(txtInfoText, 3).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ // -- Browse for ovfTool --
+ QLabel imageFileCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ImageOvfConversion.Toolpath.text"));
+ ovfToolFile = new JTextField();
+ ovfToolFile.setEditable(false);
+ ovfToolFile.setText(I18n.PAGE_LAYOUT.getString("ImageOvfConversion.Toolpath.defaultpath.text"));
+ btnBrowseForOvftool = new JButton(
+ I18n.PAGE_LAYOUT.getString("ImageOvfConversion.Toolpath.BrowseButton.text"));
+ btnBrowseForOvftool.setMnemonic(KeyEvent.VK_B);
+ grid.add(imageFileCaption);
+ grid.add(ovfToolFile).fill(true, false).expand(true, false);
+ grid.add(btnBrowseForOvftool);
+ grid.nextRow();
+
+ grid.add(Box.createVerticalGlue(), 3).expand(true, true);
+ grid.nextRow();
+
+ btnStartConversion = new JButton(
+ I18n.PAGE_LAYOUT.getString("ImageOvfConversion.Button.StartConversion.text"));
+ btnStartConversion.setMnemonic(KeyEvent.VK_B);
+ grid.add(btnStartConversion, 1).fill(false, false).expand(false, false);
+ grid.add(Box.createVerticalGlue(), 2).expand(false, false);
+ grid.nextRow();
+
+ conversionProgressBar = new JProgressBar();
+ conversionProgressBar.setMinimum(0);
+ conversionProgressBar.setMaximum(100);
+ conversionProgressBar.setStringPainted(true);
+ grid.add(conversionProgressBar, 3).fill(true, false).expand(true, false);
+ grid.nextRow();
+
+ grid.finish(false);
+ }
+}
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
new file mode 100644
index 00000000..7dac1103
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageTypePageLayout.java
@@ -0,0 +1,52 @@
+package org.openslx.dozmod.gui.wizard.layout;
+
+import org.openslx.dozmod.gui.helper.GridManager;
+import org.openslx.dozmod.gui.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.WizardPage;
+
+import javax.swing.*;
+
+public abstract class ImageTypePageLayout extends WizardPage {
+
+ protected final JTextArea txtInfoText;
+ protected final JButton btnNewVmImage;
+ protected final JButton btnNewDockerImage;
+
+ /**
+ * Page to choose between new VM-Image or Docker Image
+ */
+ public ImageTypePageLayout(Wizard wizard) {
+
+ super(wizard, "Wähle Image Type");
+ setDescription("Möchten Sie eine VM oder ein Docker Image definieren?");
+ GridManager grid = new GridManager(this, 4, false);
+
+ // Choose between new vm or new docker-image
+ txtInfoText = new JTextArea();
+ txtInfoText.setBorder(BorderFactory.createTitledBorder("Hinweis"));
+ txtInfoText.setLineWrap(true);
+ txtInfoText.setWrapStyleWord(true);
+ txtInfoText.setEditable(false);
+ txtInfoText.setFocusable(false);
+ txtInfoText.setOpaque(false);
+ 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);
+ // -- New Docker-Image Pick--
+ btnNewDockerImage = new JButton("new Docker-Image");
+ 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/layout/ImageUploadPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java
index 6f0e0afc..ceb1ed58 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadPageLayout.java
@@ -11,6 +11,7 @@ import javax.swing.JTextField;
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;
@@ -28,29 +29,30 @@ public abstract class ImageUploadPageLayout extends WizardPage {
* Page for uploading an imagefile
*/
public ImageUploadPageLayout(Wizard wizard) {
- super(wizard, "Neue VM anlegen");
- setDescription("Bitte wählen Sie eine Virtuelle Maschine zum Hochladen aus.");
+ super(wizard, I18n.PAGE_LAYOUT.getString("ImageUpload.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ImageUpload.WizardPage.description"));
GridManager grid = new GridManager(this, 3, false);
// -- Browse for VM --
- QLabel imageFileCaption = new QLabel("Virtuelle Maschine");
+ QLabel imageFileCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ImageUpload.Label.imageFile.text"));
txtImageFile = new JTextField();
txtImageFile.setEditable(false);
- btnBrowseForImage = new JButton("Durchsuchen");
+ btnBrowseForImage = new JButton(I18n.PAGE_LAYOUT.getString("ImageUpload.Button.browseForImage.text"));
btnBrowseForImage.setMnemonic(KeyEvent.VK_B);
grid.add(imageFileCaption);
grid.add(txtImageFile).fill(true, false).expand(true, false);
grid.add(btnBrowseForImage);
grid.nextRow();
- lblImageName = new QLabel("Name");
+ lblImageName = new QLabel(I18n.PAGE_LAYOUT.getString("ImageUpload.Label.imageName.text"));
txtImageName = new JTextField();
grid.add(lblImageName);
grid.add(txtImageName, 2, 1).fill(true, false).expand(true, false);
grid.nextRow();
// -- Software license changed - shown only in UploadWizard --
- chkLicenseRestricted = new JCheckBox("enthält lizenzpflichtige Software");
+ chkLicenseRestricted = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("ImageUpload.CheckBox.licenseRestricted.text"));
chkLicenseRestricted.setVisible(false);
grid.skip();
grid.add(chkLicenseRestricted, 2, 1).fill(false, false).expand(true, false);
@@ -59,18 +61,14 @@ public abstract class ImageUploadPageLayout extends WizardPage {
grid.add(Box.createVerticalGlue(), 3).expand(true, true);
txtInfoText = new JTextArea();
- txtInfoText.setBorder(BorderFactory.createTitledBorder("Hinweis"));
+ txtInfoText.setBorder(BorderFactory.createTitledBorder(
+ I18n.PAGE_LAYOUT.getString("ImageUpload.TextArea.info.title")));
txtInfoText.setLineWrap(true);
txtInfoText.setWrapStyleWord(true);
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(I18n.PAGE_LAYOUT.getString("ImageUpload.TextArea.info.text"));
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/ImageUploadSummaryPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadSummaryPageLayout.java
index c53fd907..1781a1d9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadSummaryPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageUploadSummaryPageLayout.java
@@ -6,6 +6,7 @@ import javax.swing.JLabel;
import org.openslx.dozmod.gui.control.BlockProgressBar;
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;
@@ -17,8 +18,8 @@ public class ImageUploadSummaryPageLayout extends WizardPage {
protected final JLabel lblHelpText;
public ImageUploadSummaryPageLayout(Wizard wizard) {
- super(wizard, "Fertig!");
- setDescription("Assistent abgeschlossen");
+ super(wizard, I18n.PAGE_LAYOUT.getString("ImageUploadSummary.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ImageUploadSummary.WizardPage.description"));
GridManager grid = new GridManager(this, 1);
ctlUploadProgressBar = new BlockProgressBar(null);
@@ -36,7 +37,7 @@ public class ImageUploadSummaryPageLayout extends WizardPage {
grid.add(Box.createVerticalGlue()).expand(true, true);
grid.nextRow();
- chkCreateLecture = new JCheckBox("Veranstaltung zu dieser VM erstellen");
+ chkCreateLecture = new JCheckBox(I18n.PAGE_LAYOUT.getString("ImageUploadSummary.CheckBox.createLecture.text"));
chkCreateLecture.setVisible(false);
grid.add(chkCreateLecture);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java
index 07a4887f..771dc60e 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCreationPageLayout.java
@@ -19,6 +19,7 @@ import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.QDatePickerImpl;
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;
@@ -53,12 +54,12 @@ public abstract class LectureCreationPageLayout extends WizardPage {
*/
public LectureCreationPageLayout(Wizard wizard, String title) {
super(wizard, title);
- setDescription("Geben Sie bitte einen aussagekräftigen Namen für die neue Veranstaltung ein.");
+ setDescription(I18n.PAGE_LAYOUT.getString("LectureCreation.WizardPage.description"));
GridManager grid = new GridManager(this, 3);
// lecture name
txtName = new JTextField();
- grid.add(new QLabel("Veranstaltungsname"));
+ grid.add(new QLabel(I18n.PAGE_LAYOUT.getString("LectureCreation.Label.name.text")));
grid.add(txtName, 2).fill(true, false).expand(true, false);
grid.nextRow();
@@ -109,26 +110,26 @@ public abstract class LectureCreationPageLayout extends WizardPage {
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
txtDescription.setMinimumSize(Gui.getScaledDimension(0, 60));
descPane.setMinimumSize(txtDescription.getMinimumSize());
- grid.add(new QLabel("Beschreibung"));
+ grid.add(new QLabel(I18n.PAGE_LAYOUT.getString("LectureCreation.Label.description.text")));
grid.add(descPane, 2).fill(true, false).expand(true, false);
grid.nextRow();
// Start date/time
dtpStartDate = new QDatePickerImpl();
spnStartTime = makeTimeSpinner(0, 0);
- grid.add(new QLabel("Startdatum"));
+ grid.add(new QLabel(I18n.PAGE_LAYOUT.getString("LectureCreation.Label.startTime.text")));
grid.add(dtpStartDate).fill(true, false).expand(true, false);
grid.add(spnStartTime);
grid.nextRow();
dtpEndDate = new QDatePickerImpl();
spnEndTime = makeTimeSpinner(23, 59);
- grid.add(new QLabel("Enddatum"));
+ grid.add(new QLabel(I18n.PAGE_LAYOUT.getString("LectureCreation.Label.endTime.text")));
grid.add(dtpEndDate).fill(true, false).expand(true, false);
grid.add(spnEndTime);
grid.nextRow();
- grid.add(new QLabel("Dauer der Veranstaltung: "));
+ grid.add(new QLabel(I18n.PAGE_LAYOUT.getString("LectureCreation.Label.period.text")));
lblCalcPeriod = new QLabel();
grid.add(lblCalcPeriod, 2);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java
index 64afc4df..0615fb0b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureCustomPermissionPageLayout.java
@@ -10,6 +10,7 @@ import javax.swing.JPanel;
import org.openslx.dozmod.gui.configurator.LecturePermissionConfigurator;
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;
@@ -26,8 +27,8 @@ public abstract class LectureCustomPermissionPageLayout extends WizardPage {
* Page for setting custom permissions of a lecture
*/
public LectureCustomPermissionPageLayout(Wizard wizard) {
- super(wizard, "Berechtigungen festlegen");
- setDescription("Legen Sie hier die gewünschten Berechtigungen fest.");
+ super(wizard, I18n.PAGE_LAYOUT.getString("LectureCustomPermission.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("LectureCustomPermission.WizardPage.description"));
GridManager grid = new GridManager(this, 1, false);
lectureCustomPermissionManager = new LecturePermissionConfigurator();
@@ -35,21 +36,23 @@ public abstract class LectureCustomPermissionPageLayout extends WizardPage {
grid.nextRow();
// -- default permissions --
- JLabel defaultPermLabel = new JLabel("Standardberechtigungen");
+ JLabel defaultPermLabel = new JLabel(
+ I18n.PAGE_LAYOUT.getString("LectureCustomPermission.Label.defaultPerm.text"));
defaultPermLabel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
defaultPermLabel.setFont(defaultPermLabel.getFont().deriveFont(Font.BOLD));
grid.add(defaultPermLabel);
- JLabel defaultDescriptionLabel = new JLabel("<html><body style ='width:100%'> "
- + "Legen Sie hier die Berechtigungen für alle anderen (nicht in der Liste "
- + "angezeigten) Benutzer fest.</body></html>");
+ JLabel defaultDescriptionLabel = new JLabel(
+ I18n.PAGE_LAYOUT.getString("LectureCustomPermission.Label.defaultDesc.text"));
defaultDescriptionLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
grid.add(defaultDescriptionLabel).fill(true, false).expand(true, false);
JPanel permissionsPanel = new JPanel();
permissionsPanel.setLayout(new BoxLayout(permissionsPanel, BoxLayout.LINE_AXIS));
- chkPermissionEdit = new JCheckBox("Bearbeiten");
- chkPermissionAdmin = new JCheckBox("Admin");
+ chkPermissionEdit = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("LectureCustomPermission.CheckBox.permissionEdit.text"));
+ chkPermissionAdmin = new JCheckBox(
+ I18n.PAGE_LAYOUT.getString("LectureCustomPermission.CheckBox.permissionAdmin.text"));
permissionsPanel.add(chkPermissionEdit);
permissionsPanel.add(chkPermissionAdmin);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java
index 7461df1e..ef7baf36 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureImageListPageLayout.java
@@ -3,6 +3,7 @@ package org.openslx.dozmod.gui.wizard.layout;
import org.openslx.dozmod.gui.control.ImageListViewer;
import org.openslx.dozmod.gui.control.ImageListViewer.FilterType;
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;
@@ -15,8 +16,8 @@ public abstract class LectureImageListPageLayout extends WizardPage {
* Page for setting custom permissions of a lecture
*/
public LectureImageListPageLayout(Wizard wizard) {
- super(wizard, "VM verknüpfen");
- setDescription("Wählen Sie eine VM für diese Veranstaltung aus");
+ super(wizard, I18n.PAGE_LAYOUT.getString("LectureImageList.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("LectureImageList.WizardPage.description"));
GridManager grid = new GridManager(this, 1, false);
ctlImageList = new ImageListViewer(FilterType.USABLE);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java
index 929b55b8..bd86e86c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureLocationSelectionPageLayout.java
@@ -3,6 +3,7 @@ package org.openslx.dozmod.gui.wizard.layout;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.control.LocationSelector;
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;
@@ -14,8 +15,8 @@ public class LectureLocationSelectionPageLayout extends WizardPage {
protected final LocationSelector ctlLocationSelector;
public LectureLocationSelectionPageLayout(Wizard wizard) {
- super(wizard, "Raumauswahl");
- setDescription("Bitte wählen Sie die Räume für diese Veranstaltung aus");
+ super(wizard, I18n.PAGE_LAYOUT.getString("LectureLocationSelection.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("LectureLocationSelection.WizardPage.description"));
ctlLocationSelector = new LocationSelector();
GridManager grid = new GridManager(this, 1);
grid.add(ctlLocationSelector).fill(true, true).expand(true, true);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java
index 86c68e44..28c04d81 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureOptionsPageLayout.java
@@ -5,13 +5,14 @@ import javax.swing.JCheckBox;
import javax.swing.JLabel;
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;
@SuppressWarnings("serial")
public abstract class LectureOptionsPageLayout extends WizardPage {
- protected static String title = "Zusätzliche Optionen";
+ protected static String title = I18n.PAGE_LAYOUT.getString("LectureOptions.WizardPage.title");
protected final JCheckBox chkUsbEnabled;
protected final JCheckBox chkInternetEnabled;
@@ -24,23 +25,23 @@ public abstract class LectureOptionsPageLayout extends WizardPage {
*/
public LectureOptionsPageLayout(Wizard wizard) {
super(wizard, title);
- setDescription("Bitte wählen Sie aus folgenden Optionen aus:");
+ setDescription(I18n.PAGE_LAYOUT.getString("LectureOptions.WizardPage.description"));
GridManager grid = new GridManager(this, 2);
// first column for labels hopefully clearing up some of the mess...
// first category for general options
- JLabel lblGeneral = new JLabel("Allgemeines");
+ JLabel lblGeneral = new JLabel(I18n.PAGE_LAYOUT.getString("LectureOptions.Label.general.text"));
grid.add(lblGeneral);
- chkAutoUpdate = new JCheckBox("Immer auf aktuellste VM-Version updaten", true);
+ chkAutoUpdate = new JCheckBox(I18n.PAGE_LAYOUT.getString("LectureOptions.CheckBox.autoUpdate.text"), true);
grid.add(chkAutoUpdate);
grid.nextRow();
- chkIsActive = new JCheckBox("Veranstaltung ist aktiv", true);
+ chkIsActive = new JCheckBox(I18n.PAGE_LAYOUT.getString("LectureOptions.CheckBox.isActive.text"), true);
grid.skip();
grid.add(chkIsActive);
grid.nextRow();
- chkIsExam = new JCheckBox("Veranstaltung ist eine Prüfung", false);
+ chkIsExam = new JCheckBox(I18n.PAGE_LAYOUT.getString("LectureOptions.CheckBox.isExam.text"), false);
grid.skip();
grid.add(chkIsExam);
grid.nextRow();
@@ -48,15 +49,16 @@ public abstract class LectureOptionsPageLayout extends WizardPage {
grid.add(Box.createVerticalStrut(10), 2);
grid.nextRow();
// second category for restrictions options
- JLabel lblRestriction = new JLabel("Beschränkungen");
+ JLabel lblRestriction = new JLabel(I18n.PAGE_LAYOUT.getString("LectureOptions.Label.restrictions.text"));
grid.add(lblRestriction);
- chkInternetEnabled = new JCheckBox("Netzwerk-/Internetzugriff zulassen", true);
+ chkInternetEnabled = new JCheckBox(I18n.PAGE_LAYOUT.getString("LectureOptions.CheckBox.internetEnabled.text"),
+ true);
// TODO: Hint at exception editor in lecture details window, or include here...
grid.add(chkInternetEnabled).fill(true, false).expand(true, false);
grid.nextRow();
- chkUsbEnabled = new JCheckBox("Speichermedien zulassen", true);
+ chkUsbEnabled = new JCheckBox(I18n.PAGE_LAYOUT.getString("LectureOptions.CheckBox.USBEnabled.text"), true);
grid.skip();
grid.add(chkUsbEnabled);
grid.nextRow();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureRestrictionPageLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureRestrictionPageLayout.java
index 85c508ae..02e9d7b4 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureRestrictionPageLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/LectureRestrictionPageLayout.java
@@ -1,5 +1,6 @@
package org.openslx.dozmod.gui.wizard.layout;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.WizardPage;
@@ -7,7 +8,7 @@ import org.openslx.dozmod.gui.wizard.WizardPage;
public class LectureRestrictionPageLayout extends WizardPage {
public LectureRestrictionPageLayout(Wizard wizard) {
- super(wizard, "Beschränkungen");
+ super(wizard, I18n.PAGE_LAYOUT.getString("LectureRestriction.WizardPage.title"));
}
}
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
new file mode 100644
index 00000000..f784d844
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ContainerUploadPage.java
@@ -0,0 +1,260 @@
+package org.openslx.dozmod.gui.wizard.page;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.log4j.Logger;
+import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
+import org.openslx.dozmod.Config;
+import org.openslx.dozmod.gui.helper.I18n;
+import org.openslx.dozmod.gui.helper.QFileChooser;
+import org.openslx.dozmod.gui.helper.TextChangeListener;
+import org.openslx.dozmod.gui.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.layout.ContainerUploadPageLayout;
+import org.openslx.dozmod.model.ContainerBuildContextMethod;
+import org.openslx.dozmod.model.ContainerDefinition;
+import org.openslx.dozmod.model.ContainerMeta;
+import org.openslx.dozmod.state.UploadWizardState;
+import org.openslx.dozmod.thrift.cache.MetaDataCache;
+import org.openslx.util.vm.DockerMetaDataDummy;
+
+import javax.swing.*;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.filechooser.FileFilter;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+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);
+
+ /**
+ * Page for uploading an imagefile
+ *
+ * @param wizard
+ */
+ private final UploadWizardState state;
+ private final ImageDetailsRead existingImage;
+ private final ContainerDefinition containerDefinition;
+
+ public ContainerUploadPage(Wizard wizard, final UploadWizardState state,
+ ContainerDefinition containerDefinition) {
+ super(wizard);
+ this.containerDefinition = containerDefinition;
+ this.state = state;
+
+ canComeBack = false;
+ existingImage = null;
+
+ // HACK set dummy os
+ state.selectedOs = MetaDataCache.getOsById(18);
+
+ init();
+ }
+
+ // TODO this constructor is currently used in case if user wants do upload a new version.
+ // This makes no currently no sens in context of docker container and this is used.
+ public ContainerUploadPage(Wizard wizard, UploadWizardState uploadWizardState,
+ ImageDetailsRead imageDetailsRead) {
+ super(wizard);
+
+ state = uploadWizardState;
+ existingImage = imageDetailsRead;
+
+ // TODO fix this!
+ containerDefinition = null;
+
+ lblImageName.setEnabled(existingImage == null);
+ txtImageName.setEnabled(existingImage == null);
+ txtInfoText.setVisible(existingImage == null);
+
+ state.name = imageDetailsRead.imageName;
+ state.defaultPermissions = imageDetailsRead.getDefaultPermissions();
+ state.description = imageDetailsRead.getDescription();
+ state.detectedOs = MetaDataCache.getOsById(imageDetailsRead.getOsId());
+ state.selectedOs = MetaDataCache.getOsById(imageDetailsRead.getOsId());
+ state.tags = imageDetailsRead.getTags();
+ state.defaultPermissions = imageDetailsRead.getUserPermissions();
+
+ state.uuid = imageDetailsRead.getImageBaseId();
+ init();
+ }
+
+ private void init() {
+ this.txtImageFile.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ browseFile();
+ }
+ });
+ this.btnBrowseForImage.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ browseFile();
+ }
+ });
+
+ txtImageName.getDocument().addDocumentListener(new TextChangeListener() {
+ @Override public void changed() {
+ reactOnUserInput();
+ }
+ });
+ txtContainerRun.getDocument().addDocumentListener(new TextChangeListener() {
+ @Override public void changed() {
+ reactOnUserInput();
+ }
+ });
+
+ tpInput.addChangeListener(new ChangeListener() {
+ @Override public void stateChanged(ChangeEvent e) {
+ reactOnUserInput();
+ }
+ });
+
+ txtGitRepo.getDocument().addDocumentListener(new TextChangeListener() {
+ @Override public void changed() {
+ reactOnUserInput();
+ }
+ });
+
+ btnBrowseForImage.requestFocus();
+ }
+
+ private void browseFile() {
+
+ QFileChooser fc = new QFileChooser(Config.getUploadPath(), false);
+ fc.setAcceptAllFileFilterUsed(false);
+ fc.addChoosableFileFilter(new DockerfileFilter());
+
+ int action = fc.showOpenDialog(getDialog());
+ File file = fc.getSelectedFile();
+
+ if (action != JFileChooser.APPROVE_OPTION || file == null)
+ return;
+
+ txtImageFile.setText(file.getAbsolutePath());
+
+ if (existingImage == null)
+ txtImageName.setText(file.getParentFile().getName());
+ else
+ txtImageName.setText(existingImage.getImageName());
+
+ state.descriptionFile = file;
+ // TESTING: Upload also a prematurely created image (tar)
+ String imageName = file.getParentFile().getName();
+ File imageTarFile = new File(file.getParentFile(), imageName.concat(".tar"));
+ if (imageTarFile.exists()) {
+ LOGGER.info("Upload also an created Image");
+ state.diskFile = imageTarFile;
+ } else {
+ state.diskFile = getDummyFile();
+ }
+
+ Config.setUploadPath(file.getParent());
+ reactOnUserInput();
+ }
+
+ private File getDummyFile() {
+ String configDir = Config.getPath();
+ File zeroFile = new File(configDir, "ZERO-FILE");
+ // create a temp file with dummy content,
+ // because vmchooser relies on an existing image after choosing a lecture.
+ // TODO change behavior in vmchooser to allow start lectures without images.
+ try {
+ if (!zeroFile.exists()) {
+ zeroFile.createNewFile();
+ FileUtils.writeStringToFile(zeroFile, "ZERO\n", "UTF-8");
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ LOGGER.error("Could not create a dummy file.", e);
+ }
+ LOGGER.info("Use dummy file");
+ return zeroFile;
+ }
+
+ private void reactOnUserInput() {
+ boolean completed = checkUserInput();
+ if (completed)
+ setDescription(I18n.PAGE.getString("ContainerUploadPage.Description.ContainerDefFinished"));
+ setPageComplete(completed);
+ }
+
+ private boolean checkUserInput() {
+ ContainerBuildContextMethod method = getBuildContextMethod();
+
+ switch (method) {
+ case FILE:
+ if (txtImageFile.getText() == null || txtImageFile.getText().isEmpty()) {
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoReceipt"));
+ return false;
+ }
+ break;
+ case GIT_REPOSITORY:
+ if (txtGitRepo.getText() == null || txtGitRepo.getText().isEmpty()) {
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoGitRepository"));
+ return false;
+ }
+ break;
+ }
+
+ if (txtImageName.getText() == null || txtImageName.getText().isEmpty()) {
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoProperName"));
+ return false;
+ }
+
+ if (txtContainerRun.getText() == null || txtContainerRun.getText().isEmpty()) {
+ setWarningMessage(I18n.PAGE.getString("ContainerUploadPage.Warning.NoRunOptions"));
+ return false;
+ }
+ return true;
+ }
+
+ private DockerMetaDataDummy createVmMeta() {
+
+ ContainerMeta containerMeta = containerDefinition.getContainerMeta();
+ containerMeta.setBuildContextMethod(getBuildContextMethod().ordinal());
+ containerMeta.setImageName(txtImageName.getText());
+ containerMeta.setRunOptions(txtContainerRun.getText());
+ switch (containerDefinition.getBuildContextMethod()) {
+ case FILE:
+ containerDefinition.setContainerRecipe(state.descriptionFile);
+ break;
+ case GIT_REPOSITORY:
+ containerMeta.setBuildContextUrl(txtGitRepo.getText());
+ state.diskFile = getDummyFile();
+ state.descriptionFile = getDummyFile();
+ break;
+ }
+ return containerDefinition.createVmMeta();
+ }
+
+ @Override protected boolean wantNextOrFinish() {
+ state.name = existingImage != null ? existingImage.getImageName() : txtImageName.getText();
+ state.meta = createVmMeta();
+
+ return true;
+ }
+
+ private static class DockerfileFilter extends FileFilter {
+
+ @Override public boolean accept(File f) {
+
+ Pattern p = Pattern.compile("[Dd]ockerfile");
+ Matcher m = p.matcher(f.getName());
+
+ boolean accept = false;
+ if ((f.isFile() && m.matches()) || f.isDirectory())
+ accept = true;
+ return accept;
+ }
+
+ @Override public String getDescription() {
+ return "Dockerfile";
+ }
+ }
+}
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 33ff5cd5..68beb655 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
@@ -22,30 +22,40 @@ import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.ShareMode;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.ImageMetaDataPageLayout;
+import org.openslx.dozmod.model.ContainerDefinition;
import org.openslx.dozmod.state.UploadWizardState;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.cache.MetaDataCache;
import org.openslx.thrifthelper.Comparators;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
+import org.openslx.util.vm.DockerMetaDataDummy;
import org.openslx.util.vm.QemuMetaData;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Collections;
+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) {
+ public ImageMetaDataPage(Wizard wizard, UploadWizardState uploadWizardState,
+ ContainerDefinition containerDefinition) {
super(wizard);
this.state = uploadWizardState;
+ this.containerDefinition = containerDefinition;
setPageComplete(false);
// HACK set fixed uploadWizardState to test functions
uploadWizardState.shareMode = ShareMode.LOCAL;
@@ -54,14 +64,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);
}
});
@@ -69,8 +77,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();
}
@@ -78,8 +85,7 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout {
});
txtDescription.getDocument().addDocumentListener(new TextChangeListener() {
- @Override
- public void changed() {
+ @Override public void changed() {
reactToUserInput();
}
});
@@ -140,7 +146,7 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout {
} else {
txtDescription.setContentType("text/html");
txtDescription.setText(tmp);
- btnWysiwyg.setText("Html");
+ btnWysiwyg.setText("HTML");
btnBold.setEnabled(true);
btnUnderline.setEnabled(true);
@@ -192,11 +198,15 @@ 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();
+
+ if (state.meta instanceof DockerMetaDataDummy) {
+ containerDefinition.getContainerMeta().setBindMountConfig(bindMountConfigurator.getData());
+ state.meta = containerDefinition.createVmMeta();
+ }
return state.selectedOs != null && state.description != null;
}
@@ -217,7 +227,7 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout {
private void reactToUserInput() {
if (cboOperatingSystem.getSelectedIndex() == -1) {
// OS empty, description input present
- setWarningMessage("Wählen Sie das Betriebssystem aus.");
+ setWarningMessage(I18n.PAGE.getString("ImageMetaData.WizardPage.warningMessage.noOS"));
setPageComplete(false);
return;
}
@@ -227,15 +237,28 @@ public class ImageMetaDataPage extends ImageMetaDataPageLayout {
startCommandPane.setVisible(true);
}
+ 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!
+ chkIsTemplate.setVisible(false);
+ }
+
// evaluate description field
state.description = txtDescription.getText();
if (state.description == null || state.description.isEmpty()) {
// OS set, no description
- setWarningMessage("Fügen Sie eine Beschreibung hinzu.");
+ setWarningMessage(I18n.PAGE.getString("ImageMetaData.WizardPage.warningMessage.noDescription"));
setPageComplete(false);
return;
}
- setDescription("Klicken Sie auf 'Weiter' um Berechtigungen festzulegen oder 'Fertigstellen'");
+ setDescription(I18n.PAGE.getString("ImageMetaData.WizardPage.description"));
setPageComplete(true);
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java
new file mode 100644
index 00000000..774d6a6e
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageOvfConversionPage.java
@@ -0,0 +1,231 @@
+package org.openslx.dozmod.gui.wizard.page;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.file.Files;
+
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.log4j.Logger;
+import org.openslx.dozmod.Config;
+import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
+import org.openslx.dozmod.gui.helper.MessageType;
+import org.openslx.dozmod.gui.helper.QFileChooser;
+import org.openslx.dozmod.gui.wizard.Wizard;
+import org.openslx.dozmod.gui.wizard.layout.ImageOvfConversionPageLayout;
+import org.openslx.dozmod.state.UploadWizardState;
+import org.openslx.dozmod.util.ConversionTaskWorker;
+
+/**
+ * Page for converting an ovf image into an vmx image. Creates a directory for
+ * the new vmx image, starts the conversion SwingWorker and shows the progress.
+ * Replaces the image description file in state after conversion.
+ */
+@SuppressWarnings("serial")
+public class ImageOvfConversionPage extends ImageOvfConversionPageLayout {
+ private final static Logger LOGGER = Logger.getLogger(ImageOvfConversionPage.class);
+
+ private UploadWizardState state;
+ private ImageOvfConversionPage page;
+ private File vmxFile;
+ private ConversionTaskWorker worker;
+ private String startConversionButtonString = I18n.PAGE
+ .getString("ImageOvfConversion.StartConversionButton.text");
+ public boolean conversionStarted = false;
+ public boolean conversionSuccessful = false;
+ private String ovfToolPath = "ovftool";
+
+ public ImageOvfConversionPage(Wizard wizard, UploadWizardState uploadWizardState) {
+ super(wizard);
+ setPageComplete(false);
+ this.canComeBack = false;
+ this.state = uploadWizardState;
+ page = this;
+ String os = System.getProperty("os.name");
+ // Linux install should have put the ovftool into the path variable.
+ // Try to set it for windows and macos.
+ if (os.toLowerCase().contains("windows")) {
+ ovfToolPath = System.getenv("ProgramFiles(X86)")
+ + "\\VMware\\VMware Workstation\\OVFTool\\ovftool.exe";
+ if (!(new File(ovfToolPath).exists())) {
+ ovfToolPath = System.getenv("ProgramFiles(X86)")
+ + "\\VMware\\VMware Player\\OVFTool\\ovftool.exe";
+ }
+ } else if (os.toLowerCase().contains("mac")) {
+ ovfToolPath = "/Applications/VMware Fusion.app/Contents/Library/VMware OVF Tool";
+ }
+
+ txtInfoText.setVisible(true);
+
+ // Start the conversion
+ btnStartConversion.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (worker == null) {
+ try {
+ updateConversionProgressbar(0);
+ btnStartConversion.setText(
+ I18n.PAGE.getString("ImageOvfConversion.AbortConversionButton.text"));
+ convertOvfToVmx(state.descriptionFile);
+ } catch (Exception error) {
+ btnStartConversion.setEnabled(false);
+ Gui.showMessageBox(page,
+ I18n.PAGE.getString("ImageOvfConversion.ErrorMessage.ConversionFailed"),
+ MessageType.ERROR, LOGGER, error);
+ }
+ } else {
+ page.cancelConversionWorker();
+
+ }
+ }
+ });
+ // Browse for *.vmx
+ btnBrowseForOvftool.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ browseForOvftoolPath();
+ }
+
+ });
+ }
+
+ // Check wether the file contains the keyword. Stops after the first few lines.
+ private boolean fileContainsKeyword(File file, String keyword) {
+ try (Reader reader = new FileReader(file); BufferedReader buffered = new BufferedReader(reader)) {
+ String line;
+ int lineCount = 0;
+ while ((line = buffered.readLine()) != null && lineCount < 50) {
+ if (line.toLowerCase().contains(keyword)) {
+ LOGGER.debug("Detected OVF/OVA created with Virtual Box");
+ return true;
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public void browseForOvftoolPath() {
+ QFileChooser fc = new QFileChooser(Config.getUploadPath(), false);
+ int action = fc.showOpenDialog(getDialog());
+ File file = fc.getSelectedFile();
+
+ if (action != JFileChooser.APPROVE_OPTION || file == null) {
+ return;
+ }
+ page.ovfToolPath = file.getAbsolutePath();
+ btnStartConversion.setEnabled(true);
+ ovfToolFile.setText(page.ovfToolPath);
+ }
+
+ public void cancelConversionWorker() {
+ if (worker != null) {
+ worker.cancel(true);
+ btnStartConversion.setText(startConversionButtonString);
+ worker = null;
+ }
+ }
+
+ // Check if the directory we want to create for the converted virtual machine
+ // exists and create it
+ private void convertOvfToVmx(File file) throws IOException {
+ File directoryFile = new File(file.getParent() + "/converted_vm");
+ LOGGER.debug("Directory for converted VM:" + directoryFile.getAbsolutePath());
+ // Cancel if user clicks cancel
+ if (directoryFile.exists() && !askDeleteDirAndContinue(directoryFile)) {
+ btnStartConversion.setText(startConversionButtonString);
+ return;
+ }
+ conversionStarted = true;
+ Files.createDirectories(directoryFile.toPath());
+ vmxFile = new File(
+ directoryFile.getPath() + "/" + FilenameUtils.removeExtension((file.getName())) + ".vmx");
+ worker = new ConversionTaskWorker(file, vmxFile, page, ovfToolPath);
+ worker.execute();
+ state.convertedDescriptionFile = vmxFile;
+ }
+
+ private boolean askDeleteDirAndContinue(File directoryFile) throws IOException {
+ if (directoryFile.exists()) {
+ int dialogButton = JOptionPane.YES_NO_OPTION;
+ int dialogResult;
+ if (!conversionStarted) {
+ dialogResult = JOptionPane.showConfirmDialog(this,
+ I18n.PAGE.getString("ImageOvfConversion.Dialog.DirectoryExists"),
+ I18n.PAGE.getString("ImageOvfConversion.Dialog.DirectoryExists.title"), dialogButton);
+ } else {
+ dialogResult = JOptionPane.showConfirmDialog(this,
+ I18n.PAGE.getString("ImageOvfConversion.Dialog.RemoveTmpDirectory"),
+ I18n.PAGE.getString("ImageOvfConversion.Dialog.RemoveTmpDirectory.title"),
+ dialogButton);
+ }
+ if (dialogResult == 0) {
+ FileUtils.deleteDirectory(directoryFile);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ // Nothing to delete. Should be OK to continue
+ return true;
+ }
+
+ public void updateConversionProgressbar(int percent) {
+ conversionProgressBar.setValue(percent);
+ }
+
+ public void updateConversionProgressbarText(String text) {
+ conversionProgressBar.setString(text);
+ }
+
+ @Override
+ protected boolean wantNextOrFinish() {
+ return false;
+ }
+
+ @Override
+ protected void onPageEnter() {
+ if (!fileContainsKeyword(state.descriptionFile, "vmware")) {
+ Gui.showMessageBox(this,
+ I18n.PAGE.getString("ImageOvfConversion.MessageBox.notAVmwareOrVboxImage"),
+ MessageType.WARNING, LOGGER, null);
+ } else if (fileContainsKeyword(state.descriptionFile, "vbox")) {
+ Gui.showMessageBox(this, I18n.PAGE.getString("ImageOvfConversion.MessageBox.VboxDetected"),
+ MessageType.INFO, LOGGER, null);
+ }
+ updateConversionProgressbar(0);
+ updateConversionProgressbarText("");
+ conversionStarted = false;
+ conversionSuccessful = false;
+ btnStartConversion.setText(startConversionButtonString);
+ }
+
+ @Override
+ protected void onPageLeave() {
+ // Make sure the worker is stopped when leaving the page.
+ if (wizard.isCancelled() || (conversionStarted && !conversionSuccessful)) {
+ page.cancelConversionWorker();
+ if (state.convertedDescriptionFile != null) {
+ try {
+ askDeleteDirAndContinue(state.convertedDescriptionFile.getParentFile());
+ } catch (IOException e) {
+ LOGGER.debug(e);
+ }
+ }
+ state.convertedDescriptionFile = null;
+ conversionStarted = false;
+ }
+ super.onPageLeave();
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageTypePage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageTypePage.java
new file mode 100644
index 00000000..219f3391
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageTypePage.java
@@ -0,0 +1,35 @@
+package org.openslx.dozmod.gui.wizard.page;
+
+import org.openslx.dozmod.gui.wizard.ImageCreationWizard;
+import org.openslx.dozmod.gui.wizard.layout.ImageTypePageLayout;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class ImageTypePage extends ImageTypePageLayout {
+
+ public ImageTypePage(final ImageCreationWizard wizard) {
+ super(wizard);
+
+ btnNewVmImage.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ wizard.doVmCreation();
+ setPageComplete(true);
+ wizard.doNext();
+ }
+ });
+
+ btnNewDockerImage.addActionListener(new ActionListener() {
+ @Override public void actionPerformed(ActionEvent e) {
+ wizard.doDockerCreation();
+ setPageComplete(true);
+ wizard.doNext();
+ }
+ });
+ }
+
+ @Override protected void onPageEnter() {
+ // set onPageEnter to disable Next and Finish button
+ setPageComplete(false);
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
index d0431b2e..19ce1429 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadPage.java
@@ -13,12 +13,14 @@ import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
+import org.apache.commons.io.FilenameUtils;
import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
import org.openslx.bwlp.thrift.iface.Virtualizer;
import org.openslx.dozmod.Branding;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.helper.QFileChooser;
import org.openslx.dozmod.gui.wizard.Wizard;
@@ -56,6 +58,11 @@ public class ImageUploadPage extends ImageUploadPageLayout {
private final FileNameExtensionFilter vboxFilter = new FileNameExtensionFilter(
"VirtualBox Virtual Machine", "vbox");
+ private final FileNameExtensionFilter ovfFilter = new FileNameExtensionFilter(
+ "OVF Virtual Machine Format", "ovf");
+ private final FileNameExtensionFilter ovaFilter = new FileNameExtensionFilter(
+ "OVA Virtual Machine Format", "ova");
+
public ImageUploadPage(Wizard wizard, UploadWizardState uploadWizardState,
final ImageDetailsRead existingImage) {
super(wizard);
@@ -89,9 +96,9 @@ public class ImageUploadPage extends ImageUploadPageLayout {
// initialize allSupportedFilter depending on whether multiple hypervisors
// are supported or not
if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
- allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx", "vbox");
+ allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx", "ovf", "vbox", "ova");
} else {
- allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx");
+ allSupportedFilter = new FileNameExtensionFilter("All Supported", "vmx", "ovf", "ova");
}
btnBrowseForImage.requestFocus();
}
@@ -100,6 +107,8 @@ public class ImageUploadPage extends ImageUploadPageLayout {
QFileChooser fc = new QFileChooser(Config.getUploadPath(), false);
fc.setAcceptAllFileFilterUsed(false);
fc.addChoosableFileFilter(vmxFilter);
+ fc.addChoosableFileFilter(ovfFilter);
+ fc.addChoosableFileFilter(ovaFilter);
if (Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
fc.addChoosableFileFilter(vboxFilter);
}
@@ -122,22 +131,46 @@ public class ImageUploadPage extends ImageUploadPageLayout {
vmSelected(file.getAbsoluteFile());
}
+ private void askForConversion(File file) {
+ int dialogButton = JOptionPane.YES_NO_OPTION;
+ int dialogResult = JOptionPane.showConfirmDialog(this,
+ I18n.PAGE.getString("ImageUpload.WizardPage.dialog.OvfOvaDetected"),
+ I18n.PAGE.getString("ImageUpload.WizardPage.dialog.title"), dialogButton);
+ if (dialogResult == 0) {
+ // txtImageFile.setText(file.getAbsolutePath());
+ // txtImageName.setText(state.meta.getDisplayName());
+ state.descriptionFile = file;
+ setErrorMessage(null);
+ setDescription("Bitte starten Sie die Konvertierung.");
+ wizard.showOutOfOrderPage(state.conversionPage);
+ } else {
+ setPageComplete(false);
+ }
+ }
+
private void vmSelected(File file) {
Config.setUploadPath(file.getParent());
txtImageFile.setText("");
txtImageName.setText("");
+ // ask to convert OVA and OVF files
+ String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath());
+ if (fileExtension.equalsIgnoreCase("ova") || fileExtension.equalsIgnoreCase("ovf")) {
+ askForConversion(file);
+ return;
+ }
try {
// gets the metadata object of the selected VM depending on its type
state.meta = VmMetaData.getInstance(MetaDataCache.getOperatingSystems(), file);
} catch (IOException e) {
- Gui.showMessageBox(this, "Konnte " + file.getPath() + " nicht lesen", MessageType.ERROR, LOGGER,
- e);
+ Gui.showMessageBox(this,
+ I18n.PAGE.getString("ImageUpload.Message.error.couldNotGetMetadata", file.getPath()),
+ MessageType.ERROR, LOGGER, e);
setPageComplete(false);
return;
}
if (state.meta == null || state.meta.getDisplayName() == null) {
- setErrorMessage("Ungültige Konfigurationsdatei ausgewählt!");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.invalidConfigFile"));
setPageComplete(false);
return;
}
@@ -145,8 +178,8 @@ public class ImageUploadPage extends ImageUploadPageLayout {
final String fileformat = state.meta.getVirtualizer().virtName;
// bail if multiple hypervisors are not supported
if (!(state.meta instanceof VmwareMetaData) && !Session.hasFeature(Feature.MULTIPLE_HYPERVISORS)) {
- setErrorMessage("Der Hypervisor der gewählten VM (" + fileformat
- + ") wird vom aktuellen Satellitenserver nicht unterstützt.");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.hypervisorNotSupported",
+ fileformat));
setPageComplete(false);
return;
}
@@ -156,20 +189,21 @@ public class ImageUploadPage extends ImageUploadPageLayout {
String existingImageVirtualizerName = "<error>";
if (existingImageVirtualizer != null)
existingImageVirtualizerName = existingImageVirtualizer.virtName;
- setErrorMessage("Neue Versionen müssen vom Typ " + existingImageVirtualizerName + " sein.");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.VMTypeChanged",
+ existingImageVirtualizerName));
setPageComplete(false);
return;
}
List<HardDisk> hdds = state.meta.getHdds();
if (hdds.size() == 0 || hdds.get(0).diskImage == null) {
- setErrorMessage("Die gewählte " + fileformat + "-Datei enthält keine virtuelle Festplatte!");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.noHDD", fileformat));
setPageComplete(false);
return;
}
if (hdds.size() > 1) {
setErrorMessage(
- "Die gewählte " + fileformat + "-Datei enthält mehr als eine virtuelle Festplatte!");
+ I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.moreThanOneHDD", fileformat));
setPageComplete(false);
return;
// Allow to continue!?
@@ -186,15 +220,19 @@ public class ImageUploadPage extends ImageUploadPageLayout {
try {
diskImage = new DiskImage(vmDiskFileInfo);
} catch (FileNotFoundException e) {
- setErrorMessage("'" + vmDiskFileInfo.getName() + "' kann nicht gefunden werden!");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.diskImageNotFound",
+ vmDiskFileInfo.getName()));
setPageComplete(false);
return;
} catch (IOException e) {
- setErrorMessage("'" + vmDiskFileInfo.getName() + "' kann nicht gelesen werden!");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.diskImageNotReadable",
+ vmDiskFileInfo.getName()));
setPageComplete(false);
return;
} catch (UnknownImageFormatException e) {
- setErrorMessage("'" + vmDiskFileInfo.getName() + "' hat unbekanntes Dateiformat!");
+ setErrorMessage(
+ I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.diskImageHasUnknownFormat",
+ vmDiskFileInfo.getName()));
LOGGER.debug("Selected disk file has unknown format.", e);
setPageComplete(false);
return;
@@ -202,19 +240,18 @@ public class ImageUploadPage extends ImageUploadPageLayout {
// Warn user about snapshot
if (diskImage.isSnapshot || state.meta.isMachineSnapshot()) {
- Gui.showMessageBox("Von der ausgewählten VM wurde ein Snapshot erstellt. In diesem Zustand kann\n"
- + "die VM leider nicht ins " + Branding.getServiceName() + "-System geladen werden. Bitte konsolidieren Sie zunächst\n"
- + "den Snapshot und versuchen Sie es erneut.", MessageType.WARNING, null, null);
- setErrorMessage("Die gewählte VM befindet sich im Snapshot-Zustand.");
+ Gui.showMessageBox(I18n.PAGE.getString("ImageUpload.Message.warning.diskImageSnapshot",
+ Branding.getServiceName()), MessageType.WARNING, null, null);
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.diskImageSnapshot"));
setPageComplete(false);
return;
}
if (!diskImage.isStandalone) {
- Gui.showMessageBox("Die zu dieser VM gehörige Virtuelle Festplatte ist im Format '"
- + diskImage.subFormat + "'.\n"
- + "Dieses Format wird von " + Branding.getApplicationName() + " nicht unterstützt. Bitte konvertieren Sie die VM\n"
- + "in das Format 'monolithicSparse'.", MessageType.WARNING, null, null);
- setErrorMessage("Die VMDK Datei der VM hat ein inkompatibles Format");
+ Gui.showMessageBox(
+ I18n.PAGE.getString("ImageUpload.Message.warning.diskImageStandalone",
+ diskImage.subFormat, Branding.getApplicationName()),
+ MessageType.WARNING, null, null);
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.diskImageStandalone"));
setPageComplete(false);
return;
}
@@ -235,7 +272,7 @@ public class ImageUploadPage extends ImageUploadPageLayout {
txtImageFile.setText(file.getAbsolutePath());
// let the user know the upload is ready
setErrorMessage(null);
- setDescription("Sie können jetzt den Upload starten.");
+ setDescription(I18n.PAGE.getString("ImageUpload.WizardPage.description"));
setPageComplete(true);
}
@@ -244,12 +281,7 @@ public class ImageUploadPage extends ImageUploadPageLayout {
File file = new File(lockFile);
if (!file.exists())
continue;
- return !Gui.showMessageBox(this,
- "Die gewählte VM scheint noch in Verwendung zu sein. Bitte fahren Sie die VM\n"
- + "vor dem Hochladen herunter und schließen Sie den VMware Player, ansonsten\n"
- + "kann die VM nach dem Hochladen beschädigt sein.\n\n"
- + "Möchten Sie diese Warnung ignorieren und trotzdem fortfahren?\n"
- + "(Sie sollten sich sicher sein, was sie tun, wenn Sie hier 'Ja' wählen)",
+ return !Gui.showMessageBox(this, I18n.PAGE.getString("ImageUpload.Message.yesNo.cancelLockFile"),
MessageType.QUESTION_YESNO, null, null);
}
return false;
@@ -259,21 +291,22 @@ public class ImageUploadPage extends ImageUploadPageLayout {
* This function starts the image creation process. It is triggered by the
* "Next" button.
*
- * Depending on the state, it will first try to get a UUID for the new image
- * by calling createImage() of the thrift API. If a UUID is received, it
- * will request an upload with requestImageVersionUpload(). If granted, it
- * will finally start a thread for the UploadTask.
+ * Depending on the state, it will first try to get a UUID for the new image by
+ * calling createImage() of the thrift API. If a UUID is received, it will
+ * request an upload with requestImageVersionUpload(). If granted, it will
+ * finally start a thread for the UploadTask.
*
- * Then a callback to the Gui is executed where we can process the upload
- * state and give the user feedback about it.
+ * Then a callback to the Gui is executed where we can process the upload state
+ * and give the user feedback about it.
*
*/
@Override
protected boolean wantNextOrFinish() {
+
// Check for vmware player lock files - warn user if found, might corrupt upload
if (askCancelLockFile(state.descriptionFile.getAbsolutePath() + ".lck",
state.diskFile.getAbsolutePath() + ".lck")) {
- setErrorMessage("Die gewählte VM wird noch verwendet");
+ setErrorMessage(I18n.PAGE.getString("ImageUpload.WizardPage.errorMessage.cancelLockFile"));
return false;
}
@@ -305,8 +338,9 @@ public class ImageUploadPage extends ImageUploadPageLayout {
ThriftError.showMessage(this, LOGGER, e.exception, e.displayMessage);
return false;
} catch (IOException e) {
- Gui.showMessageBox(this, "Upload-Initialisierung fehlgeschlagen", MessageType.ERROR, LOGGER,
- e);
+ Gui.showMessageBox(this,
+ I18n.PAGE.getString("ImageUpload.Message.error.uploadInitiatorFailed"),
+ MessageType.ERROR, LOGGER, e);
return false;
}
}
@@ -315,4 +349,13 @@ public class ImageUploadPage extends ImageUploadPageLayout {
return true;
}
+
+ @Override
+ protected void onPageEnter() {
+ super.onPageEnter();
+ // When entering from the conversion page the user probably wants to upload the
+ // new vmx file
+ if (state.convertedDescriptionFile != null)
+ vmSelected(state.convertedDescriptionFile);
+ }
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadSummaryPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadSummaryPage.java
index 9b564979..73b158c0 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadSummaryPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageUploadSummaryPage.java
@@ -11,6 +11,7 @@ import org.openslx.dozmod.filetransfer.TransferEvent;
import org.openslx.dozmod.filetransfer.TransferEventListener;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.wizard.LectureWizard;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.ImageUploadSummaryPageLayout;
@@ -73,35 +74,28 @@ public class ImageUploadSummaryPage extends ImageUploadSummaryPageLayout {
private void updateInfoText(final UploadInitState initState) {
String text;
if (state.upload.getUploadTask() != null && state.upload.getUploadTask().isComplete()) {
- text = "Die Virtuelle Maschine wurde erfolgreich auf den Server hochgeladen.";
+ text = I18n.PAGE.getString("ImageUploadSummary.UploadInitState.completed");
} else if (initState == null) {
return;
} else {
switch (initState) {
case REQUESTING:
- text = "Der Upload-Vorgang wird mit dem Server ausgehandelt...";
+ text = I18n.PAGE.getString("ImageUploadSummary.UploadInitState.requesting");
break;
case WAITING_FOR_SLOT:
- text = "Der Server ist zur Zeit überlastet, da zu viele Uploads gleichzeitig laufen."
- + " Es wird gewartet, bis der Server wieder Kapazitäten frei hat."
- + " Bitte schließen Sie dieses Fenster nicht.";
+ text = I18n.PAGE.getString("ImageUploadSummary.UploadInitState.waitingForSlot");
break;
case UPLOAD_STARTING:
- text = "Die Verbindung zur Übertragung der VM wird aufgebaut...";
+ text = I18n.PAGE.getString("ImageUploadSummary.UploadInitState.uploadStarting");
break;
case UPLOAD_STARTED:
- text = "Der Upload Ihrer Virtuellen Maschine wurde gestartet."
- + " Wenn Sie möchten, können Sie diesen Assistenten schließen,"
- + " und die Anwendung weiterverwenden."
- + " Die Übertragung läuft dabei im Hintergrund weiter.";
+ text = I18n.PAGE.getString("ImageUploadSummary.UploadInitState.uploadStarted");
break;
case ERROR:
- text = "Die Initialisierung des Uploads auf den Server ist fehlgeschlagen."
- + " Sie können versuchen, den Vorgang erneut zu starten."
- + " Falls das Problem weiterhin besteht,"
- + " kontaktieren Sie den " + Branding.getServiceName() + "-Support Ihrer Einrichtung.";
+ text = I18n.PAGE.getString("ImageUploadSummary.UploadInitState.error", Branding.getServiceName());
if (state.upload.getErrorMessage() != null) {
- text += "<br><br>Weitere Informationen:<br>" + state.upload.getErrorMessage();
+ text += I18n.PAGE.getString("ImageUploadSummary.UploadInitState.errorMoreInfo",
+ state.upload.getErrorMessage());
}
break;
default:
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java
index a3bf0a71..71e6fe6d 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureCreationPage.java
@@ -18,6 +18,7 @@ import javax.swing.text.html.HTMLDocument;
import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.helper.DateTimeHelper;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.TextChangeListener;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureCreationPageLayout;
@@ -40,7 +41,8 @@ public class LectureCreationPage extends LectureCreationPageLayout {
* Page for creating lectures
*/
public LectureCreationPage(Wizard wizard, LectureWizardState state) {
- super(wizard, state.image != null ? state.image.imageName : "Neu");
+ super(wizard, state.image != null ? state.image.imageName
+ : I18n.PAGE.getString("LectureCreation.WizardPage.title"));
this.state = state;
// listener for the text fields
@@ -194,23 +196,23 @@ public class LectureCreationPage extends LectureCreationPageLayout {
Date start = DateTimeHelper.getDateFrom(dtpStartDate, spnStartTime);
Date end = DateTimeHelper.getDateFrom(dtpEndDate, spnEndTime);
if (end.before(start)) {
- lblCalcPeriod.setText("Endzeitpunkt ist vor Startzeitpunkt!");
+ lblCalcPeriod.setText(I18n.PAGE.getString("LectureCreation.Label.endBeforeStart.text"));
} else {
int numberOfDays = DateTimeHelper.calculatePeriodInDays(start, end);
- lblCalcPeriod.setText(numberOfDays + "Tag(e)");
+ lblCalcPeriod.setText(I18n.PAGE.getString("LectureCreation.Label.calcPeriod.text", numberOfDays));
lblCalcPeriod.setForeground(numberOfDays < 7 ? Color.RED : null);
}
}
private boolean isPageValid() {
if (txtName.getText().isEmpty()) {
- setWarningMessage("Geben Sie einen Veranstaltungsnamen ein.");
+ setWarningMessage(I18n.PAGE.getString("LectureCreation.WizardPage.warningMessage.noName"));
return false;
} else {
state.name = txtName.getText();
}
if (txtDescription.getText().isEmpty()) {
- setWarningMessage("Fügen Sie eine Beschreibung hinzu.");
+ setWarningMessage(I18n.PAGE.getString("LectureCreation.WizardPage.warningMessage.noDesc"));
return false;
} else {
state.description = txtDescription.getText();
@@ -220,17 +222,18 @@ public class LectureCreationPage extends LectureCreationPageLayout {
final Date end = DateTimeHelper.getDateFrom(dtpEndDate, spnEndTime);
if (start.after(end)) {
- setWarningMessage("Startzeit ist nach Endzeit!");
+ setWarningMessage(I18n.PAGE.getString("LectureCreation.WizardPage.warningMessage.startAfterEnd"));
return false;
} else if (now.after(end)) {
- setWarningMessage("Endzeit liegt in die Vergangenheit!");
+ setWarningMessage(I18n.PAGE.getString("LectureCreation.WizardPage.warningMessage.nowAfterEnd"));
return false;
} else {
int validityPeriod = Session.getSatelliteConfig().getMaxLectureValidityDays();
Date validityPeriodEnd = DateTimeHelper.addDaysTo(start, validityPeriod); // all good, save them both
if (end.after(validityPeriodEnd)) {
- setWarningMessage("Endzeit liegt nach dem spätest möglichen Datum: "
- + FormatHelper.shortDate(validityPeriodEnd.getTime() / 1000L));
+ setWarningMessage(
+ I18n.PAGE.getString("LectureCreation.WizardPage.warningMessage.endAfterLatestPossibleDate",
+ FormatHelper.shortDate(validityPeriodEnd.getTime() / 1000L)));
return false;
} else {
state.start = start;
@@ -238,9 +241,9 @@ public class LectureCreationPage extends LectureCreationPageLayout {
}
}
String nextText;
- nextText = state.image == null ? ", um eine Virtuelle Maschine auszuwählen"
- : " für Berechtigungen oder 'Fertigstellen'.";
- setDescription("Klicken Sie auf 'Weiter' " + nextText);
+ nextText = state.image == null ? I18n.PAGE.getString("LectureCreation.WizardPage.description.0")
+ : I18n.PAGE.getString("LectureCreation.WizardPage.description.1");
+ setDescription(nextText);
return true;
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java
index f19ab593..01f179c2 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureImageListPage.java
@@ -10,6 +10,7 @@ import javax.swing.event.ListSelectionListener;
import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.dozmod.gui.control.table.ImageTable;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureImageListPageLayout;
import org.openslx.dozmod.permissions.ImagePerms;
@@ -91,13 +92,13 @@ public class LectureImageListPage extends LectureImageListPageLayout {
if (selected != null && selected.isValid && ImagePerms.canLink(selected)) {
state.image = selected;
state.imageVersionId = selected.getLatestVersionId();
- setDescription("Klicken Sie auf 'Weiter'");
+ setDescription(I18n.PAGE.getString("LectureImageList.WizardPage.description"));
return true;
}
if (selected != null && ImagePerms.canLink(selected)) {
- setErrorMessage("Unzureichende Berechtigungen um auf diese VM zu verlinken.");
+ setErrorMessage(I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.noPerms"));
} else {
- setErrorMessage("Ungültige VM ausgewählt");
+ setErrorMessage(I18n.PAGE.getString("LectureImageList.WizardPage.errorMessage.invalidVM"));
}
return false;
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java
index 7adf10d3..bcad47f8 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureLocationSelectionPage.java
@@ -3,6 +3,7 @@ package org.openslx.dozmod.gui.wizard.page;
import java.util.List;
import org.apache.log4j.Logger;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureLocationSelectionPageLayout;
import org.openslx.dozmod.state.LectureWizardState;
@@ -30,7 +31,7 @@ public class LectureLocationSelectionPage extends LectureLocationSelectionPageLa
List<Integer> locations = ctlLocationSelector.getSelectedLocationsAsIds();
boolean locationExclusive = ctlLocationSelector.getOnlyInSelection();
if (locations != null && locations.size() > Session.getSatelliteConfig().maxLocationsPerLecture) {
- setErrorMessage("Zu viele Räume/Orte ausgewählt");
+ setErrorMessage(I18n.PAGE.getString("LectureLocationSelection.WizardPage.errorMessage.tooManyLocations"));
ctlLocationSelector.setSelectedLocationsAsIds(locations);
return false;
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java
index a9d5bcef..45ca1d88 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/LectureOptionsPage.java
@@ -3,6 +3,7 @@ package org.openslx.dozmod.gui.wizard.page;
import java.util.List;
import org.openslx.bwlp.thrift.iface.NetRule;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.layout.LectureOptionsPageLayout;
import org.openslx.dozmod.state.LectureWizardState;
@@ -49,7 +50,7 @@ public class LectureOptionsPage extends LectureOptionsPageLayout {
state.netRules = currentNetrules;
state.runScriptText = currentRunscript;
- setDescription("Klicken Sie auf 'Weiter' für Berechtigungen oder 'Fertigstellen'.");
+ setDescription(I18n.PAGE.getString("LectureOptions.WizardPage.description"));
return true;
}
}