use of org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage in project scout.rt by eclipse.
the class JsonTreeTest method testDeletionOfAllChildrenOfUnknownNode.
@Test
public void testDeletionOfAllChildrenOfUnknownNode() throws Exception {
IOutline outline = new Outline(new ArrayList<IPage<?>>());
ITreeNode parent = new TablePage(0);
ITreeNode node1 = new TablePage(0);
node1.setParentNodeInternal(parent);
ITreeNode node2 = new TablePage(0);
node2.setParentNodeInternal(parent);
ITreeNode node3 = new TablePage(0);
node3.setParentNodeInternal(parent);
outline.addChildNode(outline.getRootNode(), parent);
outline.addChildNode(parent, node1);
outline.addChildNode(parent, node2);
outline.addChildNode(parent, node3);
JsonOutline<IOutline> jsonOutline = m_uiSession.createJsonAdapter(outline, null);
List<ITreeNode> allChildren = CollectionUtility.arrayList(node1, node2, node3);
jsonOutline.bufferModelEvent(new TreeEvent(outline, TreeEvent.TYPE_ALL_CHILD_NODES_DELETED, parent, allChildren));
try {
jsonOutline.processBufferedEvents();
} catch (UiException e) {
fail("Regression of ticket 210096: Tree does not contain node whose children are to be deleted.");
}
}
use of org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage in project scout.rt by eclipse.
the class JsonTableFieldTest method createTablePageAndSelectNode.
private IPageWithTable<?> createTablePageAndSelectNode() {
TablePage tablePage = new TablePage(1, new TablePage.NodePageWithFormFactory());
List<IPage<?>> pages = new ArrayList<IPage<?>>();
pages.add(tablePage);
IOutline outline = new Outline(pages);
outline.selectNode(tablePage);
return tablePage;
}
use of org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage 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()));
}
use of org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage in project scout.rt by eclipse.
the class JsonOutlineTest method testPageDisposal.
@Test
public void testPageDisposal() {
TablePage tablePage = new TablePage(1, new TablePage.NodePageWithFormFactory());
NodePage nodePage = new NodePage();
List<IPage<?>> pages = new ArrayList<IPage<?>>();
pages.add(nodePage);
IOutline outline = new Outline(pages);
outline.addChildNode(nodePage, tablePage);
outline.selectNode(tablePage);
JsonOutline<IOutline> jsonOutline = UiSessionTestUtility.newJsonAdapter(m_uiSession, outline, null);
List<ITreeNode> allNodes = JsonTreeTest.getAllTreeNodes(outline);
List<String> allNodeIds = new LinkedList<String>();
for (ITreeNode node : allNodes) {
String nodeId = JsonTreeTest.getOrCreateNodeId(jsonOutline, node);
allNodeIds.add(nodeId);
assertNotNull(nodeId);
assertNotNull(JsonTreeTest.getNode(jsonOutline, nodeId));
}
outline.removeNode(nodePage);
JsonTestUtility.processBufferedEvents(m_uiSession);
// Verify nodes get unregistered
for (ITreeNode node : allNodes) {
assertNull(JsonTreeTest.optNodeId(jsonOutline, node));
}
for (String nodeId : allNodeIds) {
assertNull(JsonTreeTest.getNode(jsonOutline, nodeId));
}
// Verify table adapter gets unregistered
assertNull(m_uiSession.getJsonAdapter(tablePage.getTable(), m_uiSession.getRootJsonAdapter()));
}
Aggregations