Search in sources :

Example 1 with FormGroup

use of org.activityinfo.ui.client.widget.form.FormGroup in project activityinfo by bedatadriven.

the class PanelFiller method add.

public void add(FormElementContainer container, final int depth, final FlowPanel panel) {
    if (headingVisible) {
        FormHeading heading = new FormHeading();
        heading.setFormClass(model.getRootFormClass());
        panel.add(heading);
    }
    for (FormElement element : container.getElements()) {
        if (element instanceof FormLabel) {
            FormLabel formLabel = (FormLabel) element;
            panel.add(new FormGroup().label(formLabel.getLabel()));
        } else if (element instanceof FormSection) {
            panel.add(createHeader(depth, element.getLabel()));
            add((FormElementContainer) element, depth + 1);
        } else if (element instanceof FormField) {
            FormField formField = (FormField) element;
            if (formField.isVisible()) {
                if (formField.getType() instanceof SubFormReferenceType) {
                    final FormClass subForm = model.getSubFormByOwnerFieldId(formField.getId());
                    final FlowPanel subFormFieldPanel = new FlowPanel();
                    subFormFieldPanel.addStyleName(FormPanelStyles.INSTANCE.subformPanel());
                    subFormFieldPanel.add(createHeader(depth + 1, subForm.getLabel()));
                    subFormFieldPanel.add(widgetCreator.createSubformPanel(subForm, depth + 1, relevanceHandler, this).getLoadingPanel());
                    panel.add(subFormFieldPanel);
                } else {
                    panel.add(widgetCreator.get(formField.getId()));
                }
            }
        }
    }
}
Also used : SubFormReferenceType(org.activityinfo.model.type.subform.SubFormReferenceType) FormGroup(org.activityinfo.ui.client.widget.form.FormGroup) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 SubFormReferenceType (org.activityinfo.model.type.subform.SubFormReferenceType)1 FormGroup (org.activityinfo.ui.client.widget.form.FormGroup)1