From: David ‘Bombe’ Roden Date: Sun, 25 May 2008 12:26:51 +0000 (+0200) Subject: update node labels when connecting or disconnecting X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7403a08d06153ecc3869efc0204064c37e67dc37;p=jSite2.git update node labels when connecting or disconnecting --- diff --git a/src/net/pterodactylus/jsite/gui/MainWindow.java b/src/net/pterodactylus/jsite/gui/MainWindow.java index d09c352..654f548 100644 --- a/src/net/pterodactylus/jsite/gui/MainWindow.java +++ b/src/net/pterodactylus/jsite/gui/MainWindow.java @@ -215,6 +215,36 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop return null; } + /** + * Sets the given node to the “online” state. + * + * @param node + * The node to set online + */ + public void setOnline(Node node) { + nodeLabels.get(node).setOnline(); + } + + /** + * Sets the given node to the “offline” state in the status bar. + * + * @param node + * The node to set offline + */ + public void setOffline(Node node) { + nodeLabels.get(node).setOffline(); + } + + /** + * Sets the given node to the “error” state in the status bar. + * + * @param node + * The node to set the error state for + */ + public void setError(Node node) { + nodeLabels.get(node).setError(); + } + // // ACTIONS // diff --git a/src/net/pterodactylus/jsite/gui/SwingInterface.java b/src/net/pterodactylus/jsite/gui/SwingInterface.java index 084215c..2f13df6 100644 --- a/src/net/pterodactylus/jsite/gui/SwingInterface.java +++ b/src/net/pterodactylus/jsite/gui/SwingInterface.java @@ -953,6 +953,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh public void nodeConnected(Node node) { nodeDisconnectActions.get(node).setEnabled(true); mainWindow.setStatusBarText(I18n.get("mainWindow.statusBar.connectedToNode", node.getName(), node.getHostname(), node.getPort())); + mainWindow.setOnline(node); } /** @@ -963,6 +964,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh nodeEditActions.get(node).setEnabled(true); nodeDeleteActions.get(node).setEnabled(true); mainWindow.setStatusBarText(I18n.get("mainWindow.statusBar.connectionToNodeFailed", node.getName(), node.getHostname(), node.getPort(), (cause != null) ? cause.getMessage() : "no reason given")); + mainWindow.setError(node); JOptionPane.showMessageDialog(mainWindow, I18n.get("mainWindow.error.nodeConnectionFailed.message", node.getName(), node.getHostname(), node.getPort(), (cause != null) ? cause.getMessage() : "no reason given"), I18n.get("mainWindow.error.nodeConnectionFailed.title"), JOptionPane.ERROR_MESSAGE); } @@ -975,6 +977,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh nodeEditActions.get(node).setEnabled(true); nodeDeleteActions.get(node).setEnabled(true); mainWindow.setStatusBarText(I18n.get("mainWindow.statusBar.disconnectedFromNode", node.getName(), node.getHostname(), node.getPort())); + mainWindow.setOffline(node); } /**