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);
}
}
}
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;
}
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));
}
}
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);
}
}
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();
}
}
Aggregations