/** * Convert a Model cell to one that can be used in the UI * * @param cell * @return */ @Override public CellValue<? extends Comparable<?>> convertModelCellValue( BaseColumn column, DTCellValue52 dcv) { // Analysis cells do not use data-type if (column instanceof AnalysisCol52) { return makeNewAnalysisCellValue(); } // Other cells do use data-type DTDataTypes52 dataType = getDataType(column); assertDTCellValue(dataType, dcv); CellValue<? extends Comparable<?>> cell = null; switch (dataType) { case BOOLEAN: cell = makeNewBooleanCellValue(dcv.getBooleanValue()); break; case DATE: cell = makeNewDateCellValue(dcv.getDateValue()); break; case NUMERIC: if (column instanceof RowNumberCol52) { cell = makeNewRowNumberCellValue(dcv.getNumericValue()); } else { cell = makeNewNumericCellValue(dcv.getNumericValue()); if (column instanceof AttributeCol52) { AttributeCol52 at = (AttributeCol52) column; if (at.getAttribute().equals(RuleAttributeWidget.SALIENCE_ATTR)) { if (at.isUseRowNumber()) { cell = makeNewRowNumberCellValue(dcv.getNumericValue()); } } } } break; default: cell = makeNewStringCellValue(dcv.getStringValue()); if (column instanceof AttributeCol52) { AttributeCol52 ac = (AttributeCol52) column; if (ac.getAttribute().equals(RuleAttributeWidget.DIALECT_ATTR)) { cell = makeNewDialectCellValue(dcv.getStringValue()); } } } if (dcv.isOtherwise()) { cell.addState(CellState.OTHERWISE); } return cell; }
private DTCellValue52 cloneLimitedEntryValue(DTCellValue52 dcv) { if (dcv == null) { return null; } DTCellValue52 clone = new DTCellValue52(); switch (dcv.getDataType()) { case BOOLEAN: clone.setBooleanValue(dcv.getBooleanValue()); break; case DATE: clone.setDateValue(dcv.getDateValue()); break; case NUMERIC: clone.setNumericValue(dcv.getNumericValue()); break; case STRING: clone.setStringValue(dcv.getStringValue()); } return clone; }