Search in sources :

Example 1 with IProposalField

use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField 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 2 with IProposalField

use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField 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 3 with IProposalField

use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField 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 4 with IProposalField

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

the class AbstractProposalColumnTest method testLookupRowWithTooLongText2.

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

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

        @Override
        protected int getConfiguredMaxLength() {
            return 8;
        }
    };
    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("12345678", 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 5 with IProposalField

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

the class AbstractProposalColumnTest method testPrepareEditInternal.

@Test
public void testPrepareEditInternal() {
    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);
    assertEquals("mandatory property to be progagated to field", column.isMandatory(), field.isMandatory());
    assertEquals("code type class property to be progagated to field", column.getCodeTypeClass(), field.getCodeTypeClass());
}
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)

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