Search in sources :

Example 1 with ContributionComposite

use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.

the class AbstractActionNode method initConfig.

@Override
@SuppressWarnings("unchecked")
protected void initConfig() {
    super.initConfig();
    // menus
    List<Class<? extends IActionNode>> configuredChildActions = getConfiguredChildActions();
    OrderedCollection<T> actionNodes = new OrderedCollection<T>();
    for (Class<? extends IActionNode> a : configuredChildActions) {
        IActionNode node = ConfigurationUtility.newInnerInstance(this, a);
        node.setParent(this);
        actionNodes.addOrdered((T) node);
    }
    m_contributionHolder = new ContributionComposite(this);
    List<IActionNode> contributedActions = m_contributionHolder.getContributionsByClass(IActionNode.class);
    for (IActionNode n : contributedActions) {
        actionNodes.addOrdered((T) n);
    }
    try {
        injectActionNodesInternal(actionNodes);
    } catch (RuntimeException e) {
        BEANS.get(ExceptionHandler.class).handle(e);
    }
    // add
    setChildActions(actionNodes.getOrderedList());
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection)

Example 2 with ContributionComposite

use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.

the class AbstractTreeNode method initConfig.

protected void initConfig() {
    setLeafInternal(getConfiguredLeaf());
    setEnabled(getConfiguredEnabled(), IDimensions.ENABLED);
    setExpandedInternal(getConfiguredExpanded());
    setLazyExpandingEnabled(getConfiguredLazyExpandingEnabled());
    setExpandedLazyInternal(isLazyExpandingEnabled());
    setInitialExpanded(getConfiguredExpanded());
    m_contributionHolder = new ContributionComposite(this);
// menus are lazy
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite)

Example 3 with ContributionComposite

use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.

the class AbstractTable method initConfig.

protected void initConfig() {
    m_eventHistory = createEventHistory();
    m_eventBuffer = createEventBuffer();
    m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(createUIFacade(), ModelContext.copyCurrent());
    m_contributionHolder = new ContributionComposite(this);
    setEnabled(true);
    setLoading(false);
    setGroupingStyle(getConfiguredGroupingStyle());
    setTitle(getConfiguredTitle());
    setAutoDiscardOnDelete(getConfiguredAutoDiscardOnDelete());
    setSortEnabled(getConfiguredSortEnabled());
    setDefaultIconId(getConfiguredDefaultIconId());
    setCssClass((getConfiguredCssClass()));
    setRowIconVisible(getConfiguredRowIconVisible());
    setHeaderVisible(getConfiguredHeaderVisible());
    setHeaderEnabled(getConfiguredHeaderEnabled());
    setAutoResizeColumns(getConfiguredAutoResizeColumns());
    setCheckable(getConfiguredCheckable());
    setMultiCheck(getConfiguredMultiCheck());
    setMultiSelect(getConfiguredMultiSelect());
    setInitialMultilineText(getConfiguredMultilineText());
    setMultilineText(getConfiguredMultilineText());
    setKeyboardNavigation(getConfiguredKeyboardNavigation());
    setDragType(getConfiguredDragType());
    setDropType(getConfiguredDropType());
    setDropMaximumSize(getConfiguredDropMaximumSize());
    setScrollToSelection(getConfiguredScrollToSelection());
    setTableStatusVisible(getConfiguredTableStatusVisible());
    if (getTableCustomizer() == null) {
        setTableCustomizer(createTableCustomizer());
    }
    // columns
    createColumnsInternal();
    // table controls
    createTableControlsInternal();
    // menus
    initMenus();
    // key strokes
    List<Class<? extends IKeyStroke>> ksClasses = getConfiguredKeyStrokes();
    List<IKeyStroke> ksList = new ArrayList<IKeyStroke>(ksClasses.size());
    for (Class<? extends IKeyStroke> clazz : ksClasses) {
        IKeyStroke ks = ConfigurationUtility.newInnerInstance(this, clazz);
        ks.initAction();
        if (ks.getKeyStroke() != null) {
            ksList.add(ks);
        }
    }
    // add ENTER key stroke when default menu is used or execRowAction has an override
    Class<? extends IMenu> defaultMenuType = getDefaultMenuInternal();
    if (defaultMenuType != null || ConfigurationUtility.isMethodOverwrite(AbstractTable.class, "execRowAction", new Class[] { ITableRow.class }, this.getClass())) {
        ksList.add(new KeyStroke("ENTER") {

            @Override
            protected void execAction() {
                fireRowAction(getSelectedRow());
            }
        });
    }
    // add keystroke contributions
    List<IKeyStroke> contributedKeyStrokes = m_contributionHolder.getContributionsByClass(IKeyStroke.class);
    ksList.addAll(contributedKeyStrokes);
    setKeyStrokes(ksList);
    m_tableOrganizer = BEANS.get(ITableOrganizerProvider.class).createTableOrganizer(this);
    // add Convenience observer for drag & drop callbacks, event history and ui sort possible check
    addTableListener(new TableAdapter() {

        @Override
        public void tableChanged(TableEvent e) {
            // event history
            IEventHistory<TableEvent> h = getEventHistory();
            if (h != null) {
                h.notifyEvent(e);
            }
            // dnd
            switch(e.getType()) {
                case TableEvent.TYPE_ROWS_DRAG_REQUEST:
                    {
                        if (e.getDragObject() == null) {
                            try {
                                e.setDragObject(interceptDrag(e.getRows()));
                            } catch (RuntimeException ex) {
                                BEANS.get(ExceptionHandler.class).handle(ex);
                            }
                        }
                        break;
                    }
                case TableEvent.TYPE_ROW_DROP_ACTION:
                    {
                        if (e.getDropObject() != null && isEnabled()) {
                            try {
                                interceptDrop(e.getFirstRow(), e.getDropObject());
                            } catch (RuntimeException ex) {
                                BEANS.get(ExceptionHandler.class).handle(ex);
                            }
                        }
                        break;
                    }
                case TableEvent.TYPE_ROWS_COPY_REQUEST:
                    {
                        if (e.getCopyObject() == null) {
                            try {
                                e.setCopyObject(interceptCopy(e.getRows()));
                            } catch (RuntimeException ex) {
                                BEANS.get(ExceptionHandler.class).handle(ex);
                            }
                        }
                        break;
                    }
                case TableEvent.TYPE_ALL_ROWS_DELETED:
                case TableEvent.TYPE_ROWS_DELETED:
                case TableEvent.TYPE_ROWS_INSERTED:
                case TableEvent.TYPE_ROWS_UPDATED:
                    {
                        if (isValueChangeTriggerEnabled()) {
                            try {
                                interceptContentChanged();
                            } catch (RuntimeException ex) {
                                BEANS.get(ExceptionHandler.class).handle(ex);
                            }
                        }
                        break;
                    }
                case TableEvent.TYPE_ROWS_CHECKED:
                    try {
                        interceptRowsChecked(e.getRows());
                    } catch (RuntimeException ex) {
                        BEANS.get(ExceptionHandler.class).handle(ex);
                    }
                    break;
                case TableEvent.TYPE_COLUMN_HEADERS_UPDATED:
                case TableEvent.TYPE_COLUMN_STRUCTURE_CHANGED:
                    checkIfColumnPreventsUiSortForTable();
                    break;
            }
        }
    });
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) ArrayList(java.util.ArrayList) IEventHistory(org.eclipse.scout.rt.client.ui.IEventHistory) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke) ExceptionHandler(org.eclipse.scout.rt.platform.exception.ExceptionHandler) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke) KeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke)

