Search in sources :

Example 1 with BasicForm

use of org.eclipse.scout.rt.shared.extension.fixture.BasicForm in project scout.rt by eclipse.

the class ExtensionRegistryInstantiationTest method testBasicFormExtensionWithSubclassedFormHandler.

@Test
public void testBasicFormExtensionWithSubclassedFormHandler() throws Exception {
    IExtensionRegistry registry = BEANS.get(IExtensionRegistry.class);
    registry.register(BasicFormExtension02.class);
    // test code
    BasicForm basicForm = new BasicForm();
    assertExtensions(basicForm.getAllExtensions(), BasicFormExtension02.class);
    // because no filter is applied, the form handler is instantiated too, which it shouldn't.
    // as soon as a filter checks which inner classes to instantiate, the assertion must be changed to 'assertNull'.
    assertNotNull(basicForm.getContribution(BasicFormExtension02.ReadOnlyModifyHandler.class));
}
Also used : BasicForm(org.eclipse.scout.rt.shared.extension.fixture.BasicForm) Test(org.junit.Test)

Example 2 with BasicForm

use of org.eclipse.scout.rt.shared.extension.fixture.BasicForm in project scout.rt by eclipse.

the class ExtensionRegistryInstantiationTest method testNameFieldExtension.

@Test
public void testNameFieldExtension() throws Exception {
    BEANS.get(IExtensionRegistry.class).register(NameFieldExtension.class);
    BasicForm basicForm = new BasicForm();
    assertExtensions(basicForm.getAllExtensions());
    assertExtensions(basicForm.getMainBox().getAllExtensions());
    assertExtensions(basicForm.getTopBox().getAllExtensions());
    assertExtensions(basicForm.getNameField().getAllExtensions(), NameFieldExtension.class);
    assertExtensions(basicForm.getBottomBox().getAllExtensions());
    assertExtensions(basicForm.getFirstNameField().getAllExtensions());
}
Also used : BasicForm(org.eclipse.scout.rt.shared.extension.fixture.BasicForm) Test(org.junit.Test)

Example 3 with BasicForm

use of org.eclipse.scout.rt.shared.extension.fixture.BasicForm in project scout.rt by eclipse.

the class ExtensionRegistryInstantiationTest method testExtensionForGroupBoxWithSecondInnerField.

@Test
public void testExtensionForGroupBoxWithSecondInnerField() throws Exception {
    IExtensionRegistry registry = BEANS.get(IExtensionRegistry.class);
    registry.register(TopBoxExtension.class);
    // test code
    BasicForm basicForm = new BasicForm();
    assertExtensions(basicForm.getAllExtensions());
    assertExtensions(basicForm.getTopBox().getAllExtensions(), TopBoxExtension.class);
    List<IFormField> topBoxFields = basicForm.getTopBox().getFields();
    assertEquals(2, topBoxFields.size());
    assertTrue(topBoxFields.get(0) instanceof BasicForm.MainBox.TopBox.NameField);
    assertFalse(topBoxFields.get(0) instanceof TopBoxExtension.SecondNameField);
    assertTrue(topBoxFields.get(1) instanceof TopBoxExtension.SecondNameField);
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) BasicForm(org.eclipse.scout.rt.shared.extension.fixture.BasicForm) TopBoxExtension(org.eclipse.scout.rt.shared.extension.fixture.TopBoxExtension) Test(org.junit.Test)

Example 4 with BasicForm

use of org.eclipse.scout.rt.shared.extension.fixture.BasicForm in project scout.rt by eclipse.

the class ExtensionRegistryInstantiationTest method testBasicFormExtension.

@Test
public void testBasicFormExtension() throws Exception {
    BEANS.get(IExtensionRegistry.class).register(BasicFormExtension.class);
    BasicForm basicForm = new BasicForm();
    assertExtensions(basicForm.getAllExtensions(), BasicFormExtension.class);
}
Also used : BasicForm(org.eclipse.scout.rt.shared.extension.fixture.BasicForm) Test(org.junit.Test)

Example 5 with BasicForm

use of org.eclipse.scout.rt.shared.extension.fixture.BasicForm in project scout.rt by eclipse.

the class ExtensionRegistryInstantiationTest method testStaticPojoContainerExtension.

@Test
public void testStaticPojoContainerExtension() throws Exception {
    BEANS.get(IExtensionRegistry.class).register(StaticPojoContainerExtension.NameFieldExtension.class);
    BEANS.get(IExtensionRegistry.class).register(StaticPojoContainerExtension.FirstNameFieldExtension.class);
    BasicForm basicForm = new BasicForm();
    assertExtensions(basicForm.getAllExtensions());
    assertExtensions(basicForm.getMainBox().getAllExtensions());
    assertExtensions(basicForm.getTopBox().getAllExtensions());
    assertExtensions(basicForm.getNameField().getAllExtensions(), StaticPojoContainerExtension.NameFieldExtension.class);
    assertExtensions(basicForm.getBottomBox().getAllExtensions());
    assertExtensions(basicForm.getFirstNameField().getAllExtensions(), StaticPojoContainerExtension.FirstNameFieldExtension.class);
}
Also used : BasicForm(org.eclipse.scout.rt.shared.extension.fixture.BasicForm) StaticPojoContainerExtension(org.eclipse.scout.rt.shared.extension.fixture.StaticPojoContainerExtension) Test(org.junit.Test)

Aggregations

BasicForm (org.eclipse.scout.rt.shared.extension.fixture.BasicForm)7 Test (org.junit.Test)7 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)1 NestedBasicFormExtension (org.eclipse.scout.rt.shared.extension.fixture.NestedBasicFormExtension)1 StaticPojoContainerExtension (org.eclipse.scout.rt.shared.extension.fixture.StaticPojoContainerExtension)1 TopBoxExtension (org.eclipse.scout.rt.shared.extension.fixture.TopBoxExtension)1