public void bind() { eventBus.addHandler(PlaceChangeEvent.TYPE, this); eventBus.addHandler(TestbedSelectedEvent.TYPE, this); eventBus.addHandler(ThrowableEvent.TYPE, this); eventBus.addHandler(WisemlLoadedEvent.TYPE, this); nodeSelectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(final SelectionChangeEvent event) { final Set<Node> nodes = nodeSelectionModel.getSelectedSet(); onNodeSelection(nodes); } }); nodeGroupSelectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(final SelectionChangeEvent event) { final Set<NodeGroup> nodeGroups = nodeGroupSelectionModel.getSelectedSet(); String selectedNodeGroups = "Selected node groups: { "; for (NodeGroup nodeGroup : nodeGroups) { selectedNodeGroups += nodeGroup.getName() + ";"; } selectedNodeGroups += " }"; GWT.log(selectedNodeGroups); onNodeGroupSelection(nodeGroups); } }); }
// TODO Provide consistent user interface for node selection private void onNodeSelection(final Set<Node> nodes) { for (Node node : nodes) { for (NodeGroup nodeGroup : nodeGroupSelectionModel.getSelectedSet()) { if (node.getNodeType().equals(nodeGroup.getName())) { nodeGroupSelectionModel.setSelected(nodeGroup, false); break; } } } eventBus.fireEvent(new UpdateNodesSelectedEvent(nodes)); }
@Override public void onPlaceChange(final PlaceChangeEvent event) { view.getLoadingIndicator().hideLoading(); eventBus.removeAll(); }