X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FNodeLabel.java;h=1d382fbdcd89bcfc79401756d60502513590af1a;hb=c63257e8cc0ba1a5aca9364b22171abe7279d479;hp=ca3bbfd5326c763950a24df5d466750228a07098;hpb=119b109fd29f4efa4756cef4daa43398d22cf7a0;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/NodeLabel.java b/src/net/pterodactylus/jsite/gui/NodeLabel.java index ca3bbfd..1d382fb 100644 --- a/src/net/pterodactylus/jsite/gui/NodeLabel.java +++ b/src/net/pterodactylus/jsite/gui/NodeLabel.java @@ -34,6 +34,7 @@ import javax.swing.SwingConstants; import javax.swing.border.EtchedBorder; import net.pterodactylus.jsite.core.Node; +import net.pterodactylus.jsite.i18n.I18n; import net.pterodactylus.jsite.i18n.I18nable; import net.pterodactylus.jsite.i18n.gui.I18nLabel; @@ -41,7 +42,7 @@ import net.pterodactylus.jsite.i18n.gui.I18nLabel; * A node label is a small component that sits in the status bar, displays the * current status of a node and offers a context menu to connect and disconnect * from the node. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseListener, I18nable { @@ -69,7 +70,7 @@ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseLi /** * Creates a new node label. - * + * * @param swingInterface * The Swing interface * @param node @@ -89,6 +90,7 @@ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseLi this.offlineIcon = offlineIcon; this.errorIcon = errorIcon; initComponents(); + node.addPropertyChangeListener(this); } // @@ -128,19 +130,22 @@ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseLi setIcon(offlineIcon); contextMenu = new JPopupMenu(); menuLabel = new I18nLabel("mainWindow.statusBar.nodeLabel", node.getName()); - JPanel menuPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); + JPanel menuPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 6, 0)); menuPanel.add(menuLabel); contextMenu.add(menuPanel); contextMenu.addSeparator(); contextMenu.add(swingInterface.getNodeConnectAction(node)); contextMenu.add(swingInterface.getNodeDisconnectAction(node)); + contextMenu.addSeparator(); + contextMenu.add(swingInterface.getNodeEditAction(node)); + contextMenu.add(swingInterface.getNodeDeleteAction(node)); addMouseListener(this); } /** * Checks whether the given mouse event is a trigger for popup menues and * shows the popup menu if it is. - * + * * @param mouseEvent * The mouse event to check for being a popup trigger */ @@ -161,9 +166,10 @@ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseLi if (propertyChangeEvent.getSource() != node) { return; } - if (propertyChangeEvent.getPropagationId().equals(Node.PROPERTY_NAME)) { + if (propertyChangeEvent.getPropertyName().equals(Node.PROPERTY_NAME)) { setText(node.getName()); - menuLabel.updateI18n(); + /* TODO - find way to get around this hack */ + menuLabel.setText(I18n.get("mainWindow.statusBar.nodeLabel.name", node.getName())); } }