Search in sources :

Example 1 with ITable

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

the class MobileDeviceTransformer method notifyPageDetailTableChanged.

@Override
public void notifyPageDetailTableChanged(ITable table) {
    IPage<?> activePage = getDesktop().getOutline().getActivePage();
    IPage<?> parentPage = activePage.getParentPage();
    if (parentPage == null) {
        return;
    }
    ITable parentTable = parentPage.getTable();
    if (parentTable == null) {
        return;
    }
    // Remove empty space menus of the current detail table which are already defined on the parent detail table as single selection menus
    // This prevents duplicate menus because the ui concatenates these menus when a node is shown
    // It is important to only remove outline wrapper menus which are defined on the parent table because the menu could be defined on a page and therefore needs to be displayed
    List<IMenu> newMenus = new ArrayList<IMenu>();
    for (IMenu menu : table.getMenus()) {
        if ((menu instanceof OutlineMenuWrapper)) {
            OutlineMenuWrapper menuWrapper = (OutlineMenuWrapper) menu;
            IMenu originalMenu = unwrapOutlineWrapperMenu(menuWrapper);
            if (menuWrapper.getMenuTypes().contains(TableMenuType.EmptySpace) && originalMenu.getMenuTypes().contains(TableMenuType.SingleSelection) && parentTable.getMenus().contains(originalMenu)) {
                // This menu should be removed -> don't add it to the list of new menus
                continue;
            }
        }
        newMenus.add(menu);
    }
    if (!CollectionUtility.equalsCollection(newMenus, table.getContextMenu().getChildActions())) {
        table.getContextMenu().setChildActions(newMenus);
    }
}
Also used : OutlineMenuWrapper(org.eclipse.scout.rt.client.ui.desktop.outline.OutlineMenuWrapper) IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) ArrayList(java.util.ArrayList) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 2 with ITable

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

the class ColumnUserFilterState method notifyDeserialized.

@Override
public boolean notifyDeserialized(Object obj) {
    ITable table = (ITable) obj;
    m_column = BookmarkUtility.resolveColumn(table.getColumns(), m_columnId);
    return m_column != null;
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 3 with ITable

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

the class DefaultPageChangeStrategy method pageChanged.

@Override
public void pageChanged(final IOutline outline, final IPage<?> deselectedPage, final IPage<?> selectedPage) {
    if (outline == null) {
        return;
    }
    outline.clearContextPage();
    IForm detailForm = null;
    ITable detailTable = null;
    ISearchForm searchForm = null;
    // new active page
    outline.makeActivePageToContextPage();
    IPage<?> activePage = outline.getActivePage();
    if (activePage != null) {
        try {
            activePage.ensureChildrenLoaded();
        } catch (RuntimeException | PlatformError e1) {
            BEANS.get(ExceptionHandler.class).handle(e1);
        }
        if (activePage instanceof IPageWithTable) {
            IPageWithTable tablePage = (IPageWithTable) activePage;
            detailForm = activePage.getDetailForm();
            if (activePage.isTableVisible()) {
                detailTable = tablePage.getTable(false);
            }
            if (tablePage.isSearchActive()) {
                searchForm = tablePage.getSearchFormInternal();
            }
        } else if (activePage instanceof IPageWithNodes) {
            IPageWithNodes nodePage = (IPageWithNodes) activePage;
            if (activePage.isDetailFormVisible()) {
                detailForm = activePage.getDetailForm();
            }
            if (activePage.isTableVisible()) {
                detailTable = nodePage.getTable(false);
            }
        }
    }
    // remove first
    if (detailForm == null) {
        outline.setDetailForm(null);
    }
    if (detailTable == null) {
        outline.setDetailTable(null);
    }
    if (searchForm == null) {
        outline.setSearchForm(null);
    }
    // add new
    if (detailForm != null) {
        outline.setDetailForm(detailForm);
    }
    if (detailTable != null) {
        outline.setDetailTable(detailTable);
    }
    if (searchForm != null) {
        outline.setSearchForm(searchForm);
    }
}
Also used : IPageWithTable(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable) PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) IPageWithNodes(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithNodes) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IForm(org.eclipse.scout.rt.client.ui.form.IForm) ISearchForm(org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm)

Example 4 with ITable

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

the class JsonTable method initJsonProperties.

@Override
protected void initJsonProperties(T model) {
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTI_SELECT, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiSelect();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTI_CHECK, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiCheck();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTILINE_TEXT, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultilineText();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CHECKABLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isCheckable();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_ROW_ICON_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isRowIconVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_HEADER_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isHeaderVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_HEADER_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isHeaderEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_KEYBOARD_NAVIGATION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().hasKeyboardNavigation();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_AUTO_RESIZE_COLUMNS, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isAutoResizeColumns();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_SCROLL_TO_SELECTION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isScrollToSelection();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_TABLE_STATUS_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isTableStatusVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_TABLE_STATUS, model) {

        @Override
        protected IStatus modelValue() {
            return getModel().getTableStatus();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return JsonStatus.toJson((IStatus) value);
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITable>(ITable.PROP_TABLE_CONTROLS, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<ITableControl>()).build();
        }

        @Override
        protected List<ITableControl> modelValue() {
            return getModel().getTableControls();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_DROP_TYPE, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getDropType();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_DROP_MAXIMUM_SIZE, model) {

        @Override
        protected Long modelValue() {
            return getModel().getDropMaximumSize();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_SORT_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isSortEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_UI_SORT_POSSIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isUiSortPossible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_LOADING, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isLoading();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_GROUPING_STYLE, model) {

        @Override
        protected GroupingStyle modelValue() {
            return getModel().getGroupingStyle();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return ((GroupingStyle) value).name().toLowerCase();
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITable>(ITable.PROP_KEY_STROKES, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<IAction>()).build();
        }

        @Override
        protected List<IKeyStroke> modelValue() {
            return getModel().getKeyStrokes();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CSS_CLASS, model) {

        @Override
        protected String modelValue() {
            return getModel().getCssClass();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CONTEXT_COLUMN, model) {

        @Override
        protected Object modelValue() {
            return getModel().getContextColumn();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            if (value == null) {
                return null;
            }
            return m_jsonColumns.get(value).getId();
        }
    });
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) IAction(org.eclipse.scout.rt.client.ui.action.IAction) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) TextTransferObject(org.eclipse.scout.rt.client.ui.dnd.TextTransferObject) ResourceListTransferObject(org.eclipse.scout.rt.client.ui.dnd.ResourceListTransferObject) JSONObject(org.json.JSONObject) TransferObject(org.eclipse.scout.rt.client.ui.dnd.TransferObject) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) GroupingStyle(org.eclipse.scout.rt.client.ui.basic.table.GroupingStyle)

Example 5 with ITable

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

the class AbstractColumn method completeEdit.

/**
 * Complete editing of a cell
 * <p>
 * By default this calls {@link #setValue(ITableRow, Object)} and delegates to
 * {@link #interceptParseValue(ITableRow, Object)} and {@link #interceptValidateValue(ITableRow, Object)}.
 */
@Override
public final void completeEdit(ITableRow row, IFormField editingField) {
    ITable table = getTable();
    if (table == null || !table.isCellEditable(row, this)) {
        return;
    }
    interceptCompleteEdit(row, editingField);
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Aggregations

ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)89 Test (org.junit.Test)64 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)45 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)28 JSONObject (org.json.JSONObject)23 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)16 JSONArray (org.json.JSONArray)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)10 ArrayList (java.util.ArrayList)9 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)8 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)6 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)6 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)4 IPageWithTable (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable)4 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)4 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)4