Search in sources :

Example 6 with ICell

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

Example 7 with ICell

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

Example 8 with ICell

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

Example 9 with ICell

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

Example 10 with ICell

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

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