public ServerPluginDetailView(int pluginId) {
    super();
    this.pluginId = pluginId;
    setHeight100();
    setWidth100();
    setOverflow(Overflow.AUTO);

    sectionStack = new SectionStack();
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setWidth100();
    sectionStack.setHeight100();
    sectionStack.setMargin(5);
    sectionStack.setOverflow(Overflow.VISIBLE);
  }
  /** Instantiates a new digital object menu view. */
  @Inject
  public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    this.eventBus = eventBus;

    layout = new VLayout();

    layout.setHeight100();
    layout.setWidth100();
    layout.setOverflow(Overflow.AUTO);

    relatedGrid = new ListGrid();
    relatedGrid.setWidth100();
    relatedGrid.setHeight100();
    relatedGrid.setShowSortArrow(SortArrow.CORNER);
    relatedGrid.setShowAllRecords(true);
    relatedGrid.setAutoFetchData(false);
    relatedGrid.setCanHover(true);
    relatedGrid.setCanSort(false);
    ListGridField field1 = new ListGridField("relation", lang.relation());
    field1.setWidth("40%");
    ListGridField field2 = new ListGridField("uuid", "PID");
    field2.setWidth("*");
    relatedGrid.setFields(field1, field2);
    sectionRelated = new SectionStackSection();
    sectionRelated.setID(SECTION_RELATED_ID);
    sectionRelated.setTitle(lang.referencedBy());
    sectionRelated.setResizeable(true);
    sectionRelated.setItems(relatedGrid);
    sectionRelated.setExpanded(false);

    sideNavGrid =
        new ListGrid() {

          @Override
          protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
            final ListGridRecord rollOverRecord = this.getRecord(rowNum);
            if (rollOverCanvas == null) {
              rollOverCanvas = new HLayout();
              rollOverCanvas.setSnapTo("TR");
              rollOverCanvas.setWidth(50);
              rollOverCanvas.setHeight(22);
            }

            if (rollOverCanvas.getChildren().length > 0) {
              rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]);
            }
            final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER);
            if (lockOwner != null) {
              ImgButton lockImg = new ImgButton();
              lockImg.setShowDown(false);
              lockImg.setShowRollOver(false);
              lockImg.setLayoutAlign(Alignment.CENTER);

              if ("".equals(lockOwner)) {
                lockImg.setSrc("icons/16/lock_lock_all.png");
              } else if (lockOwner.length() > 0) {
                lockImg.setSrc("icons/16/lock_lock_all_red.png");
              }

              lockImg.setPrompt(lang.lockInfoButton());
              lockImg.setHeight(16);
              lockImg.setWidth(16);
              lockImg.addClickHandler(
                  new com.smartgwt.client.widgets.events.ClickHandler() {

                    @Override
                    public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                      EditorSC.objectIsLock(
                          lang,
                          new LockInfo(
                              lockOwner,
                              rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION),
                              rollOverRecord.getAttributeAsStringArray(
                                  Constants.ATTR_TIME_TO_EXP_LOCK)));
                    }
                  });
              rollOverCanvas.addChild(lockImg);
            }
            return rollOverCanvas;
          }
        };
    sideNavGrid.setShowSelectionCanvas(false);

    sideNavGrid.setWidth100();
    sideNavGrid.setHeight100();
    sideNavGrid.setShowSortArrow(SortArrow.CORNER);
    sideNavGrid.setShowAllRecords(true);
    sideNavGrid.setAutoFetchData(true);
    sideNavGrid.setCanHover(true);
    sideNavGrid.setHoverOpacity(75);
    sideNavGrid.setHoverStyle("interactImageHover");
    sideNavGrid.setShowRollOverCanvas(true);

    final DynamicForm form = new DynamicForm();
    form.setHeight(1);
    form.setWidth(60);
    form.setNumCols(1);

    selectItem.setWidth(60);
    selectItem.setShowTitle(false);
    selectItem.setValueMap(lang.me(), lang.all());
    selectItem.setDefaultValue(lang.me());
    selectItem.setHoverOpacity(75);
    selectItem.setHoverStyle("interactImageHover");
    selectItem.addItemHoverHandler(
        new ItemHoverHandler() {

          @Override
          public void onItemHover(ItemHoverEvent event) {
            selectItem.setPrompt(
                DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue());
          }
        });
    selectItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            getUiHandlers().refreshRecentlyModified();
          }
        });

    form.setFields(selectItem);
    form.setTitle("by:");

    sectionRecentlyModified = new SectionStackSection();
    sectionRecentlyModified.setTitle(lang.recentlyModified());
    sectionRecentlyModified.setResizeable(true);
    sectionRecentlyModified.setItems(sideNavGrid);
    sectionRecentlyModified.setControls(form);
    sectionRecentlyModified.setExpanded(true);

    sectionStack = new SectionStack();
    sectionStack.addSection(sectionRelated);
    sectionStack.addSection(sectionRecentlyModified);
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setAnimateSections(true);
    sectionStack.setWidth100();
    sectionStack.setHeight100();
    sectionStack.setOverflow(Overflow.HIDDEN);
    layout.addMember(sectionStack);
  }
