Search in sources :

Example 1 with Tab

use of org.activityinfo.ui.client.component.form.subform.Tab 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

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