Search in sources :

Example 51 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testLookupRowWithUntrimmedText2.

@Test
public void testLookupRowWithUntrimmedText2() throws Exception {
    final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {

        @Override
        protected boolean getConfiguredEditable() {
            return true;
        }

        @Override
        protected boolean getConfiguredTrimText() {
            return true;
        }
    };
    column.setCodeTypeClass(TestCodeType.class);
    final ITable table = new AbstractTable() {

        @Override
        protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
            columns.addFirst(column);
        }
    };
    ITableRow row = table.addRow();
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI(" a ", false, false);
    column.completeEdit(row, field);
    assertEquals("a", column.getValue(row));
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 52 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testLookupRowWithUntrimmedText1.

@Test
public void testLookupRowWithUntrimmedText1() throws Exception {
    final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {

        @Override
        protected boolean getConfiguredEditable() {
            return true;
        }

        @Override
        protected boolean getConfiguredTrimText() {
            return false;
        }
    };
    column.setCodeTypeClass(TestCodeType.class);
    final ITable table = new AbstractTable() {

        @Override
        protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
            columns.addFirst(column);
        }
    };
    ITableRow row = table.addRow();
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI(" a ", false, true);
    column.completeEdit(row, field);
    assertEquals(" a ", column.getValue(row));
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 53 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testLookupRowWithNullText.

@Test
public void testLookupRowWithNullText() throws Exception {
    AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {
    };
    column.setCodeTypeClass(TestCodeType.class);
    column.setMandatory(true);
    ITableRow row = Mockito.mock(ITableRow.class);
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI("", false, false);
    assertEquals(null, field.getDisplayText());
    assertEquals(null, field.getValue());
}
Also used : IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 54 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractSmartColumnTest method testResetInvalidValue.

@Test
public void testResetInvalidValue() {
    table.addRowsByArray(new Long[] { 3L });
    ITableRow testRow = table.getRow(0);
    parseAndSetInEditField(testRow, "invalid Text");
    assertFalse(testRow.getCell(0).isContentValid());
    parseAndSetInEditField(testRow, "Test");
    assertEquals("Test", testRow.getCell(0).getText());
    assertEquals(0L, testRow.getCell(0).getValue());
    assertTrue(testRow.getCell(0).isContentValid());
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 55 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class InternalTableRowTest method testCellChange.

@Test
public void testCellChange() {
    TestTable table = new TestTable();
    ITableRow row = table.createRow();
    InternalTableRow ir = new InternalTableRow(table, row);
    ir.setRowChanging(true);
    ir.cellChanged(ir.getCell(0), ICell.TEXT_BIT);
    assertEquals(1, ir.getUpdatedColumnIndexes().size());
    assertEquals(Integer.valueOf(0), ir.getUpdatedColumnIndexes().iterator().next());
    ir.setRowChanging(false);
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Aggregations

ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)127 Test (org.junit.Test)77 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)47 ArrayList (java.util.ArrayList)23 JSONObject (org.json.JSONObject)22 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)16 JSONArray (org.json.JSONArray)13 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)7 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)7 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)6 IMixedSmartField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IMixedSmartField)5 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 DecimalFormat (java.text.DecimalFormat)4 List (java.util.List)4 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)4 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)4 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4