Search in sources :

Example 11 with ICell

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());
}
Also used : TestDateColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractDateColumnTest.TestTable.TestDateColumn) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell) Test(org.junit.Test)

Example 12 with ICell

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;
}
Also used : PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) ArrayList(java.util.ArrayList) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Example 13 with ICell

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);
    }
}
Also used : IMultiStatus(org.eclipse.scout.rt.platform.status.IMultiStatus) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Example 14 with ICell

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;
}
Also used : ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell) HashSet(java.util.HashSet)

Example 15 with ICell

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);
        }
    }
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Aggregations

ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)23 Test (org.junit.Test)15 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 Date (java.util.Date)3 SimpleDateFormat (java.text.SimpleDateFormat)2 HashSet (java.util.HashSet)2 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)2 ArrayList (java.util.ArrayList)1 TestDateColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractDateColumnTest.TestTable.TestDateColumn)1 AbstractIntegerField (org.eclipse.scout.rt.client.ui.form.fields.integerfield.AbstractIntegerField)1 IIntegerField (org.eclipse.scout.rt.client.ui.form.fields.integerfield.IIntegerField)1 IMixedSmartField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IMixedSmartField)1 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)1 IMultiStatus (org.eclipse.scout.rt.platform.status.IMultiStatus)1 ILookupRow (org.eclipse.scout.rt.shared.services.lookup.ILookupRow)1 ICellValueReader (org.eclipse.scout.rt.ui.html.json.basic.cell.ICellValueReader)1 JsonCell (org.eclipse.scout.rt.ui.html.json.basic.cell.JsonCell)1