/*
- * jSite-0.7 -
- * Copyright (C) 2006 David Roden
+ * jSite - NodeManagerPage.java - Copyright © 2006–2012 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
/**
+ * Notifies all listeners that a new node was selected.
+ *
+ * @param node
+ * The newly selected node
+ */
+ protected void fireNodeSelected(Node node) {
+ for (NodeManagerListener nodeManagerListener : nodeManagerListeners) {
+ nodeManagerListener.nodeSelected(node);
+ }
+ }
+
+ /**
* Creates all actions.
*/
private void createActions() {
if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.node-manager.delete-node.warning"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.CANCEL_OPTION) {
return;
}
+ int nodeIndex = nodeListModel.indexOf(node);
nodeListModel.removeElement(node);
nodeList.repaint();
+ fireNodeSelected((Node) nodeListModel.get(Math.min(nodeIndex, nodeListModel.size() - 1)));
fireNodesUpdated(getNodes());
deleteNodeAction.setEnabled(nodeListModel.size() > 1);
wizard.setNextEnabled(nodeListModel.size() > 0);
JSpinner sourceSpinner = (JSpinner) source;
if ("node-port".equals(sourceSpinner.getName())) {
selectedNode.setPort((Integer) sourceSpinner.getValue());
+ fireNodeSelected(selectedNode);
nodeList.repaint();
}
}