示例#1
0
 public boolean clearDuplicateRelateColumnResult(ReportColumn reportColumn) {
   for (ReportColumn sReportColumn :
       ReportModelPool.findReportModelByCurrentUser(user).getSubTableSelectedColumns()) {
     if (sReportColumn
         .getColumnUseMode()
         .equals(ReportConfiguration.ReportColumnType.OutputColumn.toString())) {
       if (sReportColumn.getColumnName().equals(reportColumn.getColumnName())
           && sReportColumn.getColumnLabel().equals(reportColumn.getColumnLabel())) {
         return false;
       }
     }
   }
   return true;
 }
示例#2
0
    @Override
    public void valueChange(ValueChangeEvent event) {
      rm = (ReportModel) box.getValue();
      if (rm != null) {
        columnLayout.setVisible(true);
        columnLayout.setImmediate(true);
        reportColumnStepDesc.setVisible(true);
        List<ReportColumn> columnFields = rm.getReportTables().iterator().next().getReportColumns();
        gridLayout.removeAllComponents();
        gridLayout.requestRepaintAll();
        gridLayout.setRows(columnFields.size());
        gridLayout.setSpacing(true);

        for (final ReportColumn columnField : columnFields) {
          if (columnField.getColumnLabel() != null) {
            ReportColumnCard reportColumnCard =
                new ReportColumnCard(columnField) {
                  @Override
                  public void layoutClick(LayoutClickEvent event) {
                    if (clearDuplicateRelateColumnResult(columnField)) {
                      System.out.println(
                          "User click related column: " + columnField.getColumnLabel());
                      ReportColumn reportColumn = new ReportColumn();
                      reportColumn.setColumnName(columnField.getColumnName());
                      reportColumn.setColumnLabel(columnField.getColumnLabel());
                      reportColumn.setColumnUseMode(
                          ReportConfiguration.ReportColumnType.OutputColumn.toString());
                      if (ReportModelPool.findReportModelByCurrentUser(user)
                              .getSubTableSelectedColumns()
                          == null) {
                        HashSet<ReportColumn> reportColumns = new HashSet<ReportColumn>();
                        reportColumns.add(reportColumn);
                        ReportModelPool.findReportModelByCurrentUser(user)
                            .setSubTableSelectedColumns(reportColumns);
                      } else {
                        ReportModelPool.findReportModelByCurrentUser(user)
                            .getSubTableSelectedColumns()
                            .add(reportColumn);
                      }
                    }
                  }
                };
            gridLayout.addComponent(reportColumnCard);
          }
        }
        this.addComponent(columnLayout);
        ReportTable selectSubReportTable = rm.getReportTables().iterator().next();
        ReportModelPool.findReportModelByCurrentUser(user)
            .getReportTables()
            .add(selectSubReportTable);
        boolean removeStepflg = false;
        for (WizardStep step : w.getSteps()) {
          if (step.getCaption() != null) {
            if (step.getCaption().equals("Report Filter Step")) {
              removeStepflg = true;
            }
          }
        }
        if (removeStepflg) {
          w.removeStep("Report Filter Step");
        }
        w.removeStep("Preview Step");
        w.addStep(new ReportFilterStep(w, user), "Report Filter Step");
        w.addStep(new PreviewStep(w, user), "Preview Step");
      }
    }
示例#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);
    }