complete new node management
[jSite2.git] / src / net / pterodactylus / jsite / gui / NodeLabel.java
index ca3bbfd..cd4092e 100644 (file)
@@ -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;
 
@@ -89,6 +90,7 @@ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseLi
                this.offlineIcon = offlineIcon;
                this.errorIcon = errorIcon;
                initComponents();
+               node.addPropertyChangeListener(this);
        }
 
        //
@@ -134,6 +136,9 @@ public class NodeLabel extends JLabel implements PropertyChangeListener, MouseLi
                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);
        }
 
@@ -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()));
                }
        }