private String convertStringValueToString(DTCellValue52 dcv) { final String value = dcv.getStringValue(); return (value == null ? "" : value); }
private String convertStringValueToString(DTCellValue52 dcv) { final String value = dcv.getStringValue(); return (value == null ? "" : value); }
private int getNumber(final DTCellValue52 dtCellValue52) { try { return Integer.parseInt(dtCellValue52.getStringValue()); } catch (final NumberFormatException e) { return 0; } }
private int getNumber(final DTCellValue52 dtCellValue52) { try { return Integer.parseInt(dtCellValue52.getStringValue()); } catch (final NumberFormatException e) { return 0; } }
private int getPriorityOver( final int priorityColumnIndex, final List<DTCellValue52> row ) { final String stringValue = row.get( priorityColumnIndex ) .getStringValue(); if ( stringValue == null || stringValue.trim() .equals( "" ) ) { return 0; } else { return Integer.parseInt( stringValue ); } }
private BigDecimal getBigDecimal() { if (realCellValue.getNumericValue() != null) { return (BigDecimal) realCellValue.getNumericValue(); } else if (realCellValue.getStringValue() == null || realCellValue.getStringValue() .isEmpty()) { return null; } else { try { return new BigDecimal(realCellValue.getStringValue()); } catch (final NumberFormatException nfe) { return null; } } }
private static void assertBooleanDefaultValue(final DTCellValue52 dcv) { if (dcv.getBooleanValue() == null) { dcv.setBooleanValue(Boolean.valueOf(dcv.getStringValue())); } }
private static void assertBooleanDefaultValue(final DTCellValue52 dcv) { if (dcv.getBooleanValue() == null) { dcv.setBooleanValue(Boolean.valueOf(dcv.getStringValue())); } }
protected void updateCellsForOptionValueList(final BaseColumn originalColumn, final BaseColumn editedColumn) { //If the new column definition has no Value List the existing values remain valid final List<String> values = Arrays.asList(columnUtilities.getValueList(editedColumn)); final boolean clearExistingValues = values.size() > 0; final int columnIndex = model.getExpandedColumns().indexOf(originalColumn); for (List<DTCellValue52> row : this.model.getData()) { final DTCellValue52 dcv = row.get(columnIndex); if (clearExistingValues && !values.contains(dcv.getStringValue())) { dcv.clearValues(); } } }
private static void assertLongDefaultValue(final DTCellValue52 dcv) { if (dcv.getNumericValue() == null) { try { dcv.setNumericValue(Long.valueOf(dcv.getStringValue())); } catch (NumberFormatException nfe) { dcv.setNumericValue(0L); } } }
private static void assertIntegerDefaultValue(final DTCellValue52 dcv) { if (dcv.getNumericValue() == null) { try { dcv.setNumericValue(Integer.valueOf(dcv.getStringValue())); } catch (NumberFormatException nfe) { dcv.setNumericValue(0); } } }
private static void assertIntegerDefaultValue(final DTCellValue52 dcv) { if (dcv.getNumericValue() == null) { try { dcv.setNumericValue(Integer.valueOf(dcv.getStringValue())); } catch (NumberFormatException nfe) { dcv.setNumericValue(0); } } }
private static void assertLongDefaultValue(final DTCellValue52 dcv) { if (dcv.getNumericValue() == null) { try { dcv.setNumericValue(Long.valueOf(dcv.getStringValue())); } catch (NumberFormatException nfe) { dcv.setNumericValue(0L); } } }
private static void assertDateDefaultValue(final DTCellValue52 dcv) { if (dcv.getDateValue() == null) { try { dcv.setDateValue(format.parse(dcv.getStringValue())); } catch (IllegalArgumentException eae) { dcv.setDateValue(new Date()); } } } }
private static void assertDateDefaultValue(final DTCellValue52 dcv) { if (dcv.getDateValue() == null) { try { dcv.setDateValue(format.parse(dcv.getStringValue())); } catch (IllegalArgumentException eae) { dcv.setDateValue(new Date()); } } } }
@Test public void testGetEditingColStringValue() throws Exception { final DTCellValue52 cellValue52 = mock(DTCellValue52.class); doReturn(cellValue52).when(limitedEntryActionRetractFactCol52).getValue(); doReturn(limitedEntryActionRetractFactCol52).when(plugin).editingCol(); plugin.getEditingColStringValue(); verify(cellValue52).getStringValue(); }
@Test public void conversionToDataType() { final DTCellValue52 dcv = new DTCellValue52(value); dcv.setOtherwise(isOtherwise); cellUtilities.convertDTCellValueType(DataType.DataTypes.STRING, dcv); assertEquals(expected, dcv.getStringValue()); } }
@Test public void testSetCells() throws VetoException { modelSynchronizer.appendRow(); uiModel.setCellValue(0, 1, new BaseGridCellValue<String>("value")); assertEquals("value", model.getData().get(0).get(1).getStringValue()); assertEquals("value", uiModel.getCell(0, 1).getValue().getValue()); }
@Test public void testDefaultValueNull() throws Exception { final DTCellValue52 defaultValue = null; final DTCellValue52 clone = new DTCellValue52(defaultValue); assertEquals(DataType.DataTypes.STRING, clone.getDataType()); assertNull(clone.getBooleanValue()); assertNull(clone.getDateValue()); assertNull(clone.getNumericValue()); assertNull(clone.getStringValue()); } }
@Test public void testDefaultValue() throws Exception { final DTCellValue52 defaultValue = new DTCellValue52(1); final DTCellValue52 clone = new DTCellValue52(defaultValue); assertEquals(DataType.DataTypes.NUMERIC_INTEGER, clone.getDataType()); assertNull(clone.getBooleanValue()); assertNull(clone.getDateValue()); assertEquals(1, clone.getNumericValue()); assertNull(clone.getStringValue()); }