Search in sources :

Example 1 with FormListener

use of org.eclipse.scout.rt.client.ui.form.FormListener 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 2 with FormListener

use of org.eclipse.scout.rt.client.ui.form.FormListener 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();
    }
}
Also used : FormListener(org.eclipse.scout.rt.client.ui.form.FormListener) FormEvent(org.eclipse.scout.rt.client.ui.form.FormEvent) IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 3 with FormListener

use of org.eclipse.scout.rt.client.ui.form.FormListener 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);
            }
        }
    });
}
Also used : FormListener(org.eclipse.scout.rt.client.ui.form.FormListener) FormEvent(org.eclipse.scout.rt.client.ui.form.FormEvent) ISearchForm(org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm)

Aggregations

FormEvent (org.eclipse.scout.rt.client.ui.form.FormEvent)3 FormListener (org.eclipse.scout.rt.client.ui.form.FormListener)3 ISearchForm (org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm)1 IForm (org.eclipse.scout.rt.client.ui.form.IForm)1 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)1