Search in sources :

Example 1 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.

the class AbstractDesktop method closeInternal.

@Override
public void closeInternal() {
    setOpenedInternal(false);
    detachGui();
    List<IForm> showedForms = new ArrayList<IForm>();
    // Remove showed forms
    for (IForm form : m_formStore.values()) {
        hideForm(form);
        showedForms.add(form);
    }
    // extensions
    for (IDesktopExtension ext : getDesktopExtensions()) {
        try {
            ContributionCommand cc = ext.desktopClosingDelegate();
            if (cc == ContributionCommand.Stop) {
                break;
            }
        } catch (RuntimeException | PlatformError t) {
            LOG.error("extension {}", ext, t);
        }
    }
    // close messageboxes
    for (IMessageBox m : getMessageBoxes()) {
        if (m != null) {
            try {
                m.getUIFacade().setResultFromUI(IMessageBox.CANCEL_OPTION);
            } catch (RuntimeException | PlatformError e) {
                LOG.error("Exception while closing messagebox", e);
            }
        }
    }
    // close filechoosers
    for (IFileChooser f : getFileChoosers()) {
        if (f != null) {
            try {
                f.getUIFacade().setResultFromUI(Collections.<BinaryResource>emptyList());
            } catch (RuntimeException | PlatformError e) {
                LOG.error("Exception while closing filechooser", e);
            }
        }
    }
    // close client callbacks
    for (ClientCallback<?> c : CollectionUtility.arrayList(m_pendingPositionResponses)) {
        if (c != null) {
            try {
                c.cancel(true);
                c.failed(new ThreadInterruptedError("desktop is closing"));
            } catch (RuntimeException | PlatformError e) {
                LOG.error("Exception while closing client callback", e);
            }
        }
    }
    // close open forms
    for (IForm form : showedForms) {
        if (form != null) {
            try {
                form.doClose();
            } catch (RuntimeException | PlatformError e) {
                LOG.error("Exception while closing form", e);
            }
        }
    }
    // dispose outlines
    for (IOutline outline : getAvailableOutlines()) {
        try {
            outline.disposeTree();
        } catch (RuntimeException | PlatformError e) {
            LOG.warn("Exception while disposing outline.", e);
        }
    }
    ActionUtility.disposeActions(getActions());
    fireDesktopClosed();
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ArrayList(java.util.ArrayList) ThreadInterruptedError(org.eclipse.scout.rt.platform.util.concurrent.ThreadInterruptedError) IForm(org.eclipse.scout.rt.client.ui.form.IForm) IMessageBox(org.eclipse.scout.rt.client.ui.messagebox.IMessageBox) PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) IFileChooser(org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)

Example 2 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.

the class AbstractDesktop method setOutlineInternal.

protected void setOutlineInternal(IOutline newOutline) {
    final IOutline oldOutline = m_outline;
    if (oldOutline != null) {
        if (m_activeOutlineListener != null) {
            oldOutline.removePropertyChangeListener(m_activeOutlineListener);
            m_activeOutlineListener = null;
        }
        m_outline.deactivate();
    }
    // set new outline to set facts
    m_outline = newOutline;
    // deactivate old page
    if (oldOutline != null) {
        oldOutline.clearContextPage();
    }
    final ClientRunContext ctx;
    if (m_outline == null) {
        ctx = ClientRunContexts.copyCurrent().withOutline(null, true);
    } else {
        ctx = m_outline.createDisplayParentRunContext();
    }
    ctx.run(new IRunnable() {

        @Override
        public void run() throws Exception {
            if (m_outline != null) {
                m_activeOutlineListener = new P_ActiveOutlineListener();
                m_outline.addPropertyChangeListener(m_activeOutlineListener);
                setBrowserHistoryEntry(BEANS.get(OutlineDeepLinkHandler.class).createBrowserHistoryEntry(m_outline));
            }
            // This change is needed for the "on/off semantics" of the tool tab buttons to work correctly.
            if (m_outline == null) {
                setPageDetailForm(null);
                setPageDetailTable(null);
                setPageSearchForm(null, true);
            }
            // </bsh>
            updateActiveFormOnOutlineChanged();
            fireOutlineChanged(oldOutline, m_outline);
            onOutlineChangedInternal();
            fireOutlineContentActivate();
        }
    });
}
Also used : OutlineDeepLinkHandler(org.eclipse.scout.rt.client.deeplink.OutlineDeepLinkHandler) ClientRunContext(org.eclipse.scout.rt.client.context.ClientRunContext) IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IRunnable(org.eclipse.scout.rt.platform.util.concurrent.IRunnable) DeepLinkException(org.eclipse.scout.rt.client.deeplink.DeepLinkException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) VetoException(org.eclipse.scout.rt.platform.exception.VetoException)

