Search in sources :

Example 1 with TablePage

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.");
    }
}
Also used : TreeEvent(org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent) IPage(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage) ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) TablePage(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) Outline(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline) JsonOutline(org.eclipse.scout.rt.ui.html.json.desktop.JsonOutline) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) UiException(org.eclipse.scout.rt.ui.html.UiException) Test(org.junit.Test)

Example 2 with TablePage

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;
}
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) Outline(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline) JsonOutline(org.eclipse.scout.rt.ui.html.json.desktop.JsonOutline) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)

Example 3 with 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()));
}
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)

Example 4 with TablePage

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()));
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ArrayList(java.util.ArrayList) Outline(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) LinkedList(java.util.LinkedList) IPage(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage) ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) TablePage(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage) NodePage(org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePage) JsonTreeTest(org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest) Test(org.junit.Test)

Aggregations

IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)4 IPage (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage)4 Outline (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline)4 TablePage (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)2 JsonOutline (org.eclipse.scout.rt.ui.html.json.desktop.JsonOutline)2 JsonTreeTest (org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest)2 LinkedList (java.util.LinkedList)1 TreeEvent (org.eclipse.scout.rt.client.ui.basic.tree.TreeEvent)1 UiException (org.eclipse.scout.rt.ui.html.UiException)1 NodePage (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePage)1 NodePageWithForm (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.NodePageWithForm)1