diff --git a/serverpackcreator-gui/src/main/i18n/Gui_en_GB.properties b/serverpackcreator-gui/src/main/i18n/Gui_en_GB.properties index 9604c8c2b..dbc7702ba 100644 --- a/serverpackcreator-gui/src/main/i18n/Gui_en_GB.properties +++ b/serverpackcreator-gui/src/main/i18n/Gui_en_GB.properties @@ -293,6 +293,64 @@ settings.check.java=Java executable/binary either does not exist, is not readabl settings.check.serverpacks=Server packs directory either does not exist or is not writable. settings.check.whitespace=Must not end with ','! settings.check.fallbackurl=Invalid URL format! +settings.webservice=Webservice +settings.webservice.artemisdata.tooltip=Data directory for Artemis Queue System. The Artemis Queue System handles generation request and processes generation-requests one by one. +settings.webservice.artemisdata.label=Artemis Data Directory +settings.webservice.artemisdata.chooser=Artemis Data Directory Chooser +settings.webservice.artemisusage.tooltip=Max disk usage by Artemis, in absolute percentages. A setting of 10 would use up to 10% of the available disk space before storing new data. +settings.webservice.artemisusage.label=Artemis Max Disk Usage +settings.webservice.database.tooltip=Webservice database which stores all important information about server packs available for download, among other things. +settings.webservice.database.label=Database File +settings.webservice.database.chooser=Webservice Database Directory Chooser +settings.webservice.schedule.cleanup.tooltip=CRON schedule according to which filesystem cleanups are performed. +settings.webservice.schedule.cleanup.label=Cleanup Schedule +settings.webservice.tomcat.logs.tooltip=Directory which contains the Tomcat Access logs. +settings.webservice.tomcat.logs.label=Tomcat Access Log Directory +settings.webservice.tomcat.logs.chooser=Tomcat Log Directory Chooser +settings.webservice.tomcat.dir.tooltip=Tomcat base-directory holding all Tomcat-related files. +settings.webservice.tomcat.dir.label=Tomcat Base Directory +settings.webservice.tomcat.dir.chooser=Tomcat Base Directory Chooser +settings.webservice.schedule.versions.tooltip=CRON schedule according to which version updates are performed. +settings.webservice.schedule.versions.label=Version Schedule +settings.webservice.schedule.database.tooltip=CRON schedule according to which database cleanup-operations are performed. +settings.webservice.schedule.database.label=Database Cleanup Schedule +settings.webservice.artemisdata.error=Artemis Data directory either does not exist or is not writable. +settings.webservice.artemisusage.error=Artemis max disk usage must be a value from 10 to 90. +settings.webservice.database.error=Database directory does not exist or is not writable. +settings.webservice.schedule.cleanup.error=Invalid Cleanup Schedule CRON expression. +settings.webservice.tomcat.logs.error=Tomcat Log directory does not exist or is not writable. +settings.webservice.tomcat.dir.error=Tomcat base-directory does not exist or is not writable. +settings.webservice.schedule.versions.error=Invalid Version Update Schedule CRON expression. +settings.webservice.schedule.database.error=Invalid Database Cleanup Schedule CRON expression. +settings.webservice.errors=Your Webservice settings contain errors! +settings.gui=Gui +settings.gui.font.tooltip=Font size used in ServerPackCreators GUI +settings.gui.font.label=Font Size +settings.gui.focus.start.tooltip=Whether ServerPackCreator should be focused after starting. +settings.gui.focus.start.label=Focus On Start +settings.gui.focus.generation.tooltip=Whether ServerPackCreator should be focused after a server pack has been generated. +settings.gui.focus.generation.label=Focus After Generation +settings.gui.font.error=Font size must be a value from 8 to 76. +settings.gui.errors=Your GUI settings contain errors! +settings.handle.load.tooltip=Load settings from disk +settings.handle.load.label=Load Configuration +settings.handle.save.tooltip=Save settings to disk +settings.handle.save.label=Save Configuration +settings.handle.idle=Not saved or loaded yet... +settings.handle.home.changed.message=Home directory changed. Restart ServerPackCreator for this setting to take effect. +settings.handle.home.changed.title=Home directory changed! +settings.handle.home.canceled.message=Home directory setting not saved. +settings.handle.home.canceled.title=Canceled +settings.handle.home.admin.message=Storing of the new home-directory setting requires root/admin-privileges. Continue? +settings.handle.home.admin.title=Root/Admin privileges required +settings.handle.saved=Settings last saved {0} ... +settings.handle.loaded=Settings last loaded {0} ... +settings.handle.chooser=Properties Chooser +main.unsaved.message=You have unsaved settings. Would you like to save them before closing? +main.unsaved.title=Unsaved Settings! +main.tabs.config=Configs +main.tabs.logs=Logs +main.tabs.settings=Settings # LOGS ## Error logs configuration.title.error=This configuration has errors! diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/MainPanel.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/MainPanel.kt index 12311e993..4e302a5bb 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/MainPanel.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/MainPanel.kt @@ -64,10 +64,10 @@ class MainPanel( val controlPanel = ControlPanel(guiProps, tabbedConfigsTab, larsonScanner, apiWrapper, mainFrame) init { - tabs.addTab("Configs", tabbedConfigsTab.panel) + tabs.addTab(Gui.main_tabs_config.toString(), tabbedConfigsTab.panel) tabs.setTabComponentAt(tabs.tabCount - 1, tabbedConfigsTab.title) - tabs.addTab("Logs", tabbedLogsTab.panel) - tabs.addTab("Settings (WIP, not fully implemented)", settingsEditorsTab.panel) + tabs.addTab(Gui.main_tabs_logs.toString(), tabbedLogsTab.panel) + tabs.addTab(Gui.main_tabs_settings.toString(), settingsEditorsTab.panel) tabs.setTabComponentAt(tabs.tabCount - 1, settingsEditorsTab.title) panel.add(larsonScanner, "height 40!,growx, south") panel.add(controlPanel.panel, "height 160!,growx, south") @@ -107,8 +107,8 @@ class MainPanel( apiWrapper.apiProperties.saveProperties(apiWrapper.apiProperties.serverPackCreatorPropertiesFile) if (settingsEditorsTab.allTabs.any { (it as Editor).hasUnsavedChanges() }) { if (DialogUtilities.createShowGet( - "You have unsaved settings. Would you like to save them before closing?", - "Unsaved Settings!", + Gui.main_unsaved_message.toString(), + Gui.main_unsaved_title.toString(), panel, JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION, diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt index 94c04dc6d..9c255e0f7 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/GuiSettings.kt @@ -29,35 +29,35 @@ class GuiSettings( private val guiProps: GuiProps, actionListener: ActionListener, changeListener: ChangeListener -) : Editor("Gui", guiProps) { +) : Editor(Gui.settings_gui.toString(), guiProps) { - val fontSizeIcon = StatusIcon(guiProps,"Size of fonts in ServerPackCreators GUI.") - val fontSizeLabel = ElementLabel("Font Size") + val fontSizeIcon = StatusIcon(guiProps,Gui.settings_gui_font_tooltip.toString()) + val fontSizeLabel = ElementLabel(Gui.settings_gui_font_label.toString()) val fontSizeSetting = ActionSlider(8,76,guiProps.fontSize,changeListener) - val fontSizeRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes", guiProps) { + val fontSizeRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(), guiProps) { fontSizeSetting.value = guiProps.fontSize } - val fontSizeReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { + val fontSizeReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { fontSizeSetting.value = 12 } - val startFocusIcon = StatusIcon(guiProps,"Whether ServerPackCreator should be focused after starting.") - val startFocusLabel = ElementLabel("Focus On Start") + val startFocusIcon = StatusIcon(guiProps,Gui.settings_gui_focus_start_tooltip.toString()) + val startFocusLabel = ElementLabel(Gui.settings_gui_focus_start_label.toString()) val startFocusSetting = ActionCheckBox(actionListener) - val startFocusRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes",guiProps) { + val startFocusRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { startFocusSetting.isSelected = guiProps.startFocusEnabled } - val startFocusReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { + val startFocusReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { startFocusSetting.isSelected = false } - val generationFocusIcon = StatusIcon(guiProps,"Whether ServerPackCreator should be focused after a server pack has been generated.") - val generationFocusLabel = ElementLabel("Focus After Generation") + val generationFocusIcon = StatusIcon(guiProps,Gui.settings_gui_focus_generation_tooltip.toString()) + val generationFocusLabel = ElementLabel(Gui.settings_gui_focus_generation_label.toString()) val generationFocusSetting = ActionCheckBox(actionListener) - val generationFocusRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes",guiProps) { + val generationFocusRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { generationFocusSetting.isSelected = guiProps.generationFocusEnabled } - val generationFocusReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { + val generationFocusReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { generationFocusSetting.isSelected = false } @@ -105,13 +105,13 @@ class GuiSettings( override fun validateSettings(): List { val errors = mutableListOf() if (fontSizeSetting.value < 8 || fontSizeSetting.value > 76) { - fontSizeIcon.error("Font size must be a value from 8 to 76.") - errors.add("Font size must be a value from 8 to 76.") + fontSizeIcon.error(Gui.settings_gui_font_error.toString()) + errors.add(Gui.settings_gui_font_error.toString()) } else { fontSizeIcon.info() } if (errors.isNotEmpty()) { - title.setAndShowErrorIcon("Your GUI settings contain errors!") + title.setAndShowErrorIcon(Gui.settings_gui_errors.toString()) } else { title.hideErrorIcon() } diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsHandling.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsHandling.kt index 150133411..8008f0750 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsHandling.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/SettingsHandling.kt @@ -42,10 +42,10 @@ class SettingsHandling( ) { val panel = JPanel() private val load = - BalloonTipButton("Load Configuration", guiProps.loadIcon, "Load settings from disk", guiProps) { load() } + BalloonTipButton(Gui.settings_handle_load_label.toString(), guiProps.loadIcon, Gui.settings_handle_load_tooltip.toString(), guiProps) { load() } private val save = - BalloonTipButton("Save Configuration", guiProps.saveIcon, "Save your settings", guiProps) { save() } - private val lastActionLabel = JLabel("Not saved or loaded yet...") + BalloonTipButton(Gui.settings_handle_save_label.toString(), guiProps.saveIcon, Gui.settings_handle_save_tooltip.toString(), guiProps) { save() } + private val lastActionLabel = JLabel(Gui.settings_handle_idle.toString()) private val rootExecutor = RootExecutor() var lastAction: String @@ -75,8 +75,8 @@ class SettingsHandling( private fun showHomeDirDialog() { JOptionPane.showMessageDialog( mainFrame.frame, - "Home directory changed. Restart ServerPackCreator for this setting to take effect.", - "Home directory changed!", + Gui.settings_handle_home_changed_message.toString(), + Gui.settings_handle_home_changed_title.toString(), JOptionPane.WARNING_MESSAGE ) } @@ -84,8 +84,8 @@ class SettingsHandling( private fun showCancelDialog() { JOptionPane.showMessageDialog( mainFrame.frame, - "Home directory setting not saved.", - "Canceled", + Gui.settings_handle_home_canceled_message.toString(), + Gui.settings_handle_home_canceled_title.toString(), JOptionPane.WARNING_MESSAGE ) } @@ -93,8 +93,8 @@ class SettingsHandling( private fun rootWarning(): Int { return JOptionPane.showConfirmDialog( mainFrame.frame, - "Storing of the new home-directory setting requires root/admin-privileges. Continue?", - "Root/Admin privileges required", + Gui.settings_handle_home_admin_message.toString(), + Gui.settings_handle_home_admin_title.toString(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE ) @@ -124,17 +124,17 @@ class SettingsHandling( if (previousHome != settingsEditorsTab.global.homeSetting.file.absolutePath && saved) { showHomeDirDialog() } - lastAction = "Settings last saved ${currentTime()} ..." + lastAction = Gui.settings_handle_saved(currentTime()) } fun load() { - val propertiesChooser = PropertiesChooser(apiProperties, "Properties Chooser") + val propertiesChooser = PropertiesChooser(apiProperties, Gui.settings_handle_chooser.toString()) if (propertiesChooser.showOpenDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { apiProperties.loadProperties(propertiesChooser.selectedFile) settingsEditorsTab.global.loadSettings() settingsEditorsTab.gui.loadSettings() settingsEditorsTab.webservice.loadSettings() - lastAction = "Settings last loaded ${currentTime()} ..." + lastAction = Gui.settings_handle_loaded(currentTime()) } } } \ No newline at end of file diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt index e067b58e9..a948e5d08 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/WebserviceSettings.kt @@ -37,82 +37,82 @@ class WebserviceSettings( mainFrame: MainFrame, documentChangeListener: DocumentChangeListener, changeListener: ChangeListener -) : Editor("Webservice", guiProps) { +) : Editor(Gui.settings_webservice.toString(), guiProps) { private val cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.SPRING) private val cronParser = CronParser(cronDefinition) - val artemisDataDirectoryIcon = StatusIcon(guiProps, "Data directory for Artemis Queue System") - val artemisDataDirectoryLabel = ElementLabel("Artemis Data Directory") + val artemisDataDirectoryIcon = StatusIcon(guiProps, Gui.settings_webservice_artemisdata_tooltip.toString()) + val artemisDataDirectoryLabel = ElementLabel(Gui.settings_webservice_artemisdata_label.toString()) val artemisDataDirectorySetting = ScrollTextFileField(guiProps,apiProperties.artemisDataDirectory.absoluteFile, documentChangeListener) - val artemisDataDirectoryRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { artemisDataDirectorySetting.file = apiProperties.artemisDataDirectory.absoluteFile } - val artemisDataDirectoryReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { artemisDataDirectorySetting.file = apiProperties.defaultArtemisDataDirectory().absoluteFile } - val artemisDataDirectoryChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { - val artemisChooser = ArtemisDataDirChooser(apiProperties,"Artemis Data Directory Chooser") + val artemisDataDirectoryRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { artemisDataDirectorySetting.file = apiProperties.artemisDataDirectory.absoluteFile } + val artemisDataDirectoryReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { artemisDataDirectorySetting.file = apiProperties.defaultArtemisDataDirectory().absoluteFile } + val artemisDataDirectoryChoose = BalloonTipButton(null,guiProps.folderIcon,Gui.settings_select_directory.toString(),guiProps) { + val artemisChooser = ArtemisDataDirChooser(apiProperties,Gui.settings_webservice_artemisdata_chooser.toString()) if (artemisChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { artemisDataDirectorySetting.file = artemisChooser.selectedFile.absoluteFile } } - val artemisQueueMaxDiskUsageIcon = StatusIcon(guiProps,"Max disk usage by Artemis, in absolute percentages.") - val artemisQueueMaxDiskUsageLabel = ElementLabel("Artemis Max Disk Usage") + val artemisQueueMaxDiskUsageIcon = StatusIcon(guiProps,Gui.settings_webservice_artemisusage_tooltip.toString()) + val artemisQueueMaxDiskUsageLabel = ElementLabel(Gui.settings_webservice_artemisusage_label.toString()) val artemisQueueMaxDiskUsageSetting = ActionSlider(10,90,apiProperties.artemisQueueMaxDiskUsage, changeListener) - val artemisQueueMaxDiskUsageRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { artemisQueueMaxDiskUsageSetting.value = apiProperties.artemisQueueMaxDiskUsage } - val artemisQueueMaxDiskUsageReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value", guiProps) { artemisQueueMaxDiskUsageSetting.value = apiProperties.fallbackArtemisQueueMaxDiskUsage } + val artemisQueueMaxDiskUsageRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { artemisQueueMaxDiskUsageSetting.value = apiProperties.artemisQueueMaxDiskUsage } + val artemisQueueMaxDiskUsageReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(), guiProps) { artemisQueueMaxDiskUsageSetting.value = apiProperties.fallbackArtemisQueueMaxDiskUsage } - val databaseFileIcon = StatusIcon(guiProps,"Webservice database file") - val databaseFileLabel = ElementLabel("Database File") + val databaseFileIcon = StatusIcon(guiProps,Gui.settings_webservice_database_tooltip.toString()) + val databaseFileLabel = ElementLabel(Gui.settings_webservice_database_label.toString()) val databaseFileSetting = ScrollTextFileField(guiProps,apiProperties.serverPackCreatorDatabase.absoluteFile, documentChangeListener) - val databaseFileRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { databaseFileSetting.file = apiProperties.serverPackCreatorDatabase.absoluteFile } - val databaseFileReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { databaseFileSetting.file = apiProperties.defaultWebserviceDatabase().absoluteFile } - val databaseFileChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { - val webserviceChooser = WebserviceDBDirChooser(apiProperties,"Webservice Database Directory Chooser") + val databaseFileRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { databaseFileSetting.file = apiProperties.serverPackCreatorDatabase.absoluteFile } + val databaseFileReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { databaseFileSetting.file = apiProperties.defaultWebserviceDatabase().absoluteFile } + val databaseFileChoose = BalloonTipButton(null,guiProps.folderIcon,Gui.settings_select_directory.toString(),guiProps) { + val webserviceChooser = WebserviceDBDirChooser(apiProperties,Gui.settings_webservice_database_chooser.toString()) if (webserviceChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { databaseFileSetting.file = File(webserviceChooser.selectedFile.absoluteFile,"serverpackcreator.db").absoluteFile } } - val cleanupScheduleIcon = StatusIcon(guiProps,"Schedule by which the webservice will perform cleanup operations") - val cleanupScheduleLabel = ElementLabel("Cleanup Schedule") - val cleanupScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceCleanupSchedule, "Cleanup Schedule", apiProperties, documentChangeListener) - val cleanupRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { cleanupScheduleSetting.text = apiProperties.webserviceCleanupSchedule } - val cleanupReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { cleanupScheduleSetting.text = apiProperties.fallbackCleanupSchedule } + val cleanupScheduleIcon = StatusIcon(guiProps,Gui.settings_webservice_schedule_cleanup_tooltip.toString()) + val cleanupScheduleLabel = ElementLabel(Gui.settings_webservice_schedule_cleanup_label.toString()) + val cleanupScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceCleanupSchedule, Gui.settings_webservice_schedule_cleanup_label.toString(), apiProperties, documentChangeListener) + val cleanupRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { cleanupScheduleSetting.text = apiProperties.webserviceCleanupSchedule } + val cleanupReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { cleanupScheduleSetting.text = apiProperties.fallbackCleanupSchedule } - val logDirectoryIcon = StatusIcon(guiProps,"Directory which contains the Tomcat Access logs") - val logDirectoryLabel = ElementLabel("Tomcat Access Log Directory") + val logDirectoryIcon = StatusIcon(guiProps,Gui.settings_webservice_tomcat_logs_tooltip.toString()) + val logDirectoryLabel = ElementLabel(Gui.settings_webservice_tomcat_logs_label.toString()) val logDirectorySetting = ScrollTextFileField(guiProps,apiProperties.tomcatLogsDirectory.absoluteFile, documentChangeListener) - val logDirectoryRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { logDirectorySetting.file = apiProperties.tomcatLogsDirectory.absoluteFile } - val logDirectoryReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { logDirectorySetting.file = apiProperties.defaultTomcatLogsDirectory().absoluteFile } - val logDirectoryChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { - val logDirectoryChooser = TomcatLogDirChooser(apiProperties,"Tomcat Log Directory Chooser") + val logDirectoryRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { logDirectorySetting.file = apiProperties.tomcatLogsDirectory.absoluteFile } + val logDirectoryReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { logDirectorySetting.file = apiProperties.defaultTomcatLogsDirectory().absoluteFile } + val logDirectoryChoose = BalloonTipButton(null,guiProps.folderIcon,Gui.settings_select_directory.toString(),guiProps) { + val logDirectoryChooser = TomcatLogDirChooser(apiProperties,Gui.settings_webservice_tomcat_logs_chooser.toString()) if (logDirectoryChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { logDirectorySetting.file = logDirectoryChooser.selectedFile.absoluteFile } } - val baseDirIcon = StatusIcon(guiProps,"Base directory for Tomcat") - val baseDirLabel = ElementLabel("Tomcat Base Directory") + val baseDirIcon = StatusIcon(guiProps,Gui.settings_webservice_tomcat_dir_tooltip.toString()) + val baseDirLabel = ElementLabel(Gui.settings_webservice_tomcat_dir_label.toString()) val baseDirSetting = ScrollTextFileField(guiProps,apiProperties.tomcatBaseDirectory.absoluteFile, documentChangeListener) - val baseDirRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { baseDirSetting.file = apiProperties.tomcatBaseDirectory.absoluteFile } - val baseDirReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { baseDirSetting.file = apiProperties.defaultTomcatBaseDirectory().absoluteFile } - val baseDirChoose = BalloonTipButton(null,guiProps.folderIcon,"Select directory",guiProps) { - val baseDirChooser = TomcatBaseDirChooser(apiProperties,"Tomcat Base Directory Chooser") + val baseDirRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { baseDirSetting.file = apiProperties.tomcatBaseDirectory.absoluteFile } + val baseDirReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { baseDirSetting.file = apiProperties.defaultTomcatBaseDirectory().absoluteFile } + val baseDirChoose = BalloonTipButton(null,guiProps.folderIcon,Gui.settings_select_directory.toString(),guiProps) { + val baseDirChooser = TomcatBaseDirChooser(apiProperties,Gui.settings_webservice_tomcat_dir_chooser.toString()) if (baseDirChooser.showSaveDialog(mainFrame.frame) == JFileChooser.APPROVE_OPTION) { baseDirSetting.file = baseDirChooser.selectedFile.absoluteFile } } - val versionScheduleIcon = StatusIcon(guiProps,"Schedule by which the webservice will perform version meta updates") - val versionScheduleLabel = ElementLabel("Version Schedule") - val versionScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceVersionSchedule, "Version Schedule", apiProperties, documentChangeListener) - val versionRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { versionScheduleSetting.text = apiProperties.webserviceVersionSchedule } - val versionReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { versionScheduleSetting.text = apiProperties.fallbackVersionSchedule } + val versionScheduleIcon = StatusIcon(guiProps,Gui.settings_webservice_schedule_versions_tooltip.toString()) + val versionScheduleLabel = ElementLabel(Gui.settings_webservice_schedule_versions_label.toString()) + val versionScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceVersionSchedule, Gui.settings_webservice_schedule_versions_label.toString(), apiProperties, documentChangeListener) + val versionRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { versionScheduleSetting.text = apiProperties.webserviceVersionSchedule } + val versionReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { versionScheduleSetting.text = apiProperties.fallbackVersionSchedule } - val databaseCleanupScheduleIcon = StatusIcon(guiProps,"Schedule by which the webservice will perform database cleanup operations") - val databaseCleanupScheduleLabel = ElementLabel("Database Cleanup Schedule") - val databaseCleanupScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceDatabaseCleanupSchedule, "Database Schedule", apiProperties, documentChangeListener) - val databaseCleanupRevert = BalloonTipButton(null,guiProps.revertIcon,"Revert changes.",guiProps) { databaseCleanupScheduleSetting.text = apiProperties.webserviceDatabaseCleanupSchedule } - val databaseCleanupReset = BalloonTipButton(null,guiProps.resetIcon,"Reset to default value",guiProps) { databaseCleanupScheduleSetting.text = apiProperties.fallbackDatabaseCleanupSchedule } + val databaseCleanupScheduleIcon = StatusIcon(guiProps,Gui.settings_webservice_schedule_database_tooltip.toString()) + val databaseCleanupScheduleLabel = ElementLabel(Gui.settings_webservice_schedule_database_label.toString()) + val databaseCleanupScheduleSetting = ScrollTextField(guiProps,apiProperties.webserviceDatabaseCleanupSchedule, Gui.settings_webservice_schedule_database_label.toString(), apiProperties, documentChangeListener) + val databaseCleanupRevert = BalloonTipButton(null,guiProps.revertIcon,Gui.settings_revert.toString(),guiProps) { databaseCleanupScheduleSetting.text = apiProperties.webserviceDatabaseCleanupSchedule } + val databaseCleanupReset = BalloonTipButton(null,guiProps.resetIcon,Gui.settings_reset.toString(),guiProps) { databaseCleanupScheduleSetting.text = apiProperties.fallbackDatabaseCleanupSchedule } init { loadSettings() @@ -207,22 +207,22 @@ class WebserviceSettings( override fun validateSettings(): List { val errors = mutableListOf() if (!artemisDataDirectorySetting.file.absoluteFile.isDirectory || !artemisDataDirectorySetting.file.absoluteFile.canWrite()) { - artemisDataDirectoryIcon.error("Artemis Data directory either does not exist or is not writable.") - errors.add("Artemis Data directory either does not exist or is not writable.") + artemisDataDirectoryIcon.error(Gui.settings_webservice_artemisdata_error.toString()) + errors.add(Gui.settings_webservice_artemisdata_error.toString()) } else { artemisDataDirectoryIcon.info() } if (artemisQueueMaxDiskUsageSetting.value < 10 || artemisQueueMaxDiskUsageSetting.value > 90 ) { - artemisQueueMaxDiskUsageIcon.error("Artemis max disk usage must be a value from 10 to 90.") - errors.add("Artemis max disk usage must be a value from 10 to 90.") + artemisQueueMaxDiskUsageIcon.error(Gui.settings_webservice_artemisusage_error.toString()) + errors.add(Gui.settings_webservice_artemisusage_error.toString()) } else { artemisQueueMaxDiskUsageIcon.info() } if (!databaseFileSetting.file.absoluteFile.parentFile.isDirectory || !databaseFileSetting.file.absoluteFile.parentFile.canWrite()) { - databaseFileIcon.error("Database directory does not exist or is not writable.") - errors.add("Database directory does not exist or is not writable.") + databaseFileIcon.error(Gui.settings_webservice_database_error.toString()) + errors.add(Gui.settings_webservice_database_error.toString()) } else { databaseFileIcon.info() } @@ -231,20 +231,20 @@ class WebserviceSettings( cronParser.parse(cleanupScheduleSetting.text).validate() cleanupScheduleIcon.info() } catch (ex: IllegalArgumentException) { - cleanupScheduleIcon.error("Invalid Cleanup Schedule QUARTZ CRON expression.") - errors.add("Invalid Cleanup Schedule QUARTZ CRON expression.") + cleanupScheduleIcon.error(Gui.settings_webservice_schedule_cleanup_error.toString()) + errors.add(Gui.settings_webservice_schedule_cleanup_error.toString()) } if (!logDirectorySetting.file.absoluteFile.isDirectory || !logDirectorySetting.file.absoluteFile.canWrite()) { - logDirectoryIcon.error("Tomcat Log directory does not exist or is not writable.") - errors.add("Tomcat Log directory does not exist or is not writable.") + logDirectoryIcon.error(Gui.settings_webservice_tomcat_logs_error.toString()) + errors.add(Gui.settings_webservice_tomcat_logs_error.toString()) } else { logDirectoryIcon.info() } if (!baseDirSetting.file.absoluteFile.isDirectory || !baseDirSetting.file.absoluteFile.canWrite()) { - baseDirIcon.error("Tomcat base-directory does not exist or is not writable.") - errors.add("Tomcat base-directory does not exist or is not writable.") + baseDirIcon.error(Gui.settings_webservice_tomcat_dir_error.toString()) + errors.add(Gui.settings_webservice_tomcat_dir_error.toString()) } else { baseDirIcon.info() } @@ -253,20 +253,20 @@ class WebserviceSettings( cronParser.parse(versionScheduleSetting.text).validate() versionScheduleIcon.info() } catch (ex: IllegalArgumentException) { - versionScheduleIcon.error("Invalid Version Update Schedule QUARTZ CRON expression.") - errors.add("Invalid Version Update Schedule QUARTZ CRON expression.") + versionScheduleIcon.error(Gui.settings_webservice_schedule_versions_error.toString()) + errors.add(Gui.settings_webservice_schedule_versions_error.toString()) } try { cronParser.parse(databaseCleanupScheduleSetting.text).validate() databaseCleanupScheduleIcon.info() } catch (ex: IllegalArgumentException) { - databaseCleanupScheduleIcon.error("Invalid Database Cleanup Schedule QUARTZ CRON expression.") - errors.add("Invalid Database Cleanup Schedule QUARTZ CRON expression.") + databaseCleanupScheduleIcon.error(Gui.settings_webservice_schedule_database_error.toString()) + errors.add(Gui.settings_webservice_schedule_database_error.toString()) } if (errors.isNotEmpty()) { - title.setAndShowErrorIcon("Your Webservice settings contain errors!") + title.setAndShowErrorIcon(Gui.settings_webservice_errors.toString()) } else { title.hideErrorIcon() } diff --git a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/SettingsTitle.kt b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/SettingsTitle.kt index aa8beb968..c483c4e51 100644 --- a/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/SettingsTitle.kt +++ b/serverpackcreator-gui/src/main/kotlin/de/griefed/serverpackcreator/gui/window/settings/components/SettingsTitle.kt @@ -1,3 +1,22 @@ +/* Copyright (C) 2023 Griefed + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * The full license can be found at https:github.com/Griefed/ServerPackCreator/blob/main/LICENSE + */ package de.griefed.serverpackcreator.gui.window.settings.components import de.griefed.serverpackcreator.gui.GuiProps