use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractDateColumnTest method testChangeFormat.
/**
* Tests that the cell text changes to the correct format, if the format is set on a column
*/
@Test
public void testChangeFormat() {
Date testDate = new Date();
String testFormat = "YYYY--MM--dd";
SimpleDateFormat df = new SimpleDateFormat(testFormat, NlsLocale.get());
TestTable table = new TestTable();
table.addRowsByArray(new Object[] { testDate });
TestDateColumn col = table.getTestDateColumn();
col.setFormat(testFormat);
ICell cell = table.getCell(0, 0);
assertTrue(cell.getValue() instanceof Date);
assertEquals(df.format(testDate), cell.getText());
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractPageWithTable method getChildPagesFor.
/**
* Computes the list of linked child pages for the given table rows. Revalidates the the pages cell if
* <code>updateChildPageCells</code> is true. Otherwise, the cells are not updated.
*/
private List<IPage<?>> getChildPagesFor(List<? extends ITableRow> tableRows, boolean updateChildPageCells) {
List<IPage<?>> result = new ArrayList<IPage<?>>();
try {
for (ITableRow row : tableRows) {
IPage<?> page = getPageFor(row);
if (page != null) {
result.add(page);
if (updateChildPageCells) {
// update tree nodes from table rows
page.setEnabled(row.isEnabled(), IDimensions.ENABLED);
T table = getTable();
if (table != null) {
ICell tableCell = table.getSummaryCell(row);
page.getCellForUpdate().updateFrom(tableCell);
}
}
}
}
} catch (RuntimeException | PlatformError e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
return result;
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class AbstractColumn method cellValueToEditor.
/**
* Map the values of a cell to the editing form field. The default implementation assumes a value field.
*
* @param row
* the row that is currently edited
* @param editorField
* the field to edit the value
* @throws ProcessingException
* if the field is not a value field
*/
@SuppressWarnings("unchecked")
protected void cellValueToEditor(ITableRow row, IFormField editorField) {
final ICell cell = row.getCell(this);
IMultiStatus status = cell.getErrorStatus();
if (status == null || status.isOK()) {
cellValueToEditField((VALUE) cell.getValue(), editorField);
} else {
cellTextToEditField(cell.getText(), editorField);
}
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class InternalTableRow method getColumnIndexes.
private Set<Integer> getColumnIndexes(List<ICell> cells) {
Map<ICell, Integer> indexesByCell = createCellIndexMap();
Set<Integer> result = new HashSet<>();
for (ICell cell : cells) {
Integer index = indexesByCell.get(cell);
if (index != null) {
result.add(index);
}
}
return result;
}
use of org.eclipse.scout.rt.client.ui.basic.cell.ICell in project scout.rt by eclipse.
the class InternalTableRow method setCell.
@Override
public void setCell(int columnIndex, ICell cell) {
if (cell != null) {
try {
setRowChanging(true);
//
// copy all fields
m_cells.set(columnIndex, new Cell(this, cell));
} finally {
setRowChanging(false);
}
}
}
Aggregations