protected void addHeader() {
    GridLayout header = new GridLayout(3, 2);
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    header.setSpacing(true);
    header.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.PROCESS_50);
    header.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    header.addComponent(nameLabel, 1, 0, 2, 0);

    // Add start time
    PrettyTimeLabel startTimeLabel =
        new PrettyTimeLabel(
            i18nManager.getMessage(Messages.PROCESS_START_TIME),
            historicProcessInstance.getStartTime(),
            null,
            true);
    startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME);
    header.addComponent(startTimeLabel, 1, 1);

    header.setColumnExpandRatio(1, 1.0f);
    header.setColumnExpandRatio(2, 1.0f);

    panelLayout.addComponent(header);
  }
Exemplo n.º 2
0
  protected void addDeploymentName() {

    GridLayout taskDetails = new GridLayout(3, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);
    taskDetails.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.DEPLOYMENT_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add deployment name
    Label nameLabel = new Label();
    if (deployment.getName() != null) {
      nameLabel.setValue(deployment.getName());
    } else {
      nameLabel.setValue(i18nManager.getMessage(Messages.DEPLOYMENT_NO_NAME));
    }
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 2, 0);

    // Add deploy time
    PrettyTimeLabel deployTimeLabel =
        new PrettyTimeLabel(
            i18nManager.getMessage(Messages.DEPLOYMENT_DEPLOY_TIME),
            deployment.getDeploymentTime(),
            null,
            true);
    deployTimeLabel.addStyleName(ExplorerLayout.STYLE_DEPLOYMENT_HEADER_DEPLOY_TIME);
    taskDetails.addComponent(deployTimeLabel, 1, 1);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);

    addDetailComponent(taskDetails);
  }
Exemplo n.º 3
0
    public void attach() {
      this.addStyleName("custom-report-step-caption");
      Label caption = new Label("Select Reference Table");
      caption.setStyleName("caption");
      this.addComponent(caption);
      box.setWidth(fieldWidth);
      box.setImmediate(true);
      box.addStyleName("custom-report-step-box");
      BeanItemContainer<ReportModel> container =
          new BeanItemContainer<ReportModel>(ReportModel.class);
      container.addAll(getReportModels());
      box.setContainerDataSource(container);
      box.setItemCaptionPropertyId("tableLabel");
      box.addListener(this);
      this.addComponent(box);
      columnLayout.setSpacing(true);
      columnLayout.setVisible(false);

      //			List<ReportTable> relateReportTables=null;
      //			if(getEditableReportTable()!=null){
      //				for(Iterator<ReportModel> it=container.getItemIds().iterator();it.hasNext();){
      //					rm=(ReportModel) it.next();
      //					if(rm.getTableName().equals(getEditableReportTable().getTableName())){
      //						box.setValue(rm);
      //						mainReportTable=rm.getReportTables().iterator().next();
      //						relateReportTables=buildEditableRelatedTableInfo();
      //						break;
      //					}
      //				}
      //				box.setValue(getEditableReportTable().getTableName());
      //				rm.getReportTables().addAll(relateReportTables);
      //			}

      if (relateReportTables != null && isEditableFlg) {
        columnLayout.setVisible(true);
        columnLayout.setImmediate(true);
        //				columnLayout.addComponent(gridLayout);

        //				box.setValue(getEditableReportTable().getTableName());
        //				rm.getReportTables().addAll(relateReportTables);

        for (ReportTable relateRT : relateReportTables) {
          for (Iterator<ReportModel> it = container.getItemIds().iterator(); it.hasNext(); ) {
            ReportModel tempRm = it.next();
            if (tempRm.getTableName().equals(relateRT.getTableName())) {
              box.setValue(tempRm);
              break;
            }
          }
          List<ReportColumn> columnFields = relateRT.getReportColumns();

          for (final ReportColumn columnField : columnFields) {
            if (columnField.getColumnLabel() != null) {
              ReportColumnCard reportColumnCard =
                  new ReportColumnCard(columnField) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void layoutClick(LayoutClickEvent event) {
                      ReportColumn reportColumn = columnField;
                      reportColumn.setColumnUseMode(
                          ReportConfiguration.ReportColumnType.OutputColumn.toString());
                      rm.getSubTableSelectedColumns().add(reportColumn);
                    }
                  };

              for (ReportColumn rc : relateRT.getReportColumns()) {
                if (rc.getColumnUseMode() != null
                    && rc.getColumnUseMode()
                        .equals(ReportConfiguration.ReportColumnType.OutputColumn.toString())) {
                  if (rc.getColumnName().equals(columnField.getColumnName())) {
                    reportColumnCard.getCheckBox().setValue(true);
                  }
                }
              }

              gridLayout.addComponent(reportColumnCard);
            }
          }
        }
      }

      this.addComponent(columnLayout);
      reportColumnLabel.setStyleName("custom-report-step-column-caption");
      reportColumnLabel.setVisible(false);
      reportColumnStepDesc.setStyleName("custom-report-step-column-desc");
      reportColumnStepDesc.setVisible(false);
      this.addComponent(reportColumnLabel);
      this.addComponent(reportColumnStepDesc);
      gridLayout.setSizeFull();
      gridLayout.setImmediate(true);
      gridLayout.addStyleName("custom-report-step-column-gridlayout");
      this.addComponent(gridLayout);
    }
