Home » iText-2.1.7 » com.lowagie » text » [javadoc | source]
com.lowagie.text
public class: Section [javadoc | source]
java.lang.Object
   java.util.AbstractCollection
      java.util.AbstractList
         java.util.ArrayList
            com.lowagie.text.Section

All Implemented Interfaces:
    TextElementArray, LargeElement, List, Serializable, RandomAccess, Cloneable, Collection

Direct Known Subclasses:
    Chapter, ChapterAutoNumber

A Section is a part of a Document containing other Sections, Paragraphs, List and/or Tables.

Remark: you can not construct a Section yourself. You will have to ask an instance of Section to the Chapter or Section to which you want to add the new Section.

Example:

Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
Chapter chapter2 = new Chapter(title2, 2);
Paragraph someText = new Paragraph("This is some text");
chapter2.add(someText);
Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
Section section1 = chapter2.addSection(title21);
Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section.");
section1.add(someSectionText);
Paragraph title211 = new Paragraph("This is SubSection 1 in Section 1 in Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLD, new Color(255, 0, 0)));
Section section11 = section1.addSection(40, title211, 2);
section11.add(someSectionText);
Field Summary
public static final  int NUMBERSTYLE_DOTTED    A possible number style. The default number style: "1.2.3."
    since: iText - 2.0.8
 
public static final  int NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT    A possible number style. For instance: "1.2.3"
    since: iText - 2.0.8
 
protected  Paragraph title    The title of this section. 
protected  String bookmarkTitle    The bookmark title if different from the content title 
protected  int numberDepth    The number of sectionnumbers that has to be shown before the section title. 
protected  int numberStyle    The style for sectionnumbers.
    since: iText - 2.0.8
 
protected  float indentationLeft    The indentation of this section on the left side. 
protected  float indentationRight    The indentation of this section on the right side. 
protected  float indentation    The additional indentation of the content of this section. 
protected  boolean bookmarkOpen    false if the bookmark children are not visible 
protected  boolean triggerNewPage    true if the section has to trigger a new page 
protected  int subsections    This is the number of subsections. 
protected  ArrayList numbers    This is the complete list of sectionnumbers of this section and the parents of this section. 
protected  boolean complete    Indicates if the Section will be complete once added to the document.
    since: iText - 2.0.8
 
protected  boolean addedCompletely    Indicates if the Section was added completely to the document.
    since: iText - 2.0.8
 
protected  boolean notAddedYet    Indicates if this is the first time the section was added.
    since: iText - 2.0.8
 
Fields inherited from java.util.AbstractList:
modCount
Constructor:
 protected Section() 
 protected Section(Paragraph title,
    int numberDepth) 
    Constructs a new Section.
    Parameters:
    title - a Paragraph
    numberDepth - the numberDepth
Method from com.lowagie.text.Section Summary:
add,   add,   addAll,   addMarkedSection,   addSection,   addSection,   addSection,   addSection,   addSection,   addSection,   addSection,   addSection,   constructTitle,   flushContent,   getBookmarkTitle,   getChunks,   getDepth,   getIndentation,   getIndentationLeft,   getIndentationRight,   getNumberDepth,   getNumberStyle,   getTitle,   isAddedCompletely,   isBookmarkOpen,   isChapter,   isComplete,   isContent,   isNestable,   isNotAddedYet,   isSection,   isTriggerNewPage,   newPage,   process,   setAddedCompletely,   setBookmarkOpen,   setBookmarkTitle,   setChapterNumber,   setComplete,   setIndentation,   setIndentationLeft,   setIndentationRight,   setNotAddedYet,   setNumberDepth,   setNumberStyle,   setTitle,   setTriggerNewPage,   type
Methods from java.util.ArrayList:
add,   add,   addAll,   addAll,   clear,   clone,   contains,   ensureCapacity,   get,   indexOf,   isEmpty,   lastIndexOf,   remove,   remove,   removeRange,   set,   size,   toArray,   toArray,   trimToSize
Methods from java.util.AbstractList:
add,   add,   addAll,   clear,   equals,   get,   hashCode,   indexOf,   iterator,   lastIndexOf,   listIterator,   listIterator,   remove,   removeRange,   set,   subList
Methods from java.util.AbstractCollection:
add,   addAll,   clear,   contains,   containsAll,   isEmpty,   iterator,   remove,   removeAll,   retainAll,   size,   toArray,   toArray,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.Section Detail:
 public boolean add(Object o) 
    Adds a Paragraph, List, Table or another Section to this Section.
 public  void add(int index,
    Object o) 
    Adds a Paragraph, List or Table to this Section.
 public boolean addAll(Collection collection) 
    Adds a collection of Elements to this Section.
 public MarkedSection addMarkedSection() 
    Adds a marked section. For use in class MarkedSection only!
 public Section addSection(Paragraph title) 
    Creates a Section, adds it to this Section and returns it.
 public Section addSection(String title) 
    Adds a Section to this Section and returns it.
 public Section addSection(float indentation,
    Paragraph title) 
    Creates a Section, adds it to this Section and returns it.
 public Section addSection(Paragraph title,
    int numberDepth) 
    Creates a Section, add it to this Section and returns it.
 public Section addSection(String title,
    int numberDepth) 
    Adds a Section to this Section and returns it.
 public Section addSection(float indentation,
    String title) 
    Adds a Section to this Section and returns it.
 public Section addSection(float indentation,
    Paragraph title,
    int numberDepth) 
    Creates a Section, adds it to this Section and returns it.
 public Section addSection(float indentation,
    String title,
    int numberDepth) 
    Adds a Section to this Section and returns it.
 public static Paragraph constructTitle(Paragraph title,
    ArrayList numbers,
    int numberDepth,
    int numberStyle) 
    Constructs a Paragraph that will be used as title for a Section or Chapter.
 public  void flushContent() 
 public Paragraph getBookmarkTitle() 
    Gets the bookmark title.
 public ArrayList getChunks() 
    Gets all the chunks in this element.
 public int getDepth() 
    Returns the depth of this section.
 public float getIndentation() 
    Returns the indentation of the content of this Section.
 public float getIndentationLeft() 
    Returns the indentation of this Section on the left side.
 public float getIndentationRight() 
    Returns the indentation of this Section on the right side.
 public int getNumberDepth() 
    Returns the numberdepth of this Section.
 public int getNumberStyle() 
    Gets the style used for numbering sections.
 public Paragraph getTitle() 
    Returns the title, preceded by a certain number of sectionnumbers.
 protected boolean isAddedCompletely() 
 public boolean isBookmarkOpen() 
    Getter for property bookmarkOpen.
 public boolean isChapter() 
    Checks if this object is a Chapter.
 public boolean isComplete() 
 public boolean isContent() 
 public boolean isNestable() 
 public boolean isNotAddedYet() 
    Indicates if this is the first time the section is added.
 public boolean isSection() 
    Checks if this object is a Section.
 public boolean isTriggerNewPage() 
    Getter for property bookmarkOpen.
 public  void newPage() 
    Adds a new page to the section.
 public boolean process(ElementListener listener) 
    Processes the element by adding it (or the different parts) to an ElementListener.
 protected  void setAddedCompletely(boolean addedCompletely) 
 public  void setBookmarkOpen(boolean bookmarkOpen) 
    Setter for property bookmarkOpen.
 public  void setBookmarkTitle(String bookmarkTitle) 
    Sets the bookmark title. The bookmark title is the same as the section title but can be changed with this method.
 public  void setChapterNumber(int number) 
    Changes the Chapter number.
 public  void setComplete(boolean complete) 
 public  void setIndentation(float indentation) 
    Sets the indentation of the content of this Section.
 public  void setIndentationLeft(float indentation) 
    Sets the indentation of this Section on the left side.
 public  void setIndentationRight(float indentation) 
    Sets the indentation of this Section on the right side.
 public  void setNotAddedYet(boolean notAddedYet) 
    Sets the indication if the section was already added to the document.
 public  void setNumberDepth(int numberDepth) 
    Sets the depth of the sectionnumbers that will be shown preceding the title.

    If the numberdepth is 0, the sections will not be numbered. If the numberdepth is 1, the section will be numbered with their own number. If the numberdepth is higher (for instance x > 1), the numbers of x - 1 parents will be shown.

 public  void setNumberStyle(int numberStyle) 
    Sets the style for numbering sections. Possible values are NUMBERSTYLE_DOTTED: 1.2.3. (the default) or NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT: 1.2.3
 public  void setTitle(Paragraph title) 
    Sets the title of this section.
 public  void setTriggerNewPage(boolean triggerNewPage) 
    Setter for property triggerNewPage.
 public int type() 
    Gets the type of the text element.