summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx')
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/App.java65
-rwxr-xr-xdozentenmodul/src/main/java/org/openslx/dozmod/Config.java18
-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/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.java52
-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/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
-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.java250
-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.java269
-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
-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.java174
-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.java173
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java53
-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.java49
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageUpdateWizard.java34
-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.java72
-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/ImageCustomPermissionPageLayout.java25
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/layout/ImageMetaDataPageLayout.java119
-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/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.java85
-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/ImageMetaDataPage.java123
-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/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.java129
-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
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/state/UploadWizardState.java11
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java15
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java154
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java62
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ConversionTaskWorker.java107
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java8
95 files changed, 2814 insertions, 1083 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
index 7c450c59..499c5e60 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
@@ -8,16 +8,20 @@ import java.awt.event.ContainerEvent;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.net.ssl.SSLContext;
+import javax.swing.ListCellRenderer;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
+import javax.swing.table.TableCellRenderer;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.BasicConfigurator;
@@ -28,6 +32,8 @@ import org.apache.log4j.spi.LoggingEvent;
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.util.ClientVersion;
import org.openslx.dozmod.util.FormatHelper;
@@ -152,12 +158,29 @@ public class App {
try {
Config.init();
} catch (Exception e) {
- Gui.showMessageBox(null, "Error loading configuration", MessageType.ERROR, LOGGER, e);
+ Gui.showMessageBox(null, I18n.APP.getString("App.Message.error.loadingConfigurationFailed"),
+ MessageType.ERROR, LOGGER, e);
return;
}
setupLogger();
+ // Setting the locale
+ if (!setPreferredLanguage()) {
+ // Detect operating system language
+ String ul = System.getProperty("user.language");
+ if (ul.equals("de")) {
+ Locale.setDefault(new Locale("de", "DE"));
+ Config.setPreferredLanguage(Language.DE_DE.value);
+ } else if (ul.equals("tr")) {
+ Locale.setDefault(new Locale("tr", "TR"));
+ Config.setPreferredLanguage(Language.TR_TR.value);
+ } else {
+ Locale.setDefault(new Locale("en", "US"));
+ Config.setPreferredLanguage(Language.EN_US.value);
+ }
+ }
+
// Setup swing style
System.setProperty("awt.useSystemAAFontSettings", "on");
System.setProperty("swing.aatext", "true");
@@ -226,8 +249,7 @@ public class App {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
- boolean ret = Gui.showMessageBox(null,
- "SSL nicht verfügbar. Wollen Sie sich trotzdem unverschlüsselt verbinden?",
+ boolean ret = Gui.showMessageBox(null, I18n.APP.getString("App.Message.yesNo.SSLNotAvailable"),
MessageType.QUESTION_YESNO, LOGGER, e1);
if (!ret) {
System.exit(1);
@@ -256,10 +278,9 @@ public class App {
if (e.getMessage().contains("SurfaceData"))
return;
}
- Gui.showMessageBox(null, "Ungefangene Ausnahme in Faden " + t.getName() + "\n\n"
- + "Die Anwendung könnte instabil laufen.\n"
- + "Zur Sicherheit sollten Sie sie neustarten.", MessageType.WARNING, LOGGER,
- e);
+ Gui.showMessageBox(null,
+ I18n.APP.getString("App.Message.warning.uncaughtException", t.getName()),
+ MessageType.WARNING, LOGGER, e);
}
});
MainWindow.open();
@@ -294,6 +315,11 @@ public class App {
ContainerEvent containerEvent = (ContainerEvent) event;
if (containerEvent.getID() == ContainerEvent.COMPONENT_ADDED) {
Font font = containerEvent.getChild().getFont();
+ // Do not update font in tables and ComboBoxes on every renderer call to prevent weirdness.
+ // This prevents multiple instances of fonts being scaled multiple times.
+ if (containerEvent.getChild().getName() != null){
+ return;
+ }
if (font != null && font.getSize2D() <= defaultSize) {
containerEvent.getChild().setFont(
new Font(font.getName(), font.getStyle(), Math.round(font.getSize2D()
@@ -350,6 +376,31 @@ public class App {
}
}
+ /**
+ * Check if any default language is already set and valid.
+ * @return true, if any default language exists and is valid.
+ */
+ private static boolean setPreferredLanguage() {
+ // Check if any preferred language exists
+ String language = Config.getPreferredLanguage();
+ // Check whether the provided string is null or empty
+ if (language == null || language.trim().isEmpty()) {
+ return false;
+ }
+ // Check if the provided string has the format language_country e.g. en_US
+ String[] parts = language.split("_");
+ if (parts.length != 2) {
+ return false;
+ }
+ Locale locale = new Locale(parts[0], parts[1]);
+ // Check now if the locale is valid
+ if (!Arrays.asList(Locale.getAvailableLocales()).contains(locale)) {
+ return false;
+ }
+ Locale.setDefault(locale);
+ return true;
+ }
+
public static synchronized boolean isInitDone() {
return proxyInitDone;
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
index 904d0693..a0e41689 100755
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/Config.java
@@ -458,6 +458,24 @@ public class Config {
}
/**
+ * Set the language which should be used
+ *
+ * @param value the language consists of language and country
+ */
+ public static void setPreferredLanguage(String value) {
+ setString("gui.language", value);
+ }
+
+ /**
+ * Get the language preferred by the user
+ *
+ * @return the saved language, null otherwise
+ */
+ public static String getPreferredLanguage() {
+ return getString("gui.language", null);
+ }
+
+ /**
* Gets the boolean from the given key.
* If nothing is found, return the given default value
*
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/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..b013e816 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,14 @@ public class ImageListViewer extends QLabel {
filterPanel.add(txtSearch);
filterPanel.add(cboFilter);
+ // search in description
+ chkSearchInDescription = new JCheckBox("Suche in Beschreibung");
+ 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 +169,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 +186,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 +272,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/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/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..b69aa8d6
--- /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 key is found, 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/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 b9081850..d6019fea 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,41 @@
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;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.Encoder;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.*;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.KeyStroke;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.*;
@@ -95,11 +131,11 @@ import java.util.*;
/**
* 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;
@@ -182,13 +218,106 @@ import java.util.*;
UserListWindow.open(me, new UserAddedCallback() {
@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?", MessageType.QUESTION_YESNO,
- LOGGER, null))
+ if (Gui.showMessageBox(me,
+ 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);
+ }
+ });
+
+ cbTxtSize.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int size = Integer.parseInt((String) cbTxtSize.getSelectedItem());
+ Action act = new StyledEditorKit.FontSizeAction(String.valueOf(size),size);
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+ cbTxtColor.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String color = (String) cbTxtColor.getSelectedItem();
+ Action act = null;
+
+ switch(color) {
+ case "Black":
+ act = new StyledEditorKit.ForegroundAction("Black", Color.black);
+ break;
+ case "Blue":
+ act = new StyledEditorKit.ForegroundAction("Blue", Color.blue);
+ break;
+ case "Yellow":
+ act = new StyledEditorKit.ForegroundAction("Yellow", Color.yellow);
+ break;
+ case "Red":
+ act = new StyledEditorKit.ForegroundAction("Red", Color.red);
+ break;
+ case "Green":
+ act = new StyledEditorKit.ForegroundAction("Green", Color.green);
+ break;
+ }
+
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+ btnWysiwyg.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String tmp = txtDescription.getText();
+ if (txtDescription.getContentType().equals("text/html")) {
+ txtDescription.setContentType("text/plain");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Wysiwyg");
+ if(ImagePerms.canEdit(image) || ImagePerms.canAdmin(image)) {
+ btnSaveChanges.setEnabled(true);
+ }
+
+ btnBold.setEnabled(false);
+ btnUnderline.setEnabled(false);
+ btnItalic.setEnabled(false);
+ cbTxtColor.setEnabled(false);
+ cbTxtSize.setEnabled(false);
+ } else {
+ txtDescription.setContentType("text/html");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Html");
+
+ btnBold.setEnabled(true);
+ btnUnderline.setEnabled(true);
+ btnItalic.setEnabled(true);
+ cbTxtColor.setEnabled(true);
+ cbTxtSize.setEnabled(true);
+ }
+ }
+ });
+
+ txtDescription.addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER && txtDescription.getContentType().equals("text/html")) {
+ try {
+ kit.insertHTML((HTMLDocument) txtDescription.getDocument(), txtDescription.getCaretPosition(), "<br>", 0, 0,
+ HTML.Tag.BR);
+ txtDescription.setCaretPosition(txtDescription.getCaretPosition()); // This moves caret to next line
+ } catch (BadLocationException | IOException ex) {
+ ex.printStackTrace();
+ }
+ }
}
});
@@ -299,9 +428,10 @@ import java.util.*;
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>() {
@@ -309,7 +439,7 @@ import java.util.*;
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)
@@ -317,7 +447,7 @@ import java.util.*;
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);
@@ -375,8 +505,9 @@ import java.util.*;
Gui.asyncExec(new Runnable() {
@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;
}
@@ -450,8 +581,8 @@ import java.util.*;
MetaDataCache.getOperatingSystems();
MetaDataCache.getVirtualizers();
final ImageMetaCallback callback = new ImageMetaCallback() {
- @Override public void fetchedImageDetails(ImageDetailsRead imageDetails,
- Map<String, ImagePermissions> permissions) {
+ @Override
+ public void fetchedImageDetails(ImageDetailsRead imageDetails, Map<String, ImagePermissions> permissions) {
if (imageDetails == null) {
return;
}
@@ -480,8 +611,9 @@ import java.util.*;
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();
}
@@ -493,13 +625,14 @@ import java.util.*;
private void uploadToMaster() {
// 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.", MessageType.ERROR,
- null, null);
+ Gui.showMessageBox(
+ 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;
@@ -507,7 +640,7 @@ import java.util.*;
}
}
// let the user confirm or abort
- if (!Gui.showMessageBox("Wollen Sie diese VM wirklich landesweit veröffentlichen?",
+ if (!Gui.showMessageBox(I18n.WINDOW.getString("ImageDetails.Message.yesNo.confirmOrAbort"),
MessageType.QUESTION_YESNO, null, null))
return;
// start upload to masterserver
@@ -519,10 +652,8 @@ import java.util.*;
.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");
+ I18n.WINDOW.getString("ImageDetails.Message.error.uploadFailed",
+ DesktopEnvironment.Link.REGISTER_BWIDM.uri.toString()));
return;
}
Gui.asyncExec(new Runnable() {
@@ -530,10 +661,8 @@ import java.util.*;
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);
}
});
@@ -542,8 +671,8 @@ import java.util.*;
}
/**
- * Called by the "Save" button, tries to save the changes internally and
- * then react based depending on the outcome of the save
+ * Called by the "Save" button, tries to save the changes internally and then
+ * react based depending on the outcome of the save
*/
private void saveChanges() {
boolean saved = saveChangesInternal();
@@ -559,15 +688,16 @@ import java.util.*;
}
/**
- * Helper to only save the changes, nothing else. Updating GUI elements is
- * done by saveChanges()
+ * Helper to only save the changes, nothing else. Updating GUI elements is done
+ * by saveChanges()
*
* @return false if any try to save changes failed, true otherwise
*/
private boolean saveChangesInternal() {
// Special case: User has admin rights through default permissions
- // -> user removes default admin permissions
- // -> first save custom permissions, then the rest (including default permissions)
+ // -> user removes default admin permissions
+ // -> first save custom permissions, then the rest (including default
+ // permissions)
if (adminRightsFromDefaultPermissions && changeListenerPermissions.isCurrentlyChanged()) {
if (!saveCustomPermissions()) {
return false;
@@ -586,7 +716,7 @@ import java.util.*;
LOGGER.info("Successfully saved new metadata");
} catch (TException e) {
ThriftError.showMessage(me, LOGGER, e,
- "Konnte aktualisierte Metadaten nicht an den Server übermitteln");
+ I18n.WINDOW.getString("ImageDetails.Message.error.saveChangesInternal"));
return false;
}
@@ -645,7 +775,7 @@ import java.util.*;
LOGGER.info("Successfully saved new custom permissions");
} catch (TException e) {
ThriftError.showMessage(me, LOGGER, e,
- "Konnte geänderte Berechtigungen nicht an den Server übermitteln");
+ I18n.WINDOW.getString("ImageDetails.Message.error.saveCustomPermissions"));
return false;
}
return true;
@@ -658,13 +788,15 @@ import java.util.*;
*/
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 downloads
+ // using actionHandler here is not needed, as this ThriftAction works for
+ // downloads
// from either the master server or the satellite server
- ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), selected.versionId,
- image.imageName, image.virtId, image.osId, selected.fileSize, null);
+ ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), selected.versionId, image.imageName,
+ image.virtId, image.osId, selected.fileSize, null);
}
/**
@@ -696,15 +828,16 @@ import java.util.*;
}
/**
- * Extends the expiration date for given image versions to current date
- * plus the user-supplied duration.
+ * Extends the expiration date for given image versions to current date plus the
+ * user-supplied duration.
*
* @param versions to extend the validity of
*/
private void extendVersionExpiry(List<ImageVersionDetails> versions) {
int daysToExtend = -1;
if (versions.size() > 1) {
- // more than one version given, ask the user once and use the value for all versions.
+ // more than one version given, ask the user once and use the value for all
+ // versions.
daysToExtend = ExpiryDateChooser.askFutureExpiryDuration(this, null);
if (daysToExtend == -1)
return;
@@ -726,12 +859,12 @@ import java.util.*;
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);
+ Gui.showMessageBox(this, I18n.WINDOW.getString("ImageDetails.Message.info.extendVersionExpiry", count),
+ MessageType.INFO, null, null);
refresh();
}
}
@@ -846,7 +979,8 @@ import java.util.*;
}
txtTags.setText(tagsString);
- // init permissions, remember if the user had admin rights through default permissions
+ // init permissions, remember if the user had admin rights through default
+ // permissions
adminRightsFromDefaultPermissions = image.defaultPermissions.admin;
ctlImagePermissionConfigurator.initPanel(customPermissions, image.defaultPermissions, image.ownerId);
chkDefaultPermAdmin.setSelected(image.defaultPermissions.admin);
@@ -889,6 +1023,12 @@ import java.util.*;
editable = editable && (ImagePerms.canEdit(image) || ImagePerms.canAdmin(image));
txtTitle.setEditable(editable);
txtDescription.setEditable(editable);
+ btnBold.setEnabled(editable);
+ btnItalic.setEnabled(editable);
+ btnUnderline.setEnabled(editable);
+ btnWysiwyg.setEnabled(editable);
+ cbTxtColor.setEnabled(editable);
+ cbTxtSize.setEnabled(editable);
txtTags.setEditable(editable);
cboOperatingSystem.setEnabled(editable);
// cboShareMode.setEnabled(editable);
@@ -952,9 +1092,9 @@ import java.util.*;
* 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 19e30fff..2f53e8c5 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
@@ -1,5 +1,6 @@
package org.openslx.dozmod.gui.window;
+import java.awt.Color;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -7,6 +8,9 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
@@ -16,11 +20,18 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import javax.swing.Action;
import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import org.apache.commons.codec.language.ColognePhonetic;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
@@ -41,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;
@@ -98,7 +110,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* Image, that the lecture is linked to.
*/
private ImageDetailsRead image = null;
-
+
/**
* Per-User permissions of this lecture
*/
@@ -113,11 +125,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
private final AbstractControlWrapper<?> changeListenerPermissions;
- /**
+ /**
* Constructor
*
* @param modalParent parent of this popup window
- * @param callback function to be called when a lecture update occured
+ * @param callback function to be called when a lecture update occured
*/
public LectureDetailsWindow(Frame modalParent, LectureUpdatedCallback callback) {
super(modalParent);
@@ -126,7 +138,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
this.callback = callback;
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-
+
// Set up change monitor
changeMonitor = new DialogChangeMonitor(new DialogChangeMonitor.Callback() {
@Override
@@ -135,6 +147,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
btnSaveChanges.setEnabled(changeMonitor.isValid() && changeMonitor.wasEverModified());
LOGGER.info("Valid: " + changeMonitor.isValid());
}
+
@Override
public void modificationChanged() {
btnSaveChanges.setEnabled(changeMonitor.isValid() && changeMonitor.wasEverModified());
@@ -144,12 +157,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// Add controls to change monitor
changeMonitor.addFixedCombo(cboVersions, Comparators.imageVersionDetails)
- .addConstraint(
- new DialogChangeMonitor.ValidationConstraint<ImageVersionDetails>() {
+ .addConstraint(new DialogChangeMonitor.ValidationConstraint<ImageVersionDetails>() {
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
@@ -162,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;
}
};
@@ -175,19 +188,23 @@ 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);
ctlNetshareConfigurator.addToChangeMonitor(changeMonitor);
ctlLdapFilterConfigurator.addToChangeMonitor(changeMonitor);
- // TODO: LDAP/NetShare: Having uncommitted changes in the input fields should be handled too
+ // TODO: LDAP/NetShare: Having uncommitted changes in the input fields should be
+ // handled too
// End change monitor
addWindowListener(new WindowAdapter() {
@@ -252,16 +269,112 @@ 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?", MessageType.QUESTION_YESNO,
- LOGGER, null))
+ 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);
+ }
+ });
+
+ cbTxtSize.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int size = Integer.parseInt((String) cbTxtSize.getSelectedItem());
+ Action act = new StyledEditorKit.FontSizeAction(String.valueOf(size),size);
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
}
});
-
- // Update default permissions in the permission manager immediately, so it affects
+
+ cbTxtColor.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String color = (String) cbTxtColor.getSelectedItem();
+ Action act = null;
+
+ switch(color) {
+ case "Black":
+ act = new StyledEditorKit.ForegroundAction("Black", Color.black);
+ break;
+ case "Blue":
+ act = new StyledEditorKit.ForegroundAction("Blue", Color.blue);
+ break;
+ case "Yellow":
+ act = new StyledEditorKit.ForegroundAction("Yellow", Color.yellow);
+ break;
+ case "Red":
+ act = new StyledEditorKit.ForegroundAction("Red", Color.red);
+ break;
+ case "Green":
+ act = new StyledEditorKit.ForegroundAction("Green", Color.green);
+ break;
+ }
+
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+
+ btnWysiwyg.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String tmp = txtDescription.getText();
+ if (txtDescription.getContentType().equals("text/html")) {
+ txtDescription.setContentType("text/plain");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Wysiwyg");
+ if (ImagePerms.canEdit(image) || ImagePerms.canAdmin(image)) {
+ btnSaveChanges.setEnabled(true);
+ }
+
+ btnBold.setEnabled(false);
+ btnUnderline.setEnabled(false);
+ btnItalic.setEnabled(false);
+ cbTxtColor.setEnabled(false);
+ cbTxtSize.setEnabled(false);
+ } else {
+ txtDescription.setContentType("text/html");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Html");
+
+ btnBold.setEnabled(true);
+ btnUnderline.setEnabled(true);
+ btnItalic.setEnabled(true);
+ cbTxtColor.setEnabled(true);
+ cbTxtSize.setEnabled(true);
+ }
+ }
+ });
+
+ txtDescription.addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER && txtDescription.getContentType().equals("text/html")) {
+ try {
+ kit.insertHTML((HTMLDocument) txtDescription.getDocument(), txtDescription.getCaretPosition(),
+ "<br>", 0, 0, HTML.Tag.BR);
+ txtDescription.setCaretPosition(txtDescription.getCaretPosition()); // This moves caret to next
+ // line
+ } catch (BadLocationException | IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ });
+
+
+ // Update default permissions in the permission manager immediately, so it
+ // affects
// newly added users
final ItemListener updateDefaultPermissionListener = new ItemListener() {
@Override
@@ -290,10 +403,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Sets the lecture to show the details of by setting the 'lecture' and
- * 'image'
- * members to its metadata. This method will fetch the information from the
- * sat
+ * Sets the lecture to show the details of by setting the 'lecture' and 'image'
+ * members to its metadata. This method will fetch the information from the sat
*
* @param lectureId the id of the lecture to be displayed
*/
@@ -307,8 +418,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
lecture = lectureDetails;
image = imageDetails;
if (lecture != null) {
- customPermissions = ThriftActions.getLecturePermissions(
- JOptionPane.getFrameForComponent(me), lecture.lectureId);
+ customPermissions = ThriftActions
+ .getLecturePermissions(JOptionPane.getFrameForComponent(me), lecture.lectureId);
}
fillDetails();
}
@@ -317,7 +428,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Internal callback function when we received the lecture's details from the server
+ * Internal callback function when we received the lecture's details from the
+ * server
*/
private void fillDetails() {
if (lecture == null) {
@@ -379,21 +491,20 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
Calendar endCal = Calendar.getInstance();
endCal.setTime(new Date(lecture.getEndTime() * 1000l));
- dtpEndDate.getModel().setDate(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH),
- endCal.get(Calendar.DATE));
+ dtpEndDate.getModel().setDate(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH), endCal.get(Calendar.DATE));
spnEndTime.getModel().setValue(endCal.getTime());
-
+
// 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();
}
/**
- * Helper to fill the combobox with the versions of the image. The list will
- * be sorted by creation timestamp
+ * Helper to fill the combobox with the versions of the image. The list will be
+ * sorted by creation timestamp
*/
private void fillVersionsCombo() {
List<ImageVersionDetails> versions;
@@ -420,8 +531,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
cboVersions.setModel(new DefaultComboBoxModel<ImageVersionDetails>(
versions.toArray(new ImageVersionDetails[versions.size()])));
cboVersions.setSelectedIndex(-1); // To make the change monitor happy
- cboVersions.setSelectedItem(new ImageVersionDetails(lecture.getImageVersionId(), 0, 0, 0, null, true,
- true, true, null));
+ cboVersions.setSelectedItem(
+ new ImageVersionDetails(lecture.getImageVersionId(), 0, 0, 0, null, true, true, true, null));
}
/**
@@ -430,13 +541,13 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* @param user UserInfo representation of the new owner
*/
private void setLectureOwner(final UserInfo user) {
- if (!ThriftActions.setLectureOwner(JOptionPane.getFrameForComponent(this), lecture.getLectureId(),
- user)) {
+ if (!ThriftActions.setLectureOwner(JOptionPane.getFrameForComponent(this), lecture.getLectureId(), user)) {
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) {
@@ -451,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);
@@ -459,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;
@@ -467,12 +580,12 @@ 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, image.virtId, image.osId, versionSize, new DownloadCallback() {
+ ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), lecture.imageVersionId, image.imageName,
+ image.virtId, image.osId, versionSize, new DownloadCallback() {
@Override
public void downloadInitialized(boolean success) {
if (!success) {
@@ -488,8 +601,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Triggers the saving of the changes of this lecture
- * And inform the callback function about the outcome
+ * Triggers the saving of the changes of this lecture And inform the callback
+ * function about the outcome
*/
private void saveChanges() {
boolean saved = saveChangesInternal();
@@ -511,7 +624,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
long endTime = DateTimeHelper.getDateFrom(dtpEndDate, spnEndTime).getTime() / 1000L;
if (!isPeriodValid(startTime, endTime, true))
return false;
-
+
// check, whether autoupdate is selected and choose version accordingly
if (image != null) {
lecture.imageVersionId = chkAutoUpdate.isSelected() ? image.latestVersionId
@@ -529,11 +642,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// first build the LectureWrite from the GUI fields
StartupSettings startupSettings = ctlRunscriptConfigurator.getState();
final LectureWrite metadata = new LectureWrite(txtTitle.getText(), txtDescription.getText(),
- lecture.getImageVersionId(), chkAutoUpdate.isSelected(), chkIsActive.isSelected(),
- startTime, endTime,
- startupSettings.serializeItems(), null,
- chkIsExam.isSelected(),
- chkHasInternetAccess.isSelected(),
+ lecture.getImageVersionId(), chkAutoUpdate.isSelected(), chkIsActive.isSelected(), startTime, endTime,
+ startupSettings.serializeItems(), null, chkIsExam.isSelected(), chkHasInternetAccess.isSelected(),
lecture.getDefaultPermissions(), ctlLocationSelector.getSelectedLocationsAsIds(),
ctlLocationSelector.getOnlyInSelection(),
// TODO limitOnlyToAllowedUsers, default to false for now
@@ -545,14 +655,13 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
metadata.setLdapFilters(ctlLdapFilterConfigurator.getState());
metadata.setPresetScriptIds(startupSettings.selectedScripts);
- // now trigger the actual action
+ // now trigger the actual action
try {
- ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(),
- lecture.getLectureId(), metadata);
+ ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(), lecture.getLectureId(), metadata);
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;
}
@@ -572,25 +681,24 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
*/
private boolean saveCustomPermissions() {
try {
- ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(),
- lecture.lectureId, ctlPermissionManager.getPermissions());
+ ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lecture.lectureId,
+ ctlPermissionManager.getPermissions());
LOGGER.info("Successfully saved custom permissions");
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;
}
/**
- * Checks if the given start and end date represent a valid time period.
- * This is the case, if start < end and if current time < end
+ * Checks if the given start and end date represent a valid time period. This is
+ * the case, if start < end and if current time < end
*
- * @param start date of the period to check
- * @param end date of the period to check
- * @param feedback true if the user should be shown feedback, false
- * otherwise
+ * @param start date of the period to check
+ * @param end date of the period to check
+ * @param feedback true if the user should be shown feedback, false otherwise
* @return true if the period is valid, false otherwise
*/
private boolean isPeriodValid(long start, long end, boolean feedback) {
@@ -599,10 +707,9 @@ 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);
+ Gui.showMessageBox(me, msg, MessageType.ERROR, LOGGER, null);
}
lblError.setText(msg);
return false;
@@ -611,8 +718,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
/**
* Enables/Disables the tabs based on the given flag 'editable'.
*
- * @param editable when true, will enable the tabs if the user is allowed to see them.
- * If false, this will disable all tabs but the first tab "About".
+ * @param editable when true, will enable the tabs if the user is allowed to see
+ * them. If false, this will disable all tabs but the first tab
+ * "About".
*/
protected void toggleEditable(boolean editable) {
// if we don't have a lecture and an image set, just disable
@@ -620,7 +728,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// enable the standard tabs that are always enabled
setTabEnabled(pnlTabGeneral, editable);
setTabEnabled(pnlTabPermissions, editable && LecturePerms.canAdmin(lecture));
- // enable the other tabs that might have been added to the panel (depends on API version)
+ // enable the other tabs that might have been added to the panel (depends on API
+ // version)
setTabEnabled(pnlTabRestrictions, editable);
setTabEnabled(pnlTabLocations, editable);
setTabEnabled(pnlTabRunscript, editable);
@@ -630,7 +739,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
btnChangeOwner.setEnabled(LecturePerms.canAdmin(lecture));
btnDownloadImage.setEnabled(ImagePerms.canDownload(image));
}
-
+
private void setTabEnabled(JPanel tab, boolean editable) {
int index = pnlTabs.indexOfComponent(tab);
if (index == -1) // Check if tab exists -- we don't add some, depending on server version
@@ -639,11 +748,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Opens a new LectureDetailsWindow showing the details of the
- * lecture with ID = lectureId
+ * Opens a new LectureDetailsWindow showing the details of the lecture with ID =
+ * lectureId
*
* @param modalParent parent of this window
- * @param lectureId id of the lecture to set the details of
+ * @param lectureId id of the lecture to set the details of
*/
public static void open(Frame modalParent, String lectureId, LectureUpdatedCallback callback) {
LectureDetailsWindow win = new LectureDetailsWindow(modalParent, callback);
@@ -661,9 +770,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
super.show();
}
- /* *******************************************************************************
+ /*
+ * *****************************************************************************
+ * **
*
- * UIFeedback implementation
+ * UIFeedback implementation
*
********************************************************************************/
@Override
@@ -683,10 +794,10 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
*/
private void safeClose() {
if (changeMonitor.isCurrentlyModified()
- && !Gui.showMessageBox(me, "Änderungen werden verworfen, wollen Sie wirklich schließen?",
+ && !Gui.showMessageBox(me, I18n.WINDOW.getString("LectureDetails.Message.yesNo.safeClose"),
MessageType.QUESTION_YESNO, null, null))
return;
- synchronized(me) {
+ synchronized (me) {
lecture = null;
image = 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/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 69bfe634..73425880 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,5 +1,25 @@
package org.openslx.dozmod.gui.window.layout;
+import java.awt.*;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+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;
+
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.ShareMode;
import org.openslx.dozmod.gui.Gui;
@@ -12,6 +32,7 @@ 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;
import javax.swing.*;
@@ -26,7 +47,7 @@ import java.awt.*;
private final String TAB_PERMISSIONS_TITEL = "Berechtigungen";
protected final JTextField txtTitle;
- protected final JTextArea txtDescription;
+ protected final JEditorPane txtDescription;
private final JPanel pnlTabContainer;
protected final JTextArea txtContainerRecipe;
@@ -66,13 +87,18 @@ import java.awt.*;
protected final ImageVersionTable tblVersions;
protected final QScrollPane scpVersions;
+ protected final JButton btnBold;
+ protected final JButton btnItalic;
+ protected final JButton btnUnderline;
+ protected final JButton btnWysiwyg;
+
+ protected final JComboBox cbTxtSize;
+ protected final JComboBox cbTxtColor;
+ protected final HTMLEditorKit kit;
protected JTabbedPane pnlTabs;
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);
@@ -80,9 +106,11 @@ import java.awt.*;
setPreferredSize(Gui.getScaledDimension(630, 680));
((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
- /* *******************************************************************************
+ /*
+ * *****************************************************************************
+ * **
*
- * Tab: Overview
+ * Tab: Overview
*
********************************************************************************/
JPanel pnlTabOverview = new JPanel();
@@ -90,15 +118,55 @@ import java.awt.*;
// name
txtTitle = new JTextField();
txtTitle.setFont(txtTitle.getFont().deriveFont(Font.BOLD, txtTitle.getFont().getSize2D() * 1.4f));
- //txtTitle.setMinimumSize(Gui.getScaledDimension(0, 24));
grid.add(txtTitle, 3).expand(true, false).fill(true, false);
grid.nextRow();
+ // buttons for text editing
+ JPanel editingPanel = new JPanel();
+
+ editingPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
+ JPanel emptyPanel = new JPanel();
+ grid.add(emptyPanel);
+ btnBold = new JButton(new StyledEditorKit.BoldAction());
+ btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 15, this));
+ btnBold.setText("");
+ btnItalic = new JButton(new StyledEditorKit.ItalicAction());
+ btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 15, this));
+ btnItalic.setText("");
+ btnUnderline = new JButton(new StyledEditorKit.UnderlineAction());
+ btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 15, this));
+ btnUnderline.setText("");
+ editingPanel.add(btnBold);
+ editingPanel.add(btnItalic);
+ editingPanel.add(btnUnderline);
+
+ String[] textsizes = {"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"};
+ cbTxtSize = new JComboBox<>(textsizes);
+ cbTxtSize.setPreferredSize(new Dimension(65,25));
+ editingPanel.add(cbTxtSize);
+
+ Object[] colors = {"Black", "Blue", "Red", "Yellow", "Green"};
+ cbTxtColor = new JComboBox<>(colors);
+ cbTxtColor.setPreferredSize(new Dimension(100,25));
+ editingPanel.add(cbTxtColor);
+
+ grid.add(editingPanel).expand(false, true);
+
+ emptyPanel.setLayout(new FlowLayout());
+ btnWysiwyg = new JButton("HTML");
+ btnWysiwyg.setPreferredSize(new Dimension(100,25));
+ emptyPanel.add(btnWysiwyg);
+
+ grid.add(emptyPanel);
+ grid.nextRow();
+
// description
- txtDescription = new JTextArea();
- txtDescription.setLineWrap(true);
- txtDescription.setWrapStyleWord(true);
- grid.add(new QLabel("Beschreibung")).anchor = GridBagConstraints.FIRST_LINE_START;
+ txtDescription = new JEditorPane();
+ kit = new HTMLEditorKit();
+ txtDescription.setEditorKit(kit);
+ txtDescription.setContentType("text/html");
+
+ 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));
@@ -108,27 +176,27 @@ import java.awt.*;
// 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();
@@ -142,7 +210,7 @@ import java.awt.*;
});
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();
@@ -157,39 +225,40 @@ import java.awt.*;
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);
@@ -198,20 +267,25 @@ import java.awt.*;
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();
grid.finish(false);
- /* *******************************************************************************
+ /*
+ * *****************************************************************************
+ * **
*
- * Tab: VM versions
+ * Tab: VM versions
*
********************************************************************************/
JPanel pnlTabVersions = new JPanel();
@@ -221,9 +295,11 @@ import java.awt.*;
grdVersions.add(scpVersions).fill(true, true).expand(true, true);
grdVersions.finish(false);
- /* *******************************************************************************
+ /*
+ * *****************************************************************************
+ * **
*
- * Tab: Permissions
+ * Tab: Permissions
*
********************************************************************************/
JPanel pnlTabPermissions = new JPanel();
@@ -235,9 +311,10 @@ import java.awt.*;
.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
@@ -245,10 +322,10 @@ import java.awt.*;
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);
@@ -303,14 +380,14 @@ import java.awt.*;
/* *******************************************************************************
*
- * Bottom panel for buttons
+ * Bottom panel for buttons
*
********************************************************************************/
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);
@@ -319,17 +396,18 @@ import java.awt.*;
pnlButtons.add(btnClose);
pnlButtons.add(btnSaveChanges);
- /* *******************************************************************************
+ /*
+ * *****************************************************************************
+ * **
*
- * Main panel containing the tabs
+ * Main panel containing the tabs
*
********************************************************************************/
pnlTabs = new JTabbedPane();
-
- pnlTabs.addTab(TAB_OVERVIEW_TITEL, pnlTabOverview);
- pnlTabs.addTab(TAB_VERSIONS_TITEL, pnlTabVersions);
- pnlTabs.addTab(TAB_PERMISSIONS_TITEL, 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);
}
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 0dc3cee2..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
@@ -2,18 +2,24 @@ 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.util.Calendar;
+import java.awt.GridLayout;
+import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
+import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
import javax.swing.JDialog;
+import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -23,6 +29,8 @@ import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import javax.swing.text.DateFormatter;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTMLEditorKit;
import org.jdatepicker.JDatePicker;
import org.openslx.bwlp.thrift.iface.ImageVersionDetails;
@@ -41,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;
@@ -53,7 +62,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
// stuff ending in '...Info' are supposed to be the read-only labels for the information tab
protected final QLabel lblTitleInfo;
protected final JTextField txtTitle;
- protected final JTextArea txtDescription;
+ protected final JEditorPane txtDescription;
protected final QLabel lblImageNameInfo;
protected final QLabel txtImageName;
protected final JButton btnLinkImage;
@@ -106,11 +115,21 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
protected final JPanel pnlTabNetshare;
protected final JPanel pnlTabLdapFilter;
+ protected final JButton btnBold;
+ protected final JButton btnItalic;
+ protected final JButton btnUnderline;
+ protected final JButton btnWysiwyg;
+
+ protected final JComboBox cbTxtSize;
+ protected final JComboBox cbTxtColor;
+ protected final HTMLEditorKit kit;
+
+
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));
@@ -126,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);
@@ -170,15 +189,59 @@ 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();
+ // buttons for text editing
+ JPanel editingPanel = new JPanel();
+
+ editingPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
+ JPanel emptyPanel = new JPanel();
+ grdGeneral.add(emptyPanel);
+ btnBold = new JButton(new StyledEditorKit.BoldAction());
+ btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 15, this));
+ btnBold.setText("");
+ btnItalic = new JButton(new StyledEditorKit.ItalicAction());
+ btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 15, this));
+ btnItalic.setText("");
+ btnUnderline = new JButton(new StyledEditorKit.UnderlineAction());
+ btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 15, this));
+ btnUnderline.setText("");
+ editingPanel.add(btnBold);
+ editingPanel.add(btnItalic);
+ editingPanel.add(btnUnderline);
+
+ String[] textsizes = {"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"};
+ cbTxtSize = new JComboBox<>(textsizes);
+ cbTxtSize.setPreferredSize(new Dimension(65,25));
+ editingPanel.add(cbTxtSize);
+
+ Object[] colors = {"Black", "Blue", "Red", "Yellow", "Green"};
+ cbTxtColor = new JComboBox<>(colors);
+ cbTxtColor.setPreferredSize(new Dimension(100,25));
+ editingPanel.add(cbTxtColor);
+
+ grdGeneral.add(editingPanel);
+
+
+ emptyPanel.setLayout(new FlowLayout());
+ btnWysiwyg = new JButton("HTML");
+ btnWysiwyg.setPreferredSize(new Dimension(100,25));
+ emptyPanel.add(btnWysiwyg);
+
+ grdGeneral.add(emptyPanel);
+ grdGeneral.add(new JPanel());
+ grdGeneral.add(new JPanel());
+
+ grdGeneral.nextRow();
+
// description
- txtDescription = new JTextArea();
- txtDescription.setLineWrap(true);
- txtDescription.setWrapStyleWord(true);
- grdGeneral.add(new QLabel("Beschreibung")).anchor(GridBagConstraints.FIRST_LINE_START);
+ txtDescription = new JEditorPane();
+ kit = new HTMLEditorKit();
+ txtDescription.setEditorKit(kit);
+ txtDescription.setContentType("text/html");
+ 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));
@@ -186,18 +249,19 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
grdGeneral.add(jsp, 4).expand(true, true).fill(true, true);
grdGeneral.nextRow();
+
// ID. NOTE: currently disabled
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();
@@ -205,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>() {
@@ -226,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();
@@ -249,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();
@@ -262,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();
@@ -280,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);
@@ -301,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)
@@ -335,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);
@@ -396,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..90c1b47f 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,14 @@ public abstract class LectureListWindowLayout extends CompositePage {
filterPanel.add(txtSearch);
filterPanel.add(cboFilter);
+ // search in description
+ chkSearchInDescription = new JCheckBox("Suche in Beschreibung");
+ 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 +95,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 ba336652..71a70b0e 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
@@ -5,6 +5,7 @@ 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;
@@ -54,12 +55,16 @@ import java.util.List;
* Adding Pages to the Wizard to create a virtual machine
*/
public void doVmCreation() {
- cleanCurrent();
- currentPages.add(new ImageUploadPage(this, state, null));
+ 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);
}
/**
@@ -87,8 +92,9 @@ import java.util.List;
}
}
- @Override public String getWindowTitle() {
- return "Neue VM erzeugen";
+ @Override
+ public String getWindowTitle() {
+ return I18n.WIZARD.getString("ImageCreation.Wizard.title");
}
/**
@@ -135,7 +141,7 @@ import java.util.List;
// 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;
}
@@ -145,7 +151,7 @@ import java.util.List;
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;
@@ -156,7 +162,7 @@ import java.util.List;
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;
@@ -173,8 +179,8 @@ import java.util.List;
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);
}
}
@@ -255,10 +261,31 @@ import java.util.List;
state.shareMode);
}
- @Override protected boolean onCancelRequest() {
+ @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() {
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 96305128..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,9 +7,11 @@ 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;
@@ -39,7 +41,10 @@ public class ImageUpdateWizard extends Wizard implements UiFeedback, QuitNotific
case TConst.VIRT_QEMU:
case TConst.VIRT_VIRTUALBOX:
case TConst.VIRT_VMWARE:
- addPage(new ImageUploadPage(this, state, image));
+ imageUploadPage = new ImageUploadPage(this, state, image);
+ addPage(imageUploadPage);
+ state.conversionPage = new ImageOvfConversionPage(this, state);
+ addOutOfOrderPage(state.conversionPage);
break;
}
}
@@ -60,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);
}
}
@@ -81,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() {
@@ -106,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
@@ -116,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 5ce2c815..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,9 +223,14 @@ 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)
- {
+ for (WizardPage i : currentPages) {
pages.remove(i);
}
}
@@ -214,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);
@@ -239,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()) {
@@ -249,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) {
@@ -266,6 +313,9 @@ public abstract class Wizard extends JDialog {
if (isPostFinish) {
postFinishPage.onPageLeave();
}
+ if (outOfOrderPage != null) {
+ outOfOrderPage.onPageLeave();
+ }
dispose();
}
}
@@ -293,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/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 8de4fa9b..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
@@ -1,5 +1,17 @@
package org.openslx.dozmod.gui.wizard.layout;
+import java.awt.FlowLayout;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JButton;
+import javax.swing.text.StyledEditorKit;
+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;
@@ -7,6 +19,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.gui.wizard.Wizard;
import org.openslx.dozmod.gui.wizard.WizardPage;
import org.openslx.thrifthelper.Comparators;
@@ -17,13 +30,23 @@ import javax.swing.*;
protected final QLabel lblOperatingSystem;
protected final JComboBox<OperatingSystem> cboOperatingSystem;
- protected final JTextArea txtDescription;
+ protected final JEditorPane txtDescription;
protected final JTextArea startCommand;
protected final QLabel sCommandCaption;
protected final JScrollPane startCommandPane;
protected final JCheckBox chkLicenseRestricted;
protected final JCheckBox chkIsTemplate;
+ protected final JButton btnBold;
+ protected final JButton btnItalic;
+ protected final JButton btnUnderline;
+ protected final JButton btnWysiwyg;
+
+ protected final JComboBox cbTxtSize;
+ protected final JComboBox cbTxtColor;
+ protected final HTMLEditorKit kit;
+
+
protected final ContainerBindMountConfigurator bindMountConfigurator;
/**
@@ -32,25 +55,26 @@ import javax.swing.*;
* @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.");
-
- GridManager grid = new GridManager(this, 2, false);
-
- lblOperatingSystem = new QLabel("Betriebssystem");
- cboOperatingSystem = new ComboBox<>(Comparators.operatingSystem,
- new ComboBoxRenderer<OperatingSystem>() {
- @Override public String renderItem(OperatingSystem item) {
- if (item == null)
- return null;
- return item.getOsName();
- }
- });
+ super(wizard, I18n.PAGE_LAYOUT.getString("ImageMetaData.WizardPage.title"));
+ setDescription(I18n.PAGE_LAYOUT.getString("ImageMetaData.WizardPage.description"));
+
+ GridManager grid = new GridManager(this, 3, false);
+
+ 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) {
+ if (item == null)
+ return null;
+ return item.getOsName();
+ }
+ });
cboOperatingSystem.setEditable(false);
grid.add(lblOperatingSystem);
- grid.add(cboOperatingSystem);
+ 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);
@@ -60,23 +84,62 @@ import javax.swing.*;
startCommandPane.setMinimumSize(startCommand.getMinimumSize());
grid.add(sCommandCaption);
grid.add(startCommandPane).fill(true, false).expand(true, false);
+ grid.add(new JPanel());
+ grid.nextRow();
+
+ // buttons for text editing
+ JPanel editingPanel = new JPanel();
+ editingPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
+ JPanel emptyPanel = new JPanel();
+ grid.add(emptyPanel);
+ btnBold = new JButton(new StyledEditorKit.BoldAction());
+ btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 15, this));
+ btnBold.setText("");
+ btnItalic = new JButton(new StyledEditorKit.ItalicAction());
+ btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 15, this));
+ btnItalic.setText("");
+ btnUnderline = new JButton(new StyledEditorKit.UnderlineAction());
+ btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 15, this));
+ btnUnderline.setText("");
+ editingPanel.add(btnBold);
+ editingPanel.add(btnItalic);
+ editingPanel.add(btnUnderline);
+
+ String[] textsizes = {"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"};
+ cbTxtSize = new JComboBox<>(textsizes);
+ cbTxtSize.setPreferredSize(new Dimension(65,25));
+ editingPanel.add(cbTxtSize);
+
+ Object[] colors = {"Black", "Blue", "Red", "Yellow", "Green"};
+ cbTxtColor = new JComboBox<>(colors);
+ cbTxtColor.setPreferredSize(new Dimension(95,25));
+ editingPanel.add(cbTxtColor);
+
+ grid.add(editingPanel);
+ emptyPanel.setLayout(new FlowLayout());
+ btnWysiwyg = new JButton("HTML");
+ btnWysiwyg.setPreferredSize(new Dimension(100,25));
+ emptyPanel.add(btnWysiwyg);
+ grid.add(emptyPanel);
grid.nextRow();
- QLabel descriptionCaption = new QLabel("Beschreibung");
- txtDescription = new JTextArea(5, 50);
+ // description
+ QLabel descriptionCaption = new QLabel(I18n.PAGE_LAYOUT.getString("ImageMetaData.Label.description.text"));
+ txtDescription = new JEditorPane();
txtDescription.setMinimumSize(Gui.getScaledDimension(0, 70));
- txtDescription.setLineWrap(true);
- txtDescription.setWrapStyleWord(true);
- JScrollPane descPane = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ kit = new HTMLEditorKit();
+ txtDescription.setEditorKit(kit);
+ txtDescription.setContentType("text/html");
+ JScrollPane descPane = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- descPane.setMinimumSize(txtDescription.getMinimumSize());
grid.add(descriptionCaption);
- grid.add(descPane).fill(true, false).expand(true, false);
+ 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, 2);
+ grid.add(chkLicenseRestricted, 3);
grid.nextRow();
bindMountConfigurator = new ContainerBindMountConfigurator();
@@ -86,8 +149,8 @@ import javax.swing.*;
grid.nextRow();
// -- end permissions group --
- chkIsTemplate = new JCheckBox("Vorlage erstellen");
- grid.add(chkIsTemplate, 2);
+ chkIsTemplate = new JCheckBox(I18n.PAGE_LAYOUT.getString("ImageMetaData.CheckBox.isTemplate.text"));
+ grid.add(chkIsTemplate, 3);
grid.nextRow();
grid.finish(true);
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/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 5df21c1d..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
@@ -1,76 +1,135 @@
package org.openslx.dozmod.gui.wizard.layout;
import java.util.Calendar;
+import java.awt.FlowLayout;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
-import javax.swing.JTextArea;
import javax.swing.JTextField;
+import javax.swing.JPanel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
import javax.swing.SpinnerDateModel;
import javax.swing.text.DateFormatter;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTMLEditorKit;
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;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+
@SuppressWarnings("serial")
public abstract class LectureCreationPageLayout extends WizardPage {
protected final JTextField txtName;
- protected final JTextArea txtDescription;
+ protected final JEditorPane txtDescription;
protected final QDatePickerImpl dtpStartDate;
protected final QDatePickerImpl dtpEndDate;
protected final JSpinner spnStartTime;
protected final JSpinner spnEndTime;
protected final QLabel lblCalcPeriod;
+ protected final JButton btnBold;
+ protected final JButton btnItalic;
+ protected final JButton btnUnderline;
+ protected final JButton btnWysiwyg;
+
+ protected final JComboBox cbTxtSize;
+ protected final JComboBox cbTxtColor;
+ protected final HTMLEditorKit kit;
+
+
/**
* Page for creating lectures
*
- * @param editExistingLecture whether to edit existing lecture or create new
- * one
+ * @param editExistingLecture whether to edit existing lecture or create new one
*/
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();
- txtDescription = new JTextArea(3, 50);
- txtDescription.setLineWrap(true);
- txtDescription.setWrapStyleWord(true);
+ // buttons for text editing
+ JPanel editingPanel = new JPanel();
+ editingPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
+ JPanel emptyPanel = new JPanel();
+ grid.add(emptyPanel);
+ btnBold = new JButton(new StyledEditorKit.BoldAction());
+ btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 15, this));
+ btnBold.setText("");
+ btnItalic = new JButton(new StyledEditorKit.ItalicAction());
+ btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 15, this));
+ btnItalic.setText("");
+ btnUnderline = new JButton(new StyledEditorKit.UnderlineAction());
+ btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 15, this));
+ btnUnderline.setText("");
+ editingPanel.add(btnBold);
+ editingPanel.add(btnItalic);
+ editingPanel.add(btnUnderline);
+
+ String[] textsizes = {"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"};
+ cbTxtSize = new JComboBox<>(textsizes);
+ cbTxtSize.setPreferredSize(new Dimension(65,25));
+ editingPanel.add(cbTxtSize);
+
+ Object[] colors = {"Black", "Blue", "Red", "Yellow", "Green"};
+ cbTxtColor = new JComboBox<>(colors);
+ cbTxtColor.setPreferredSize(new Dimension(95,25));
+ editingPanel.add(cbTxtColor);
+
+ grid.add(editingPanel);
+ emptyPanel.setLayout(new FlowLayout());
+ btnWysiwyg = new JButton("HTML");
+ btnWysiwyg.setPreferredSize(new Dimension(100,25));
+ emptyPanel.add(btnWysiwyg);
+
+ grid.add(emptyPanel);
+ grid.nextRow();
+
+ // description
+ txtDescription = new JEditorPane();
+ kit = new HTMLEditorKit();
+ txtDescription.setEditorKit(kit);
+ txtDescription.setContentType("text/html");
+ txtDescription.setPreferredSize(new Dimension(600,800));
JScrollPane descPane = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
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/ImageMetaDataPage.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/page/ImageMetaDataPage.java
index 47408fd9..306359e8 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
@@ -1,9 +1,28 @@
package org.openslx.dozmod.gui.wizard.page;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Collections;
+import java.util.List;
+import java.awt.Color;
+
+import javax.swing.Action;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.io.IOException;
+
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;
@@ -70,9 +89,102 @@ import java.util.List;
reactToUserInput();
}
});
+
+ cbTxtSize.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int size = Integer.parseInt((String) cbTxtSize.getSelectedItem());
+ Action act = new StyledEditorKit.FontSizeAction(String.valueOf(size), size);
+ act.actionPerformed(new ActionEvent(act, ActionEvent.ACTION_PERFORMED,
+ (String) act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+ cbTxtColor.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String color = (String) cbTxtColor.getSelectedItem();
+ Action act = null;
+
+ switch (color) {
+ case "Black":
+ act = new StyledEditorKit.ForegroundAction("Black", Color.black);
+ break;
+ case "Blue":
+ act = new StyledEditorKit.ForegroundAction("Blue", Color.blue);
+ break;
+ case "Yellow":
+ act = new StyledEditorKit.ForegroundAction("Yellow", Color.yellow);
+ break;
+ case "Red":
+ act = new StyledEditorKit.ForegroundAction("Red", Color.red);
+ break;
+ case "Green":
+ act = new StyledEditorKit.ForegroundAction("Green", Color.green);
+ break;
+ }
+
+ act.actionPerformed(new ActionEvent(act, ActionEvent.ACTION_PERFORMED,
+ (String) act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+ btnWysiwyg.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String tmp = txtDescription.getText();
+ if (txtDescription.getContentType().equals("text/html")) {
+ txtDescription.setContentType("text/plain");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Wysiwyg");
+
+ btnBold.setEnabled(false);
+ btnUnderline.setEnabled(false);
+ btnItalic.setEnabled(false);
+ cbTxtColor.setEnabled(false);
+ cbTxtSize.setEnabled(false);
+ } else {
+ txtDescription.setContentType("text/html");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Html");
+
+ btnBold.setEnabled(true);
+ btnUnderline.setEnabled(true);
+ btnItalic.setEnabled(true);
+ cbTxtColor.setEnabled(true);
+ cbTxtSize.setEnabled(true);
+ }
+ }
+ });
+
+ txtDescription.addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER && txtDescription.getContentType().equals("text/html")) {
+ try {
+ kit.insertHTML((HTMLDocument) txtDescription.getDocument(), txtDescription.getCaretPosition(),
+ "<br>", 0, 0, HTML.Tag.BR);
+ txtDescription.setCaretPosition(txtDescription.getCaretPosition()); // This moves caret to next
+ // line
+ } catch (BadLocationException | IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ });
}
- @Override protected void onPageEnter() {
+
+ @Override
+ protected void onPageEnter() {
// Preselect OS if possible
if (state.detectedOs != null) {
cboOperatingSystem.setSelectedItem(state.detectedOs);
@@ -109,14 +221,13 @@ import java.util.List;
}
/**
- * Called by event listeners. This will set guidance message or error
- * message
+ * Called by event listeners. This will set guidance message or error message
* and call setPageComplete(bool) accordingly.
*/
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;
}
@@ -143,11 +254,11 @@ import java.util.List;
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/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 9bb91409..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
@@ -4,12 +4,21 @@ import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
+import java.io.IOException;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import javax.swing.Action;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTML;
+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;
@@ -32,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
@@ -65,8 +75,102 @@ public class LectureCreationPage extends LectureCreationPageLayout {
dtpStartDate.addActionListener(actionListener);
dtpEndDate.addActionListener(actionListener);
calculateDatePeriod();
+
+ cbTxtSize.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int size = Integer.parseInt((String) cbTxtSize.getSelectedItem());
+ Action act = new StyledEditorKit.FontSizeAction(String.valueOf(size),size);
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+ cbTxtColor.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String color = (String) cbTxtColor.getSelectedItem();
+ Action act = null;
+
+ switch(color) {
+ case "Black":
+ act = new StyledEditorKit.ForegroundAction("Black", Color.black);
+ break;
+ case "Blue":
+ act = new StyledEditorKit.ForegroundAction("Blue", Color.blue);
+ break;
+ case "Yellow":
+ act = new StyledEditorKit.ForegroundAction("Yellow", Color.yellow);
+ break;
+ case "Red":
+ act = new StyledEditorKit.ForegroundAction("Red", Color.red);
+ break;
+ case "Green":
+ act = new StyledEditorKit.ForegroundAction("Green", Color.green);
+ break;
+ }
+
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+
+ btnWysiwyg.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String tmp = txtDescription.getText();
+ if (txtDescription.getContentType().equals("text/html")) {
+ txtDescription.setContentType("text/plain");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Wysiwyg");
+
+ btnBold.setEnabled(false);
+ btnUnderline.setEnabled(false);
+ btnItalic.setEnabled(false);
+ cbTxtColor.setEnabled(false);
+ cbTxtSize.setEnabled(false);
+ } else {
+ txtDescription.setContentType("text/html");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Html");
+
+ btnBold.setEnabled(true);
+ btnUnderline.setEnabled(true);
+ btnItalic.setEnabled(true);
+ cbTxtColor.setEnabled(true);
+ cbTxtSize.setEnabled(true);
+ }
+ }
+ });
+
+ txtDescription.addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER && txtDescription.getContentType().equals("text/html")) {
+ try {
+ kit.insertHTML((HTMLDocument) txtDescription.getDocument(), txtDescription.getCaretPosition(),
+ "<br>", 0, 0, HTML.Tag.BR);
+ txtDescription.setCaretPosition(txtDescription.getCaretPosition()); // This moves caret to next
+ // line
+ } catch (BadLocationException | IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ });
}
+
+
@Override
protected boolean wantNextOrFinish() {
return reactToUserInput();
@@ -92,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();
@@ -118,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;
@@ -136,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;
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/state/UploadWizardState.java b/dozentenmodul/src/main/java/org/openslx/dozmod/state/UploadWizardState.java
index 46810096..beea1a74 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/state/UploadWizardState.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/state/UploadWizardState.java
@@ -7,6 +7,7 @@ import java.util.Map;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.ShareMode;
+import org.openslx.dozmod.gui.wizard.WizardPage;
import org.openslx.dozmod.thrift.Session;
import org.openslx.dozmod.thrift.UploadInitiator;
import org.openslx.util.vm.VmMetaData;
@@ -35,6 +36,9 @@ public class UploadWizardState {
public boolean isRestricted = true;
// flags an image as a template
public boolean isTemplate = false;
+ // flag if we the description file is in the ovf format that needs conversion
+ public File convertedDescriptionFile;
+
/**
* list of strings for tags
*/
@@ -42,7 +46,7 @@ public class UploadWizardState {
// -- Objects returned by thrift calls --
// UUID given returned by the satellite after creating the image
public String uuid = null;
-
+
public UploadInitiator upload = null;
/**
@@ -50,4 +54,9 @@ public class UploadWizardState {
*/
public VmMetaData meta = null;
+ // To be able to call the conversion Page from within the ImageUploadPage
+ // TODO find cleaner approach, this probably shouldn't be in here..
+ public WizardPage conversionPage;
+ public WizardPage imageUploadPage;
+
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java
index 4267ea31..07146ead 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/GuiErrorCallback.java
@@ -10,6 +10,7 @@ import org.openslx.bwlp.thrift.iface.TAuthorizationException;
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.thrifthelper.ThriftManager.ErrorCallback;
@@ -44,9 +45,9 @@ public class GuiErrorCallback implements ErrorCallback {
return Gui.syncExec(new GuiCallable<Boolean>() {
@Override
public Boolean run() {
- if (Gui.showMessageBox(parent, "Ungültiges Sitzungstoken oder fehlerhafte Authentifizierung am " + serverString + "!" +
- //"\n" + errMsg + "\n" +
- "\nBitte starten Sie das Programm neu. Jetzt beenden?", MessageType.ERROR_RETRY, LOGGER, t)) {
+ if (Gui.showMessageBox(parent,
+ I18n.THRIFT.getString("GuiErrorCallback.Message.error.notAuthenticatedOrInvalidToken",
+ serverString), MessageType.ERROR_RETRY, LOGGER, t)) {
// user confirmed exit
Config.saveCurrentSession("", "", "");
Gui.exit(0);
@@ -64,11 +65,11 @@ public class GuiErrorCallback implements ErrorCallback {
public Boolean run() {
String errMsg = null;
if (tex != null) {
- errMsg = " (Fehler " + tex.getType() + ")";
+ errMsg = I18n.THRIFT.getString("GuiErrorCallback.thriftError.String.errMsg", tex.getType());
}
- return Gui.showMessageBox(parent, "Die Kommunikation mit " + serverString + " ist"
- + " gestört. Der Aufruf der Funktion " + method + " ist fehlgeschlagen" + errMsg
- + ".\n\n" + "Möchten Sie den Aufruf wiederholen?", MessageType.ERROR_RETRY, LOGGER, t);
+ return Gui.showMessageBox(parent,
+ I18n.THRIFT.getString("GuiErrorCallback.Message.error.transportException",
+ serverString, method, errMsg), MessageType.ERROR_RETRY, LOGGER, t);
}
});
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java
index 11feba74..0bf1bfcb 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ImageLocalDetailsActions.java
@@ -15,6 +15,7 @@ import org.openslx.bwlp.thrift.iface.TInvocationException;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.thrift.ThriftActions.DeleteCallback;
import org.openslx.dozmod.thrift.ThriftActions.ImageMetaCallback;
import org.openslx.thrifthelper.ThriftManager;
@@ -74,7 +75,8 @@ public class ImageLocalDetailsActions implements ImageDetailsActions {
try {
ThriftActions.writeImagePermissions(imageBaseId, customPermissions);
} catch (TException e) {
- ThriftError.showMessage(parent, LOGGER, e, "Could not write permissions");
+ ThriftError.showMessage(parent, LOGGER, e,
+ I18n.THRIFT.getString("ImageLocalDetailsActions.Message.error.writeImagePermissionsFailed"));
}
}
});
@@ -105,7 +107,8 @@ public class ImageLocalDetailsActions implements ImageDetailsActions {
ThriftManager.getSatClient().setImageVersionVirtConfig(Session.getSatelliteToken(), imageVersionId, machineDescription);
success = true;
} catch (TException e) {
- ThriftError.showMessage(parent, LOGGER, e, "Fehler beim Speichern der VM-Konfiguration!");
+ ThriftError.showMessage(parent, LOGGER, e,
+ I18n.THRIFT.getString("ImageLocalDetailsActions.Message.error.setVirtualizerConfigFailed"));
}
Gui.asyncExec(new Runnable() {
@Override
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
index aa43601e..46771d46 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/Session.java
@@ -7,6 +7,7 @@ import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.LecturePermissions;
+import org.openslx.bwlp.thrift.iface.Role;
import org.openslx.bwlp.thrift.iface.SatelliteConfig;
import org.openslx.bwlp.thrift.iface.WhoamiInfo;
import org.openslx.sat.thrift.version.Feature;
@@ -82,7 +83,7 @@ public class Session {
return null;
return data.user.userId;
}
-
+
/**
* @return the organization id
*/
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
index 27a77322..96c4d1f6 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
@@ -4,6 +4,7 @@ import java.awt.Frame;
import java.awt.Window;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -18,6 +19,7 @@ import org.apache.thrift.transport.TTransportException;
import org.openslx.bwlp.thrift.iface.*;
import org.openslx.bwlp.thrift.iface.SatelliteServer.Client;
import org.openslx.dozmod.App;
+import org.openslx.dozmod.Branding;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.Config.SavedSession;
import org.openslx.dozmod.authentication.Authenticator.AuthenticationData;
@@ -27,6 +29,7 @@ import org.openslx.dozmod.filetransfer.TransferEventListener;
import org.openslx.dozmod.gui.GraphicalCertHandler;
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.QFileChooser;
import org.openslx.dozmod.gui.window.SatelliteListWindow;
@@ -37,10 +40,13 @@ import org.openslx.dozmod.thrift.cache.UserCache;
import org.openslx.dozmod.util.FormatHelper;
import org.openslx.dozmod.util.ImageWrapper;
import org.openslx.dozmod.util.VmWrapper;
+import org.openslx.dozmod.util.VmWrapper.MetaDataMissingException;
import org.openslx.sat.thrift.version.Version;
import org.openslx.thrifthelper.ThriftManager;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
+import org.openslx.util.vm.DiskImage;
+import org.openslx.util.vm.DiskImage.UnknownImageFormatException;
public class ThriftActions {
@@ -74,9 +80,8 @@ public class ThriftActions {
long remoteVersion = -1;
if (interactive && !forceCustomSatellite && (data.satellites == null || data.satellites.isEmpty())) {
- Gui.asyncMessageBox("Login erfolgreich, aber es wurde kein Satellitenserver gefunden.\n"
- + " Bitte geben Sie die Adresse Ihres Servers manuell an.", MessageType.ERROR, LOGGER,
- null);
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.satellitesNullOrEmpty"),
+ MessageType.ERROR, LOGGER, null);
}
do {
@@ -126,10 +131,8 @@ public class ThriftActions {
}
}
if (sat.addressList == null || sat.addressList.isEmpty()) {
- Gui.asyncMessageBox(
- "Login erfolgreich, aber für den ausgewählten Satellitenserver ist\n"
- + "keine Adresse hinterlegt. Kann nicht verbinden.", MessageType.ERROR,
- LOGGER, null);
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.addressListNullOrEmpty"),
+ MessageType.ERROR, LOGGER, null);
continue;
}
address = sat.addressList.get(0);
@@ -155,9 +158,7 @@ public class ThriftActions {
if (client == null || remoteVersion == -1) {
if (interactive) {
- Gui.asyncMessageBox(
- "Authentifizierung erfolgreich, die Verbindung zum Satellitenserver ist jedoch nicht möglich.\n\n"
- + "Möglicherweise ist der Server nicht verfügbar, oder die Netzwerkverbindung gestört.",
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.couldNotGetNewClient"),
MessageType.ERROR, null, null);
if (data.satellites.size() == 1) {
return false;
@@ -169,10 +170,8 @@ public class ThriftActions {
if (remoteVersion < Version.MIN_VERSION || remoteVersion > Version.VERSION) {
if (interactive) {
- Gui.asyncMessageBox("Das von Ihnen verwendete Dozentenmodul ist nicht mit dem"
- + " gewählten Satellitenserver kompatibel.\n" + "Ihre Version: "
- + Version.VERSION + "\n" + "Satelliten-Version: " + remoteVersion,
- MessageType.ERROR, LOGGER, null);
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.versionNotCompatible",
+ Version.VERSION, remoteVersion), MessageType.ERROR, LOGGER, null);
continue;
}
return false;
@@ -184,21 +183,19 @@ public class ThriftActions {
} catch (TAuthorizationException e) {
if (interactive) {
ThriftError.showMessage(window, LOGGER, e,
- "Authentifizierung erfolgreich, der Satellitenserver verweigert jedoch die Verbindung.\n"
- + "Versuchen Sie, sich erneut anzumelden.\n");
+ I18n.THRIFT.getString("ThriftActions.Message.error.authorizationException"));
}
return false;
} catch (TException e) {
if (interactive) {
ThriftError.showMessage(window, LOGGER, e,
- "Authentifizierung erfolgreich, bei der Kommunikation mit"
- + " dem Satellitenserver trat jedoch ein interner Fehler auf.");
+ I18n.THRIFT.getString("ThriftActions.Message.error.sessionInternalError"));
continue;
}
return false;
} catch (Exception e) {
if (interactive) {
- Gui.asyncMessageBox("Unbekannter Fehler beim Verbinden mit dem Satellitenserver.",
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.sessionUnknownError"),
MessageType.ERROR, LOGGER, e);
continue;
}
@@ -247,10 +244,11 @@ public class ThriftActions {
try {
uuid = ThriftManager.getSatClient().createImage(Session.getSatelliteToken(), name);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Erstellen der VM fehlgeschlagen");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.createImageFailed"));
} catch (Exception e) {
- Gui.showMessageBox(frame, "Unbekannter Fehler beim Erstellen der VM", MessageType.ERROR, LOGGER,
- e);
+ Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.error.createImageUnknownError"),
+ MessageType.ERROR, LOGGER, e);
}
return uuid;
}
@@ -350,7 +348,7 @@ public class ThriftActions {
final String virtualizerId, final int osId, final long imageSize, final DownloadCallback callback) {
// TODO: Return value? Callback?
QFileChooser fc = new QFileChooser(Config.getDownloadPath(), true);
- fc.setDialogTitle("Bitte wählen Sie einen Speicherort");
+ fc.setDialogTitle(I18n.THRIFT.getString("ThriftActions.FileChooser.fc.dialogTitle"));
int action = fc.showSaveDialog(frame);
File selected = fc.getSelectedFile();
if (action != JFileChooser.APPROVE_OPTION || selected == null) {
@@ -364,9 +362,8 @@ public class ThriftActions {
null) + ".part");
if (destDir.exists()) {
- boolean ret = Gui.showMessageBox(frame, "Verzeichnis '" + destDir.getAbsolutePath()
- + "' existiert bereits, wollen Sie die VM darin überschreiben?",
- MessageType.QUESTION_YESNO, LOGGER, null);
+ boolean ret = Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.yesNo.destDirExists",
+ destDir.getAbsolutePath()), MessageType.QUESTION_YESNO, LOGGER, null);
if (!ret) {
// user aborted
if (callback != null)
@@ -375,8 +372,8 @@ public class ThriftActions {
}
// delete it
if (!tmpDiskFile.delete() && tmpDiskFile.exists()) {
- Gui.showMessageBox(frame, "Datei konnte nicht überschrieben werden!", MessageType.ERROR,
- LOGGER, null);
+ Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.error.couldNotDeleteDiskFile"),
+ MessageType.ERROR, LOGGER, null);
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -387,10 +384,9 @@ public class ThriftActions {
// Check the free space on disk
if (destDir.getUsableSpace() < imageSize + SIZE_CHECK_EXTRA_DL) {
- Gui.showMessageBox(frame, "Nicht genügend Speicherplatz im ausgewählten Verzeichnis verfügbar.\n"
- + "Brauche: " + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false) + "\n"
- + "Habe: " + FormatHelper.bytes(destDir.getUsableSpace(), false), MessageType.ERROR,
- LOGGER, null);
+ Gui.showMessageBox(frame, I18n.THRIFT.getString("ThriftActions.Message.error.destDirHasNotEnoughFreeSpace",
+ FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false),
+ FormatHelper.bytes(destDir.getUsableSpace(), false)), MessageType.ERROR, LOGGER, null);
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -426,7 +422,8 @@ public class ThriftActions {
}
if (transInf == null) {
// both download request failed, show user feedback
- ThriftError.showMessage(frame, LOGGER, transEx, "Die Download-Anfrage ist gescheitert");
+ ThriftError.showMessage(frame, LOGGER, transEx,
+ I18n.THRIFT.getString("ThriftActions.Message.error.downloadRequestFailed"));
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -438,8 +435,7 @@ public class ThriftActions {
dlTask = new DownloadTask(fTransHost, transInf.getPlainPort(),
transInf.getToken(), tmpDiskFile, imageSize, null);
} catch (FileNotFoundException e) {
- Gui.asyncMessageBox(
- "Konnte Download nicht vorbereiten: Der gewählte Zielort ist nicht beschreibbar",
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.error.destinationNotWritable"),
MessageType.ERROR, LOGGER, e);
if (callback != null)
callback.downloadInitialized(false);
@@ -454,6 +450,37 @@ public class ThriftActions {
return;
ImageWrapper.unpack(virtualizerId, tmpDiskFile, imageName, destDir, osId,
fTransInf.getMachineDescription());
+ DiskImage diskImage = null;
+ String ext = virtualizerId;
+ try {
+ diskImage = new DiskImage(tmpDiskFile);
+ } catch (IOException | UnknownImageFormatException e) {
+ LOGGER.warn("Could not open downloaded image for analyze step", e);
+ }
+ if (diskImage != null) {
+ if (diskImage.format != null) {
+ ext = diskImage.format.extension;
+ }
+ if (diskImage.isCompressed) {
+ Gui.asyncMessageBox(
+ I18n.THRIFT.getString("ThriftActions.Message.warning.diskImageCompressed",
+ imageName, Branding.getServiceFAQWebsite()),
+ MessageType.WARNING, null, null);
+ }
+ }
+ File destImage = new File(destDir.getAbsolutePath(), VmWrapper.generateFilename(
+ imageName, ext));
+ destImage.delete();
+ if (!tmpDiskFile.renameTo(destImage)) {
+ destImage = tmpDiskFile; // Must be Windows...
+ }
+ try {
+ VmWrapper.wrapVm(destImage, imageName, fTransInf.getMachineDescription(),
+ virtualizerId, osId, diskImage);
+ } catch (MetaDataMissingException | IOException e) {
+ Gui.asyncMessageBox(I18n.THRIFT.getString("ThriftActions.Message.warning.couldNotWrapVM"),
+ MessageType.WARNING, LOGGER, e);
+ }
}
});
@@ -520,7 +547,8 @@ public class ThriftActions {
try {
details = ThriftManager.getSatClient().getImageDetails(Session.getSatelliteToken(), imageBaseId);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Lesen der Metadaten");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.getImageDetailsFailed"));
}
return details;
}
@@ -612,7 +640,8 @@ public class ThriftActions {
permissionMap = ThriftManager.getSatClient().getImagePermissions(Session.getSatelliteToken(),
imageBaseId);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Lesen der Metadaten");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.getImagePermissionsFailed"));
}
return permissionMap;
}
@@ -630,7 +659,8 @@ public class ThriftActions {
ThriftManager.getSatClient().setImageOwner(Session.getSatelliteToken(), lectureId,
newOwner.getUserId());
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.setImageOwnerFailed"));
return false;
}
return true;
@@ -690,12 +720,12 @@ public class ThriftActions {
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e,
- "Fehler beim Holen der Versionen/Veranstaltung zu folgender VM: " + imageBaseId);
+ I18n.THRIFT.getString("ThriftActions.Message.error.couldNotGetImageBase", imageBaseId));
return;
}
String questionText;
if (versionToBeDeleted != null && !versionToBeDeleted.isEmpty()) {
- questionText = "Die VM \"" + details.getImageName() + "\" hat folgende gültige Versionen:\n";
+ questionText = I18n.THRIFT.getString("ThriftActions.deleteImageBase.String.questionText.0", details.getImageName());
for (ImageVersionDetails version : versionToBeDeleted) {
questionText += version.getVersionId() + "\n";
}
@@ -704,19 +734,20 @@ public class ThriftActions {
questionText = "";
}
if (lecturesToBeDeleted != null && !lecturesToBeDeleted.isEmpty()) {
- questionText += "Folgende Veranstaltungen sind mit dieser VM verknüpft: \n";
+ questionText += I18n.THRIFT.getString("ThriftActions.deleteImageBase.String.questionText.1");
for (LectureSummary lecture : lecturesToBeDeleted) {
questionText += lecture.getLectureName() + "\n";
}
questionText += "\n";
}
- questionText += "Wollen Sie wirklich mit dem Löschen fortfahren?";
+ questionText += I18n.THRIFT.getString("ThriftActions.deleteImageBase.String.questionText.2");
if (!userConfirmed(frame, questionText))
return;
try {
ThriftManager.getSatClient().deleteImageBase(Session.getSatelliteToken(), imageBaseId);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Konnte VM-Daten nicht löschen!");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.couldNotDeleteImageBase"));
}
}
@@ -744,7 +775,8 @@ public class ThriftActions {
// fetch lectures
lectureList = ThriftManager.getSatClient().getLectureList(Session.getSatelliteToken(), 100);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Holen der Liste der Veranstaltungen");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.couldNotGetImageVersion"));
if (callback != null)
callback.isDeleted(success);
return;
@@ -757,17 +789,17 @@ public class ThriftActions {
for (LectureSummary lecture : lectureList) {
if (versionId.equals(lecture.getImageVersionId())) {
if (!matches)
- questionText = "Diese Version ist zu folgende Veranstaltungen verknüpft:\n";
+ questionText = I18n.THRIFT.getString("ThriftActions.deleteImageVersion.String.questionText.0");
matches = true;
questionText += lecture.getLectureName() + "\n";
}
}
if (matches)
- questionText += "\nWollen Sie diese Version samt Veranstaltungen löschen?\n";
+ questionText += I18n.THRIFT.getString("ThriftActions.deleteImageVersion.String.questionText.1");
}
if (!matches)
- questionText = "Wollen Sie die VM-Image-Version vom "
- + FormatHelper.shortDate(version.createTime) + " Uhr wirklich löschen?";
+ questionText = I18n.THRIFT.getString("ThriftActions.deleteImageVersion.String.questionText.2",
+ FormatHelper.shortDate(version.createTime));
if (!userConfirmed(frame, questionText))
return;
@@ -776,7 +808,8 @@ public class ThriftActions {
LOGGER.info("Deleted version '" + versionId + "'.");
success = true;
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Löschen der Version");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.couldNotDeleteImageVersion"));
if (callback != null)
callback.isDeleted(success);
return;
@@ -811,7 +844,8 @@ public class ThriftActions {
// push to sat
uuid = ThriftManager.getSatClient().createLecture(Session.getSatelliteToken(), meta);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Failed to create lecture");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.createLectureFailed"));
}
return uuid;
}
@@ -830,7 +864,8 @@ public class ThriftActions {
ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lectureId,
permissions);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Failed to write lecture permissions");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.writeLecturePermissionsFailed"));
return false;
}
return true;
@@ -895,7 +930,8 @@ public class ThriftActions {
try {
lecture = ThriftManager.getSatClient().getLectureDetails(Session.getSatelliteToken(), lectureId);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Konnte Veranstaltungdaten nicht abrufen");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.getLectureDetailsFailed"));
}
return lecture;
}
@@ -913,7 +949,8 @@ public class ThriftActions {
try {
ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(), lectureId, lectureWrite);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Updaten der Veranstaltung");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.updateLectureFailed"));
return false;
}
return true;
@@ -937,7 +974,8 @@ public class ThriftActions {
permissions = ThriftManager.getSatClient().getLecturePermissions(Session.getSatelliteToken(),
lectureId);
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Konnte Veranstaltungdaten nicht abrufen");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.getLecturePermissionsFailed"));
}
return permissions;
@@ -956,7 +994,8 @@ public class ThriftActions {
ThriftManager.getSatClient().setLectureOwner(Session.getSatelliteToken(), lectureId,
newOwner.getUserId());
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte");
+ ThriftError.showMessage(frame, LOGGER, e,
+ I18n.THRIFT.getString("ThriftActions.Message.error.setLectureOwnerFailed"));
return false;
}
return true;
@@ -986,8 +1025,9 @@ public class ThriftActions {
final DeleteLectureCallback callback) {
if (lectures == null)
return;
- String messageText = lectures.size() == 1 ? "Wollen Sie diese Veranstaltung wirklich löschen?"
- : "Wollen Sie die " + lectures.size() + " Veranstaltungen wirklich löschen?";
+ String messageText = lectures.size() == 1
+ ? I18n.THRIFT.getString("ThriftActions.deleteLecture.String.messageText.0")
+ : I18n.THRIFT.getString("ThriftActions.deleteLecture.String.messageText.1", lectures.size());
if (!userConfirmed(frame, messageText))
return;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
index 773b941f..dd69d55c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
@@ -14,25 +14,29 @@ import org.openslx.bwlp.thrift.iface.TInvocationException;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.TTransferRejectedException;
import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.gui.helper.MessageType;
public class ThriftError {
public static void showMessage(final Component parent, Logger logger, TException ex, String messageText) {
if (ex instanceof TNotFoundException) {
- messageText += "\n\nNicht gefunden";
+ messageText += I18n.THRIFT.getString("ThriftError.Message.error.notFoundException");
} else if (ex instanceof TAuthorizationException) {
String reason = getString(((TAuthorizationException) ex).getNumber());
- messageText += "\n\nZugriff verweigert: " + reason + "\n" + ex.getMessage();
+ messageText += I18n.THRIFT.getString("ThriftError.Message.error.authorizationException",
+ reason, ex.getMessage());
} else if (ex instanceof TInvocationException) {
- messageText += "\n\nDer Funktionsaufruf konnte nicht durchgeführt werden: "
- + getString(((TInvocationException) ex).getNumber()) + "\n" + ex.getMessage();
+ messageText += I18n.THRIFT.getString("ThriftError.Message.error.invocationException",
+ getString(((TInvocationException) ex).getNumber()), ex.getMessage());
} else if (ex instanceof TInvalidDateParam) {
- messageText += "\n\nEin angegebenes Datum ist ungültig:\n" + ex.getMessage();
+ messageText += I18n.THRIFT.getString("ThriftError.Message.error.invalidDateParam", ex.getMessage());
} else if (ex instanceof TTransferRejectedException) {
- messageText += "\n\nDie Transferanfrage wurde vom Server abgelehnt:\n" + ex.getMessage();
+ messageText += I18n.THRIFT.getString("ThriftError.Message.error.transferRejectedException",
+ ex.getMessage());
} else {
- messageText += "\n\nUnerwartete Ausnahme " + ex.getClass().getSimpleName() + " ist aufgetreten.";
+ messageText += I18n.THRIFT.getString("ThriftError.Message.error.unexpectedException",
+ ex.getClass().getSimpleName());
}
if (logger != null) {
logger.warn("A thrift call raised an exception", ex);
@@ -52,55 +56,55 @@ public class ThriftError {
private static String getString(InvocationError error) {
if (error == null)
- return "Interner serverseitiger Fehler";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.null");
switch (error) {
case INTERNAL_SERVER_ERROR:
- return "Interner serverseitiger Fehler";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.internalServerError");
case INVALID_DATA:
- return "Ein Parameter hat einen ungültigen Wert";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.invalidData");
case INVALID_SHARE_MODE:
- return "Ungültiger Share-Mode";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.invalidShareMode");
case MISSING_DATA:
- return "Ein Parameter fehlt (null?)";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.missingData");
case UNKNOWN_IMAGE:
- return "Unbekannte VM/Image";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.unknownImage");
case UNKNOWN_LECTURE:
- return "Unbekannte Veranstaltung";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.unknownLecture");
case UNKNOWN_USER:
- return "Unbekannter Benutzer";
+ return I18n.THRIFT.getString("ThriftError.InvocationError.unknownUser");
default:
- return "Unbekannter Fehlercode: " + error.toString();
+ return I18n.THRIFT.getString("ThriftError.InvocationError.default", error.toString());
}
}
public static String getString(AuthorizationError error) {
if (error == null)
- return "(AuthorizationError=null)";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.null");
switch (error) {
case ACCOUNT_SUSPENDED:
- return "Das Benutzerkonto ist gesperrt";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.accountSuspended");
case BANNED_NETWORK:
- return "Das Netzwerk, aus dem Sie operieren, ist gesperrt";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.bannedNetwork");
case CHALLENGE_FAILED:
- return "Challenge fehlgeschlagen";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.challengeFailed");
case GENERIC_ERROR:
- return "Generischer Fehler";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.genericError");
case INVALID_CREDENTIALS:
- return "Ungültige Zugangsdaten\nStellen Sie sicher, dass Benutzername und Passwort korrekt sind";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidCredentials");
case INVALID_KEY:
- return "Ungültiger Schlüssel";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidKey");
case INVALID_ORGANIZATION:
- return "Ungültige oder unbekannte Organisation";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidOrganization");
case INVALID_TOKEN:
- return "Ungültiges Sitzungstoken";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.invalidToken");
case NOT_AUTHENTICATED:
- return "Nicht authentifiziert";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.notAuthenticated");
case NO_PERMISSION:
- return "Keine ausreichenden Berechtigungen";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.noPermission");
case ORGANIZATION_SUSPENDED:
- return "Ihre zugehörige Organisation ist gesperrt";
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.organizationSuspended");
default:
- return "Unbekannter Fehlercode: " + error.toString();
+ return I18n.THRIFT.getString("ThriftError.AuthorizationError.default", error.toString());
}
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ConversionTaskWorker.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ConversionTaskWorker.java
new file mode 100644
index 00000000..a4e1be54
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ConversionTaskWorker.java
@@ -0,0 +1,107 @@
+package org.openslx.dozmod.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import javax.swing.SwingWorker;
+
+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.wizard.page.ImageOvfConversionPage;
+
+public class ConversionTaskWorker extends SwingWorker<Boolean, String> {
+ private final static Logger LOGGER = Logger.getLogger(ConversionTaskWorker.class);
+
+ private File srcFile;
+ private File destFile;
+ private ImageOvfConversionPage page;
+ private Process process = null;
+ private String conversionCancelledText = I18n.HELPER.getString("OVFConversion.info.aborted.text");
+ private String ovfToolPath = "ovftool";
+
+ /**
+ * Converts a given ovf and associated vmdk into an vmx and associated vmdk file
+ * via the VMware OVF Tool Ovf images created with virtualBox are not supported.
+ *
+ * @param srcFile: Ovf source file
+ * @param destFile: Desired destination file
+ * @param page: Page that creates and starts the worker
+ * @param ovfToolPath: Path to the OVF Tool on the system
+ */
+ public ConversionTaskWorker(File srcFile, File destFile, ImageOvfConversionPage page,
+ String ovfToolPath) {
+ this.srcFile = srcFile;
+ this.destFile = destFile;
+ this.page = page;
+ if (ovfToolPath != null) {
+ this.ovfToolPath = ovfToolPath;
+ }
+ }
+
+ @Override
+ protected Boolean doInBackground() throws Exception {
+ process = new ProcessBuilder(ovfToolPath, srcFile.getAbsolutePath(), destFile.getAbsolutePath())
+ .start();
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ LOGGER.info("Running OVFTool");
+ while ((line = br.readLine()) != null) {
+ LOGGER.debug(line);
+ publish(line);
+ }
+ return true;
+ }
+
+ @Override
+ protected void process(List<String> chunks) {
+ // Don't update the gui progress bar and text if cancelled as this thread my run
+ // longer and override our cancelled notifications.
+ if (isCancelled())
+ return;
+ String progressText = chunks.get(chunks.size() - 1);
+ page.updateConversionProgressbarText(progressText);
+ progressText = progressText.replaceAll("[^\\d]", "");
+ try {
+ int progressInt = Integer.parseInt(progressText);
+ if (progressInt < 100)
+ page.updateConversionProgressbar(progressInt);
+ } catch (NumberFormatException e) {
+ // We are only interested in integers for the progressbar
+ // should therefore be OK to discard the exceptions here.
+ }
+ }
+
+ @Override
+ protected void done() {
+ try {
+ get();
+ page.setPageComplete(true);
+ page.conversionSuccessful = true;
+ page.updateConversionProgressbar(100);
+ } catch (InterruptedException e) {
+ LOGGER.debug("Conversion execution interrupted", e);
+ process.destroy();
+ page.updateConversionProgressbarText(conversionCancelledText);
+ } catch (CancellationException e) {
+ LOGGER.debug("Conversion execution Cancelled", e);
+ process.destroy();
+ page.updateConversionProgressbarText(conversionCancelledText);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ Gui.showMessageBox(page, I18n.HELPER.getString("OVFConversion.error.text"), MessageType.ERROR,
+ LOGGER, e);
+ page.btnStartConversion.setEnabled(false);
+ page.btnStartConversion
+ .setText(I18n.PAGE.getString("ImageOvfConversion.StartConversionButton.text"));
+ }
+ super.done();
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java
index d03bafb0..fee5e7c2 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ResourceLoader.java
@@ -20,6 +20,7 @@ import javax.swing.ImageIcon;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
+import org.openslx.dozmod.Config;
/**
* Helper class for loading resources.
@@ -52,7 +53,12 @@ public class ResourceLoader
LOGGER.error( "Resource not found: " + path );
} else {
try {
- return new ImageIcon( url, description );
+ ImageIcon icon = new ImageIcon(url);
+ float scalingFactor = Config.getFontScaling() / (float)100;
+ return new ImageIcon(
+ icon.getImage().getScaledInstance(Math.round(icon.getIconWidth() * scalingFactor),
+ Math.round(icon.getIconHeight() * scalingFactor), java.awt.Image.SCALE_SMOOTH),
+ description);
} catch ( Exception e ) {
LOGGER.error( "Resource not loadable: " + path );
}