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