Search in sources :

Example 6 with IKeyStroke

use of org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke in project scout.rt by eclipse.

the class AbstractTable method handleKeyStroke.

protected boolean handleKeyStroke(String keyName, char keyChar) {
    if (keyName == null) {
        return false;
    }
    keyName = keyName.toLowerCase();
    // check if there is no menu keystroke with that name
    for (IMenu m : getMenus()) {
        if (m.getKeyStroke() != null && m.getKeyStroke().equalsIgnoreCase(keyName)) {
            return false;
        }
    }
    // check if there is no keystroke with that name (ticket 78234)
    for (IKeyStroke k : getKeyStrokes()) {
        if (k.getKeyStroke() != null && k.getKeyStroke().equalsIgnoreCase(keyName)) {
            return false;
        }
    }
    if (keyChar > ' ' && (!keyName.contains("control")) && (!keyName.contains("ctrl")) && (!keyName.contains("alt"))) {
        // select first/next line with corresponding character
        String newText = "" + Character.toLowerCase(keyChar);
        m_keyStrokeBuffer.append(newText);
        String prefix = m_keyStrokeBuffer.getText();
        IColumn<?> col = getContextColumn();
        if (col == null) {
            List<IColumn<?>> sortCols = getColumnSet().getSortColumns();
            if (sortCols.size() > 0) {
                col = CollectionUtility.lastElement(sortCols);
            } else {
                TreeMap<CompositeObject, IColumn<?>> sortMap = new TreeMap<CompositeObject, IColumn<?>>();
                int index = 0;
                for (IColumn<?> c : getColumnSet().getVisibleColumns()) {
                    if (c.getDataType() == String.class) {
                        sortMap.put(new CompositeObject(1, index), c);
                    } else if (c.getDataType() == Boolean.class) {
                        sortMap.put(new CompositeObject(3, index), c);
                    } else {
                        sortMap.put(new CompositeObject(2, index), c);
                    }
                    index++;
                }
                if (sortMap.size() > 0) {
                    col = sortMap.get(sortMap.firstKey());
                }
            }
        }
        if (col != null) {
            int colIndex = col.getColumnIndex();
            String pattern = StringUtility.toRegExPattern(prefix.toLowerCase());
            pattern = pattern + ".*";
            if (LOG.isInfoEnabled()) {
                LOG.info("finding regex: '{}' in column '{}'", pattern, getColumnSet().getColumn(colIndex).getHeaderCell().getText());
            }
            // loop over values and find matching one
            int rowCount = getRowCount();
            ITableRow selRow = getSelectedRow();
            int startIndex = 0;
            if (selRow != null) {
                if (prefix.length() <= 1) {
                    startIndex = selRow.getRowIndex() + 1;
                } else {
                    startIndex = selRow.getRowIndex();
                }
            }
            for (int i = 0; i < rowCount; i++) {
                ITableRow row = m_rows.get((startIndex + i) % rowCount);
                String text = row.getCell(colIndex).getText();
                if (text != null && text.toLowerCase().matches(pattern)) {
                    // handled
                    selectRow(row, false);
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) TreeMap(java.util.TreeMap) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)

Example 7 with IKeyStroke

use of org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke in project scout.rt by eclipse.

the class AbstractTree method initConfig.

protected void initConfig() {
    // default enabled
    m_enabled = NamedBitMaskHelper.ALL_BITS_SET;
    m_eventHistory = createEventHistory();
    m_eventBuffer = createEventBuffer();
    m_uiFacade = BEANS.get(ModelContextProxy.class).newProxy(createUIFacade(), ModelContext.copyCurrent());
    m_contributionHolder = new ContributionComposite(this);
    setEnabled(true);
    setTitle(getConfiguredTitle());
    setIconId(getConfiguredIconId());
    setDefaultIconId(getConfiguredDefaultIconId());
    setCssClass(getConfiguredCssClass());
    setAutoTitle(getConfiguredAutoTitle());
    setCheckable(getConfiguredCheckable());
    setNodeHeightHint(getConfiguredNodeHeightHint());
    setMultiCheck(getConfiguredMultiCheck());
    setMultiSelect(getConfiguredMultiSelect());
    setAutoDiscardOnDelete(getConfiguredAutoDiscardOnDelete());
    setDragEnabled(getConfiguredDragEnabled());
    setDragType(getConfiguredDragType());
    setDropType(getConfiguredDropType());
    setDropMaximumSize(getConfiguredDropMaximumSize());
    setRootNodeVisible(getConfiguredRootNodeVisible());
    setRootHandlesVisible(getConfiguredRootHandlesVisible());
    setScrollToSelection(getConfiguredScrollToSelection());
    setSaveAndRestoreScrollbars(getConfiguredSaveAndRestoreScrollbars());
    setAutoCheckChildNodes(getConfiguredAutoCheckChildNodes());
    setLazyExpandingEnabled(getConfiguredLazyExpandingEnabled());
    setDisplayStyle(getConfiguredDisplayStyle());
    setToggleBreadcrumbStyleEnabled(getConfiguredToggleBreadcrumbStyleEnabled());
    setRootNode(new AbstractTreeNode() {
    });
    // add Convenience observer for drag & drop callbacks and event history
    addTreeListener(new TreeAdapter() {

        @Override
        public void treeChanged(TreeEvent e) {
            // event history
            IEventHistory<TreeEvent> h = getEventHistory();
            if (h != null) {
                h.notifyEvent(e);
            }
            // dnd
            switch(e.getType()) {
                case TreeEvent.TYPE_NODES_DRAG_REQUEST:
                    {
                        m_lastSeenDropNode = null;
                        if (e.getDragObject() == null) {
                            try {
                                TransferObject transferObject = interceptDrag(e.getNode());
                                if (transferObject == null) {
                                    transferObject = interceptDrag(e.getNodes());
                                }
                                e.setDragObject(transferObject);
                            } catch (Exception t) {
                                LOG.error("Drag", t);
                            }
                        }
                        break;
                    }
                case TreeEvent.TYPE_NODE_DROP_ACTION:
                    {
                        m_lastSeenDropNode = null;
                        if (e.getDropObject() != null) {
                            try {
                                interceptDrop(e.getNode(), e.getDropObject());
                            } catch (Exception t) {
                                LOG.error("Drop", t);
                            }
                        }
                        break;
                    }
                case TreeEvent.TYPE_NODES_SELECTED:
                    {
                        rebuildKeyStrokesInternal();
                        break;
                    }
                case TreeEvent.TYPE_NODES_CHECKED:
                    {
                        try {
                            interceptNodesChecked(CollectionUtility.arrayList(e.getNodes()));
                        } catch (RuntimeException ex) {
                            BEANS.get(ExceptionHandler.class).handle(ex);
                        }
                        break;
                    }
                case TreeEvent.TYPE_NODE_DROP_TARGET_CHANGED:
                    {
                        try {
                            if (m_lastSeenDropNode == null || m_lastSeenDropNode != e.getNode()) {
                                m_lastSeenDropNode = e.getNode();
                                interceptDropTargetChanged(e.getNode());
                            }
                        } catch (RuntimeException ex) {
                            LOG.error("DropTargetChanged", ex);
                        }
                        break;
                    }
                case TreeEvent.TYPE_DRAG_FINISHED:
                    {
                        m_lastSeenDropNode = null;
                    }
            }
        }
    });
    // key shortcuts
    List<Class<? extends IKeyStroke>> configuredKeyStrokes = getConfiguredKeyStrokes();
    List<IKeyStroke> ksList = new ArrayList<IKeyStroke>(configuredKeyStrokes.size());
    for (Class<? extends IKeyStroke> keystrokeClazz : configuredKeyStrokes) {
        ksList.add(ConfigurationUtility.newInnerInstance(this, keystrokeClazz));
    }
    // ticket 87370: add ENTER key stroke when execNodeAction has an override
    if (ConfigurationUtility.isMethodOverwrite(AbstractTree.class, "execNodeAction", new Class[] { ITreeNode.class }, this.getClass())) {
        ksList.add(new KeyStroke("ENTER") {

            @Override
            protected void execAction() {
                fireNodeAction(getSelectedNode());
            }
        });
    }
    List<IKeyStroke> contributedKeyStrokes = m_contributionHolder.getContributionsByClass(IKeyStroke.class);
    contributedKeyStrokes.addAll(contributedKeyStrokes);
    m_baseKeyStrokes = ksList;
    setKeyStrokesInternal(m_baseKeyStrokes);
    // menus
    List<Class<? extends IMenu>> declaredMenus = getDeclaredMenus();
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    for (Class<? extends IMenu> menuClazz : declaredMenus) {
        IMenu menu = ConfigurationUtility.newInnerInstance(this, menuClazz);
        menus.addOrdered(menu);
    }
    try {
        injectMenusInternal(menus);
    } catch (Exception e) {
        LOG.error("Error occured while dynamically contributing menus.", e);
    }
    menus.addAllOrdered(contributedMenus);
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    TreeContextMenu contextMenu = new TreeContextMenu(this, menus.getOrderedList());
    setContextMenuInternal(contextMenu);
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) ContributionComposite(org.eclipse.scout.rt.shared.extension.ContributionComposite) ArrayList(java.util.ArrayList) IEventHistory(org.eclipse.scout.rt.client.ui.IEventHistory) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke) TransferObject(org.eclipse.scout.rt.client.ui.dnd.TransferObject) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke) KeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke) TreeContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.internal.TreeContextMenu) ITreeContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.ITreeContextMenu)

