Search in sources :

Example 1 with PeriodSubFormPanel

use of org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel in project activityinfo by bedatadriven.

the class FormWidgetCreator method createSubformPanel.

public SubFormPanel createSubformPanel(FormClass subForm, int depth, RelevanceHandler relevanceHandler, PanelFiller filler) {
    final SubFormPanel panel;
    if (subForm.getSubFormKind() == SubFormKind.REPEATING) {
        panel = new RepeatingSubFormPanel(subForm, model);
    } else {
        panel = new PeriodSubFormPanel(model, subForm, relevanceHandler, filler, depth);
    }
    subformPanels.put(subForm, panel);
    return panel;
}
Also used : RepeatingSubFormPanel(org.activityinfo.ui.client.component.form.subform.RepeatingSubFormPanel) SubFormPanel(org.activityinfo.ui.client.component.form.subform.SubFormPanel) PeriodSubFormPanel(org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel) PeriodSubFormPanel(org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel) RepeatingSubFormPanel(org.activityinfo.ui.client.component.form.subform.RepeatingSubFormPanel)

Example 2 with PeriodSubFormPanel

use of org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel in project activityinfo by bedatadriven.

the class SimpleFormPanel method getSelectedKey.

/**
 * Returns selected key/tab for given field or otherwise null if nothing is selected or it is root instance (no key).
 *
 * @return selected key/tab for given field or otherwise null if nothing is selected or it is root instance (no key).
 */
public String getSelectedKey(FormField field) {
    FormClass formClass = model.getClassByField(field.getId());
    if (formClass.isSubForm()) {
        SubFormPanel subformPanel = widgetCreator.getSubformPanel(formClass);
        if (subformPanel instanceof PeriodSubFormPanel) {
            PeriodSubFormPanel periodSubFormPanel = (PeriodSubFormPanel) subformPanel;
            Tab selectedTab = periodSubFormPanel.getSelectedTab();
            if (selectedTab != null) {
                return selectedTab.getId();
            }
        }
    }
    return null;
}
Also used : PeriodSubFormPanel(org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel) RepeatingSubFormPanel(org.activityinfo.ui.client.component.form.subform.RepeatingSubFormPanel) SubFormPanel(org.activityinfo.ui.client.component.form.subform.SubFormPanel) Tab(org.activityinfo.ui.client.component.form.subform.Tab) FormClass(org.activityinfo.model.form.FormClass) PeriodSubFormPanel(org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel)

Aggregations

PeriodSubFormPanel (org.activityinfo.ui.client.component.form.subform.PeriodSubFormPanel)2 RepeatingSubFormPanel (org.activityinfo.ui.client.component.form.subform.RepeatingSubFormPanel)2 SubFormPanel (org.activityinfo.ui.client.component.form.subform.SubFormPanel)2 FormClass (org.activityinfo.model.form.FormClass)1 Tab (org.activityinfo.ui.client.component.form.subform.Tab)1