use of org.eclipse.scout.rt.client.ui.form.FormEvent 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.client.ui.form.FormEvent in project scout.rt by eclipse.
the class AbstractFormTableControl method ensureFormCreated.
public void ensureFormCreated() {
if (getForm() != null) {
return;
}
IForm form = createForm();
if (form != null) {
form.addFormListener(new FormListener() {
@Override
public void formChanged(FormEvent e) {
if (e.getType() == FormEvent.TYPE_CLOSED) {
setSelected(false);
setForm(null);
}
}
});
setForm(form);
decorateForm();
interceptInitForm();
}
}
use of org.eclipse.scout.rt.client.ui.form.FormEvent in project scout.rt by eclipse.
the class MobileDeviceTransformer method notifyPageSearchFormInit.
@Override
public void notifyPageSearchFormInit(final IPageWithTable<ITable> page) {
if (!getDeviceTransformationConfig().isTransformationEnabled(MobileDeviceTransformation.AUTO_CLOSE_SEARCH_FORM)) {
return;
}
ISearchForm searchForm = page.getSearchFormInternal();
searchForm.addFormListener(new FormListener() {
@Override
public void formChanged(FormEvent e) {
if (FormEvent.TYPE_STORE_AFTER == e.getType()) {
onSearchFormStored(page);
}
}
});
}
use of org.eclipse.scout.rt.client.ui.form.FormEvent in project scout.rt by eclipse.
the class JsonForm method init.
@Override
public void init() {
super.init();
// Replay missed events
IEventHistory<FormEvent> eventHistory = getModel().getEventHistory();
if (eventHistory != null) {
for (FormEvent event : eventHistory.getRecentEvents()) {
handleModelFormChanged(event);
}
}
}
Aggregations