NodeLabel nodeLabel = new NodeLabel(swingInterface, node, onlineIcon, offlineIcon, errorIcon);
nodeLabels.put(node, nodeLabel);
statusBar.addSideComponent(nodeLabel);
+ node.addPropertyChangeListener(this);
}
/**
void removeNode(Node node) {
nodeMenu.remove(nodeMenus.remove(node));
statusBar.removeSideComponent(nodeLabels.remove(node));
+ node.removePropertyChangeListener(this);
}
/**
}
}
}
+ } else if (eventSource instanceof Node) {
+ if (propertyName.equals(Node.PROPERTY_NAME)) {
+ Node changedNode = (Node) eventSource;
+ nodeMenus.get(changedNode).setText(changedNode.getName());
+ }
}
}
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;
this.offlineIcon = offlineIcon;
this.errorIcon = errorIcon;
initComponents();
+ node.addPropertyChangeListener(this);
}
//
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()));
}
}
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
* {@inheritDoc}
*/
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
- if (propertyChangeEvent.getSource() instanceof Node) {
- Node changedNode = (Node) propertyChangeEvent.getSource();
- nodeConnectActions.get(changedNode).putValue(Action.NAME, changedNode.getName());
- nodeDisconnectActions.get(changedNode).putValue(Action.NAME, changedNode.getName());
- }
+ /* do not react to anything (yet). */
}
}