Search in sources :

Example 1 with AbstractFormData

use of org.eclipse.scout.rt.shared.data.form.AbstractFormData in project scout.rt by eclipse.

the class AbstractForm method getFormDataClass.

protected Class<? extends AbstractFormData> getFormDataClass() {
    FormData formDataAnnotation = getClass().getAnnotation(FormData.class);
    // look in superclasses for annotation
    Class<?> superclazz = getClass().getSuperclass();
    while (formDataAnnotation == null && superclazz != null) {
        formDataAnnotation = superclazz.getAnnotation(FormData.class);
        superclazz = superclazz.getSuperclass();
    }
    if (formDataAnnotation == null) {
        // no annotation found..
        return null;
    }
    @SuppressWarnings("unchecked") Class<? extends AbstractFormData> formDataClass = formDataAnnotation.value();
    if (formDataClass == null) {
        return null;
    }
    if (AbstractFormData.class.isAssignableFrom(formDataClass) && !Modifier.isAbstract(formDataClass.getModifiers())) {
        return formDataClass;
    }
    return null;
}
Also used : FormData(org.eclipse.scout.rt.client.dto.FormData) AbstractFormData(org.eclipse.scout.rt.shared.data.form.AbstractFormData) AbstractFormData(org.eclipse.scout.rt.shared.data.form.AbstractFormData)

Example 2 with AbstractFormData

use of org.eclipse.scout.rt.shared.data.form.AbstractFormData in project scout.rt by eclipse.

the class AbstractForm method execResetSearchFilter.

/**
 * Called when saving the form via {@link #resetSearchFilter()}.
 * <p>
 * This operation fills up the search filter and subclass override sets the formData property of the
 * {@link SearchFilter#setFormData(AbstractFormData)} and adds verbose texts with
 * {@link SearchFilter#addDisplayText(String)}
 * <p>
 * May call {@link #setSearchFilter(SearchFilter)}
 * <p>
 * Attaches a filled form data to the search filter if {@link #execCreateFormData()} returns a value.
 *
 * @param searchFilter
 *          is never null
 */
@ConfigOperation
@Order(10)
protected void execResetSearchFilter(final SearchFilter searchFilter) {
    searchFilter.clear();
    // add verbose field texts
    // do not use visitor, so children can block traversal on whole subtrees
    getRootGroupBox().applySearch(searchFilter);
    // add verbose form texts
    interceptAddSearchTerms(searchFilter);
    // override may add form data
    AbstractFormData data = createFormData();
    if (data != null) {
        exportFormData(data);
        getSearchFilter().setFormData(data);
    }
}
Also used : AbstractFormData(org.eclipse.scout.rt.shared.data.form.AbstractFormData) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Aggregations

AbstractFormData (org.eclipse.scout.rt.shared.data.form.AbstractFormData)2 FormData (org.eclipse.scout.rt.client.dto.FormData)1 Order (org.eclipse.scout.rt.platform.Order)1 ConfigOperation (org.eclipse.scout.rt.platform.annotations.ConfigOperation)1