Search in sources :

Example 1 with NodePageWithForm

use of org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePageWithForm in project scout.rt by eclipse.

the class JsonOutlineTest method testTableNotSentIfInvisible.

/**
 * Node.detailTable must not be sent if node.tableVisible is set to false to reduce response size.
 */
@Test
public void testTableNotSentIfInvisible() throws JSONException {
    NodePageWithForm nodePage = new NodePageWithForm();
    // trigger table creation
    nodePage.getTable(true);
    nodePage.setTableVisible(false);
    List<IPage<?>> pages = new ArrayList<IPage<?>>();
    pages.add(nodePage);
    IOutline outline = new Outline(pages);
    JsonOutline<IOutline> jsonOutline = UiSessionTestUtility.newJsonAdapter(m_uiSession, outline, null);
    JSONObject jsonNode = jsonOutline.toJson().getJSONArray("nodes").getJSONObject(0);
    Assert.assertNull(jsonNode.opt(IOutline.PROP_DETAIL_TABLE));
    nodePage.setTableVisible(true);
    JsonTestUtility.processBufferedEvents(m_uiSession);
    jsonNode = jsonOutline.toJson().getJSONArray("nodes").getJSONObject(0);
    Assert.assertNotNull(jsonNode.opt(IOutline.PROP_DETAIL_TABLE));
}
Also used : IPage(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage) JSONObject(org.json.JSONObject) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ArrayList(java.util.ArrayList) NodePageWithForm(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePageWithForm) Outline(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) JsonTreeTest(org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest) Test(org.junit.Test)

Example 2 with NodePageWithForm

use of org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePageWithForm in project scout.rt by eclipse.

the class JsonOutlineTest method testChildAdaptersCreated.

/**
 * Tests whether the adapters for the detail forms get created
 */
@Test
public void testChildAdaptersCreated() {
    TablePage tablePage = new TablePage(1, new TablePage.NodePageWithFormFactory());
    NodePageWithForm nodePage = new NodePageWithForm();
    List<IPage<?>> pages = new ArrayList<IPage<?>>();
    pages.add(nodePage);
    pages.add(tablePage);
    IOutline outline = new Outline(pages);
    // Activate nodes (forms get created lazily on activation)
    outline.selectNode(nodePage);
    outline.selectNode(tablePage);
    IPage rowPage = (IPage) tablePage.getTreeNodeFor(tablePage.getTable().getRow(0));
    outline.selectNode(rowPage);
    JsonOutline<IOutline> jsonOutline = UiSessionTestUtility.newJsonAdapter(m_uiSession, outline, null);
    Assert.assertNotNull(jsonOutline.getAdapter(nodePage.getDetailForm()));
    Assert.assertNotNull(jsonOutline.getAdapter(rowPage.getDetailForm()));
}
Also used : IPage(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage) TablePage(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ArrayList(java.util.ArrayList) NodePageWithForm(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePageWithForm) Outline(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) JsonTreeTest(org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)2 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)2 IPage (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage)2 NodePageWithForm (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePageWithForm)2 Outline (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline)2 JsonTreeTest (org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest)2 Test (org.junit.Test)2 TablePage (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage)1 JSONObject (org.json.JSONObject)1