コード例 #1
0
ファイル: TableHandler.java プロジェクト: eclipse/ptp
  public TableType generateDefaultTable(String gid) {
    final TableType table = new TableType();
    table.setId(gid);
    table.setTitle(ILMLCoreConstants.TITLE_PREFIX + gid);
    final ContentType ct = ContentType.fromValue(ILguiItem.CONTENT_JOBS);
    table.setContenttype(ct);

    for (final ColumnlayoutType columnLayout :
        lguiItem.getLayoutAccess().getTableLayout(gid).getColumn()) {
      if (columnLayout.isActive()) {
        final ColumnType column = new ColumnType();
        column.setId(columnLayout.getCid());
        column.setName(columnLayout.getKey());
        generateDefaultSorting(column);
        if (columnLayout.getKey().equals(ILguiItem.JOB_STATUS)) {
          column.setType(ITableColumnLayout.COLUMN_TYPE_MANDATORY);
          if (gid.equals(ILMLCoreConstants.ID_ACTIVE_JOBS_VIEW)) {
            generateDefaultPattern(JobStatusData.RUNNING, ILMLCoreConstants.EQ, columnLayout);
          } else {
            generateDefaultPattern(JobStatusData.RUNNING, ILMLCoreConstants.NEQ, columnLayout);
          }
        }
        table.getColumn().add(column);
      }
    }
    jaxbUtil.addTable(lgui, table);
    return table;
  }
コード例 #2
0
ファイル: TableHandler.java プロジェクト: eclipse/ptp
 /**
  * Get column indexes of active columns for the table layout
  *
  * @param gid ID of the table layout
  * @return array of column indexes
  */
 private BigInteger[] getCids(String gid) {
   final TablelayoutType layout = lguiItem.getLayoutAccess().getTableLayout(gid);
   final BigInteger[] cids = new BigInteger[layout.getColumn().size()];
   for (int i = 0; i < layout.getColumn().size(); i++) {
     for (final ColumnlayoutType column : layout.getColumn()) {
       if (column.getPos() != null && column.getPos().equals(BigInteger.valueOf(i))) {
         cids[i] = column.getCid();
       }
     }
   }
   return cids;
 }
コード例 #3
0
ファイル: TableHandler.java プロジェクト: eclipse/ptp
 /**
  * Get column indexes of active columns for the table layout
  *
  * @param gid ID of the table layout
  * @return array of column indexes
  */
 private BigInteger[] getCidsActiveColumns(String gid) {
   final TablelayoutType layout = lguiItem.getLayoutAccess().getTableLayout(gid);
   final List<BigInteger> cids = new ArrayList<BigInteger>();
   for (int i = 0; i < layout.getColumn().size(); i++) {
     for (final ColumnlayoutType column : layout.getColumn()) {
       if (column.getPos() != null
           && column.getPos().equals(BigInteger.valueOf(i))
           && column.isActive()) {
         cids.add(column.getCid());
       }
     }
   }
   return cids.toArray(new BigInteger[cids.size()]);
 }
コード例 #4
0
ファイル: TableHandler.java プロジェクト: eclipse/ptp
  /**
   * Reading out the select patterns from the JAXB objects.
   *
   * <p>Also taking care of the switch between the operators on the client side and in the LML file.
   *
   * @param gid Id of the table from which we want to get the list of patterns.
   * @return List of select patterns
   */
  public List<IPattern> getPattern(String gid) {
    // Expects both elements to be available table and tablelayout
    // Requires sort datatype from table and pattern from tablelayout
    final TablelayoutType tablelayout = lguiItem.getLayoutAccess().getTableLayout(gid);
    final TableType table = getTable(gid);
    final LinkedList<IPattern> patternList = new LinkedList<IPattern>();
    // Avoid null values
    if (tablelayout == null || table == null) {
      return patternList;
    }
    final HashMap<ColumnlayoutType, ColumnType> columnLayoutToColumn =
        new HashMap<ColumnlayoutType, ColumnType>();
    // Search column for each columnlayout
    for (final ColumnlayoutType columnLayout : tablelayout.getColumn()) {
      for (final ColumnType aColumn : table.getColumn()) {
        // Search for columnlayout referencing to the column's ID
        if (aColumn.getId().intValue() == columnLayout.getCid().intValue()) {
          columnLayoutToColumn.put(columnLayout, aColumn);
          break;
        }
      }
    }

    for (final ColumnlayoutType columnLayout : tablelayout.getColumn()) {
      final ColumnType column = columnLayoutToColumn.get(columnLayout);
      if (column != null && columnLayout != null && columnLayout.getPattern() != null) {
        final List<SelectType> selects =
            jaxbUtil.getSelects(columnLayout.getPattern().getIncludeAndExcludeAndSelect());
        if (selects.size() == 1) {
          String rel = null;
          if (selects.get(0).getRel().equals(ILMLCoreConstants.xLT_LC)) {
            rel = ILMLCoreConstants.LT;
          } else if (selects.get(0).getRel().equals(ILMLCoreConstants.xLE_LC)) {
            rel = ILMLCoreConstants.LE;
          } else if (selects.get(0).getRel().equals(ILMLCoreConstants.xGT_LC)) {
            rel = ILMLCoreConstants.GT;
          } else if (selects.get(0).getRel().equals(ILMLCoreConstants.xGE_LC)) {
            rel = ILMLCoreConstants.GE;
          } else {
            rel = selects.get(0).getRel();
          }
          if (rel != null) {
            patternList.add(
                (new Pattern(columnLayout.getKey(), column.getSort().value()))
                    .setRelation(rel, selects.get(0).getValue()));
          }
        } else if (selects.size() == 2) {
          String minValue = null;
          String maxValue = null;
          for (final SelectType select : selects) {
            if (select.getRel().equals(ILMLCoreConstants.xLE_LC)) {
              maxValue = select.getValue();
            } else if (select.getRel().equals(ILMLCoreConstants.xGE_LC)) {
              minValue = select.getValue();
            }
          }
          if (minValue != null && maxValue != null) {
            patternList.add(
                (new Pattern(columnLayout.getKey(), column.getSort().value()))
                    .setRange(minValue, maxValue));
          }
        }
      }
    }
    return patternList;
  }