Search in sources :

Example 6 with ITableContextMenu

use of org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu in project scout.rt by eclipse.

the class TableMenuTest method testEmptySelection.

/**
 * Tests the visibility for a empty space menu
 */
@Test
public void testEmptySelection() {
    Table t = new Table();
    t.addRowsByMatrix(TEST_ROWS);
    ITableContextMenu contextMenu = t.getContextMenu();
    // empty selection
    t.selectRows(CollectionUtility.<ITableRow>emptyArrayList(), false);
    IActionFilter filter = ActionUtility.createMenuFilterMenuTypes(contextMenu.getCurrentMenuTypes(), true);
    List<IMenu> visibleMenus = ActionUtility.normalizedActions(contextMenu.getChildActions(), filter);
    assertEquals(1, visibleMenus.size());
    assertEquals("EmptySpaceMenu", visibleMenus.get(0).getClass().getSimpleName());
}
Also used : ITableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu) AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IActionFilter(org.eclipse.scout.rt.client.ui.action.IActionFilter) Test(org.junit.Test)

Example 7 with ITableContextMenu

use of org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu in project scout.rt by eclipse.

the class TableMenuTest method testRowDisabledEmptySelection.

/**
 * Tests menu empty space menu enabled if row disabled, empty selection
 */
@Test
public void testRowDisabledEmptySelection() {
    Table t = new Table();
    t.addRowsByMatrix(TEST_ROWS);
    ITableContextMenu contextMenu = t.getContextMenu();
    t.getRow(0).setEnabled(false);
    t.selectRows(CollectionUtility.<ITableRow>emptyArrayList(), false);
    IActionFilter filter = ActionUtility.createMenuFilterMenuTypes(contextMenu.getCurrentMenuTypes(), true);
    List<IMenu> visibleMenus = ActionUtility.normalizedActions(contextMenu.getChildActions(), filter);
    assertEquals(true, visibleMenus.get(0).isEnabled());
}
Also used : ITableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu) AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IActionFilter(org.eclipse.scout.rt.client.ui.action.IActionFilter) Test(org.junit.Test)

Example 8 with ITableContextMenu

use of org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu in project scout.rt by eclipse.

the class TableMenuTest method testTableDisabledSingleSelection.

/**
 * Tests menu disabled if table disabled, single selection
 */
@Test
public void testTableDisabledSingleSelection() {
    Table t = new Table();
    t.setEnabled(false);
    t.addRowsByMatrix(TEST_ROWS);
    ITableContextMenu contextMenu = t.getContextMenu();
    t.selectRows(CollectionUtility.arrayList(t.getRow(0)), false);
    IActionFilter filter = ActionUtility.createMenuFilterMenuTypes(contextMenu.getCurrentMenuTypes(), true);
    List<IMenu> visibleMenus = ActionUtility.normalizedActions(contextMenu.getChildActions(), filter);
    assertEquals(false, visibleMenus.get(0).isEnabled());
}
Also used : ITableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu) AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IActionFilter(org.eclipse.scout.rt.client.ui.action.IActionFilter) Test(org.junit.Test)

Example 9 with ITableContextMenu

use of org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu in project scout.rt by eclipse.

the class TableMenuTest method testTableDisabledEmptySelection.

/**
 * Tests empty space menu disabled if table disabled, empty selection
 */
@Test
public void testTableDisabledEmptySelection() {
    Table t = new Table();
    t.setEnabled(false);
    t.addRowsByMatrix(TEST_ROWS);
    ITableContextMenu contextMenu = t.getContextMenu();
    t.selectRows(CollectionUtility.<ITableRow>emptyArrayList(), false);
    IActionFilter filter = ActionUtility.createMenuFilterMenuTypes(contextMenu.getCurrentMenuTypes(), true);
    List<IMenu> visibleMenus = ActionUtility.normalizedActions(contextMenu.getChildActions(), filter);
    assertEquals(false, visibleMenus.get(0).isEnabled());
}
Also used : ITableContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu) AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IActionFilter(org.eclipse.scout.rt.client.ui.action.IActionFilter) Test(org.junit.Test)

Aggregations

ITableContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.ITableContextMenu)9 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)8 IActionFilter (org.eclipse.scout.rt.client.ui.action.IActionFilter)7 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)7 Test (org.junit.Test)7 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)2 TableContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.internal.TableContextMenu)1 OutlineMenuWrapper (org.eclipse.scout.rt.client.ui.desktop.outline.OutlineMenuWrapper)1 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)1