Example 4 with ContributionComposite

use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.

the class AbstractMixedSmartColumn method initConfig.

@Override
protected void initConfig() {
    super.initConfig();
    m_contributionHolder = new ContributionComposite(this);
    setSortCodesByDisplayText(getConfiguredSortCodesByDisplayText());
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite)

Example 5 with ContributionComposite

use of org.eclipse.scout.rt.shared.extension.ContributionComposite in project scout.rt by eclipse.

the class AbstractSmartColumn2 method initConfig.

@Override
protected void initConfig() {
    super.initConfig();
    m_contributionHolder = new ContributionComposite(this);
    setSortCodesByDisplayText(getConfiguredSortCodesByDisplayText());
    // code type
    if (getConfiguredCodeType() != null) {
        setCodeTypeClass(getConfiguredCodeType());
    }
    // lazy lookup decorator
    Class<? extends ILookupCall<VALUE>> lookupCallClass = getConfiguredLookupCall();
    if (lookupCallClass != null) {
        ILookupCall<VALUE> call;
        try {
            call = BEANS.get(lookupCallClass);
            setLookupCall(call);
        } catch (Exception e) {
            BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + lookupCallClass.getName() + "'.", e));
        }
    }
}
Also used : ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Aggregations

ContributionComposite (org.eclipse.scout.rt.shared.extension.ContributionComposite)16 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)8 ArrayList (java.util.ArrayList)6 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)5 PropertyChangeEvent (java.beans.PropertyChangeEvent)4 PropertyChangeListener (java.beans.PropertyChangeListener)4 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)4 List (java.util.List)3 IEventHistory (org.eclipse.scout.rt.client.ui.IEventHistory)3 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)3 EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)3 KeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke)2 ExceptionHandler (org.eclipse.scout.rt.platform.exception.ExceptionHandler)2 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 DeepLinkException (org.eclipse.scout.rt.client.deeplink.DeepLinkException)1 MoveFormFieldsHandler (org.eclipse.scout.rt.client.extension.ui.form.MoveFormFieldsHandler)1 IDeviceTransformationService (org.eclipse.scout.rt.client.transformation.IDeviceTransformationService)1