use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class ExtendFormWithDeepLinkingTest method testContributeOnlyToOneNestedTemplateUsageOverSpecified.
@Test
public void testContributeOnlyToOneNestedTemplateUsageOverSpecified() throws Exception {
BEANS.get(IExtensionRegistry.class).register(ContributedTestField.class, new ClassIdentifier(MultiTemplateUsageForm.class, MultiTemplateUsageForm.MainBox.class, FirstTemplateBox.class, TopFieldsBox.class, AbstractTemplateFieldsBox.class), null);
MultiTemplateUsageForm form = new MultiTemplateUsageForm();
assertTypes(form.getMainBox().getFields(), FirstTemplateBox.class, SecondTemplateBox.class, MainBoxStringField.class);
// first template box
FirstTemplateBox firstTemplateBox = form.getFirstTemplateBox();
assertTypes(firstTemplateBox.getFields(), TopFieldsBox.class, MiddleStringField.class, BottomFieldsBox.class);
assertTypes(firstTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class, ContributedTestField.class);
assertTypes(firstTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
// second template box
SecondTemplateBox secondTemplateBox = form.getSecondTemplateBox();
assertTypes(secondTemplateBox.getFields(), TopFieldsBox.class, BottomFieldsBox.class);
assertTypes(secondTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
assertTypes(secondTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class ExtendFormWithDeepLinkingTest method testExtendTemplate.
@Test
public void testExtendTemplate() throws Exception {
BEANS.get(IExtensionRegistry.class).register(TemplateStringFieldExtension.class, new ClassIdentifier(AbstractTemplateFieldsBox.class, AbstractStringField.class), null);
MultiTemplateUsageForm form = new MultiTemplateUsageForm();
form.initForm();
assertTypes(form.getMainBox().getFields(), FirstTemplateBox.class, SecondTemplateBox.class, MainBoxStringField.class);
// first template box
FirstTemplateBox firstTemplateBox = form.getFirstTemplateBox();
assertTypes(firstTemplateBox.getFields(), TopFieldsBox.class, MiddleStringField.class, BottomFieldsBox.class);
assertTypes(firstTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
assertTypes(firstTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
// second template box
SecondTemplateBox secondTemplateBox = form.getSecondTemplateBox();
assertTypes(secondTemplateBox.getFields(), TopFieldsBox.class, BottomFieldsBox.class);
assertTypes(secondTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
assertTypes(secondTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
// behavior checks
assertEquals("A", form.getFirstTemplateBox().getTopFieldsBox().getTopStringField().getValue());
assertEquals("A", form.getFirstTemplateBox().getTopFieldsBox().getBottomStringField().getValue());
assertNull(form.getMiddleStringField().getValue());
assertEquals("A", form.getFirstTemplateBox().getBottomFieldsBox().getTopStringField().getValue());
assertEquals("A", form.getFirstTemplateBox().getBottomFieldsBox().getBottomStringField().getValue());
assertEquals("A", form.getSecondTemplateBox().getTopFieldsBox().getTopStringField().getValue());
assertEquals("A", form.getSecondTemplateBox().getTopFieldsBox().getBottomStringField().getValue());
assertEquals("A", form.getSecondTemplateBox().getBottomFieldsBox().getTopStringField().getValue());
assertEquals("A", form.getSecondTemplateBox().getBottomFieldsBox().getBottomStringField().getValue());
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class ExtendFormWithDeepLinkingTest method testContributeOnlyToOneNestedTemplateUsage.
@Test
public void testContributeOnlyToOneNestedTemplateUsage() throws Exception {
BEANS.get(IExtensionRegistry.class).register(ContributedTestField.class, new ClassIdentifier(FirstTemplateBox.class, TopFieldsBox.class, AbstractTemplateFieldsBox.class), null);
MultiTemplateUsageForm form = new MultiTemplateUsageForm();
assertTypes(form.getMainBox().getFields(), FirstTemplateBox.class, SecondTemplateBox.class, MainBoxStringField.class);
// first template box
FirstTemplateBox firstTemplateBox = form.getFirstTemplateBox();
assertTypes(firstTemplateBox.getFields(), TopFieldsBox.class, MiddleStringField.class, BottomFieldsBox.class);
assertTypes(firstTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class, ContributedTestField.class);
assertTypes(firstTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
// second template box
SecondTemplateBox secondTemplateBox = form.getSecondTemplateBox();
assertTypes(secondTemplateBox.getFields(), TopFieldsBox.class, BottomFieldsBox.class);
assertTypes(secondTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
assertTypes(secondTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class ExtendFormWithDeepLinkingTest method testExtendOnlyToOneTemplateUsesOverSpecified.
@Test
public void testExtendOnlyToOneTemplateUsesOverSpecified() throws Exception {
BEANS.get(IExtensionRegistry.class).register(TemplateStringFieldExtension.class, new ClassIdentifier(MultiTemplateUsageForm.class, TopFieldsBox.class, AbstractStringField.class), null);
MultiTemplateUsageForm form = new MultiTemplateUsageForm();
form.initForm();
assertTypes(form.getMainBox().getFields(), FirstTemplateBox.class, SecondTemplateBox.class, MainBoxStringField.class);
// first template box
FirstTemplateBox firstTemplateBox = form.getFirstTemplateBox();
assertTypes(firstTemplateBox.getFields(), TopFieldsBox.class, MiddleStringField.class, BottomFieldsBox.class);
assertTypes(firstTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
assertTypes(firstTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
// second template box
SecondTemplateBox secondTemplateBox = form.getSecondTemplateBox();
assertTypes(secondTemplateBox.getFields(), TopFieldsBox.class, BottomFieldsBox.class);
assertTypes(secondTemplateBox.getTopFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
assertTypes(secondTemplateBox.getBottomFieldsBox().getFields(), TopStringField.class, BottomStringField.class);
// behavior checks
assertEquals("A", form.getFirstTemplateBox().getTopFieldsBox().getTopStringField().getValue());
assertEquals("A", form.getFirstTemplateBox().getTopFieldsBox().getBottomStringField().getValue());
assertNull(form.getMiddleStringField().getValue());
assertNull(form.getFirstTemplateBox().getBottomFieldsBox().getTopStringField().getValue());
assertNull(form.getFirstTemplateBox().getBottomFieldsBox().getBottomStringField().getValue());
assertEquals("A", form.getSecondTemplateBox().getTopFieldsBox().getTopStringField().getValue());
assertEquals("A", form.getSecondTemplateBox().getTopFieldsBox().getBottomStringField().getValue());
assertNull(form.getSecondTemplateBox().getBottomFieldsBox().getTopStringField().getValue());
assertNull(form.getSecondTemplateBox().getBottomFieldsBox().getBottomStringField().getValue());
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class MoveFormFieldTest method testMultiTemplateUsageFormMoveTopStringFieldInFirstTemplateBoxUsingClassIdentifier.
@Test
public void testMultiTemplateUsageFormMoveTopStringFieldInFirstTemplateBoxUsingClassIdentifier() throws Exception {
BEANS.get(IExtensionRegistry.class).registerMove(new ClassIdentifier(FirstTemplateBox.class, TopStringField.class), 30d);
MultiTemplateUsageForm form = new MultiTemplateUsageForm();
assertEquals(3, form.getMainBox().getFieldCount());
assertSame(form.getFirstTemplateBox(), form.getMainBox().getFields().get(0));
assertSame(form.getSecondTemplateBox(), form.getMainBox().getFields().get(1));
assertSame(form.getMainBoxStringField(), form.getMainBox().getFields().get(2));
// first template box
FirstTemplateBox firstTemplateBox = form.getFirstTemplateBox();
assertEquals(3, firstTemplateBox.getFieldCount());
assertSame(firstTemplateBox.getTopFieldsBox(), firstTemplateBox.getFields().get(0));
assertSame(form.getMiddleStringField(), firstTemplateBox.getFields().get(1));
assertSame(firstTemplateBox.getBottomFieldsBox(), firstTemplateBox.getFields().get(2));
// top fields box in first template box
assertAbstractTemplateFieldsBox(firstTemplateBox.getTopFieldsBox(), false);
assertAbstractTemplateFieldsBox(firstTemplateBox.getBottomFieldsBox(), false);
// second template box
SecondTemplateBox secondTemplateBox = form.getSecondTemplateBox();
assertEquals(2, secondTemplateBox.getFieldCount());
assertSame(secondTemplateBox.getTopFieldsBox(), secondTemplateBox.getFields().get(0));
assertSame(secondTemplateBox.getBottomFieldsBox(), secondTemplateBox.getFields().get(1));
// top fields box in first template box
assertAbstractTemplateFieldsBox(secondTemplateBox.getTopFieldsBox(), true);
assertAbstractTemplateFieldsBox(secondTemplateBox.getBottomFieldsBox(), true);
}
Aggregations