Search in sources :

Example 1 with FormEvent

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));
    }
}
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 FormEvent

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

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

Example 4 with FormEvent

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

Aggregations

FormEvent (org.eclipse.scout.rt.client.ui.form.FormEvent)4 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