use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.
the class PageWithTable1Test method testReloadPage_multipleSummaryColumns.
@Test
public void testReloadPage_multipleSummaryColumns() 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());
page.reloadPage();
page.reloadPage();
page.reloadPage();
}
use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.
the class PageWithTable1Test 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 PageWithTable);
PageWithTable pageWithNodes = (PageWithTable) o.getActivePage();
Assert.assertEquals(1, pageWithNodes.m_execPageDataLoadedCalled);
Assert.assertEquals(1, pageWithNodes.m_execCreateChildPage);
for (IPage<?> p : pageWithNodes.getChildPages()) {
Assert.assertEquals(0, ((PageWithNode) p).m_execCreateChildPages);
Assert.assertEquals(0, ((PageWithNode) p).m_execInitDetailForm);
Assert.assertEquals(0, ((PageWithNode) p).m_firePageChanged);
}
IPage<?> firstChildPage = pageWithNodes.getChildPage(0);
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);
}
use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.
the class ColumnAutoResizeTest method testReloadPage_multipleSummaryColumns.
@Test
public void testReloadPage_multipleSummaryColumns() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
desktop.setAvailableOutlines(Collections.singletonList(new PageWithTableOutline()));
desktop.setOutline(PageWithTableOutline.class);
desktop.activateFirstPage();
IOutline outline = desktop.getOutline();
IPage<?> page = outline.getActivePage();
assertNotNull(page);
assertTrue(page instanceof AbstractPageWithTable);
ITable table = ((AbstractPageWithTable) page).getTable();
assertTrue(table instanceof ColumnAutoResizeTest.PageWithTable.TestTable);
ColumnAutoResizeTest.PageWithTable.TestTable testTable = (ColumnAutoResizeTest.PageWithTable.TestTable) table;
IColumn col1 = CollectionUtility.firstElement(testTable.getColumns());
int width1 = col1.getWidth();
// when page is reloaded, the column width shall not be different afterwards
page.reloadPage();
int width2 = col1.getWidth();
assertTrue(width1 == width2);
}
use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.
the class PageWithTable3Test method testSorting.
@Test
public void testSorting() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
PageWithTableOutline outline = new PageWithTableOutline();
desktop.setAvailableOutlines(Collections.singletonList(outline));
desktop.activateOutline(outline);
desktop.activateFirstPage();
PageWithTable page = (PageWithTable) desktop.getOutline().getActivePage();
PageWithTable.Table table = page.getTable();
table.resetColumns();
//
// load table with configured sort columns
assertTrue(CollectionUtility.equalsCollection(CollectionUtility.arrayList(7, 6, 5, 4, 3, 2, 1, 0), table.getValueColumn().getValues()));
// user sorts value column asc (all other columns lost their sort index resp. their sort is now explicit=false)
table.getUIFacade().fireHeaderSortFromUI(table.getValueColumn(), false, true);
assertSortState(table, CollectionUtility.arrayList(0, 1, 2, 3, 4, 5, 6, 7), CollectionUtility.arrayList(0));
//
// reset desktop and re-create new outline
desktop.activateOutline((IOutline) null);
outline = new PageWithTableOutline();
desktop.setAvailableOutlines(Collections.singletonList(outline));
desktop.activateOutline(outline);
desktop.activateFirstPage();
page = (PageWithTable) desktop.getOutline().getActivePage();
table = page.getTable();
assertSortState(table, CollectionUtility.arrayList(0, 1, 2, 3, 4, 5, 6, 7), CollectionUtility.arrayList(0));
}
use of org.eclipse.scout.rt.client.ui.desktop.IDesktop in project scout.rt by eclipse.
the class PageWithTable6Test method testMenus.
@Test
public void testMenus() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
Outline outline = new Outline();
desktop.setAvailableOutlines(Collections.singletonList(outline));
desktop.activateOutline(outline);
desktop.activateFirstPage();
PageWithTable page = (PageWithTable) desktop.getOutline().getActivePage();
PageWithTable.Table table = page.getTable();
//
table.selectRow(null);
assertMenus(table, new String[] { "New Account" });
//
table.selectRow(0);
assertMenus(table, new String[] { "Edit Account" });
//
table.selectRow(1);
assertMenus(table, new String[] {});
//
table.selectAllRows();
assertMenus(table, new String[] {});
//
table.selectRow(1);
assertMenus(table, new String[] {});
table.selectRow(0);
assertMenus(table, new String[] { "Edit Account" });
//
table.deselectAllRows();
assertMenus(table, new String[] { "New Account" });
}
Aggregations