Search in sources :

Example 46 with IDesktop

use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.

the class PageWithNodesTest method testExecPageDataLoaded.

/**
 * Tests that {@link AbstractPage#execPageDataLoaded()} is called correctly on a {@link AbstractPageWithNodes}
 */
@Test
public void testExecPageDataLoaded() {
    IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
    desktop.setAvailableOutlines(Collections.singletonList(new PageWithTableOutline()));
    desktop.setOutline(PageWithTableOutline.class);
    desktop.activateFirstPage();
    IOutline outline = desktop.getOutline();
    PageWithNodes page = (PageWithNodes) outline.getActivePage();
    Assert.assertEquals(1, page.m_execPageDataLoadedCalled);
    page.reloadPage();
    page.reloadPage();
    page.reloadPage();
    Assert.assertEquals(4, page.m_execPageDataLoadedCalled);
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Example 47 with IDesktop

use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.

the class PageWithNodesTest method testLazyLoading.

@Test
public void testLazyLoading() {
    IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
    PageWithTableOutline o = new PageWithTableOutline();
    desktop.setAvailableOutlines(Collections.singletonList(o));
    desktop.setOutline(PageWithTableOutline.class);
    desktop.activateFirstPage();
    Assert.assertTrue(o.getActivePage() instanceof PageWithNodes);
    PageWithNodes pageWithNodes = (PageWithNodes) o.getActivePage();
    Assert.assertEquals(1, pageWithNodes.m_execCreateChildPages);
    for (IPage<?> p : pageWithNodes.getChildPages()) {
        Assert.assertEquals(0, ((PageWithNode) p).m_execCreateChildPages);
        Assert.assertEquals(0, ((PageWithNode) p).m_execInitDetailForm);
    }
    IPage<?> firstChildPage = pageWithNodes.getChildPage(0);
    IPage<?> secondChildPage = pageWithNodes.getChildPage(1);
    firstChildPage.getTree().getUIFacade().setNodesSelectedFromUI(Collections.<ITreeNode>singletonList(firstChildPage));
    Assert.assertEquals(1, ((PageWithNode) firstChildPage).m_execCreateChildPages);
    Assert.assertEquals(1, ((PageWithNode) firstChildPage).m_execInitDetailForm);
    Assert.assertTrue(((PageWithNode) firstChildPage).m_firePageChanged > 0);
    Assert.assertEquals(0, ((PageWithNode) secondChildPage).m_execCreateChildPages);
    Assert.assertEquals(0, ((PageWithNode) secondChildPage).m_execInitDetailForm);
    Assert.assertEquals(0, ((PageWithNode) secondChildPage).m_firePageChanged);
}
Also used : IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Example 48 with IDesktop

use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.

the class PageWithTable1Test method testExecPageDataLoaded.

/**
 * Tests that {@link AbstractPage#execPageDataLoaded()} is called correctly on a {@link AbstractTablePage}
 */
@Test
public void testExecPageDataLoaded() {
    IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
    desktop.setAvailableOutlines(Collections.singletonList(new PageWithTableOutline()));
    desktop.setOutline(PageWithTableOutline.class);
    desktop.activateFirstPage();
    IOutline outline = desktop.getOutline();
    PageWithTable page = (PageWithTable) outline.getActivePage();
    Assert.assertEquals(1, page.m_execPageDataLoadedCalled);
    page.reloadPage();
    page.reloadPage();
    page.reloadPage();
    Assert.assertEquals(4, page.m_execPageDataLoadedCalled);
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Example 49 with IDesktop

use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.

the class PageWithTableGroupingTest method testGroupingPreferences.

@Test
public void testGroupingPreferences() throws Exception {
    // reset columns
    table.resetColumns();
    // additional grouping
    table.getUIFacade().fireHeaderGroupFromUI(b2, true, true);
    assertGroupingState(table, CollectionUtility.arrayList(b3, b2), CollectionUtility.arrayList(b1));
    // reset desktop and re-create new outline
    IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
    desktop.activateOutline((IOutline) null);
    setup();
    assertGroupingState(table, CollectionUtility.arrayList(b3, b2), CollectionUtility.arrayList(b1));
}
Also used : IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Example 50 with IDesktop

use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.

the class PageWithTableGroupingTestHelper method setupDesktop.

public static ITable setupDesktop(IOutline outline) {
    IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
    desktop.setAvailableOutlines(Collections.singletonList(outline));
    desktop.activateOutline(outline);
    desktop.activateFirstPage();
    if (desktop.getOutline().getActivePage() instanceof IPageWithTable) {
        return ((IPageWithTable) (desktop.getOutline().getActivePage())).getTable();
    }
    return null;
}
Also used : IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop)

Aggregations

IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)61 Test (org.junit.Test)36 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)18 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)7 JsonAdapterRegistryTest (org.eclipse.scout.rt.ui.html.json.JsonAdapterRegistryTest)7 IOutlineViewButton (org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineViewButton)5 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)5 JsonForm (org.eclipse.scout.rt.ui.html.json.form.JsonForm)5 JSONObject (org.json.JSONObject)5 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)4 IClientSession (org.eclipse.scout.rt.client.IClientSession)3 ITree (org.eclipse.scout.rt.client.ui.basic.tree.ITree)3 IForm (org.eclipse.scout.rt.client.ui.form.IForm)3 DesktopWithOneOutline (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.DesktopWithOneOutline)3 OutlineViewButton (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.OutlineViewButton)3 OutlineWithOneNode (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.OutlineWithOneNode)3 FormWithOneField (org.eclipse.scout.rt.ui.html.json.form.fixtures.FormWithOneField)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 PropertyChangeListener (java.beans.PropertyChangeListener)2 Locale (java.util.Locale)2