@Override public void start( AcceptsOneWidget containerWidget, com.google.gwt.event.shared.EventBus eventBus) { containerWidget.setWidget(navigationView.asWidget()); registrations.add( navigationView .getSelectionModel() .addSelectionChangeHandler( new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { TreePlace place = navigationView.getSelectionModel().getSelectedObject(); if (place != null) { goTo(place); } } })); registrations.add( eventBus.addHandler( DataEvent.getType(), new DataEventHandler() { @Override public void onDataChanged(DataEvent event) { if (event.refreshTree()) { refreshTree(); if (pendingPlace != null) { selectPlace(pendingPlace); } } } })); }
private void selectPlace(TreePlace place) { TreeNode node = navigationView.getMenuTree().getRootTreeNode(); if (openNode(node, place)) { navigationView.getSelectionModel().setSelected(place, true); pendingPlace = null; } else { navigationView.getSelectionModel().clear(); } }
public void onPlaceChanged(TreePlace place) { TreePlace selected = navigationView.getSelectionModel().getSelectedObject(); if (!place.equals(selected)) { pendingPlace = place; selectPlace(place); } }
private void refreshTree() { TreeNode node = navigationView.getMenuTree().getRootTreeNode(); refreshTree(node); }