/** The “cancel” action. */
private I18nAction cancelAction;
+ /** The “advanced mode” action. */
+ private I18nAction advancedModeAction;
+
+ /** The “advanced mode” checkbox. */
+ private JCheckBox advancedModeCheckBox;
+
/** The “beautify GUI” action. */
private I18nAction antialiasAction;
}
/**
+ * Returns whether the advanced mode is selected.
+ *
+ * @return <code>true</code> if the advanced mode is selected,
+ * <code>false</code> otherwise
+ */
+ public boolean isAdvancedMode() {
+ return advancedModeCheckBox.isSelected();
+ }
+
+ /**
+ * Sets whether the advanced mode is selected.
+ *
+ * @param advancedMode
+ * <code>true</code> if the advanced mode is selected,
+ * <code>false</code> otherwise
+ */
+ public void setAdvancedMode(boolean advancedMode) {
+ advancedModeCheckBox.setSelected(advancedMode);
+ }
+
+ /**
* Returns whether the “beautify” checkbox has been selected. The result of
* this method should not be used if {@link #wasCancelled()} returned
* <code>true</code>!
actionCancel();
}
};
+ advancedModeAction = new I18nAction("configurationDialog.page.interface.item.advancedMode") {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void actionPerformed(ActionEvent e) {
+ /* do nothing. */
+ }
+ };
antialiasAction = new I18nAction("configurationDialog.page.interfaceTweaks.item.antialias") {
/**
*/
private JComponent createInterfaceConfig() {
JPanel interfaceConfigPanel = new JPanel(new GridBagLayout());
+ interfaceConfigPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
+
+ advancedModeCheckBox = new JCheckBox(advancedModeAction);
+ interfaceConfigPanel.add(advancedModeCheckBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+
+ interfaceConfigPanel.add(new JPanel(), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
return interfaceConfigPanel;
}
//
/**
+ * Expose the edit node dialog for the simple mode.
+ *
+ * @return The edit node dialog
+ */
+ EditNodeDialog getEditNodeDialog() {
+ return editNodeDialog;
+ }
+
+ /**
* Returns the list of nodes.
*
* @return The list of nodes
* Adds a new node via {@link #editNodeDialog}.
*/
private void addNode() {
- editNodeDialog.setNodeName("New Node");
+ editNodeDialog.setNodeName(I18n.get("general.newNode.name"));
editNodeDialog.setNodeHostname("localhost");
editNodeDialog.setNodePort(9481);
editNodeDialog.setVisible(true);
// CONFIGURATION
//
+ /** The advanced mode. */
+ private boolean advancedMode;
+
/** Whether to antialias the GUI. */
private boolean antialias;
} finally {
Closer.close(configInputStream);
}
+ if (configProperties.containsKey("advancedMode")) {
+ advancedMode = Boolean.valueOf(configProperties.getProperty("advancedMode"));
+ }
if (configProperties.containsKey("antialias")) {
antialias = Boolean.valueOf(configProperties.getProperty("antialias"));
}
}
File configFile = new File(configDirectory, "swing-interface.properties");
Properties configProperties = new Properties();
+ configProperties.setProperty("advancedMode", String.valueOf(advancedMode));
configProperties.setProperty("antialias", String.valueOf(antialias));
if (controlFont != null) {
configProperties.setProperty("controlFont", controlFont);
* Shows the configuration dialog.
*/
private void configure() {
+ configurationDialog.setAdvancedMode(advancedMode);
configurationDialog.setAntialias(antialias);
configurationDialog.setControlFont(controlFont);
configurationDialog.setUserFont(userFont);
configurationDialog.setVisible(true);
if (!configurationDialog.wasCancelled()) {
+ advancedMode = configurationDialog.isAdvancedMode();
+ if (!advancedMode && (nodeList.size() > 1)) {
+ JOptionPane.showMessageDialog(mainWindow, I18n.get("mainWindow.warning.multipleNodesNotAdvancedMode.message"), I18n.get("mainWindow.warning.multipleNodesNotAdvancedMode.title"), JOptionPane.WARNING_MESSAGE);
+ }
antialias = configurationDialog.isAntialias();
controlFont = configurationDialog.getControlFont();
userFont = configurationDialog.getUserFont();
* Pops up the “manage nodes” dialog.
*/
private void manageNodes() {
- manageNodesDialog.setNodeList(nodeList);
- manageNodesDialog.setVisible(true);
- nodeList = manageNodesDialog.getNodeList();
+ if (advancedMode) {
+ manageNodesDialog.setNodeList(nodeList);
+ manageNodesDialog.setVisible(true);
+ nodeList = manageNodesDialog.getNodeList();
+ } else {
+ if (nodeList.isEmpty()) {
+ Node newNode = new Node();
+ newNode.setName(I18n.get("general.defaultNode.name"));
+ newNode.setHostname("localhost");
+ newNode.setPort(9481);
+ nodeList.add(newNode);
+ }
+ Node firstNode = nodeList.get(0);
+ EditNodeDialog editNodeDialog = manageNodesDialog.getEditNodeDialog();
+ editNodeDialog.setNodeName(firstNode.getName());
+ editNodeDialog.setNodeHostname(firstNode.getHostname());
+ editNodeDialog.setNodePort(firstNode.getPort());
+ editNodeDialog.setVisible(true);
+ if (!editNodeDialog.wasCancelled()) {
+ firstNode.setName(editNodeDialog.getNodeName());
+ firstNode.setHostname(editNodeDialog.getNodeHostname());
+ firstNode.setPort(editNodeDialog.getNodePort());
+ /* TODO - give to core. */
+ }
+ }
}
/**
general.language.de.shortDescription: Switch language to German
general.language.de.longDescription: Switch language to German
+general.defaultNode.name: Default Node
+general.newNode.name: New Node
+
# main window
mainWindow.toolbar.name: jSite Toolbar
+mainWindow.warning.multipleNodesNotAdvancedMode.title: Multiple Nodes in Simple Mode
+mainWindow.warning.multipleNodesNotAdvancedMode.message: <html>You have enabled the simple mode but have more than one node configured.<br>Select advanced mode to configure all of your nodes.</html>
+
mainWindow.error.projectLoadingFailed.title: Loading Projects Failed
mainWindow.error.projectLoadingFailed.message: Loading the projects from \u201c{0}\u201d has failed.
configurationDialog.page.interface.name: Interface
+configurationDialog.page.interface.item.advancedMode.name: Advanced mode
+configurationDialog.page.interface.item.advancedMode.mnemonic: VK_A
+configurationDialog.page.interface.item.advancedMode.accelerator: Alt-VK_A
+configurationDialog.page.interface.item.advancedMode.shortDescription: Activates advanced mode
+configurationDialog.page.interface.item.advancedMode.longDescription: Activates advanced mode which allows multiple nodes to be configured
+
configurationDialog.page.interfaceTweaks.name: Interface Tweaks
configurationDialog.page.interfaceTweaks.item.restartRequired.name: All items on this page require a restart to take effect!
general.language.de.shortDescription: Sprache auf deutsch umschalten
general.language.de.longDescription: Sprache auf deutsch umschalten
+general.defaultNode.name: Standardnode
+general.newNode.name: Neuer Node
+
# main window
mainWindow.toolbar.name: jSite Toolbar
+mainWindow.warning.multipleNodesNotAdvancedMode.title: Mehrere Nodes im einfachen Modus
+mainWindow.warning.multipleNodesNotAdvancedMode.message: <html>Der einfache Modus wurde aktiviert, obwohl mehr als ein Node konfiguriert sind.<br>Bitte den erweitern Modus ausw\u00e4hlen, um alle Nodes zu konfigurieren.</html>
+
mainWindow.error.projectLoadingFailed.title: Laden der Projekte fehlgeschlagen
mainWindow.error.projectLoadingFailed.message: Die Projekte aus \u201e{0}\u201c konnten nicht geladen werden.
configurationDialog.page.interface.name: GUI
+configurationDialog.page.interface.item.advancedMode.name: Erweiterter Modus
+configurationDialog.page.interface.item.advancedMode.mnemonic: VK_E
+configurationDialog.page.interface.item.advancedMode.accelerator: Alt-VK_E
+configurationDialog.page.interface.item.advancedMode.shortDescription: Aktiviert den erweiterten Modus
+configurationDialog.page.interface.item.advancedMode.longDescription: Aktiviert den erweiterten Modus, welcher mehrere Nodes erlaubt
+
configurationDialog.page.interfaceTweaks.name: GUI Tweaks
configurationDialog.page.interfaceTweaks.item.restartRequired.name: Alle Einstellungen auf dieser Seite erfordern einen Neustart, um wirksam zu werden!