Search in sources :

Example 6 with IProposalField

use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testPrepareLookupCallback.

/**
 * Tests that {@link AbstractProposalColumn#execPrepareLookup(ILookupCall, ITableRow)} is called when
 * {@link IProposalField#prepareKeyLookup(ILookupCall, Object)} is called on the editor field.
 */
@SuppressWarnings("unchecked")
@Test
public void testPrepareLookupCallback() {
    TestProposalColumn column = new TestProposalColumn();
    ITableRow row = Mockito.mock(ITableRow.class);
    IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    ILookupCall call = mock(ILookupCall.class);
    field.prepareKeyLookup(call, 10L);
    assertEquals(row, column.lastRow);
    assertEquals(call, column.lastCall);
}
Also used : IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall) Test(org.junit.Test)

Example 7 with IProposalField

use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField in project scout.rt by eclipse.

the class AbstractProposalColumnTest method testLookupRowWithTooLongText1.

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

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

        @Override
        protected int getConfiguredMaxLength() {
            return 32;
        }
    };
    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("1234567890", false, false);
    column.completeEdit(row, field);
    assertEquals("1234567890", 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)

Aggregations

ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)7 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)7 Test (org.junit.Test)7 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)4 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)4 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)4 ILookupCall (org.eclipse.scout.rt.shared.services.lookup.ILookupCall)1