Search in sources :

Example 16 with PlatformError

use of org.eclipse.scout.rt.platform.exception.PlatformError in project scout.rt by eclipse.

the class AbstractPage method disposeInternal.

@Override
public void disposeInternal() {
    super.disposeInternal();
    try {
        interceptDisposePage();
        disposeDetailForm();
        disposeTable();
        fireAfterPageDispose();
    } catch (RuntimeException | PlatformError e) {
        BEANS.get(ExceptionHandler.class).handle(e);
    }
    // automatically remove all data change listeners
    ITree tree = getTree();
    if (tree != null) {
        tree.removeTreeListener(m_treeListener);
    }
    if (m_internalDataChangeListener != null) {
        IDesktop desktop = ClientSessionProvider.currentSession().getDesktop();
        if (desktop != null) {
            desktop.removeDataChangeListener(m_internalDataChangeListener);
        }
    }
}
Also used : PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) ITree(org.eclipse.scout.rt.client.ui.basic.tree.ITree) IDesktop(org.eclipse.scout.rt.client.ui.desktop.IDesktop)

Example 17 with PlatformError

use of org.eclipse.scout.rt.platform.exception.PlatformError in project scout.rt by eclipse.

the class AbstractPageWithTable method getChildPagesFor.

/**
 * Computes the list of linked child pages for the given table rows. Revalidates the the pages cell if
 * <code>updateChildPageCells</code> is true. Otherwise, the cells are not updated.
 */
private List<IPage<?>> getChildPagesFor(List<? extends ITableRow> tableRows, boolean updateChildPageCells) {
    List<IPage<?>> result = new ArrayList<IPage<?>>();
    try {
        for (ITableRow row : tableRows) {
            IPage<?> page = getPageFor(row);
            if (page != null) {
                result.add(page);
                if (updateChildPageCells) {
                    // update tree nodes from table rows
                    page.setEnabled(row.isEnabled(), IDimensions.ENABLED);
                    T table = getTable();
                    if (table != null) {
                        ICell tableCell = table.getSummaryCell(row);
                        page.getCellForUpdate().updateFrom(tableCell);
                    }
                }
            }
        }
    } catch (RuntimeException | PlatformError e) {
        BEANS.get(ExceptionHandler.class).handle(e);
    }
    return result;
}
Also used : PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) ArrayList(java.util.ArrayList) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell)

Example 18 with PlatformError

use of org.eclipse.scout.rt.platform.exception.PlatformError in project scout.rt by eclipse.

the class AbstractPageWithTable method attachToSearchFormInternal.

