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