コード例 #1
0
  @Override
  public void init(final ProcessInstanceListPresenter presenter) {
    final List<String> bannedColumns = new ArrayList<String>();
    bannedColumns.add(constants.Select());
    bannedColumns.add(constants.Id());
    bannedColumns.add(constants.Name());
    bannedColumns.add(constants.Process_Instance_Description());
    bannedColumns.add(constants.Actions());
    final List<String> initColumns = new ArrayList<String>();
    initColumns.add(constants.Select());
    initColumns.add(constants.Id());
    initColumns.add(constants.Name());
    initColumns.add(constants.Process_Instance_Description());
    initColumns.add(constants.Version());
    initColumns.add(constants.Actions());
    initColumns.add(constants.Version());

    final Button button = new Button();
    button.setText("+");
    button.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Command addNewGrid =
                new Command() {
                  @Override
                  public void execute() {
                    HashMap<String, Object> newTabFormValues = newTabFilterPopup.getFormValues();
                    final String key = getValidKeyForAdditionalListGrid("ProcessInstancesGrid_");
                    filterPagedTable.saveNewTabSettings(key, newTabFormValues);
                    final ExtendedPagedTable<ProcessInstanceSummary> extendedPagedTable =
                        createGridInstance(
                            new GridGlobalPreferences(key, initColumns, bannedColumns), key);

                    extendedPagedTable.setDataProvider(presenter.getDataProvider());

                    filterPagedTable.createNewTab(
                        extendedPagedTable,
                        key,
                        button,
                        new Command() {
                          @Override
                          public void execute() {
                            currentListGrid = extendedPagedTable;
                            applyFilterOnPresenter(key);
                          }
                        });
                    applyFilterOnPresenter(newTabFormValues);
                  }
                };
            createFilterForm();
            newTabFilterPopup.show(addNewGrid, getMultiGridPreferencesStore());
          }
        });

    super.init(
        presenter,
        new GridGlobalPreferences("ProcessInstancesGrid", initColumns, bannedColumns),
        button);
  }
コード例 #2
0
  @Override
  public void initColumns(ExtendedPagedTable<ProcessInstanceSummary> extendedPagedTable) {

    Column checkColumn = initChecksColumn();
    Column processInstanceIdColumn = initProcessInstanceIdColumn();
    Column processNameColumn = initProcessNameColumn();
    Column processInitiatorColumn = initInitiatorColumn();
    Column processVersionColumn = initProcessVersionColumn();
    Column processStateColumn = initProcessStateColumn();
    Column startTimeColumn = initStartDateColumn();
    Column descriptionColumn = initDescriptionColumn();
    actionsColumn = initActionsColumn();

    List<ColumnMeta<ProcessInstanceSummary>> columnMetas =
        new ArrayList<ColumnMeta<ProcessInstanceSummary>>();
    columnMetas.add(new ColumnMeta<ProcessInstanceSummary>(checkColumn, constants.Select()));
    columnMetas.add(
        new ColumnMeta<ProcessInstanceSummary>(processInstanceIdColumn, constants.Id()));
    columnMetas.add(new ColumnMeta<ProcessInstanceSummary>(processNameColumn, constants.Name()));
    columnMetas.add(
        new ColumnMeta<ProcessInstanceSummary>(
            descriptionColumn, constants.Process_Instance_Description()));
    columnMetas.add(
        new ColumnMeta<ProcessInstanceSummary>(processInitiatorColumn, constants.Initiator()));
    columnMetas.add(
        new ColumnMeta<ProcessInstanceSummary>(processVersionColumn, constants.Version()));
    columnMetas.add(new ColumnMeta<ProcessInstanceSummary>(processStateColumn, constants.State()));
    columnMetas.add(
        new ColumnMeta<ProcessInstanceSummary>(startTimeColumn, constants.Start_Date()));
    columnMetas.add(new ColumnMeta<ProcessInstanceSummary>(actionsColumn, constants.Actions()));
    extendedPagedTable.addColumns(columnMetas);
  }
