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