// Path: src/main/java/org/dynaform/xml/form/Form.java
// public interface Form {
//   
//   String HL_CHILD = "/";
//   String HL_DESCENDANT_OR_SELF = "//";
//   String LL_CHILD = "!";
//   String LL_DESCENDANT_OR_SELF = "!!";
//   String INDEX_START = "[";
//   String INDEX_END = "]";
//   String OPERATOR_SEQUENCE = "sequence";
//   String OPERATOR_CHOICE = "choice";
//   String OPERATOR_ALL = "all";
//   
//   // Identity and parent
//   String getDescendantOrSelfSelector();         // "//element"
//   String getFullSelector();                     // "/aa/bb/cc!selector[0]"
//   String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc"
// 
//   String getHighLevelId();  // cc
//   String getLowLevelId();   // selector[0]
//   
//   Form getParent();
//   void _setParent(Form parent);
//   
//   // Sequence
//   String nextCounterValue();
//   
//   // Visitors
// 	void accept(FormVisitor visitor);
// 	<T> T apply(FormFunction<T> function);
// 
// }
// 
// Path: src/main/java/org/dynaform/xml/form/FormSection.java
// public interface FormSection<F extends Form> extends Form, Labeled {
// 
// 	String getLabel();
// 	void setLabel(String label);
//   
//   SectionStyle getSectionStyle();
//   void setSectionStyle(SectionStyle orientation);
// 	
// 	F getContent();
// 	
// 	// Listeners
//   
//   void addListener(SectionChangeListener<F> listener);
//   void removeListener(SectionChangeListener<F> listener);
//   
//   public interface SectionChangeListener<F extends Form> {
//     void onSetLabel(FormSection<F> section);
//     void onSetSectionStyle(FormSection<F> section);
//   }
// 	
// }


import org.dynaform.xml.form.Form;
import org.dynaform.xml.form.FormRepeat;
import org.dynaform.xml.form.FormSection;
import org.dynaform.xml.form.FormSequence;
import org.dynaform.xml.form.Labeled;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

    }
    finally {
      formRepeat.remove(child);
    }
  }

  public List<String> getSubHeaders() {
    List<Form> children = formRepeat.getChildren();
    if (!children.isEmpty()) {
      Form child = children.get(0);
      return getSubHeaders(child);
    }

    Form child = formRepeat.add();
    try {
      return getSubHeaders(child);
    }
    finally {
      formRepeat.remove(child);
    }
  }

  private String getHeader(Form child) {
    if (child instanceof Labeled)
      return ((Labeled) child).getLabel();
    
    return null;
  }

  private List<String> getSubHeaders(Form child) {

// Path: src/main/java/org/dynaform/xml/form/Form.java
// public interface Form {
//   
//   String HL_CHILD = "/";
//   String HL_DESCENDANT_OR_SELF = "//";
//   String LL_CHILD = "!";
//   String LL_DESCENDANT_OR_SELF = "!!";
//   String INDEX_START = "[";
//   String INDEX_END = "]";
//   String OPERATOR_SEQUENCE = "sequence";
//   String OPERATOR_CHOICE = "choice";
//   String OPERATOR_ALL = "all";
//   
//   // Identity and parent
//   String getDescendantOrSelfSelector();         // "//element"
//   String getFullSelector();                     // "/aa/bb/cc!selector[0]"
//   String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc"
// 
//   String getHighLevelId();  // cc
//   String getLowLevelId();   // selector[0]
//   
//   Form getParent();
//   void _setParent(Form parent);
//   
//   // Sequence
//   String nextCounterValue();
//   
//   // Visitors
// 	void accept(FormVisitor visitor);
// 	<T> T apply(FormFunction<T> function);
// 
// }
// 
// Path: src/main/java/org/dynaform/xml/form/FormSection.java
// public interface FormSection<F extends Form> extends Form, Labeled {
// 
// 	String getLabel();
// 	void setLabel(String label);
//   
//   SectionStyle getSectionStyle();
//   void setSectionStyle(SectionStyle orientation);
// 	
// 	F getContent();
// 	
// 	// Listeners
//   
//   void addListener(SectionChangeListener<F> listener);
//   void removeListener(SectionChangeListener<F> listener);
//   
//   public interface SectionChangeListener<F extends Form> {
//     void onSetLabel(FormSection<F> section);
//     void onSetSectionStyle(FormSection<F> section);
//   }
// 	
// }


// Path: src/main/java/org/dynaform/xml/form/label/SequenceHeaderFactory.java
import org.dynaform.xml.form.Form;
import org.dynaform.xml.form.FormRepeat;
import org.dynaform.xml.form.FormSection;
import org.dynaform.xml.form.FormSequence;
import org.dynaform.xml.form.Labeled;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

    }
    finally {
      formRepeat.remove(child);
    }
  }

  public List<String> getSubHeaders() {
    List<Form> children = formRepeat.getChildren();
    if (!children.isEmpty()) {
      Form child = children.get(0);
      return getSubHeaders(child);
    }

    Form child = formRepeat.add();
    try {
      return getSubHeaders(child);
    }
    finally {
      formRepeat.remove(child);
    }
  }

  private String getHeader(Form child) {
    if (child instanceof Labeled)
      return ((Labeled) child).getLabel();
    
    return null;
  }

  private List<String> getSubHeaders(Form child) {

    if (child instanceof FormSection) {
