Пример #1
0
  @Override
  public void selectNode(final ProcessTreeNode node) {
    SelectionModel<ProcessTreeNode> selectionModel = processTree.getSelectionModel();

    if (node == null) {
      selectionModel.clearSelections();
      return;
    } else {
      selectionModel.setTreeActive(true);
      selectionModel.clearSelections();
      selectionModel.selectSingleNode(node);

      node.getTreeNodeElement().scrollIntoView();
    }

    Scheduler.get()
        .scheduleDeferred(
            new Scheduler.ScheduledCommand() {
              @Override
              public void execute() {
                delegate.onTreeNodeSelected(node);
              }
            });
  }
  /** {@inheritDoc} */
  @Override
  public void onNodeSelected(final TreeNode<?> node, final SelectionModel<?> model) {
    final List<?> allSelected = model.getSelectedNodes();
    final List<Object> newSelection = new ArrayList<>();
    for (final Object item : allSelected) {
      newSelection.add(item);
    }
    if (newSelection.contains(node)) {
      setSelection(new Selection<>(newSelection, node));
    } else {
      setSelection(new Selection<>(newSelection));
    }

    if (node != null && node instanceof StorableNode && appContext.getCurrentProject() != null) {
      appContext
          .getCurrentProject()
          .setProjectDescription(node.getProject().getProjectDescriptor());
    }
  }