コード例 #3
0
  private void initTableColumns(final SelectionModel<ProcessSummary> selectionModel) {
    // Checkbox column. This table will uses a checkbox column for selection.
    // Alternatively, you can call dataGrid.setSelectionEnabled(true) to enable
    // mouse selection.

    Column<ProcessSummary, Boolean> checkColumn =
        new Column<ProcessSummary, Boolean>(new CheckboxCell(true, false)) {
          @Override
          public Boolean getValue(ProcessSummary object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
          }
        };

    processdefListGrid.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    processdefListGrid.setColumnWidth(checkColumn, "40px");

    // Id.
    Column<ProcessSummary, String> processIdColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getId();
          }
        };
    processIdColumn.setSortable(true);
    sortHandler.setComparator(
        processIdColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return Long.valueOf(o1.getId()).compareTo(Long.valueOf(o2.getId()));
          }
        });
    processdefListGrid.addColumn(
        processIdColumn, new ResizableHeader(constants.Id(), processdefListGrid, processIdColumn));

    // Process Id String.
    Column<ProcessSummary, String> processNameColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getName();
          }
        };
    processNameColumn.setSortable(true);
    sortHandler.setComparator(
        processNameColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return o1.getName().compareTo(o2.getName());
          }
        });
    processdefListGrid.addColumn(
        processNameColumn,
        new ResizableHeader(constants.Name(), processdefListGrid, processNameColumn));

    // Process PKG.
    Column<ProcessSummary, String> processPkgColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getPackageName();
          }
        };
    processPkgColumn.setSortable(true);
    sortHandler.setComparator(
        processPkgColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return o1.getPackageName().compareTo(o2.getPackageName());
          }
        });
    processdefListGrid.addColumn(
        processPkgColumn,
        new ResizableHeader(constants.Package(), processdefListGrid, processPkgColumn));

    // Process Session Id.
    Column<ProcessSummary, Number> processSessionIdColumn =
        new Column<ProcessSummary, Number>(new NumberCell()) {
          @Override
          public Number getValue(ProcessSummary object) {
            return object.getSessionId();
          }
        };
    processSessionIdColumn.setSortable(true);
    sortHandler.setComparator(
        processSessionIdColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return (o1.getSessionId() == o2.getSessionId()) ? 0 : 1;
          }
        });
    processdefListGrid.addColumn(
        processSessionIdColumn,
        new ResizableHeader("Session Id", processdefListGrid, processSessionIdColumn));
    processdefListGrid.setColumnWidth(processSessionIdColumn, "90px");

    // Version Type
    Column<ProcessSummary, String> versionColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getVersion();
          }
        };
    versionColumn.setSortable(true);
    sortHandler.setComparator(
        versionColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return o1.getVersion().compareTo(o2.getVersion());
          }
        });
    processdefListGrid.addColumn(
        versionColumn, new ResizableHeader(constants.Version(), processdefListGrid, versionColumn));
    processdefListGrid.setColumnWidth(versionColumn, "90px");

    // actions (icons)
    List<HasCell<ProcessSummary, ?>> cells = new LinkedList<HasCell<ProcessSummary, ?>>();

    cells.add(
        new StartActionHasCell(
            "Start process",
            new Delegate<ProcessSummary>() {
              @Override
              public void execute(ProcessSummary process) {
                PlaceRequest placeRequestImpl = new DefaultPlaceRequest("Form Display");
                System.out.println("Opening form for process id = " + process.getId());
                placeRequestImpl.addParameter("processId", process.getId());
                placeRequestImpl.addParameter("sessionId", String.valueOf(process.getSessionId()));
                placeManager.goTo(placeRequestImpl);
              }
            }));

    cells.add(
        new DetailsActionHasCell(
            "Details",
            new Delegate<ProcessSummary>() {
              @Override
              public void execute(ProcessSummary process) {

                PlaceRequest placeRequestImpl =
                    new DefaultPlaceRequest(constants.Process_Definition_Details());
                placeRequestImpl.addParameter("processId", process.getId());
                placeRequestImpl.addParameter(
                    "sessionId", Integer.toString(process.getSessionId()));
                placeManager.goTo(placeRequestImpl);
              }
            }));

    CompositeCell<ProcessSummary> cell = new CompositeCell<ProcessSummary>(cells);
    Column<ProcessSummary, ProcessSummary> actionsColumn =
        new Column<ProcessSummary, ProcessSummary>(cell) {
          @Override
          public ProcessSummary getValue(ProcessSummary object) {
            return object;
          }
        };
    processdefListGrid.addColumn(actionsColumn, "Actions");
    processdefListGrid.setColumnWidth(actionsColumn, "70px");
  }