private void attachToSearchFormInternal() {
    if (m_searchForm == null) {
        return;
    }
    m_searchForm.setDisplayHint(ISearchForm.DISPLAY_HINT_VIEW);
    if (m_searchForm.getDisplayViewId() == null) {
        m_searchForm.setDisplayViewId(IForm.VIEW_ID_PAGE_SEARCH);
    }
    m_searchForm.setShowOnStart(false);
    // listen for search action
    m_searchFormListener = new FormListener() {

        @Override
        public void formChanged(FormEvent e) {
            switch(e.getType()) {
                case FormEvent.TYPE_LOAD_COMPLETE:
                    {
                        // do page reload to execute search
                        try {
                            T table = getTable(false);
                            if (table != null) {
                                table.discardAllRows();
                            }
                        } catch (RuntimeException | PlatformError ex) {
                            BEANS.get(ExceptionHandler.class).handle(ex);
                        }
                        break;
                    }
                case FormEvent.TYPE_STORE_AFTER:
                    {
                        // do page reload to execute search
                        try {
                            reloadPage();
                        } catch (RuntimeException | PlatformError ex) {
                            BEANS.get(ExceptionHandler.class).handle(ex);
                        }
                        break;
                    }
            }
        }
    };
    m_searchForm.addFormListener(m_searchFormListener);
    try {
        interceptInitSearchForm();
    } catch (Exception e) {
        BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating search form '" + m_searchForm.getClass().getName() + "' for page '" + getClass().getName() + "'.", e));
    }
}
Also used : FormListener(org.eclipse.scout.rt.client.ui.form.FormListener) FormEvent(org.eclipse.scout.rt.client.ui.form.FormEvent) PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) VetoException(org.eclipse.scout.rt.platform.exception.VetoException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Example 19 with PlatformError

use of org.eclipse.scout.rt.platform.exception.PlatformError in project scout.rt by eclipse.

the class AbstractValueField method setValue.

@Override
public final void setValue(VALUE rawValue) {
    if (isValueChanging()) {
        LOG.warn("Loop detection in {} with value {}", getClass().getName(), rawValue, new Exception());
        return;
    }
    try {
        setFieldChanging(true);
        setValueChanging(true);
        removeErrorStatus(ParsingFailedStatus.class);
        removeErrorStatus(ValidationFailedStatus.class);
        VALUE validatedValue = null;
        try {
            validatedValue = validateValue(rawValue);
        } catch (ProcessingException v) {
            handleValidationFailed(v, rawValue);
            return;
        } catch (Exception e) {
            final String message = TEXTS.get("InvalidValueMessageX", StringUtility.emptyIfNull(rawValue));
            ProcessingException pe = new ProcessingException(message, e);
            LOG.warn("Unexpected Error: ", pe);
            handleValidationFailed(pe, rawValue);
            return;
        }
        // 
        VALUE oldValue = getValue();
        boolean changed = propertySupport.setPropertyNoFire(PROP_VALUE, validatedValue);
        // change text if auto-set-text enabled
        updateDisplayText(validatedValue);
        if (changed) {
            propertySupport.firePropertyChange(PROP_VALUE, oldValue, validatedValue);
            // 
            valueChangedInternal();
            checkSaveNeeded();
            checkEmpty();
            fireMasterChanged();
            if (isValueChangeTriggerEnabled()) {
                try {
                    interceptChangedValue();
                } catch (RuntimeException | PlatformError ex) {
                    BEANS.get(ExceptionHandler.class).handle(ex);
                }
            }
        }
    } finally {
        setValueChanging(false);
        setFieldChanging(false);
    }
}
Also used : PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) IOException(java.io.IOException) VetoException(org.eclipse.scout.rt.platform.exception.VetoException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Example 20 with PlatformError

use of org.eclipse.scout.rt.platform.exception.PlatformError in project scout.rt by eclipse.

the class AbstractClientSession method stop.

@Override
public void stop(int exitCode) {
    if (!m_permitToStop.tryAcquire()) {
        // we are already stopping (or have been stopped)
        return;
    }
    try {
        if (!m_desktop.doBeforeClosingInternal()) {
            m_permitToStop.release();
            return;
        }
    } catch (RuntimeException | PlatformError e) {
        m_permitToStop.release();
        throw e;
    }
    // --- Point of no return ---
    m_stopping = true;
    m_exitCode = exitCode;
    try {
        fireSessionChangedEvent(new SessionEvent(this, SessionEvent.TYPE_STOPPING));
    } catch (Exception t) {
        LOG.error("Failed to send STOPPING event.", t);
    }
    try {
        interceptStoreSession();
    } catch (Exception t) {
        LOG.error("Failed to store the client session.", t);
    }
    if (m_desktop != null) {
        try {
            m_desktop.closeInternal();
        } catch (Exception t) {
            LOG.error("Failed to close the desktop.", t);
        }
        m_desktop = null;
    }
    try {
        cancelRunningJobs();
    } finally {
        inactivateSession();
    }
}
Also used : SessionEvent(org.eclipse.scout.rt.shared.session.SessionEvent) PlatformError(org.eclipse.scout.rt.platform.exception.PlatformError) URISyntaxException(java.net.URISyntaxException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Aggregations

PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)21 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)7 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)6 ArrayList (java.util.ArrayList)5 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)5 HashSet (java.util.HashSet)4 IForm (org.eclipse.scout.rt.client.ui.form.IForm)4 PlatformExceptionTranslator (org.eclipse.scout.rt.platform.exception.PlatformExceptionTranslator)4 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)4 Holder (org.eclipse.scout.rt.platform.holders.Holder)3 IHolder (org.eclipse.scout.rt.platform.holders.IHolder)3 IPropertyHolder (org.eclipse.scout.rt.shared.data.form.IPropertyHolder)3 IExtensibleObject (org.eclipse.scout.rt.shared.extension.IExtensibleObject)3 IOException (java.io.IOException)2 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)2 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)2 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)2 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1