use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractIntegerColumnTest method testPrepareEditInternal.
@Test
public void testPrepareEditInternal() {
AbstractIntegerColumn column = new AbstractIntegerColumn() {
};
column.setMandatory(true);
ITableRow row = mock(ITableRow.class);
IIntegerField field = (IIntegerField) column.prepareEditInternal(row);
assertEquals("mandatory property to be progagated to field", column.isMandatory(), field.isMandatory());
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractIntegerColumnTest method testFormattingInDecorateCellInternal.
@Test
public void testFormattingInDecorateCellInternal() {
ITableRow row = Mockito.mock(ITableRow.class);
Cell cell = new Cell();
Integer testValue = Integer.valueOf(-123456789);
cell.setValue(testValue);
for (Locale locale : DecimalFormat.getAvailableLocales()) {
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(locale);
df.applyPattern(getFormat().toPattern());
setFormat(df);
updateDisplayText(row, cell);
assertEquals("cell text not formatted as expected", df.format(testValue), cell.getText());
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractLongColumnTest method testFormattingInDecorateCellInternal.
@Test
public void testFormattingInDecorateCellInternal() {
ITableRow row = mock(ITableRow.class);
Cell cell = new Cell();
Long testValue = Long.valueOf(-123456789);
cell.setValue(testValue);
for (Locale locale : DecimalFormat.getAvailableLocales()) {
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(locale);
df.applyPattern(getFormat().toPattern());
setFormat(df);
updateDisplayText(row, cell);
assertEquals("cell text not formatted as expected", df.format(testValue), cell.getText());
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractMixedSmartColumnTest method tesConvertValueToKeyCallback.
/**
* Tests that {@link AbstractMixedSmartColumn#execPrepareLookup(ILookupCall, ITableRow)} is called when
* {@link IMixedSmartField#prepareKeyLookup(ILookupCall, Object)} is called on the editor field.
*/
@SuppressWarnings("unchecked")
@Test
public void tesConvertValueToKeyCallback() {
TestMixedSmartColumn column = new TestMixedSmartColumn();
ITableRow row = Mockito.mock(ITableRow.class);
AbstractMixedSmartField<String, Long> field = (AbstractMixedSmartField<String, Long>) column.prepareEditInternal(row);
field.setValue("test");
Long lookupKey = field.getValueAsLookupKey();
assertEquals(Long.valueOf(0L), lookupKey);
assertEquals(column.lastValue, "test");
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractNumberColumnTest method testPrepareEditInternal.
@Test
public void testPrepareEditInternal() {
setGroupingUsed(false);
String bColor = "469406";
setBackgroundColor(bColor);
String fColor = "FAAAF1";
setForegroundColor(fColor);
FontSpec fontSpec = new FontSpec("Arial", FontSpec.STYLE_ITALIC | FontSpec.STYLE_BOLD, 0);
setFont(fontSpec);
Integer minValue = Integer.valueOf(-42);
setMinValue(minValue);
Integer maxValue = Integer.valueOf(42);
setMaxValue(maxValue);
ITableRow row = Mockito.mock(ITableRow.class);
AbstractIntegerField field = (AbstractIntegerField) prepareEditInternal(row);
assertFalse("expected groupingUsed property to be propagated to field", field.isGroupingUsed());
setGroupingUsed(true);
field = (AbstractIntegerField) prepareEditInternal(row);
assertTrue("expected groupingUsed property to be propagated to field", field.isGroupingUsed());
assertEquals("expected backgroundColor property to be progagated to field", bColor, field.getBackgroundColor());
assertEquals("expected foregroundColor property to be progagated to field", fColor, field.getForegroundColor());
assertEquals("expected font property to be progagated to field", fontSpec, field.getFont());
assertEquals("expected minValue property to be progagated to field", minValue, field.getMinValue());
assertEquals("expected maxValue property to be progagated to field", maxValue, field.getMaxValue());
}
Aggregations