Exemplo n.º 4
0
  private void initUI() {
    addStyleName(Reindeer.WINDOW_LIGHT);
    setModal(true);
    setHeight("90%");
    setWidth("60%");
    center();

    HorizontalLayout bottom = new HorizontalLayout();
    bottom.setStyleName(ExplorerLayout.THEME);
    bottom.setSizeFull();
    // bottom.setMargin(true);
    bottom.setSpacing(true);
    bottom.addStyleName(Runo.LAYOUT_DARKER);
    this.setContent(bottom);

    scheduleEventFieldGroup = new FieldGroup();
    scheduleEventFieldGroup.setBuffered(true);
    if (currentBeanItem != null) {
      scheduleEventFieldGroup.setItemDataSource(currentBeanItem);
    }

    line = new GridLayout(4, 20);
    line.addStyleName("v-gridlayout");
    line.setWidth("100%");
    line.setSpacing(true);
    line.setMargin(true);

    final Label lbTitle = CommonFieldHandler.createLable("计划名称:");
    line.addComponent(lbTitle);
    line.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT);
    final TextField txtTitle = new TextField();
    txtTitle.setWidth("80%");
    scheduleEventFieldGroup.bind(txtTitle, "name");
    line.addComponent(txtTitle, 1, 0, 3, 0);
    line.setComponentAlignment(txtTitle, Alignment.MIDDLE_LEFT);

    Label label2 = CommonFieldHandler.createLable("开始时间:");
    line.addComponent(label2, 0, 1, 0, 1);
    line.setComponentAlignment(label2, Alignment.MIDDLE_RIGHT);
    // 创建一个时间后台变化的listener
    BlurListener startTimeListener = createTimeReCountListener();
    DateField startDateField = CommonFieldHandler.createDateField("", false);
    scheduleEventFieldGroup.bind(startDateField, "startDate");
    startDateField.addBlurListener(startTimeListener);
    line.addComponent(startDateField, 1, 1, 1, 1);
    line.setComponentAlignment(startDateField, Alignment.MIDDLE_LEFT);

    Label label3 = CommonFieldHandler.createLable("估算时间:");
    line.addComponent(label3, 2, 1, 2, 1);
    line.setComponentAlignment(label3, Alignment.MIDDLE_RIGHT);
    HorizontalLayout hlay = new HorizontalLayout();
    final TextField estimateField = new TextField();
    estimateField.setValue("1");
    estimateField.setWidth("60px");
    estimateField.setNullSettingAllowed(false);
    BlurListener timeReCountListener = createTimeReCountListener();
    estimateField.addBlurListener(timeReCountListener);
    scheduleEventFieldGroup.bind(estimateField, "estimate");
    hlay.addComponent(estimateField);
    Map<Object, String> data = new HashMap();
    data.put(0, "天");
    data.put(1, "时");
    data.put(2, "分");
    // WW_TODO 估算时间单位
    ComboBox unit_cb = createComboBox(data, "55px");
    scheduleEventFieldGroup.bind(unit_cb, "estimateUnit");
    hlay.addComponent(unit_cb);
    line.addComponent(hlay, 3, 1, 3, 1);
    line.setComponentAlignment(hlay, Alignment.MIDDLE_LEFT);

    Label label4 = CommonFieldHandler.createLable("到期时间:");
    line.addComponent(label4, 0, 2, 0, 2);
    line.setComponentAlignment(label4, Alignment.MIDDLE_RIGHT);
    completionDateField = CommonFieldHandler.createDateField("", false);
    line.addComponent(completionDateField, 1, 2, 1, 2);
    line.setComponentAlignment(completionDateField, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(completionDateField, "completionDate");
    //		line.setExpandRatio(completionDateField, 1.0f);

    Label label6 = CommonFieldHandler.createLable("消耗时间:");
    line.addComponent(label6, 2, 2, 2, 2);
    line.setComponentAlignment(label6, Alignment.MIDDLE_RIGHT);
    TextField gs1 = new TextField();
    gs1.setValue("20%");
    gs1.setInputPrompt("50%");
    scheduleEventFieldGroup.bind(gs1, "useup");
    line.addComponent(gs1, 3, 2, 3, 2);
    line.setComponentAlignment(gs1, Alignment.MIDDLE_LEFT);

    Label label5 = CommonFieldHandler.createLable("优先级:");
    //		label.setWidth("80px");
    line.addComponent(label5, 0, 3, 0, 3);
    line.setComponentAlignment(label5, Alignment.MIDDLE_RIGHT);
    Map<Object, String> dtp = new HashMap();
    dtp.put(0, "底");
    dtp.put(1, "中");
    dtp.put(2, "高");
    ComboBox selectPriority = createComboBox(dtp, "100px");
    //		NativeSelect select = new NativeSelect();
    //		select.addItem("无");
    //		select.addItem("0(最低)");
    //		String itemId = "1(中)";
    //		select.addItem(itemId);
    //		select.addItem("2(高)");
    selectPriority.setNullSelectionAllowed(false);
    selectPriority.select(2);
    scheduleEventFieldGroup.bind(selectPriority, "priority");
    line.addComponent(selectPriority, 1, 3, 1, 3);
    line.setComponentAlignment(selectPriority, Alignment.MIDDLE_LEFT);

    Label label1 = CommonFieldHandler.createLable("完成百分比:");
    line.addComponent(label1, 2, 3, 2, 3);
    line.setComponentAlignment(label1, Alignment.MIDDLE_RIGHT);
    TextField tf = new TextField();
    tf.setInputPrompt("50%");
    line.addComponent(tf, 3, 3, 3, 3);
    line.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);

    Label label7 = CommonFieldHandler.createLable("关联日程:");
    line.addComponent(label7, 0, 4, 0, 4);
    line.setComponentAlignment(label7, Alignment.MIDDLE_RIGHT);
    CheckBox relatedCalendar_cb = new CheckBox();
    relatedCalendar_cb.setValue(false);
    line.addComponent(relatedCalendar_cb, 1, 4, 1, 4);
    line.setComponentAlignment(relatedCalendar_cb, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(relatedCalendar_cb, "relatedCalendar");

    Label lbStatus = CommonFieldHandler.createLable("计划状态:");
    lbStatus.setWidth("20px");
    line.addComponent(lbStatus, 2, 4, 2, 4);
    line.setComponentAlignment(lbStatus, Alignment.MIDDLE_RIGHT);
    Map<Object, String> sta = new HashMap();
    sta.put(0, "新建");
    sta.put(1, "完成");
    sta.put(2, "关闭");
    sta.put(3, "取消");
    ComboBox sectStatus = createComboBox(sta, "100px");
    sectStatus.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(sectStatus, "status");
    line.addComponent(sectStatus, 3, 4, 3, 4);
    line.setComponentAlignment(sectStatus, Alignment.MIDDLE_LEFT);

    Label label8 = CommonFieldHandler.createLable("关联外部任务:");
    label8.setWidth("20px");
    line.addComponent(label8, 0, 5, 0, 5);
    line.setComponentAlignment(label8, Alignment.MIDDLE_RIGHT);
    CheckBox cb = new CheckBox();
    cb.setValue(true);
    line.addComponent(cb, 1, 5, 1, 5);
    line.setComponentAlignment(cb, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(cb, "relatedTask");

    Label label9 = CommonFieldHandler.createLable("外部任务类型:");
    label9.setWidth("20px");
    line.addComponent(label9, 2, 5, 2, 5);
    line.setComponentAlignment(label9, Alignment.MIDDLE_RIGHT);
    Map<Object, String> oat = new HashMap();
    oat.put(0, "外包任务");
    oat.put(1, "外包任务-类型2");
    ComboBox select2 = createComboBox(oat, "150px");
    //		NativeSelect select2 = new NativeSelect();
    //		select2.addItem("外包任务");
    //		select2.addItem("外包任务-类型2");
    select2.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(select2, "type");
    line.addComponent(select2, 3, 5, 3, 5);
    line.setComponentAlignment(select2, Alignment.MIDDLE_LEFT);
    // select2.select("Timed");

    Label lbOwnGrp = CommonFieldHandler.createLable("计划分配团队:");
    lbOwnGrp.setWidth("20px");
    line.addComponent(lbOwnGrp, 0, 6, 0, 6);
    line.setComponentAlignment(lbOwnGrp, Alignment.MIDDLE_RIGHT);

    //		NativeSelect sectOwnGrp = new NativeSelect();
    Map<Object, String> groupsMap =
        teamService.queryTeamOfUser(LoginHandler.getLoggedInUser().getId());
    groupsMap.put("", "请选择");
    ComboBox sectOwnGrp = createComboBox(groupsMap, "150px");
    //		for (String p : groupsMap.keySet()) {
    //			String title = groupsMap.get(p);
    //			sectOwnGrp.addItem(p);
    //			sectOwnGrp.setItemCaption(p, title);
    //		}
    sectOwnGrp.setNullSelectionAllowed(false);
    ValueChangeListener valueChangeListener = createValueChangeListener();
    sectOwnGrp.addValueChangeListener(valueChangeListener);
    sectOwnGrp.setImmediate(true);
    scheduleEventFieldGroup.bind(sectOwnGrp, "assignedTeam");
    line.addComponent(sectOwnGrp, 1, 6, 1, 6);
    line.setComponentAlignment(sectOwnGrp, Alignment.MIDDLE_LEFT);

    final Label lbOwner = CommonFieldHandler.createLable("计划分配用户:");
    lbOwner.setWidth("20px");
    line.addComponent(lbOwner, 2, 6, 2, 6);
    line.setComponentAlignment(lbOwner, Alignment.MIDDLE_RIGHT);
    //		sectOwner = new NativeSelect();
    //		sectOwner.addItem("请选择");
    sectOwner.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(sectOwner, "assignedUser");
    line.addComponent(sectOwner, 3, 6, 3, 6);
    line.setComponentAlignment(sectOwner, Alignment.MIDDLE_LEFT);

    final Label lbDesc = CommonFieldHandler.createLable("计划描述:");
    lbDesc.setWidth("15px");
    line.addComponent(lbDesc, 0, 7, 0, 7);
    line.setComponentAlignment(lbDesc, Alignment.MIDDLE_RIGHT);
    final TextArea taDesc = CommonFieldHandler.createTextArea("");
    taDesc.setWidth("85%");
    taDesc.setHeight("290px");
    scheduleEventFieldGroup.bind(taDesc, "description");
    line.addComponent(taDesc, 1, 7, 3, 13);
    line.setComponentAlignment(taDesc, Alignment.MIDDLE_LEFT);

    //		CKEditorConfig config = new CKEditorConfig();

    final Button updateSave = new Button("保存");
    updateSave.addClickListener(
        new ClickListener() {
          @SuppressWarnings("unchecked")
          public void buttonClick(ClickEvent event) {
            // WW_TODO 修改保存到数据库
            Todo fieldGroupTodo = saveFieldGroupToDB();
            fireEvent(
                new SubmitEvent(
                    updateSave,
                    SubmitEvent.SUBMITTED,
                    scheduleEventFieldGroup.getItemDataSource()));

            // close popup window
            close();
            /*
             * Todo fieldGroupTodo = saveFieldGroupToDB(); //reflash current
             * Item copyBeanValueToContainer(hContainer,(BeanItem<Todo>)(
             * scheduleEventFieldGroup.getItemDataSource())); //刷新日历
             * main.refreshCalendarView(); Notification.show("保存成功",
             * Notification.Type.HUMANIZED_MESSAGE); //如果有外部流程,启动外部流程 if
             * (fieldGroupTodo.getRelatedTask()) { ViewToolManager
             * .showPopupWindow(new ActivityStartPopupWindow( "1111")); }
             */
            if (fieldGroupTodo.getRelatedTask()) {
              ViewToolManager.showPopupWindow(new ActivityStartPopupWindow("1111"));
            }
          }
        });
    line.addComponent(updateSave, 3, 14, 3, 14);
    line.setComponentAlignment(updateSave, Alignment.MIDDLE_RIGHT);
    //		line.setExpandRatio(updateSave, 1.0f);

    bottom.addComponent(line);
  }