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));
}
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));
}
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());
}
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));
}
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());
}
Aggregations