Exemple #1
0
  @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);
                  }
                }
              }
            }));
  }
Exemple #2
0
 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();
   }
 }
Exemple #3
0
 public void onPlaceChanged(TreePlace place) {
   TreePlace selected = navigationView.getSelectionModel().getSelectedObject();
   if (!place.equals(selected)) {
     pendingPlace = place;
     selectPlace(place);
   }
 }
Exemple #4
0
 private void refreshTree() {
   TreeNode node = navigationView.getMenuTree().getRootTreeNode();
   refreshTree(node);
 }