@Override public IResizeConfiguration getResizeConfiguration(IResizeShapeContext context) { IPattern pattern = delegate.getPattern(); IResizeConfiguration resizeConfiguration = pattern.getResizeConfiguration(context); if (resizeConfiguration != null) { return resizeConfiguration; } return super.getResizeConfiguration(context); }
public Row[] getTableDataWithColor( String gid, boolean addColor, List<IPattern> filterTitlesValues) { final Row[] rows = getTableDataWithColor(gid, addColor); if (rows.length == 0) { return rows; } final BigInteger[] cids = getCids(gid); final TableType table = getTable(gid); // Convert Map filterTitlesValues into Map filterPosValues final Map<Integer, IPattern> filterPosValues = new HashMap<Integer, IPattern>(); for (final IPattern pattern : filterTitlesValues) { BigInteger cid = BigInteger.valueOf(-1); for (final ColumnType column : table.getColumn()) { if (column.getName().equals(pattern.getColumnTitle())) { cid = column.getId(); break; } } if (cid.equals(BigInteger.valueOf(-1))) { continue; } int position = -1; for (int i = 0; i < cids.length; i++) { if (cids[i].equals(cid)) { position = i; break; } } if (position == -1) { continue; } filterPosValues.put(position, pattern); } // Filter the rows final List<Row> filterRows = new ArrayList<Row>(); for (final Row row : rows) { boolean allIncluded = true; for (final int position : filterPosValues.keySet()) { if (row.cells[position] == null) { continue; } final IPattern pattern = filterPosValues.get(position); final String rowValue = row.cells[position].value; if (rowValue.equals(ILMLCoreConstants.QM)) { allIncluded = false; continue; } final String type = pattern.getType(); if (pattern.isRange()) { // Range final String minValue = pattern.getMinValueRange(); final String maxValue = pattern.getMaxValueRange(); if (type.equals(ILMLCoreConstants.TABLECOLUMN_NUMERIC)) { if ((Integer.valueOf(rowValue) < Integer.valueOf(minValue)) || (Integer.valueOf(maxValue) < Integer.valueOf(rowValue))) { allIncluded = false; break; } } else { if (rowValue.compareTo(minValue) < 0 || maxValue.compareTo(rowValue) < 0) { allIncluded = false; break; } } } else if (pattern.isRelation()) { // Relation final String compareValue = pattern.getRelationValue(); final String compareOperator = pattern.getRelationOperator(); if (type.equals(ILMLCoreConstants.TABLECOLUMN_NUMERIC)) { final int rowValueInt = Integer.valueOf(rowValue); final int compareValueInt = Integer.valueOf(compareValue); if (compareOperator.equals(ILMLCoreConstants.EQ) && rowValueInt != compareValueInt) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.NEQ) && rowValueInt == compareValueInt) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.LT) && rowValueInt >= compareValueInt) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.LE) && rowValueInt > compareValueInt) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.GT) && rowValueInt <= compareValueInt) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.GE) && rowValueInt < compareValueInt) { allIncluded = false; break; } } else { if ((compareOperator.equals(ILMLCoreConstants.EQ) && !compareValue.equals(rowValue)) || (compareOperator.equals(ILMLCoreConstants.NEQ) && compareValue.equals(rowValue))) { allIncluded = false; break; } else if (type.equals(ILMLCoreConstants.TABLECOLUMN_ALPHA)) { if ((compareOperator.equals(ILMLCoreConstants.SI) && !rowValue.contains(compareValue)) || (compareOperator.equals(ILMLCoreConstants.NSI) && rowValue.contains(compareValue))) { allIncluded = false; break; } } else if (type.equals(ILMLCoreConstants.TABLECOLUMN_DATE)) { if (compareOperator.equals(ILMLCoreConstants.LT) && rowValue.compareTo(compareValue) >= 0) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.LE) && rowValue.compareTo(compareValue) > 0) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.GT) && rowValue.compareTo(compareValue) <= 0) { allIncluded = false; break; } else if (compareOperator.equals(ILMLCoreConstants.GE) && rowValue.compareTo(compareValue) < 0) { allIncluded = false; break; } } } } } if (allIncluded) { filterRows.add(row); } } return filterRows.toArray(new Row[filterRows.size()]); }
@Override public boolean canResizeShape(IResizeShapeContext context) { IPattern pattern = delegate.getPattern(); return pattern.canResizeShape(context); }
public void generateNewPattern(String gid, List<IPattern> filterValues) { final TablelayoutType tablelayout = lguiItem.getLayoutAccess().getTableLayout(gid); if (tablelayout != null) { for (final ColumnlayoutType column : tablelayout.getColumn()) { for (final IPattern filterValue : filterValues) { if (column.getKey().equals(filterValue.getColumnTitle())) { final PatternType pattern = new PatternType(); if (filterValue.isRange()) { final SelectType selectMin = new SelectType(); selectMin.setRel(ILMLCoreConstants.xGE_LC); selectMin.setValue(filterValue.getMinValueRange()); final SelectType selectMax = new SelectType(); selectMax.setRel(ILMLCoreConstants.xLE_LC); selectMax.setValue(filterValue.getMaxValueRange()); jaxbUtil.addPatternSelect(pattern, selectMin); jaxbUtil.addPatternSelect(pattern, selectMax); } else { final SelectType select = new SelectType(); select.setValue(filterValue.getRelationValue()); if (filterValue.getRelationOperator().equals(ILMLCoreConstants.LT)) { select.setRel(ILMLCoreConstants.xLT_LC); } else if (filterValue.getRelationOperator().equals(ILMLCoreConstants.LE)) { select.setRel(ILMLCoreConstants.xLE_LC); } else if (filterValue.getRelationOperator().equals(ILMLCoreConstants.GT)) { select.setRel(ILMLCoreConstants.xGT_LC); } else if (filterValue.getRelationOperator().equals(ILMLCoreConstants.GE)) { select.setRel(ILMLCoreConstants.xGE_LC); } else { select.setRel(filterValue.getRelationOperator()); } jaxbUtil.addPatternSelect(pattern, select); } column.setPattern(pattern); } } } } }