use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.
the class MediumMemoryPolicy method beforeTablePageLoadData.
/**
* when table contains 1000+ rows clear table before loading new data, thus disabling "replaceRow" mechanism
*/
@Override
public void beforeTablePageLoadData(IPageWithTable<?> page) {
if (m_release) {
// make sure inactive outlines have no selection that "keeps" the pages
IDesktop desktop = ClientSessionProvider.currentSession().getDesktop();
for (IOutline o : desktop.getAvailableOutlines()) {
if (o != desktop.getOutline()) {
o.selectNode(null);
}
}
desktop.releaseUnusedPages();
m_release = false;
}
if (page.getTable() != null && page.getTable().getRowCount() > 1000) {
page.getTable().discardAllRows();
}
}
use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.
the class AbstractPageWithNodesTest method testSetupOutlinePage.
@Test
public void testSetupOutlinePage() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
assertNotNull(desktop);
desktop.setAvailableOutlines(CollectionUtility.arrayList(new PageWithNodeOutline()));
desktop.setOutline(PageWithNodeOutline.class);
desktop.activateFirstPage();
IOutline outline = desktop.getOutline();
assertNotNull(outline);
assertSame(PageWithNodeOutline.class, outline.getClass());
IPage<?> page = outline.getActivePage();
assertNotNull(page);
}
use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.
the class AbstractPageWithNodesTest method testModelContextOfInitPageAndInitTable.
@Test
public void testModelContextOfInitPageAndInitTable() {
IForm mockForm = Mockito.mock(IForm.class);
IOutline mockOutline = Mockito.mock(IOutline.class);
ClientRunContexts.copyCurrent().withOutline(mockOutline, true).withForm(mockForm).run(new IRunnable() {
@Override
public void run() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
assertNotNull(desktop);
desktop.setAvailableOutlines(CollectionUtility.arrayList(new PageWithNodeOutline()));
desktop.setOutline(PageWithNodeOutline.class);
desktop.activateFirstPage();
IOutline outline = desktop.getOutline();
assertNotNull(outline);
assertSame(PageWithNodeOutline.class, outline.getClass());
IPage<?> page = outline.getActivePage();
assertNotNull(page);
assertSame(ParentItemNodePage.class, page.getClass());
ParentItemNodePage nodePage = (ParentItemNodePage) page;
// init page
ModelContext initPageContext = nodePage.getInitPageContext();
assertNotNull(initPageContext);
assertSame(desktop, initPageContext.getDesktop());
assertSame(outline, initPageContext.getOutline());
// no context form must be set
assertNull(initPageContext.getForm());
// init table
ModelContext initTableContext = nodePage.getInitTableContext();
assertNotNull(initTableContext);
assertSame(desktop, initTableContext.getDesktop());
assertSame(outline, initTableContext.getOutline());
// no context form must be set
assertNull(initTableContext.getForm());
}
});
}
use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.
the class OutlineTreeContextMenuTest method testEmptySpaceAndRowMenus.
@Test
public void testEmptySpaceAndRowMenus() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
assertNotNull(desktop);
desktop.setAvailableOutlines(Collections.singletonList(new PageWithTableOutline()));
desktop.setOutline(PageWithTableOutline.class);
desktop.activateFirstPage();
IOutline outline = desktop.getOutline();
assertNotNull(outline);
assertSame(PageWithTableOutline.class, outline.getClass());
IPage<?> page = outline.getActivePage();
assertNotNull(page);
assertSame(PageWithTable.class, page.getClass());
assertEmptySpaceMenusExistOnTablePageParent(outline);
assertRowMenusExistOnTablePageNode(outline);
}
use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline 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);
}
Aggregations