Example 8 with IKeyStroke

use of org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke in project scout.rt by eclipse.

the class JsonObjectFactory method createJsonAdapter.

@SuppressWarnings("unchecked")
@Override
public IJsonAdapter<?> createJsonAdapter(Object model, IUiSession session, String id, IJsonAdapter<?> parent) {
    // --- form fields ----
    if (model instanceof IGroupBox) {
        // we must distinct between normal group-boxes and group-boxes in tab-boxes
        // the use the same model, but we need different adapters
        IGroupBox groupBox = (IGroupBox) model;
        if (groupBox.getParentField() instanceof ITabBox) {
            return new JsonTabItem<IGroupBox>(groupBox, session, id, parent);
        } else {
            return new JsonGroupBox<IGroupBox>(groupBox, session, id, parent);
        }
    }
    if (model instanceof ISequenceBox) {
        return new JsonSequenceBox<ISequenceBox>((ISequenceBox) model, session, id, parent);
    }
    if (model instanceof ITabBox) {
        return new JsonTabBox<ITabBox>((ITabBox) model, session, id, parent);
    }
    if (model instanceof IBooleanField) {
        return new JsonCheckBoxField<IBooleanField>((IBooleanField) model, session, id, parent);
    }
    if (model instanceof ILabelField) {
        return new JsonLabelField<ILabelField>((ILabelField) model, session, id, parent);
    }
    if (model instanceof IImageField) {
        return new JsonImageField<IImageField>((IImageField) model, session, id, parent);
    }
    if (model instanceof ITableField<?>) {
        return new JsonTableField<ITableField<? extends ITable>>((ITableField<?>) model, session, id, parent);
    }
    if (model instanceof IListBox<?>) {
        return new JsonListBox((IListBox<?>) model, session, id, parent);
    }
    if (model instanceof ITreeField) {
        return new JsonTreeField<ITreeField>((ITreeField) model, session, id, parent);
    }
    if (model instanceof ITreeBox<?>) {
        return new JsonTreeBox<ITreeBox>((ITreeBox<?>) model, session, id, parent);
    }
    if (model instanceof IRadioButton<?>) {
        return new JsonRadioButton<IRadioButton>((IRadioButton<?>) model, session, id, parent);
    }
    if (model instanceof IRadioButtonGroup<?>) {
        return new JsonRadioButtonGroup<IRadioButtonGroup>((IRadioButtonGroup<?>) model, session, id, parent);
    }
    if (model instanceof IButton) {
        return new JsonButton<IButton>((IButton) model, session, id, parent);
    }
    if (model instanceof IStringField) {
        return new JsonStringField<IStringField>((IStringField) model, session, id, parent);
    }
    if (model instanceof INumberField<?>) {
        return new JsonNumberField<INumberField>((INumberField<?>) model, session, id, parent);
    }
    if (model instanceof IProposalField2<?>) {
        return new JsonProposalField2((IProposalField2<?>) model, session, id, parent);
    }
    if (model instanceof ISmartField2<?>) {
        return new JsonSmartField2((ISmartField2<?>) model, session, id, parent);
    }
    if (model instanceof IContentAssistField<?, ?>) {
        return new JsonSmartField((IContentAssistField<?, ?>) model, session, id, parent);
    }
    if (model instanceof IProposalChooser) {
        return new JsonProposalChooser<IProposalChooser>((IProposalChooser) model, session, id, parent);
    }
    if (model instanceof IDateField) {
        return new JsonDateField<IDateField>((IDateField) model, session, id, parent);
    }
    if (model instanceof ICalendarField<?>) {
        return new JsonCalendarField<ICalendarField<? extends ICalendar>>((ICalendarField<?>) model, session, id, parent);
    }
    if (model instanceof IPlannerField<?>) {
        return new JsonPlannerField((IPlannerField<?>) model, session, id, parent);
    }
    if (model instanceof IWrappedFormField<?>) {
        return new JsonWrappedFormField<IWrappedFormField<? extends IForm>>((IWrappedFormField<?>) model, session, id, parent);
    }
    if (model instanceof ISplitBox) {
        return new JsonSplitBox<ISplitBox>((ISplitBox) model, session, id, parent);
    }
    if (model instanceof IPlaceholderField) {
        return new JsonPlaceholderField<IPlaceholderField>((IPlaceholderField) model, session, id, parent);
    }
    if (model instanceof IWizardProgressField) {
        return new JsonWizardProgressField<IWizardProgressField>((IWizardProgressField) model, session, id, parent);
    }
    if (model instanceof IHtmlField) {
        return new JsonHtmlField<IHtmlField>((IHtmlField) model, session, id, parent);
    }
    if (model instanceof IComposerField) {
        return new JsonComposerField<IComposerField>((IComposerField) model, session, id, parent);
    }
    if (model instanceof IBeanField) {
        return new JsonBeanField<IBeanField<?>>((IBeanField) model, session, id, parent);
    }
    if (model instanceof IFileChooserField) {
        return new JsonFileChooserField<IFileChooserField>((IFileChooserField) model, session, id, parent);
    }
    if (model instanceof IColorField) {
        return new JsonColorField<IColorField>((IColorField) model, session, id, parent);
    }
    if (model instanceof IBrowserField) {
        return new JsonBrowserField<IBrowserField>((IBrowserField) model, session, id, parent);
    }
    if (model instanceof IClipboardField) {
        return new JsonClipboardField<IClipboardField>((IClipboardField) model, session, id, parent);
    }
    // --- other model objects ---
    if (model instanceof IDesktop) {
        return new JsonDesktop<IDesktop>((IDesktop) model, session, id, parent);
    }
    if (model instanceof IFormMenu<?>) {
        return new JsonFormMenu((IFormMenu<?>) model, session, id, parent);
    }
    if (model instanceof IMenu) {
        return new JsonMenu<IMenu>((IMenu) model, session, id, parent);
    }
    if (model instanceof IKeyStroke) {
        return new JsonKeyStroke<IKeyStroke>((IKeyStroke) model, session, id, parent);
    }
    if (model instanceof ISearchForm) {
        return new JsonSearchForm<ISearchForm>((ISearchForm) model, session, id, parent);
    }
    if (model instanceof IForm) {
        return new JsonForm<IForm>((IForm) model, session, id, parent);
    }
    if (model instanceof IMessageBox) {
        return new JsonMessageBox<IMessageBox>((IMessageBox) model, session, id, parent);
    }
    if (model instanceof IDesktopNotification) {
        return new JsonDesktopNotification<IDesktopNotification>((IDesktopNotification) model, session, id, parent);
    }
    if (model instanceof IOutlineViewButton) {
        return new JsonOutlineViewButton<IOutlineViewButton>((IOutlineViewButton) model, session, id, parent);
    }
    if (model instanceof IViewButton) {
        return new JsonViewButton<IViewButton>((IViewButton) model, session, id, parent);
    }
    if (model instanceof ISearchOutline) {
        return new JsonSearchOutline<ISearchOutline>((ISearchOutline) model, session, id, parent);
    }
    if (model instanceof IOutline) {
        return new JsonOutline<IOutline>((IOutline) model, session, id, parent);
    }
    if (model instanceof ITree) {
        return new JsonTree<ITree>((ITree) model, session, id, parent);
    }
    if (model instanceof ITable) {
        ITable table = (ITable) model;
        IPage page = (IPage) table.getProperty(JsonOutlineTable.PROP_PAGE);
        if (page != null) {
            return new JsonOutlineTable<ITable>(table, session, id, parent, page);
        }
        return new JsonTable<ITable>(table, session, id, parent);
    }
    if (model instanceof IClientSession) {
        return new JsonClientSession<IClientSession>((IClientSession) model, session, id, parent);
    }
    if (model instanceof ICalendar) {
        return new JsonCalendar<ICalendar>((ICalendar) model, session, id, parent);
    }
    if (model instanceof CalendarComponent) {
        return new JsonCalendarComponent<CalendarComponent>((CalendarComponent) model, session, id, parent);
    }
    if (model instanceof IPlanner<?, ?>) {
        return new JsonPlanner<IPlanner>((IPlanner<?, ?>) model, session, id, parent);
    }
    if (model instanceof IFileChooser) {
        return new JsonFileChooser<IFileChooser>((IFileChooser) model, session, id, parent);
    }
    if (model instanceof IAggregateTableControl) {
        // needs to be before ITableControl
        return new JsonAggregateTableControl<IAggregateTableControl>((IAggregateTableControl) model, session, id, parent);
    }
    if (model instanceof IFormTableControl) {
        // needs to be before ITableControl
        return new JsonFormTableControl<IFormTableControl>((IFormTableControl) model, session, id, parent);
    }
    if (model instanceof ITableControl) {
        return new JsonTableControl<ITableControl>((ITableControl) model, session, id, parent);
    }
    if (model instanceof IStatusMenuMapping) {
        return new JsonStatusMenuMapping<IStatusMenuMapping>((IStatusMenuMapping) model, session, id, parent);
    }
    return null;
}
Also used : JsonTabItem(org.eclipse.scout.rt.ui.html.json.form.fields.tabbox.JsonTabItem) ITableField(org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField) IColorField(org.eclipse.scout.rt.client.ui.form.fields.colorfield.IColorField) JsonSearchForm(org.eclipse.scout.rt.ui.html.json.desktop.JsonSearchForm) JsonProposalField2(org.eclipse.scout.rt.ui.html.json.form.fields.smartfield.JsonProposalField2) JsonFormMenu(org.eclipse.scout.rt.ui.html.json.desktop.JsonFormMenu) IOutlineViewButton(org.eclipse.scout.rt.client.ui.desktop.outline.IOutlineViewButton) IAggregateTableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.IAggregateTableControl) IFileChooser(org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser) ICalendar(org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar) JsonKeyStroke(org.eclipse.scout.rt.ui.html.json.action.keystroke.JsonKeyStroke) ISearchForm(org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm) ITabBox(org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox) JsonMessageBox(org.eclipse.scout.rt.ui.html.json.messagebox.JsonMessageBox) JsonSplitBox(org.eclipse.scout.rt.ui.html.json.form.fields.splitbox.JsonSplitBox) IWizardProgressField(org.eclipse.scout.rt.client.ui.form.fields.wizard.IWizardProgressField) IImageField(org.eclipse.scout.rt.client.ui.form.fields.imagefield.IImageField) JsonClientSession(org.eclipse.scout.rt.ui.html.json.JsonClientSession) IMessageBox(org.eclipse.scout.rt.client.ui.messagebox.IMessageBox) IRadioButtonGroup(org.eclipse.scout.rt.client.ui.form.fields.radiobuttongroup.IRadioButtonGroup) JsonAggregateTableControl(org.eclipse.scout.rt.ui.html.json.table.control.JsonAggregateTableControl) JsonTableControl(org.eclipse.scout.rt.ui.html.json.table.control.JsonTableControl) JsonImageField(org.eclipse.scout.rt.ui.html.json.form.fields.imagefield.JsonImageField) IButton(org.eclipse.scout.rt.client.ui.form.fields.button.IButton) IFormMenu(org.eclipse.scout.rt.client.ui.form.IFormMenu) JsonNumberField(org.eclipse.scout.rt.ui.html.json.form.fields.numberfield.JsonNumberField) ISplitBox(org.eclipse.scout.rt.client.ui.form.fields.splitbox.ISplitBox) IFormTableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.IFormTableControl) IBooleanField(org.eclipse.scout.rt.client.ui.form.fields.booleanfield.IBooleanField) JsonOutlineViewButton(org.eclipse.scout.rt.ui.html.json.desktop.JsonOutlineViewButton) IHtmlField(org.eclipse.scout.rt.client.ui.form.fields.htmlfield.IHtmlField) IPage(org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage) ISequenceBox(org.eclipse.scout.rt.client.ui.form.fields.sequencebox.ISequenceBox) ITreeField(org.eclipse.scout.rt.client.ui.form.fields.treefield.ITreeField) JsonDateField(org.eclipse.scout.rt.ui.html.json.form.fields.JsonDateField) IWrappedFormField(org.eclipse.scout.rt.client.ui.form.fields.wrappedform.IWrappedFormField) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) JsonCalendarComponent(org.eclipse.scout.rt.ui.html.json.calendar.JsonCalendarComponent) JsonFormTableControl(org.eclipse.scout.rt.ui.html.json.table.control.JsonFormTableControl) IContentAssistField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IContentAssistField) JsonSearchOutline(org.eclipse.scout.rt.ui.html.json.desktop.JsonSearchOutline) JsonFileChooserField(org.eclipse.scout.rt.ui.html.json.form.fields.filechooserfield.JsonFileChooserField) JsonFileChooser(org.eclipse.scout.rt.ui.html.json.basic.filechooser.JsonFileChooser) JsonStringField(org.eclipse.scout.rt.ui.html.json.form.fields.stringfield.JsonStringField) IProposalField2(org.eclipse.scout.rt.client.ui.form.fields.smartfield2.IProposalField2) IDesktopNotification(org.eclipse.scout.rt.client.ui.desktop.notification.IDesktopNotification) JsonDesktopNotification(org.eclipse.scout.rt.ui.html.json.desktop.JsonDesktopNotification) IViewButton(org.eclipse.scout.rt.client.ui.action.view.IViewButton) JsonCalendarField(org.eclipse.scout.rt.ui.html.json.form.fields.calendar.JsonCalendarField) JsonTabBox(org.eclipse.scout.rt.ui.html.json.form.fields.tabbox.JsonTabBox) JsonWrappedFormField(org.eclipse.scout.rt.ui.html.json.form.fields.wrappedform.JsonWrappedFormField) JsonDesktop(org.eclipse.scout.rt.ui.html.json.desktop.JsonDesktop) JsonViewButton(org.eclipse.scout.rt.ui.html.json.desktop.JsonViewButton) JsonTreeBox(org.eclipse.scout.rt.ui.html.json.form.fields.treebox.JsonTreeBox) IListBox(org.eclipse.scout.rt.client.ui.form.fields.listbox.IListBox) IStatusMenuMapping(org.eclipse.scout.rt.client.ui.form.fields.IStatusMenuMapping) IBeanField(org.eclipse.scout.rt.client.ui.form.fields.beanfield.IBeanField) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) IDateField(org.eclipse.scout.rt.client.ui.form.fields.datefield.IDateField) IFileChooserField(org.eclipse.scout.rt.client.ui.form.fields.filechooserfield.IFileChooserField) IForm(org.eclipse.scout.rt.client.ui.form.IForm) IClipboardField(org.eclipse.scout.rt.client.ui.form.fields.clipboardfield.IClipboardField) JsonTreeField(org.eclipse.scout.rt.ui.html.json.form.fields.treefield.JsonTreeField) INumberField(org.eclipse.scout.rt.client.ui.form.fields.numberfield.INumberField) JsonRadioButtonGroup(org.eclipse.scout.rt.ui.html.json.form.fields.radiobutton.JsonRadioButtonGroup) JsonButton(org.eclipse.scout.rt.ui.html.json.form.fields.button.JsonButton) JsonCheckBoxField(org.eclipse.scout.rt.ui.html.json.form.fields.checkbox.JsonCheckBoxField) JsonRadioButton(org.eclipse.scout.rt.ui.html.json.form.fields.radiobutton.JsonRadioButton) ISmartField2(org.eclipse.scout.rt.client.ui.form.fields.smartfield2.ISmartField2) IBrowserField(org.eclipse.scout.rt.client.ui.form.fields.browserfield.IBrowserField) JsonWizardProgressField(org.eclipse.scout.rt.ui.html.json.form.fields.wizard.JsonWizardProgressField) JsonMenu(org.eclipse.scout.rt.ui.html.json.menu.JsonMenu) JsonGroupBox(org.eclipse.scout.rt.ui.html.json.form.fields.groupbox.JsonGroupBox) ITree(org.eclipse.scout.rt.client.ui.basic.tree.ITree) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop) JsonListBox(org.eclipse.scout.rt.ui.html.json.form.fields.listbox.JsonListBox) JsonComposerField(org.eclipse.scout.rt.ui.html.json.form.fields.composer.JsonComposerField) IPlanner(org.eclipse.scout.rt.client.ui.basic.planner.IPlanner) IGroupBox(org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox) IClientSession(org.eclipse.scout.rt.client.IClientSession) JsonClipboardField(org.eclipse.scout.rt.ui.html.json.form.fields.clipboardfield.JsonClipboardField) JsonSequenceBox(org.eclipse.scout.rt.ui.html.json.form.fields.sequencebox.JsonSequenceBox) IComposerField(org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField) ITreeBox(org.eclipse.scout.rt.client.ui.form.fields.treebox.ITreeBox) JsonStatusMenuMapping(org.eclipse.scout.rt.ui.html.json.form.fields.JsonStatusMenuMapping) IStringField(org.eclipse.scout.rt.client.ui.form.fields.stringfield.IStringField) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) JsonOutlineTable(org.eclipse.scout.rt.ui.html.json.table.JsonOutlineTable) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke) JsonLabelField(org.eclipse.scout.rt.ui.html.json.form.fields.labelfield.JsonLabelField) IPlaceholderField(org.eclipse.scout.rt.client.ui.form.fields.placeholder.IPlaceholderField) JsonBrowserField(org.eclipse.scout.rt.ui.html.json.form.fields.browserfield.JsonBrowserField) ISearchOutline(org.eclipse.scout.rt.client.ui.desktop.outline.ISearchOutline) JsonSmartField(org.eclipse.scout.rt.ui.html.json.form.fields.smartfield.JsonSmartField) JsonOutline(org.eclipse.scout.rt.ui.html.json.desktop.JsonOutline) JsonProposalChooser(org.eclipse.scout.rt.ui.html.json.form.fields.smartfield.JsonProposalChooser) ILabelField(org.eclipse.scout.rt.client.ui.form.fields.labelfield.ILabelField) JsonBeanField(org.eclipse.scout.rt.ui.html.json.form.fields.beanfield.JsonBeanField) JsonTable(org.eclipse.scout.rt.ui.html.json.table.JsonTable) JsonTree(org.eclipse.scout.rt.ui.html.json.tree.JsonTree) CalendarComponent(org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent) JsonCalendarComponent(org.eclipse.scout.rt.ui.html.json.calendar.JsonCalendarComponent) JsonPlanner(org.eclipse.scout.rt.ui.html.json.basic.planner.JsonPlanner) JsonPlannerField(org.eclipse.scout.rt.ui.html.json.form.fields.plannerfield.JsonPlannerField) ICalendarField(org.eclipse.scout.rt.client.ui.form.fields.calendarfield.ICalendarField) JsonCalendar(org.eclipse.scout.rt.ui.html.json.calendar.JsonCalendar) IRadioButton(org.eclipse.scout.rt.client.ui.form.fields.button.IRadioButton) JsonHtmlField(org.eclipse.scout.rt.ui.html.json.form.fields.htmlfield.JsonHtmlField) JsonPlaceholderField(org.eclipse.scout.rt.ui.html.json.form.fields.placeholder.JsonPlaceholderField) JsonTableField(org.eclipse.scout.rt.ui.html.json.form.fields.tablefield.JsonTableField) JsonColorField(org.eclipse.scout.rt.ui.html.json.form.fields.colorfield.JsonColorField) JsonForm(org.eclipse.scout.rt.ui.html.json.form.JsonForm) IProposalChooser(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalChooser) IPlannerField(org.eclipse.scout.rt.client.ui.form.fields.plannerfield.IPlannerField) JsonSmartField2(org.eclipse.scout.rt.ui.html.json.form.fields.smartfield.JsonSmartField2)