Пример #3
0
  public Tasks() {
    super();

    SectionStack sectionStack = new SectionStack();
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setWidth100();
    sectionStack.setHeight100();

    sections = new SectionStackSection[3];
    for (int i = 0; i < 2; i++) {
      sections[i] = new SectionStackSection(i == 0 ? "My Tasks" : "Available Tasks");
      sections[i].setExpanded(true);
      sections[i].setResizeable(false);

      ListGridField complete = new ListGridField("complete", " ");
      complete.setType(ListGridFieldType.BOOLEAN);
      complete.setCanEdit(true);
      complete.setCanToggle(true);

      if (i == 0) {

        final MyTasksListGrid taskgrid = new MyTasksListGrid();
        taskgrid.setWidth100();
        taskgrid.setHeight100();
        taskgrid.setCanExpandRecords(true);
        taskgrid.setCanExpandMultipleRecords(false);
        taskgrid.setExpansionMode(ExpansionMode.DETAILS);
        taskgrid.setShowAllRecords(true);
        taskgrid.setExpansionCanEdit(true);
        taskgrid.addCellDoubleClickHandler(
            new CellDoubleClickHandler() {
              public void onCellDoubleClick(CellDoubleClickEvent event) {
                taskgrid.expandRecord(taskgrid.getRecord(event.getRowNum()));
              }
            });

        ListGridField processIntanceID = new ListGridField("$#processInstanceId", "Workflow");
        processIntanceID.setBaseStyle("linkLabel");
        processIntanceID.addRecordClickHandler(
            new RecordClickHandler() {
              public void onRecordClick(RecordClickEvent event) {
                Object[] args = {event.getValue(), true};
                PageManager.getInstance().setPageHistory(Pages.VIEWWORKFLOW, args);
              }
            });

        taskgrid.setFields(
            complete,
            new ListGridField("taskname", "Name"),
            new ListGridField("$#createTime", "Time"),
            new ListGridField("$#priority", "Priority"),
            new ListGridField("$#assignee", "Assignee"),
            new ListGridField("$#activityName", "ActivityName"),
            processIntanceID);
        sections[i].addItem(taskgrid);
      } else {
        CustomListGrid grid = new CustomListGrid();
        grid.setWidth100();
        grid.setHeight100();
        grid.setCanExpandRecords(true);
        grid.setCanExpandMultipleRecords(false);
        grid.setExpansionMode(ExpansionMode.DETAILS);
        grid.setShowAllRecords(true);

        complete.addRecordClickHandler(getRecordClickHandler(grid, i == 1));

        grid.setShowRecordComponents(true);
        grid.setShowRecordComponentsByCell(true);
        ListGridField assign = new ListGridField("Assign", "Assign");
        assign.setAlign(Alignment.CENTER);
        grid.setFields(
            complete,
            new ListGridField("taskname", "Name"),
            new ListGridField("$#createTime", "Time"),
            new ListGridField("$#priority", "Priority"),
            assign);
        sections[i].addItem(grid);
      }
    }

    sections[2] = new SectionStackSection("Event Log");
    sections[2].setExpanded(true);
    sections[2].setResizeable(false);
    ListGrid grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setCanExpandRecords(false);
    grid.setShowAllRecords(true);
    grid.setCanEdit(false);
    grid.setFields(
        new ListGridField("$#endTime", "Time"),
        new ListGridField("$#id", "Task"),
        new ListGridField("$#assignee", "User"),
        new ListGridField("$#state", "Action"),
        new ListGridField("outcome", "Outcome"),
        new ListGridField("$#processInstanceId", "Workflow"));
    sections[2].addItem(grid);

    sectionStack.addSection(sections[0]);
    sectionStack.addSection(sections[1]);
    sectionStack.addSection(sections[2]);

    BpmServiceMain.sendGet(
        "/processInstances/tasks?assignee=" + BpmServiceMain.getUser(),
        new AsyncCallback<String>() {
          public void onFailure(Throwable arg0) {}

          public void onSuccess(String arg0) {
            ArrayList<Task> tasks = Parse.parseProcessTasks(arg0);

            records1 = new ListGridRecord[MAX_TASKS];
            int i = 0;
            for (Task t : tasks) {
              records1[i++] = createLGR(false, t);
            }
            ((MyTasksListGrid) sections[0].getItems()[0]).setData(records1);
          }
        });
    BpmServiceMain.sendGet(
        "/processInstances/tasks?candidate=" + BpmServiceMain.getUser(),
        new AsyncCallback<String>() {
          public void onFailure(Throwable arg0) {}

          public void onSuccess(String arg0) {
            ArrayList<Task> tasks = Parse.parseProcessTasks(arg0);
            records2 = new ListGridRecord[MAX_TASKS];
            int i = 0;
            for (Task t : tasks) {
              records2[i++] = createLGR(false, t);
            }
            ((CustomListGrid) sections[1].getItems()[0]).setData(records2);
          }
        });

    int dayLength = 24 * 60 * 60 * 1000;
    Date d = new Date();
    d.setTime(d.getTime() + dayLength);
    String end =
        (1900 + d.getYear())
            + "-"
            + (d.getMonth() < 9 ? "0" : "")
            + (d.getMonth() + 1)
            + "-"
            + (d.getDate() < 9 ? "0" : "")
            + d.getDate();
    d = new Date();
    d.setTime(d.getTime() - dayLength * 3);
    String start =
        (1900 + d.getYear())
            + "-"
            + (d.getMonth() < 9 ? "0" : "")
            + (d.getMonth() + 1)
            + "-"
            + (d.getDate() < 9 ? "0" : "")
            + d.getDate();
    BpmServiceMain.sendGet(
        "/tasks/history?assignee=" + BpmServiceMain.getUser() + "&start=" + start + "&end=" + end,
        new AsyncCallback<String>() {
          public void onFailure(Throwable arg0) {}

          public void onSuccess(String arg0) {
            ArrayList<Task> tasks = Parse.parseTasks(arg0);
            records3 = new ListGridRecord[MAX_TASKS];
            int i = 0;
            for (Task t : tasks) {
              records3[i++] = createLGR(true, t);
            }
            ((ListGrid) sections[2].getItems()[0]).setData(records3);
            ((ListGrid) sections[2].getItems()[0]).sort(0, SortDirection.DESCENDING);
          }
        });

    createPage(sectionStack, PageWidget.PAGE_TASKS);

    timer =
        new Timer() {
          public void run() {
            updateTasks();
          }
        };
    timer.scheduleRepeating(BpmServiceMain.getPollingRate());
  }