Example 3 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.

the class AbstractDesktop method activateForm.

@Override
public void activateForm(IForm form) {
    if (form == null) {
        setActiveForm(form);
        return;
    }
    if (!m_formStore.contains(form)) {
        // only dialogs or views can be activated.
        return;
    }
    IDisplayParent displayParent = form.getDisplayParent();
    if (displayParent instanceof IForm) {
        activateForm((IForm) displayParent);
    } else if (displayParent instanceof IOutline && !displayParent.equals(getOutline())) {
        activateOutline(((IOutline) displayParent));
    }
    setActiveForm(form);
    fireFormActivate(form);
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) IDisplayParent(org.eclipse.scout.rt.client.ui.IDisplayParent) IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 4 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.

the class AbstractDesktop method ensureProposalChoosersClosed.

/**
 * Avoid that proposal choosers from content assist fields are still opened in the Java model after the UI has been
 * reloaded by pressing Ctrl + R. This is only required for the 'old' smart-field, the new smart-field (2) has no
 * model representation of the proposal chooser anymore. That means when the UI is reloaded, the proposal chooser is
 * gone. Thus, this method mimics the behavior of the new smart-field. #216067
 *
 * @deprecated will be removed with 7.1
 */
@Deprecated
protected void ensureProposalChoosersClosed() {
    closeProposalChoosers(getActiveForm());
    IOutline outline = getOutline();
    if (outline != null) {
        closeProposalChoosers(outline.getDetailForm());
        closeProposalChoosers(outline.getSearchForm());
    }
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)

Example 5 with IOutline

use of org.eclipse.scout.rt.client.ui.desktop.outline.IOutline in project scout.rt by eclipse.

the class AbstractDesktopExtension method contributeOutlines.

@Override
public void contributeOutlines(OrderedCollection<IOutline> outlines) {
    List<Class<? extends IOutline>> contributedOutlines = getConfiguredOutlines();
    if (contributedOutlines == null) {
        return;
    }
    for (Class<? extends IOutline> element : contributedOutlines) {
        try {
            IOutline o = element.newInstance();
            outlines.addOrdered(o);
        } catch (Exception t) {
            BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + element.getName() + "'.", t));
        }
    }
}
Also used : IOutline(org.eclipse.scout.rt.client.ui.desktop.outline.IOutline) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) VetoException(org.eclipse.scout.rt.platform.exception.VetoException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Aggregations

IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)49 Test (org.junit.Test)24 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)18 IPage (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage)12 ArrayList (java.util.ArrayList)11 Outline (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.Outline)9 JsonTreeTest (org.eclipse.scout.rt.ui.html.json.tree.JsonTreeTest)7 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)5 IForm (org.eclipse.scout.rt.client.ui.form.IForm)5 JSONObject (org.json.JSONObject)5 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)4 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)4 TablePage (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.TablePage)4 List (java.util.List)3 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)3 IViewButton (org.eclipse.scout.rt.client.ui.action.view.IViewButton)3 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)3 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)3 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)3 JsonOutline (org.eclipse.scout.rt.ui.html.json.desktop.JsonOutline)3