Ejemplo n.º 1
0
  private Layout() {

    vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();

    messageWindow = new MessageWindow(vLayout);

    vLayout.addMember(MainToolStrip.getInstance());

    mainSectionStack = new SectionStack();
    mainSectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    mainSectionStack.setAnimateSections(true);
    mainSectionStack.setCanResizeSections(true);

    SectionStackSection mainTabSection = new SectionStackSection();
    mainTabSection.setCanCollapse(false);
    mainTabSection.setShowHeader(false);

    centerTabSet = CenterTabSet.getInstance();
    mainTabSection.addItem(centerTabSet);

    mainSectionStack.setSections(mainTabSection);

    vLayout.addMember(mainSectionStack);

    modal = new ModalWindow(vLayout);

    vLayout.draw();
  }
Ejemplo n.º 2
0
  public EventViewerWindow() {
    super();

    setTitle(AppMessages.EVENT_VIEWER_LABEL);
    setShortcutIcon(AppImages.EVENT_DETAIL_SHORTCUT);
    setHeaderIcon(AppImages.EVENT_DETAIL_ICON);

    stack = new SectionStack();
    stack.setVisibilityMode(VisibilityMode.MULTIPLE);

    SectionStackSection findSection = new SectionStackSection("Find");
    findSection.setExpanded(true);

    final DynamicForm form = new SearchForm();
    form.setNumCols(7);
    form.setHeight(35);
    form.setTop(15);
    form.setCellPadding(10);

    TextItem actIdItem = new TextItem();
    actIdItem.setTitle("Activity ID");
    TextItem contextItem = new TextItem();
    contextItem.setTitle("Context");
    ButtonItem findBtn = new ButtonItem("Search");
    findBtn.setStartRow(false);
    findBtn.setIcon(AppImages.SEARCH_ICON);
    findBtn.setWidth("125px");

    form.setFields(actIdItem, contextItem, findBtn);
    findSection.addItem(form);

    SectionStackSection resultSection = new SectionStackSection("Activities");
    resultSection.setExpanded(true);

    grid = new ListGrid();
    grid.setShowAllRecords(true);
    grid.setHeight(300);

    ListGridField actId = new ListGridField("activityId", "ID", 40);
    ListGridField actDate = new ListGridField("activityDate", "Date", 150);
    ListGridField actCtx = new ListGridField("activityContext", "Context", 220);
    ListGridField actDesc = new ListGridField("activityDescription", "Description");

    grid.setFields(actId, actCtx, actDesc, actDate);
    grid.setData(getData());

    resultSection.addItem(grid);

    SectionStackSection detailSection = new SectionStackSection("Activity Detail");
    detailSection.setExpanded(true);

    stack.addSection(findSection);
    stack.addSection(resultSection);
    stack.addSection(detailSection);

    this.addItem(stack);
  }
 /*
  * (non-Javadoc)
  * @see
  * cz.fi.muni.xkremser.editor.client.presenter.DigitalObjectMenuPresenter.
  * MyView#setRelatedDocuments(java.util.List)
  */
 @Override
 public void setRelatedDocuments(List<? extends List<String>> data) {
   if (data != null && data.size() != 0) {
     sectionStack.getSection(SECTION_RELATED_ID).setExpanded(true);
     // sectionRelated.setExpanded(true);
     Record[] records = new Record[data.size()];
     for (int i = 0; i < data.size(); i++) {
       records[i] = new ListGridRecord();
       records[i].setAttribute("uuid", data.get(i).get(0));
       records[i].setAttribute("relation", data.get(i).get(1));
     }
     relatedGrid.setData(records);
   } else sectionStack.getSection(SECTION_RELATED_ID).setExpanded(false);
 }
  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);
  }
  /*
   * (non-Javadoc)
   * @see
   * cz.fi.muni.xkremser.editor.client.presenter.DigitalObjectMenuPresenter.
   * MyView#showInputQueue(com.gwtplatform.dispatch.client.DispatchAsync)
   */
  @Override
  public void showInputQueue(
      InputQueueTree tree, DispatchAsync dispatcher, final PlaceManager placeManager) {
    SectionStackSection section1 = new SectionStackSection();
    section1.setTitle(lang.inputQueue());
    if (tree == null) {
      inputTree = new InputQueueTree(dispatcher, lang, eventBus);
      inputTree
          .getCreateMenuItem()
          .addClickHandler(
              new com.smartgwt.client.widgets.menu.events.ClickHandler() {

                @Override
                public void onClick(final MenuItemClickEvent event) {
                  String msg = event.getMenu().getEmptyMessage();
                  String model = msg.substring(0, msg.indexOf("/"));
                  String path = msg.substring(msg.indexOf("/") + 1);
                  String id = path;
                  if (path.contains("/")) {
                    id = path.substring(0, path.indexOf("/"));
                  }

                  placeManager.revealRelativePlace(
                      new PlaceRequest(NameTokens.FIND_METADATA)
                          .with(Constants.ATTR_MODEL, model)
                          .with(Constants.URL_PARAM_SYSNO, id)
                          .with(Constants.URL_PARAM_PATH, path));
                }
              });
    } else {
      String isInputSection = sectionStack.getSection(0).getAttribute(SECTION_INPUT_ID);
      if (isInputSection != null && "yes".equals(isInputSection)) {
        sectionStack.removeSection(0);
      }
      inputTree = tree;
    }
    section1.setItems(inputTree);
    refreshButton = new ImgButton();
    refreshButton.setSrc("[SKIN]headerIcons/refresh.png");
    refreshButton.setSize(16);
    refreshButton.setShowRollOver(true);
    refreshButton.setCanHover(true);
    refreshButton.setShowDownIcon(false);
    refreshButton.setShowDown(false);
    refreshButton.setHoverStyle("interactImageHover");
    refreshButton.setHoverOpacity(75);
    refreshButton.addHoverHandler(
        new HoverHandler() {

          @Override
          public void onHover(HoverEvent event) {
            refreshButton.setPrompt(lang.inputQueueRescan());
          }
        });

    section1.setControls(refreshButton);
    section1.setResizeable(true);
    section1.setExpanded(true);
    sectionStack.addSection(section1, 0);
    section1.setAttribute(SECTION_INPUT_ID, "yes");
  }
  /** 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);
  }
  public UserManagement() {
    setWidth100();
    setHeight100();
    setLayoutMargin(20);

    UserDataSource userDS = UserDataSource.getInstance();

    searchForm = new SearchForm(userDS);

    // final ComboBoxItem searchConditions = searchForm.getSearchConditionField();

    setupContextMenu();

    userList = new ItemListGrid(userDS);
    userList.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            userDetailTabPane.updateDetails();
          }
        });

    userList.addCellSavedHandler(
        new CellSavedHandler() {
          public void onCellSaved(CellSavedEvent event) {
            userDetailTabPane.updateDetails();
          }
        });

    userList.addCellContextClickHandler(
        new CellContextClickHandler() {
          public void onCellContextClick(CellContextClickEvent event) {
            userListMenu.showContextMenu();
            event.cancel();
          }
        });

    SectionStack sessionLayout = new SectionStack();
    sessionLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    sessionLayout.setAnimateSections(true);

    searchForm.setHeight(60);
    searchForm.addFindListener(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            findUsers();
          }
        });

    SectionStackSection findSection = new SectionStackSection("Find Users");
    findSection.setItems(searchForm);
    findSection.setExpanded(true);

    SectionStackSection usersSection = new SectionStackSection("User List");
    usersSection.setItems(userList);
    usersSection.setExpanded(true);

    userDetailTabPane = new UserDetailTabPane(userDS, userList);
    SectionStackSection userDetailsSection = new SectionStackSection("User Details");
    userDetailsSection.setItems(userDetailTabPane);
    userDetailsSection.setExpanded(true);

    sessionLayout.setSections(findSection, usersSection, userDetailsSection);

    addMember(sessionLayout);
  }
Ejemplo n.º 8
0
 public SectionStackSection getMainSection(String sectionID) {
   return mainSectionStack.getSection(sectionID);
 }
Ejemplo n.º 9
0
 public void removeMainSection(String sectionID) {
   mainSectionStack.removeSection(sectionID);
 }
Ejemplo n.º 10
0
 public void addMainSection(SectionStackSection section) {
   mainSectionStack.addSection(section);
 }
Ejemplo n.º 11
0
  public void onModuleLoad() {

    topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setWidth(1024);
    topTabSet.setHeight(768);
    topTabSet.setTabBarThickness(50);

    Tab tTab1 = new Tab("Menu", "assets/mainMenu.png");
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 96, 96);

    topTabSet.addTab(tTab1);

    Tab lTab1 = new Tab();
    lTab1.setIcon("pieces/16/pawn_blue.png", 16);
    Img lImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    lTab1.setPane(lImg1);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    // vLayout.addMember(leftTabSet);
    vLayout.setHeight("*");

    vLayout.draw();

    final HLayout hLayout = new HLayout();
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setLayoutMargin(20);

    // tree menu
    TreeGrid tree = new TreeGrid();
    tree.setShowConnectors(true);
    tree.setShowResizeBar(true);

    Tree dataTree = new Tree();
    dataTree.setModelType(TreeModelType.CHILDREN);
    dataTree.setRoot(
        new TreeNode(
            "root",
            new TreeNode("Aluno"),
            new TreeNode("Funcionario"),
            new TreeNode("Contato"),
            new TreeNode("Veiculo"),
            new TreeNode("Disciplina")));

    tree.setData(dataTree);

    TreeGridField fieldTree = new TreeGridField("Navegacao");
    fieldTree.setCellFormatter(
        new CellFormatter() {
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            return record.getAttribute("name");
          }
        });
    tree.setFields(fieldTree);

    // layout esquerda
    SectionStack leftSideLayout = new SectionStack();
    leftSideLayout.setWidth(200);
    leftSideLayout.setShowResizeBar(true);
    leftSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    leftSideLayout.setAnimateSections(true);

    leftSideLayout.setMembers(tree);

    // UIs
    final AlunoUI alunoUI = new AlunoUI();
    final FuncionarioUI funcionarioUI = new FuncionarioUI();
    final ContatoUI contatoUI = new ContatoUI();
    final VeiculoUI veiculoUI = new VeiculoUI();
    final DisciplinaUI disciplinaUI = new DisciplinaUI();

    // layout direita
    final SectionStack rightSideLayout = new SectionStack();
    rightSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    rightSideLayout.setAnimateSections(true);

    grid = alunoUI.getGrid();
    formBotoes = alunoUI.getFormBotoes();
    menuItens = new DynamicForm();
    menuItens.setWidth(100);
    menuItens.setAlign(Alignment.RIGHT);

    ButtonItem aluno = new ButtonItem("Aluno");
    aluno.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomAluno("Aluno");
          }
        });

    ButtonItem disc = new ButtonItem("Disciplina");
    disc.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomDisciplina("Disciplina");
          }
        });

    ButtonItem curso = new ButtonItem("Curso");
    curso.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomCurso("Curso");
          }
        });

    ButtonItem matric = new ButtonItem("Matricula");
    matric.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomMatricula("Matricula");
          }
        });

    menuItens.setFields(aluno, disc, curso, matric);

    rightSideLayout.setMembers(menuItens);
    rightSideLayout.setWidth(200);
    // seleciona tree
    tree.addNodeClickHandler(
        new NodeClickHandler() {
          public void onNodeClick(NodeClickEvent event) {
            String node = event.getNode().getAttribute("name");
            if (node.equals("Aluno")) {
              // rightSideLayout.removeMembers(formBotoes,grid);
              // Tab tab = new Tab(node);
              newTabCustomAluno(node);
            } else {
              if (node.equals("Disciplina")) {
                newTabCustomDisciplina(node);
              } else {
                if (node.equals("Curso")) {
                  //	newTabCustom(node);
                } else {
                  if (node.equals("Matricula")) {
                    //	newTabCustom(node);
                  } else {
                    if (node.equals("Disciplina")) {
                      rightSideLayout.removeMembers(formBotoes, grid);
                      grid = disciplinaUI.getGrid();
                      formBotoes = disciplinaUI.getFormBotoes();
                      rightSideLayout.setMembers(formBotoes, grid);
                    }
                  }
                }
              }
            }
          }
        });

    // hLayout

    hLayout.addMember(leftSideLayout);
    hLayout.addMember(rightSideLayout);
    hLayout.draw();

    tTab1.setPane(hLayout);
  }
Ejemplo n.º 12
0
  public static void setInputTreeToSection(
      final DispatchAsync dispatcher,
      final LangConstants lang,
      final EventBus eventBus,
      SectionStack sectionStack,
      final PlaceManager placeManager,
      final MessageBus messageBus,
      boolean force) {

    SectionStackSection section1 = new SectionStackSection();
    section1.setTitle(lang.inputQueue());
    String isInputSection = sectionStack.getSection(0).getAttribute(Constants.SECTION_INPUT_ID);
    boolean notContains = isInputSection == null || !"yes".equals(isInputSection);
    if (notContains || force) {
      if (!notContains) {
        sectionStack.collapseSection(0);
        sectionStack.removeSection(0);
      }
      if (inputQueueTree == null) {
        inputQueueTree = new InputQueueTree(dispatcher, lang, eventBus);
        inputQueueTree
            .getCreateMenuItem()
            .addClickHandler(
                new com.smartgwt.client.widgets.menu.events.ClickHandler() {

                  @Override
                  public void onClick(final MenuItemClickEvent event) {
                    String msg = event.getMenu().getEmptyMessage();
                    String model = msg.substring(0, msg.indexOf("/"));
                    String path = msg.substring(msg.indexOf("/") + 1);
                    String id = path;
                    if (path.contains("/")) {
                      id = path.substring(0, path.indexOf("/"));
                    }

                    placeManager.revealRelativePlace(
                        new PlaceRequest(NameTokens.FIND_METADATA)
                            .with(Constants.ATTR_MODEL, model)
                            .with(Constants.URL_PARAM_SYSNO, id)
                            .with(Constants.URL_PARAM_PATH, path));
                  }
                });

        messageBus.subscribe(
            "InputQueueBroadcastReceiver",
            new MessageCallback() {
              @Override
              public void callback(Message message) {
                String inputItem = message.get(String.class, "ingested");
                for (ListGridRecord record : inputQueueTree.getRecords()) {
                  if (record.getAttribute(Constants.ATTR_ID).equals(inputItem)) {
                    record.setAttribute(Constants.ATTR_INGEST_INFO, true);
                    inputQueueTree.redraw();
                  }
                }
              }
            });
      }

      section1.setItems(inputQueueTree);
      section1.setControls(getRefreshButton(lang, eventBus, dispatcher));
      section1.setResizeable(true);
      section1.setExpanded(true);
      sectionStack.addSection(section1, 0);
      section1.setAttribute(Constants.SECTION_INPUT_ID, "yes");
    }
  }
Ejemplo n.º 13
0
  /** This is the entry point method. */
  public void onModuleLoad() {

    final HelpCanvas help1 = new HelpCanvas("help1");
    final HelpCanvas help2 = new HelpCanvas("help2");

    HLayout layout = new HLayout();
    layout.setMembersMargin(20);

    final SectionStack sectionStack = new SectionStack();
    sectionStack.setVisibilityMode(VisibilityMode.MUTEX);
    sectionStack.setWidth(800);
    sectionStack.setHeight(600);

    SectionStackSection section1 = new SectionStackSection("Settings for Stream Recorder");
    section1.setExpanded(true);
    section1.setResizeable(false);

    // VLayout layout = new VLayout(25);

    layout.setAlign(Alignment.CENTER);
    layout.setMargin(23);
    layout.setWidth("93%");

    final DataSource dataSource = SettingsDS.getInstance();

    final DynamicForm form = new DynamicForm();
    form.setIsGroup(true);
    form.setGroupTitle("Update");
    form.setNumCols(4);
    form.setDataSource(dataSource);
    form.setMargin(1);

    final ListGrid listGrid = new ListGrid();
    listGrid.setWidth100();
    listGrid.setHeight(130);
    listGrid.setDataSource(dataSource);
    listGrid.setAutoFetchData(true);
    listGrid.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            form.reset();
            form.editSelectedData(listGrid);
          }
        });

    section1.addItem(listGrid);
    section1.addItem(form);

    IButton butt = new IButton("Save");
    butt.setMargin(2);

    butt.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            form.saveData();
          }
        });
    section1.addItem(butt);

    Button button = new Button("Hello from Admin");
    button.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            Services.getHelloService()
                .hello(
                    "Admin",
                    new AsyncCallback<Void>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub

                      }

                      @Override
                      public void onSuccess(Void result) {
                        // TODO Auto-generated method stub

                      }
                    });
          }
        });

    sectionStack.addSection(section1);

    SectionStackSection section2 = new SectionStackSection("Help 1");
    section2.setExpanded(true);
    section2.setCanCollapse(true);

    section2.addItem(help1);
    sectionStack.addSection(section2);
    // SectionStackSection section3 = new SectionStackSection("Help 2");
    // section3.setExpanded(true);
    // section3.setCanCollapse(true);
    // section3.addItem(help2);
    // sectionStack.addSection(section3);

    // IButton resizeButton = new IButton("Resize Help 1");
    // resizeButton.setWidth(150);
    // resizeButton.addClickHandler(new ClickHandler() {
    // public void onClick(ClickEvent event) {
    // help1.setHeight(200);
    // }
    // });

    layout.addMember(sectionStack);

    // VLayout buttons = new VLayout(25);
    // buttons.setMembersMargin(10);
    // buttons.addMember(resizeButton);

    // layout.addMember(buttons);

    layout.addMember(button);
    layout.draw();

    // RootPanel.get().add(topTabSet);
  }
Ejemplo n.º 14
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());
  }