Search in sources :

Example 11 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell 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());
    }
}
Also used : Locale(java.util.Locale) DecimalFormat(java.text.DecimalFormat) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) Test(org.junit.Test)

Example 12 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell 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());
    }
}
Also used : Locale(java.util.Locale) DecimalFormat(java.text.DecimalFormat) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) Test(org.junit.Test)

Example 13 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class TableFieldTest method testErrorColumn_Visible.

/**
 * Tests that an invisible displayable column is shown, if there is an error.
 */
@Test
public void testErrorColumn_Visible() {
    P_TableField tableField = createTableField(false);
    tableField.getTable().addRowByArray(TEST_ROW);
    Cell cell = (Cell) tableField.getTable().getCell(0, 1);
    cell.setEditable(true);
    tableField.getTable().getStringColumn().setVisible(false);
    cell.addErrorStatus("ErrorX");
    IValidateContentDescriptor desc = tableField.validateContent();
    assertTrue(tableField.getTable().getStringColumn().isVisible());
}
Also used : IValidateContentDescriptor(org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor) Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) Test(org.junit.Test)

Example 14 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractTable method decorateCell.

@Override
public final void decorateCell(ITableRow row, IColumn<?> col) {
    Cell cell = row.getCellForUpdate(col.getColumnIndex());
    decorateCellInternal(cell, row, col);
    try {
        interceptDecorateCell(cell, row, col);
    } catch (Exception e) {
        BEANS.get(ExceptionHandler.class).handle(e);
    }
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Example 15 with Cell

use of org.eclipse.scout.rt.client.ui.basic.cell.Cell in project scout.rt by eclipse.

the class AbstractColumn method decorateCell.

@Override
public void decorateCell(ITableRow row) {
    Cell cell = row.getCellForUpdate(getColumnIndex());
    decorateCellInternal(cell, row);
    try {
        interceptDecorateCell(cell, row);
    } catch (RuntimeException e) {
        LOG.warn("Exception decorating cell", e);
    }
}
Also used : Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) IHeaderCell(org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell) HeaderCell(org.eclipse.scout.rt.client.ui.basic.table.HeaderCell) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Aggregations

Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)27 Test (org.junit.Test)10 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)9 HeaderCell (org.eclipse.scout.rt.client.ui.basic.table.HeaderCell)5 IHeaderCell (org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell)5 DecimalFormat (java.text.DecimalFormat)4 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IValidateContentDescriptor (org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor)4 Locale (java.util.Locale)3 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 NonMandatoryTestColumn (org.eclipse.scout.rt.client.ui.basic.table.ColumnMandatoryTest.MandatoryTestTable.NonMandatoryTestColumn)1 ITableRowCustomValueContributor (org.eclipse.scout.rt.client.ui.basic.table.ITableRowCustomValueContributor)1 InternalTableRow (org.eclipse.scout.rt.client.ui.basic.table.internal.InternalTableRow)1 IValueField (org.eclipse.scout.rt.client.ui.form.fields.IValueField)1 ValidationFailedStatus (org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus)1 NumberFormatProvider (org.eclipse.scout.rt.platform.util.NumberFormatProvider)1