use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractBigIntegerColumnTest method testFormattingInDecorateCellInternal.
@Test
public void testFormattingInDecorateCellInternal() {
ITableRow row = Mockito.mock(ITableRow.class);
Cell cell = new Cell();
BigInteger testValue = BigInteger.valueOf(-123456789);
cell.setValue(testValue);
DecimalFormat df = BEANS.get(NumberFormatProvider.class).getNumberInstance(Locale.CANADA_FRENCH);
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 AbstractBooleanColumnWithTriStateTest method testToggle.
@Test
public void testToggle() {
TestTable table = new TestTable();
TestTable.TestBooleanColumn column = table.getTestBooleanColumn();
ITableRow row = table.addRowByArray(new Object[] { null });
Boolean value = column.getValue(0);
assertNull(value);
column.setEditable(true);
// toggle
IBooleanField checkbox = (IBooleanField) table.getTestBooleanColumn().prepareEdit(row);
checkbox.toggleValue();
table.getTestBooleanColumn().completeEdit(row, checkbox);
value = table.getTestBooleanColumn().getValue(0);
assertNotNull(value);
assertFalse(value);
// toggle
checkbox = (IBooleanField) table.getTestBooleanColumn().prepareEdit(row);
checkbox.toggleValue();
table.getTestBooleanColumn().completeEdit(row, checkbox);
value = table.getTestBooleanColumn().getValue(0);
assertNotNull(value);
assertTrue(value);
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class ContentAssistFieldTable method setLookupRows.
@Override
public void setLookupRows(List<? extends ILookupRow<LOOKUP_KEY>> lookupRows) {
List<ITableRow> rows = new ArrayList<ITableRow>();
for (ILookupRow<LOOKUP_KEY> lookupRow : lookupRows) {
ITableRow row = createRow();
// Note: we should use a ComparableLookupRow here because restoreSelection does not work
// since LookupRow does not implement equals/hashCode [awe]
row.getCellForUpdate(getKeyColumn()).setValue(lookupRow);
rows.add(row);
row.setEnabled(lookupRow.isEnabled());
AbstractTableRowData tableRowBean = lookupRow.getAdditionalTableRowData();
if (tableRowBean != null) {
ITableRowDataMapper mapper = createTableRowDataMapper(tableRowBean.getClass());
mapper.importTableRowData(row, tableRowBean);
}
}
try {
setTableChanging(true);
replaceRows(rows);
} finally {
setTableChanging(false);
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.
the class AbstractListBox method syncTableToValue.
private void syncTableToValue() {
if (m_valueTableSyncActive) {
return;
}
boolean resync = false;
try {
m_valueTableSyncActive = true;
m_table.setTableChanging(true);
//
Collection<ITableRow> checkedRows;
if (getTable().isCheckable()) {
checkedRows = getTable().getCheckedRows();
} else {
checkedRows = getTable().getSelectedRows();
}
List<KEY> checkedKeys = getKeyColumnInternal().getValues(checkedRows);
checkKeys(checkedKeys);
// Due to validate logic, the actual value
// may differ now, making a resync of the value is necessary
Set<KEY> validatedCheckedKeys = getCheckedKeys();
if (!CollectionUtility.equalsCollection(checkedKeys, validatedCheckedKeys)) {
resync = true;
}
if (!getTable().isCheckable()) {
// checks follow selection
for (ITableRow row : m_table.getRows()) {
row.setChecked(row.isSelected());
}
}
getTable().applyRowFilters();
} finally {
getTable().setTableChanging(false);
m_valueTableSyncActive = false;
}
if (resync) {
// The value of the treeBox is different
// from the one represented in the tree.
// Need to sync.
syncValueToTable();
}
}
use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow 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;
}
Aggregations