Search in sources :

Example 16 with IOutline

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

the class AbstractPageWithTableTest 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 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(ParentItemTablePage.class, page.getClass());
            ParentItemTablePage tablePage = (ParentItemTablePage) page;
            // init page
            ModelContext initPageContext = tablePage.getInitPageContext();
            assertNotNull(initPageContext);
            assertSame(desktop, initPageContext.getDesktop());
            assertSame(outline, initPageContext.getOutline());
            // no context form must be set
            assertNull(initPageContext.getForm());
            // init table
            ModelContext initTableContext = tablePage.getInitTableContext();
            assertNotNull(initTableContext);
            assertSame(desktop, initTableContext.getDesktop());
            assertSame(outline, initTableContext.getOutline());
            // no context form must be set
            assertNull(initTableContext.getForm());
        }
    });
}
Also used : ModelContext(org.eclipse.scout.rt.client.ModelContextProxy.ModelContext) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IForm(org.eclipse.scout.rt.client.ui.form.IForm) IRunnable(org.eclipse.scout.rt.platform.util.concurrent.IRunnable) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Example 17 with IOutline

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

the class OutlineTreeContextMenuNestedPageWithTablesTest 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());
    assertRowMenusExistOnTablePageNode(outline);
}
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 18 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline 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();
}
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 19 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline 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);
}
Also used : AbstractPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) AbstractPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.AbstractPageWithTable) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) Test(org.junit.Test)

Example 20 with IOutline

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

the class PageWithTable7Test method testExecPageDataLoaded.

@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();
    page.m_counter = 1;
    page.reloadPage();
    page.m_counter = 2;
    page.reloadPage();
    page.m_counter = 3;
    page.reloadPage();
    ScoutAssert.assertListEquals(new String[] { "counter: 0 value: first", "counter: 1 value: second", "counter: 2 value: third", "counter: 3 value: fourth" }, page.m_protocol);
}
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)

Aggregations

IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)49 Test (org.junit.Test)24 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)18 IPage (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage)12 ArrayList (java.util.ArrayList)11 Outline (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline)9 JsonTreeTest (org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest)7 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)5 IForm (org.eclipse.scout.rt.client.ui.form.IForm)5 JSONObject (org.json.JSONObject)5 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)4 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)4 TablePage (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage)4 List (java.util.List)3 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)3 IViewButton (org.eclipse.scout.rt.client.ui.action.view.IViewButton)3 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)3 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)3 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)3 JsonOutline (org.eclipse.scout.rt.ui.html.json.desktop.JsonOutline)3