use of org.eclipse.scout.rt.client.ui.form.IForm 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();
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractDesktop method setPageDetailForm.
@Override
public void setPageDetailForm(IForm f) {
if (m_pageDetailForm != f) {
IForm oldForm = m_pageDetailForm;
m_pageDetailForm = f;
// extensions
for (IDesktopExtension ext : getDesktopExtensions()) {
try {
ContributionCommand cc = ext.pageDetailFormChangedDelegate(oldForm, m_pageDetailForm);
if (cc == ContributionCommand.Stop) {
break;
}
} catch (Exception e) {
LOG.error("extension {}", ext, e);
}
}
}
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractDesktop method getUnsavedForms.
@Override
public List<IForm> getUnsavedForms() {
List<IForm> saveNeededForms = new ArrayList<IForm>();
List<IForm> showedForms = m_formStore.values();
// last element on the stack is the first that needs to be saved: iterate from end to start
for (int i = showedForms.size() - 1; i >= 0; i--) {
IForm f = showedForms.get(i);
if (f.isAskIfNeedSave() && f.isSaveNeeded()) {
saveNeededForms.add(f);
}
}
return saveNeededForms;
}
use of org.eclipse.scout.rt.client.ui.form.IForm 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);
}
use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.
the class AbstractDesktop method getSimilarViewForms.
@Override
public List<IForm> getSimilarViewForms(final IForm form) {
if (form == null) {
return CollectionUtility.emptyArrayList();
}
final Object formKey;
try {
formKey = form.computeExclusiveKey();
} catch (final RuntimeException | PlatformError e) {
BEANS.get(ExceptionHandler.class).handle(e);
return CollectionUtility.emptyArrayList();
}
if (formKey == null) {
return CollectionUtility.emptyArrayList();
}
final IForm currentDetailForm = getPageDetailForm();
final IForm currentSearchForm = getPageSearchForm();
final List<IForm> similarForms = new ArrayList<>();
for (final IForm candidateView : m_formStore.getViewsByKey(formKey)) {
if (candidateView == currentDetailForm) {
continue;
}
if (candidateView == currentSearchForm) {
continue;
}
if (candidateView.getClass().equals(form.getClass())) {
similarForms.add(candidateView);
}
}
return similarForms;
}
Aggregations