package gov.nih.nci.cabig.ctms.web.tabs;

import gov.nih.nci.cabig.ctms.web.tabs.Tab;

import java.util.List;
import java.util.LinkedList;

/**
 * A collection of {@link Tab}s.
 *
 * @see AbstractTabbedFlowFormController
 * @author Rhett Sutphin
 */
public class Flow<C> {
    private String name;
    private List<Tab<C>> tabs;

    public Flow(String name) {
        this.name = name;
        this.tabs = new LinkedList<Tab<C>>();
    }

    public void addTab(Tab<C> tab) {
        tab.setNumber(tabs.size());
        tab.setFlow(this);
        this.tabs.add(tab);
    }

    public int getTabCount() {
        return getTabs().size();
    }

    public Tab<C> getTab(int number) {
        return getTabs().get(number);
    }

    public List<Tab<C>> getTabs() {
        return tabs;
    }

    public String getName() {
        return name;
    }

    ////// OBJECT METHODS

    @Override
    public String toString() {
        return new StringBuilder(getClass().getSimpleName())
            .append('[').append(getName()).append(']')
            .toString();
    }
}

@@ -779,32 +779,156 @@
 rn tabs;%0A    %7D%0A%0A
+    public void setTabs(List%3CTab%3CC%3E%3E tabs) %7B%0A        getTabs().clear();%0A        for (Tab%3CC%3E tab : tabs) addTab(tab);%0A    %7D%0A%0A
     public Strin

Add setTabs for DI