use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractColumnTest method testValidate_MandatoryChange.
/**
* Tests mandatory validation after setting property.
*/
@Test
public void testValidate_MandatoryChange() {
TestVetoTable table = new TestVetoTable();
table.addRowsByArray(new String[] { "", "" });
table.addRowsByArray(new String[] { "", "" });
table.getValidateTestColumn().setMandatory(true);
ICell c0 = table.getCell(0, 0);
assertFalse(c0.isContentValid());
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractColumnTest method testValidateVetoColumn.
/**
* Tests validation with a {@link VetoException}<br>
* Invalid column values should have an error status
*/
@Test
public void testValidateVetoColumn() {
TestVetoTable table = new TestVetoTable();
table.addRowsByArray(new String[] { INVALID, "a" });
ICell c0 = table.getCell(0, 0);
ICell c1 = table.getCell(1, 0);
assertErrorStatus(c0);
assertNoErrorStatus(c1);
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractColumnTest method testInvalidColumn.
/**
* Test that value, text and error status are correct after adding an invalid row to a table with
* {@link AbstractTable#addRowByArray(Object)}
*/
@Test
public void testInvalidColumn() {
TestTable table = new TestTable();
table.addRowsByArray(new String[] { INVALID, "a" });
ICell c0 = table.getCell(0, 0);
ICell c1 = table.getCell(1, 0);
assertFalse(table.getValidateTestColumn().isContentValid(table.getRow(0)));
assertNoErrorStatus(c1);
assertErrorStatus(c0);
// invalid value is set on the table anyways
assertEquals(INVALID, c0.getValue());
assertEquals(INVALID, c0.getText());
assertEquals("a", c1.getValue());
assertEquals("a", c1.getText());
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractListBox method getCheckedLookupRows.
@SuppressWarnings("unchecked")
@Override
public Set<ILookupRow<KEY>> getCheckedLookupRows() {
Collection<ITableRow> checkedRows = getTable().getCheckedRows();
Set<ILookupRow<KEY>> result = new HashSet<ILookupRow<KEY>>(checkedRows.size());
for (ITableRow row : checkedRows) {
ICell cell = row.getCell(1);
result.add(new LookupRow<KEY>((KEY) row.getCellValue(0), cell.getText()).withIconId(cell.getIconId()).withTooltipText(cell.getTooltipText()).withBackgroundColor(cell.getBackgroundColor()).withForegroundColor(cell.getForegroundColor()).withFont(cell.getFont()).withEnabled(row.isEnabled()));
}
return result;
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractDateColumnTest method testConfiguredDateFormat.
@Test
public void testConfiguredDateFormat() throws Exception {
Date testDate = new Date();
SimpleDateFormat df = new SimpleDateFormat(TEST_FORMAT1, NlsLocale.get());
TestTable table = new TestTable();
table.addRowsByArray(new Object[] { testDate });
ICell cell = table.getCell(0, 0);
assertTrue(cell.getValue() instanceof Date);
assertEquals(df.format(testDate), cell.getText());
}
Aggregations