}
/**
+ * 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);
package de.todesbaum.jsite.main;
+import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
/**
* {@inheritDoc}
*/
+ public void nodeSelected(Node node) {
+ for (Component menuItem : nodeMenu.getMenuComponents()) {
+ if (menuItem instanceof JMenuItem) {
+ if (node.equals(((JMenuItem) menuItem).getClientProperty("Node"))) {
+ ((JMenuItem) menuItem).setSelected(true);
+ }
+ }
+ }
+ freenetInterface.setNode(node);
+ selectedNode = node;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source instanceof JRadioButtonMenuItem) {