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);
          }
        });
  }
Esempio n. 2
0
    private void makeSelectionOnTaskDataGrid(
        MultiSelectionModel<TaskDataDto> model, List<TaskDataDto> tests) {

      if (selectTests) {
        if (!previousSelectedSet.isEmpty()) {
          for (TaskDataDto taskDataDto : tests) {
            for (TaskDataDto taskDataPrevious : previousSelectedSet) {
              if (taskDataDto.getTaskName().equals(taskDataPrevious.getTaskName())) {
                model.setSelected(taskDataDto, true);
              }
            }
          }
          SelectionChangeEvent.fire(testDataGrid.getSelectionModel());
        }

      } else {
        Set<TestsMetrics> testsMetrics = place.getSelectedTestsMetrics();
        for (TaskDataDto taskDataDto : tests) {
          for (TestsMetrics testMetric : testsMetrics) {
            if (testMetric.getTestName().equals(taskDataDto.getTaskName())) {
              model.setSelected(taskDataDto, true);
            }
          }
        }
        model.addSelectionChangeHandler(new TestSelectChangeHandler());

        SelectionChangeEvent.fire(model);
      }
      previousSelectedSet.clear();
    }
Esempio n. 3
0
  public DeviceDiskViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    for (String pageSize : DevicePageSize.getPageSizeList()) {
      pageSizeList.addItem(pageSize);
    }
    pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex());
    pageSizeList.addChangeHandler(
        new ChangeHandler() {

          @Override
          public void onChange(ChangeEvent event) {
            DevicePageSize.setPageSizeSelectedIndex(pageSizeList.getSelectedIndex());
            if (table != null) {
              table.setPageSize(DevicePageSize.getPageSize());
            }
          }
        });

    selection = new MultiSelectionModel<SearchResultRow>(SearchResultRow.KEY_PROVIDER);
    selection.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            updateSearchResultButtonStatus();
            presenter.onSelectionChange(selection.getSelectedSet());
          }
        });
    updateSearchResultButtonStatus();

    popup.setAutoHideEnabled(true);
  }
  @Override
  public void init(ProcessDefinitionListPresenter presenter) {
    this.presenter = presenter;

    listContainer.add(processdefListGrid);
    listContainer.add(pager);

    processdefListGrid.setHeight("350px");

    // Set the message to display when the table is empty.
    processdefListGrid.setEmptyTableWidget(new Label(constants.No_Process_Definitions_Available()));

    // Attach a column sort handler to the ListDataProvider to sort the list.
    sortHandler = new ListHandler<ProcessSummary>(presenter.getDataProvider().getList());
    processdefListGrid.addColumnSortHandler(sortHandler);

    // Create a Pager to control the table.

    pager.setDisplay(processdefListGrid);
    pager.setPageSize(10);

    // Add a selection model so we can select cells.
    final MultiSelectionModel<ProcessSummary> selectionModel =
        new MultiSelectionModel<ProcessSummary>();
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            selectedProcessDef = selectionModel.getSelectedSet();
            for (ProcessSummary pd : selectedProcessDef) {
              processSelection.fire(new ProcessDefSelectionEvent(pd.getId()));
            }
          }
        });

    processdefListGrid.setSelectionModel(
        selectionModel, DefaultSelectionEventManager.<ProcessSummary>createCheckboxManager());

    initTableColumns(selectionModel);

    presenter.addDataDisplay(processdefListGrid);
  }