Search in sources :

Example 41 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class OutlineMediator method mediateTreeNodeDropAction.

public void mediateTreeNodeDropAction(TreeEvent e, IPageWithTable<? extends ITable> pageWithTable) {
    ITableRow row = pageWithTable.getTableRowFor(e.getNode());
    ITable table = pageWithTable.getTable();
    if (row != null) {
        table.getUIFacade().fireRowDropActionFromUI(row, e.getDropObject());
    }
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 42 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractPage method execComputeParentTablePageMenus.

/**
 * The default implementation returns the single selection menus from the parent table page's table.
 * <p>
 * If this behavior is not desired return an empty list or filter the menus for your needs instead.
 *
 * @param parentTablePage
 *          Parent table page
 * @return A list (non-null) of single selection menus.
 */
@Order(150)
@ConfigOperation
protected List<IMenu> execComputeParentTablePageMenus(IPageWithTable<?> parentTablePage) {
    ITableRow row = parentTablePage.getTableRowFor(this);
    if (row == null) {
        return CollectionUtility.emptyArrayList();
    }
    ITable table = parentTablePage.getTable();
    table.getUIFacade().setSelectedRowsFromUI(CollectionUtility.arrayList(row));
    return ActionUtility.getActions(table.getContextMenu().getChildActions(), ActionUtility.createMenuFilterMenuTypes(CollectionUtility.hashSet(TableMenuType.SingleSelection), false));
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Example 43 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractPageWithNodes method updateContextMenusForSelection.

protected void updateContextMenusForSelection() {
    // remove old
    if (m_pageMenusOfSelection != null) {
        getTable().getContextMenu().removeChildActions(m_pageMenusOfSelection);
        m_pageMenusOfSelection = null;
    }
    List<IMenu> pageMenus = new ArrayList<IMenu>();
    List<ITableRow> selectedRows = getTable().getSelectedRows();
    if (CollectionUtility.size(selectedRows) == 1) {
        ITreeNode node = getTreeNodeFor(CollectionUtility.firstElement(selectedRows));
        if (node instanceof IPageWithNodes) {
            IPageWithNodes pageWithNodes = (IPageWithNodes) node;
            IActionFilter filter = ActionUtility.createMenuFilterMenuTypes(CollectionUtility.hashSet(TreeMenuType.SingleSelection), false);
            List<IMenu> menus = ActionUtility.getActions(pageWithNodes.getMenus(), filter);
            for (IMenu m : menus) {
                pageMenus.add(new OutlineMenuWrapper(m, TREE_MENU_TYPE_MAPPER, filter));
            }
        }
    }
    getTable().getContextMenu().addChildActions(pageMenus);
    m_pageMenusOfSelection = pageMenus;
}
Also used : OutlineMenuWrapper(org.eclipse.scout.rt.client.ui.desktop.outline.OutlineMenuWrapper) IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) ArrayList(java.util.ArrayList) IActionFilter(org.eclipse.scout.rt.client.ui.action.IActionFilter) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 44 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractPageWithNodes method rebuildTableInternal.

@Override
public void rebuildTableInternal() {
    List<ITreeNode> childNodes = getChildNodes();
    try {
        getTable().setTableChanging(true);
        // 
        unlinkAllTableRowWithPage();
        getTable().discardAllRows();
        for (ITreeNode childNode : childNodes) {
            ITableRow row = new TableRow(getTable().getColumnSet());
            updateCellFromPageCell(row.getCellForUpdate(0), childNode.getCell());
            ITableRow insertedRow = getTable().addRow(row);
            linkTableRowWithPage(insertedRow, (IPage) childNode);
        }
    } finally {
        getTable().setTableChanging(false);
    }
}
Also used : ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) TableRow(org.eclipse.scout.rt.client.ui.basic.table.TableRow) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 45 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractDecimalColumnTest method testPrepareEditInternal.

@Test
public void testPrepareEditInternal() {
    setGroupingUsed(false);
    setMinFractionDigits(5);
    setMaxFractionDigits(6);
    setPercent(true);
    setMultiplier(100);
    setFractionDigits(3);
    ITableRow row = Mockito.mock(ITableRow.class);
    AbstractBigDecimalField field = (AbstractBigDecimalField) prepareEditInternal(row);
    assertFalse("expected groupingUsed-property to be propagated to field", field.isGroupingUsed());
    assertEquals("expected minFractionDigits-property to be propagated to field", 5, field.getMinFractionDigits());
    assertEquals("expected maxFractionDigits-property to be propagated to field", 6, field.getMaxFractionDigits());
    assertTrue("expected percent-property to be propagated to field", field.isPercent());
    assertEquals("expected multiplier-property to be propagated to field", 100, field.getMultiplier());
    assertEquals("expected fractionDigits-property to be propagated to field", 3, field.getFractionDigits());
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) AbstractBigDecimalField(org.eclipse.scout.rt.client.ui.form.fields.bigdecimalfield.AbstractBigDecimalField) Test(org.junit.Test)

Aggregations

ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)127 Test (org.junit.Test)77 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)47 ArrayList (java.util.ArrayList)23 JSONObject (org.json.JSONObject)22 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)16 JSONArray (org.json.JSONArray)13 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)7 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)7 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)6 IMixedSmartField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IMixedSmartField)5 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 DecimalFormat (java.text.DecimalFormat)4 List (java.util.List)4 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)4 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)4 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4