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