Search in sources :

Example 11 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class JsonDesktop method handleUiFormActivate.

protected void handleUiFormActivate(JsonEvent event) {
    String formId = event.getData().optString("formId", null);
    if (formId == null) {
        getModel().getUIFacade().activateForm(null);
        return;
    }
    IJsonAdapter<?> jsonAdapter = getUiSession().getJsonAdapter(formId);
    if (jsonAdapter == null) {
        // should not occur, but if it occurs its not fatal because on next dialog/view/outline opening this is repaired
        LOG.info("handleUIFormActivated is looking for form which exists no more. ID: {}", formId);
        return;
    }
    IForm form = (IForm) jsonAdapter.getModel();
    addDesktopEventFilterCondition(DesktopEvent.TYPE_FORM_ACTIVATE).setForm(form);
    getModel().getUIFacade().activateForm(form);
}
Also used : IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 12 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class AbstractPage method decorateDetailForm.

protected void decorateDetailForm() {
    IForm form = getDetailForm();
    if (form.getDisplayHint() != IForm.DISPLAY_HINT_VIEW) {
        form.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
    }
    if (form.getDisplayViewId() == null) {
        form.setDisplayViewId(IForm.VIEW_ID_PAGE_DETAIL);
    }
    // TODO [7.0] bsh: do the same as in todo of WrappedFormField
    form.setModal(false);
    form.setShowOnStart(false);
}
Also used : IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 13 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class AbstractPage method ensureDetailFormCreated.

protected void ensureDetailFormCreated() {
    if (getDetailForm() != null) {
        return;
    }
    IForm form = createDetailForm();
    if (form != null) {
        setDetailForm(form);
        interceptInitDetailForm();
    }
}
Also used : IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 14 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class OutlineTest method testDefaultDetailForm.

@Test
public void testDefaultDetailForm() {
    TestOutline o = new TestOutline(true);
    assertNotNull("DefaultDetailForm was not instantiated", o.getDefaultDetailForm());
    assertTrue("DefaultDetailForm was not started", o.getDefaultDetailForm().isFormStarted());
    IForm form = o.getDefaultDetailForm();
    o.disposeTree();
    assertNull("DefaultDetailForm should be null", o.getDefaultDetailForm());
    assertTrue("DefaultDetailForm should have been closed", form.isFormClosed());
}
Also used : IForm(org.eclipse.scout.rt.client.ui.form.IForm) Test(org.junit.Test)

Example 15 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class AbstractPageWithTableTest method testModelContextOfInitPageAndInitTable.

@Test
public void testModelContextOfInitPageAndInitTable() {
    IForm mockForm = Mockito.mock(IForm.class);
    IOutline mockOutline = Mockito.mock(IOutline.class);
    ClientRunContexts.copyCurrent().withOutline(mockOutline, true).withForm(mockForm).run(new IRunnable() {

        @Override
        public void run() throws Exception {
            IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
            assertNotNull(desktop);
            desktop.setAvailableOutlines(CollectionUtility.arrayList(new PageWithTableOutline()));
            desktop.setOutline(PageWithTableOutline.class);
            desktop.activateFirstPage();
            IOutline outline = desktop.getOutline();
            assertNotNull(outline);
            assertSame(PageWithTableOutline.class, outline.getClass());
            IPage<?> page = outline.getActivePage();
            assertNotNull(page);
            assertSame(ParentItemTablePage.class, page.getClass());
            ParentItemTablePage tablePage = (ParentItemTablePage) page;
            // init page
            ModelContext initPageContext = tablePage.getInitPageContext();
            assertNotNull(initPageContext);
            assertSame(desktop, initPageContext.getDesktop());
            assertSame(outline, initPageContext.getOutline());
            // no context form must be set
            assertNull(initPageContext.getForm());
            // init table
            ModelContext initTableContext = tablePage.getInitTableContext();
            assertNotNull(initTableContext);
            assertSame(desktop, initTableContext.getDesktop());
            assertSame(outline, initTableContext.getOutline());
            // no context form must be set
            assertNull(initTableContext.getForm());
        }
    });
}
Also used : ModelContext(org.eclipse.scout.rt.client.ModelContextProxy.ModelContext) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IForm(org.eclipse.scout.rt.client.ui.form.IForm) IRunnable(org.eclipse.scout.rt.platform.util.concurrent.IRunnable) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Aggregations

IForm (org.eclipse.scout.rt.client.ui.form.IForm)38 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)7 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)5 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)4 IDisplayParent (org.eclipse.scout.rt.client.ui.IDisplayParent)3 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)3 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)3 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)3 JSONObject (org.json.JSONObject)3 List (java.util.List)2 ModelContext (org.eclipse.scout.rt.client.ModelContextProxy.ModelContext)2 DeepLinkException (org.eclipse.scout.rt.client.deeplink.DeepLinkException)2 IFileChooser (org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)2 ISearchForm (org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm)2 IGroupBox (org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox)2 ITabBox (org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox)2 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1