@Override DTCellValue52 getCurrentValue() { //GUVNOR-1960: Always return a new instance return new DTCellValue52(); }
DTCellValue52 sourceCell = sourceRowData.get( iCol ); DTCellValue52 targetCell = rowData.get( iCol ); switch ( sourceCell.getDataType() ) { case BOOLEAN: targetCell.setBooleanValue( sourceCell.getBooleanValue() ); break; case DATE: targetCell.setDateValue( sourceCell.getDateValue() ); break; case NUMERIC: targetCell.setNumericValue( sourceCell.getNumericValue() ); break; case NUMERIC_BIGDECIMAL: targetCell.setNumericValue( (BigDecimal) sourceCell.getNumericValue() ); break; case NUMERIC_BIGINTEGER: targetCell.setNumericValue( (BigInteger) sourceCell.getNumericValue() ); break; case NUMERIC_BYTE: targetCell.setNumericValue( (Byte) sourceCell.getNumericValue() ); break; case NUMERIC_DOUBLE: targetCell.setNumericValue( (Double) sourceCell.getNumericValue() ); break; case NUMERIC_FLOAT: targetCell.setNumericValue( (Float) sourceCell.getNumericValue() ); break; case NUMERIC_INTEGER: targetCell.setNumericValue( (Integer) sourceCell.getNumericValue() );
private void removeOtherwiseStates( DTColumnConfig52 column ) { int index = this.model.getExpandedColumns().indexOf( column ); for ( List<DTCellValue52> row : this.model.getData() ) { DTCellValue52 dcv = row.get( index ); dcv.setOtherwise( false ); } }
private String convertDTCellValueToString( final DTCellValue52 dcv ) { switch ( dcv.getDataType() ) { case BOOLEAN: Boolean booleanValue = dcv.getBooleanValue(); return ( booleanValue == null ? null : booleanValue.toString() ); case DATE: Date dateValue = dcv.getDateValue(); return ( dateValue == null ? null : format.format( dcv.getDateValue() ) ); case NUMERIC: BigDecimal numericValue = (BigDecimal) dcv.getNumericValue(); return ( numericValue == null ? null : numericValue.toPlainString() ); case NUMERIC_BIGDECIMAL: BigDecimal bigDecimalValue = (BigDecimal) dcv.getNumericValue(); return ( bigDecimalValue == null ? null : bigDecimalValue.toPlainString() ); case NUMERIC_BIGINTEGER: BigInteger bigIntegerValue = (BigInteger) dcv.getNumericValue(); return ( bigIntegerValue == null ? null : bigIntegerValue.toString() ); case NUMERIC_BYTE: Byte byteValue = (Byte) dcv.getNumericValue(); return ( byteValue == null ? null : byteValue.toString() ); case NUMERIC_DOUBLE: Double doubleValue = (Double) dcv.getNumericValue(); return ( doubleValue == null ? null : doubleValue.toString() ); case NUMERIC_FLOAT: Float floatValue = (Float) dcv.getNumericValue(); return ( floatValue == null ? null : floatValue.toString() ); case NUMERIC_INTEGER: Integer integerValue = (Integer) dcv.getNumericValue(); return ( integerValue == null ? null : integerValue.toString() ); case NUMERIC_LONG:
private void convertDTCellValueFromNumeric( DataType.DataTypes dataType, DTCellValue52 dcv ) { final BigDecimal value = (BigDecimal) dcv.getNumericValue(); switch ( dataType ) { case NUMERIC_BIGDECIMAL: dcv.setNumericValue( value == null ? null : value ); break; case NUMERIC_BIGINTEGER: dcv.setNumericValue( value == null ? null : value.toBigInteger() ); break; case NUMERIC_BYTE: dcv.setNumericValue( value == null ? null : value.byteValue() ); break; case NUMERIC_DOUBLE: dcv.setNumericValue( value == null ? null : value.doubleValue() ); break; case NUMERIC_FLOAT: dcv.setNumericValue( value == null ? null : value.floatValue() ); break; case NUMERIC_INTEGER: dcv.setNumericValue( value == null ? null : value.intValue() ); break; case NUMERIC_LONG: dcv.setNumericValue( value == null ? null : value.longValue() ); break; case NUMERIC_SHORT: dcv.setNumericValue( value == null ? null : value.shortValue() ); break;
private List<CellValue<? extends Comparable<?>>> makeRowNumberColumnData( GuidedDecisionTable52 model, BaseColumn column, int colIndex ) { int dataSize = model.getData().size(); List<CellValue<? extends Comparable<?>>> columnData = new ArrayList<CellValue<? extends Comparable<?>>>( dataSize ); for ( int iRow = 0; iRow < dataSize; iRow++ ) { DTCellValue52 dcv = new DTCellValue52(); dcv.setNumericValue( iRow + 1 ); CellValue<? extends Comparable<?>> cv = cellValueFactory.convertModelCellValue( column, dcv ); columnData.add( cv ); } return columnData; }
private String convertFloatValueToString( DTCellValue52 dcv ) { final Float value = (Float) dcv.getNumericValue(); return ( value == null ? "" : value.toString() ); }
private void isRowEquivalent( List<DTCellValue52> row, String[] array ) { assertEquals( row.size(), array.length ); int newRowNum = (Integer) row.get( 0 ).getNumericValue(); int oldRowNum = Integer.valueOf( array[ 0 ] ); assertEquals( newRowNum, oldRowNum ); for ( int iCol = 1; iCol < row.size(); iCol++ ) { DTCellValue52 cell = row.get( iCol ); String v1 = cell.getStringValue(); String v2 = array[ iCol ]; assertTrue( isEqualOrNull( v1, v2 ) ); assertEquals( v1, v2 ); } }
private void convertDTCellValueFromString( DataType.DataTypes dataType, DTCellValue52 dcv ) { String text = dcv.getStringValue(); switch ( dataType ) { case BOOLEAN: dcv.setBooleanValue( ( text == null ? false : Boolean.valueOf( text ) ) ); break; case DATE: dcv.setDateValue( d ); break; case NUMERIC: dcv.setNumericValue( numericValue ); break; case NUMERIC_BIGDECIMAL: dcv.setNumericValue( bigDecimalValue ); break; case NUMERIC_BIGINTEGER: dcv.setNumericValue( bigIntegerValue ); break; case NUMERIC_BYTE: dcv.setNumericValue( byteValue ); break; case NUMERIC_DOUBLE: dcv.setNumericValue( doubleValue );
private String convertStringValueToString( DTCellValue52 dcv ) { final String value = dcv.getStringValue(); return ( value == null ? "" : value ); }
dtCell = new DTCellValue52( (Boolean) cell.getValue() ); break; case DATE: dtCell = new DTCellValue52( (Date) cell.getValue() ); break; case NUMERIC: dtCell = new DTCellValue52( (BigDecimal) cell.getValue() ); break; case NUMERIC_BIGDECIMAL: dtCell = new DTCellValue52( (BigDecimal) cell.getValue() ); break; case NUMERIC_BIGINTEGER: dtCell = new DTCellValue52( (BigInteger) cell.getValue() ); break; case NUMERIC_BYTE: dtCell = new DTCellValue52( (Byte) cell.getValue() ); break; case NUMERIC_DOUBLE: dtCell = new DTCellValue52( (Double) cell.getValue() ); break; case NUMERIC_FLOAT: dtCell = new DTCellValue52( (Float) cell.getValue() ); break; case NUMERIC_INTEGER: dtCell = new DTCellValue52( (Integer) cell.getValue() ); break; case NUMERIC_LONG: dtCell = new DTCellValue52( (Long) cell.getValue() ); break;
final Integer rowNumber = ( (Integer) row.get( 0 ).getNumericValue() ) - 1; RowDetector rowDetector = new RowDetector( rowNumber ); for ( Pattern52 pattern : model.getPatterns() ) { if ( conditionCol instanceof LimitedEntryCol ) { realCellValue = ( (LimitedEntryCol) conditionCol ).getValue(); cellIsNotBlank = visibleCellValue.getBooleanValue(); } else { realCellValue = visibleCellValue; cellIsNotBlank = visibleCellValue.hasValue(); if ( actionCol instanceof LimitedEntryCol ) { realCellValue = ( (LimitedEntryCol) actionCol ).getValue(); cellIsNotBlank = visibleCellValue.getBooleanValue(); } else { realCellValue = visibleCellValue; cellIsNotBlank = visibleCellValue.hasValue();
private ActionRetractFactCol52 cloneActionRetractColumn( ActionRetractFactCol52 col ) { ActionRetractFactCol52 clone = null; if ( col instanceof LimitedEntryCol ) { clone = new LimitedEntryActionRetractFactCol52(); DTCellValue52 dcv = new DTCellValue52( ( (LimitedEntryCol) col ).getValue().getStringValue() ); ( (LimitedEntryCol) clone ).setValue( dcv ); } else { clone = new ActionRetractFactCol52(); } clone.setHeader( col.getHeader() ); clone.setHideColumn( col.isHideColumn() ); return clone; }
private boolean updateCellsForOptionValueList( final DTColumnConfig52 editColumn, final DTColumnConfig52 origColumn ) { //If the new column definition has no Value List the existing values remain valid List<String> vals = Arrays.asList( utils.getValueList( editColumn ) ); final boolean clearExistingValues = vals.size() > 0; boolean bUpdateColumnData = false; int iCol = model.getExpandedColumns().indexOf( origColumn ); for ( List<DTCellValue52> row : this.model.getData() ) { if ( !vals.contains( row.get( iCol ).getStringValue() ) ) { bUpdateColumnData = true; } if ( clearExistingValues ) { row.get( iCol ).clearValues(); } } return bUpdateColumnData; }
String currentItem = value.getStringValue(); int selectedIndexOffset = ( allowEmptyValues ? 1 : 0 ); for ( int i = 0; i < completions.length; i++ ) { if ( lb.getItemCount() > 0 ) { lb.setSelectedIndex( 0 ); value.setStringValue( lb.getValue( 0 ) ); } else { value.setStringValue( null );
private void assertDefaultValue() { final List<String> valueList = Arrays.asList( utils.getValueList( editingCol ) ); if ( valueList.size() > 0 ) { final String defaultValue = utilities.asString( editingCol.getDefaultValue() ); if ( !valueList.contains( defaultValue ) ) { editingCol.getDefaultValue().clearValues(); } } else { //Ensure the Default Value has been updated to represent the column's data-type. final DTCellValue52 defaultValue = editingCol.getDefaultValue(); final DataType.DataTypes dataType = utilities.getDataType( editingCol ); utilities.assertDTCellValue( dataType, defaultValue ); } }
LimitedEntryCol lecOrig = (LimitedEntryCol) origColumn; LimitedEntryCol lecEditing = (LimitedEntryCol) editColumn; if ( !lecOrig.getValue().equals( lecEditing.getValue() ) ) { bUpdateColumnDefinition = true;
private String convertDateValueToString( DTCellValue52 dcv ) { final Date value = dcv.getDateValue(); String result = ""; if ( value != null ) { result = DATE_CONVERTOR.format( (Date) value ); } return result; }
private String convertBooleanValueToString( DTCellValue52 dcv ) { final Boolean value = dcv.getBooleanValue(); return ( value == null ? "" : value.toString() ); }
/** * The column-data type is looked up from the SuggestionCompletionEngine and * represents the *true* data-type that the column represents. The data-type * associated with the Cell Value can be incorrect for legacy models. For * pre-5.2 they will always be String and for pre-5.4 numerical fields are * always Numeric * @param dataType * @param dcv */ public void assertDTCellValue( DataType.DataTypes dataType, DTCellValue52 dcv ) { if ( dcv == null ) { return; } //If already converted exit if ( dataType.equals( dcv.getDataType() ) ) { return; } switch ( dcv.getDataType() ) { case NUMERIC: convertDTCellValueFromNumeric( dataType, dcv ); break; default: convertDTCellValueFromString( dataType, dcv ); } }