Example 9 with IKeyStroke

use of org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke in project scout.rt by eclipse.

the class JsonDesktop method toJson.

@Override
public JSONObject toJson() {
    JSONObject json = super.toJson();
    json.put(IDesktop.PROP_DISPLAY_STYLE, getModel().getDisplayStyle());
    putAdapterIdProperty(json, IDesktop.PROP_ACTIVE_FORM, getModel().getActiveForm());
    putAdapterIdsProperty(json, "views", getModel().getViews(getModel()));
    putAdapterIdsProperty(json, "dialogs", getModel().getDialogs(getModel(), false));
    putAdapterIdsProperty(json, "messageBoxes", getModel().getMessageBoxes(getModel()));
    putAdapterIdsProperty(json, "notifications", getModel().getNotifications());
    putAdapterIdsProperty(json, "fileChoosers", getModel().getFileChoosers(getModel()));
    putAdapterIdsProperty(json, "menus", getModel().getMenus(), new DisplayableActionFilter<IMenu>());
    putAdapterIdsProperty(json, "addOns", getModel().getAddOns());
    putAdapterIdsProperty(json, "keyStrokes", getModel().getKeyStrokes(), new DisplayableActionFilter<IKeyStroke>());
    putAdapterIdsProperty(json, "viewButtons", getModel().getViewButtons(), new DisplayableActionFilter<IViewButton>());
    putAdapterIdProperty(json, "outline", getModel().getOutline(), new DisplayableOutlineFilter<IOutline>());
    if (getModel().getSelectedViews(getModel()).size() > 0) {
        putAdapterIdsProperty(json, "selectedViewTabs", getModel().getSelectedViews(getModel()));
    }
    return json;
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) JSONObject(org.json.JSONObject) IViewButton(org.eclipse.scout.rt.client.ui.action.view.IViewButton) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IKeyStroke(org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)

Aggregations

IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)9 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 IEventHistory (org.eclipse.scout.rt.client.ui.IEventHistory)3 IViewButton (org.eclipse.scout.rt.client.ui.action.view.IViewButton)3 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)3 ContributionComposite (org.eclipse.scout.rt.shared.extension.ContributionComposite)3 LinkedHashMap (java.util.LinkedHashMap)2 KeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.KeyStroke)2 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)2 TreeMap (java.util.TreeMap)1 IClientSession (org.eclipse.scout.rt.client.IClientSession)1 DeepLinkException (org.eclipse.scout.rt.client.deeplink.DeepLinkException)1 IDeviceTransformationService (org.eclipse.scout.rt.client.transformation.IDeviceTransformationService)1 ActionFinder (org.eclipse.scout.rt.client.ui.action.ActionFinder)1 IAction (org.eclipse.scout.rt.client.ui.action.IAction)1 ITreeContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.ITreeContextMenu)1 TreeContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.internal.TreeContextMenu)1