-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathNetworkPane.java
More file actions
64 lines (52 loc) · 2.07 KB
/
NetworkPane.java
File metadata and controls
64 lines (52 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package nodebox.client;
import java.awt.*;
public class NetworkPane extends Pane {
private final NodeBoxDocument document;
private final PaneHeader paneHeader;
private final NetworkView networkView;
public NetworkPane(NodeBoxDocument document) {
this.document = document;
setLayout(new BorderLayout(0, 0));
paneHeader = new PaneHeader(this);
NButton newNodeButton = new NButton("New Node", "res/network-new-node.png");
newNodeButton.setToolTipText("New Node (TAB)");
newNodeButton.setActionMethod(this, "createNewNode");
paneHeader.add(newNodeButton);
networkView = new NetworkView(document);
add(paneHeader, BorderLayout.NORTH);
add(networkView, BorderLayout.CENTER);
}
public NetworkView getNetworkView() {
return networkView;
}
public Pane duplicate() {
return new NetworkPane(document);
}
public PaneHeader getPaneHeader() {
return paneHeader;
}
public String getPaneName() {
return "Network";
}
public PaneView getPaneView() {
return networkView;
}
public void createNewNode() {
networkView.showNodeSelectionDialog();
}
// public void propertyChange(PropertyChangeEvent evt) {
// if (!evt.getPropertyName().equals(NetworkView.SELECT_PROPERTY)) return;
// Set<NodeView> selection = (Set<NodeView>) evt.getNewValue();
// // If there is no selection, set the active node to null.
// if (selection == null || selection.isEmpty()) {
// getDocument().setActiveNode((Node) null);
// } else {
// // If the active node is in the new selection leave the active node as is.
// NodeView nv = networkView.getNodeView(getDocument().getActiveNode());
// if (selection.contains(nv)) return;
// // If there are multiple elements selected, the first one will be the active node.
// NodeView firstElement = selection.iterator().next();
// getDocument().setActiveNode(firstElement.getNode());
// }
// }
}