com.itextpdf.text
Class MarkedSection

java.lang.Object
  extended by com.itextpdf.text.MarkedObject
      extended by com.itextpdf.text.MarkedSection
All Implemented Interfaces:
Indentable, Element

public class MarkedSection
extends MarkedObject
implements Indentable

Wrapper that allows to add properties to a Chapter/Section object. Before iText 1.5 every 'basic building block' implemented the MarkupAttributes interface. By setting attributes, you could add markup to the corresponding XML and/or HTML tag. This functionality was hardly used by anyone, so it was removed, and replaced by the MarkedObject functionality.


Field Summary
protected  MarkedObject title
          This is the title of this section.
 
Fields inherited from class com.itextpdf.text.MarkedObject
element, markupAttributes
 
Fields inherited from interface com.itextpdf.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
 
Constructor Summary
MarkedSection(Section section)
          Creates a MarkedObject with a Section or Chapter object.
 
Method Summary
 boolean add(Element o)
          Adds a Paragraph, List, Table or another Section to this Section.
 void add(int index, Element o)
          Adds a Paragraph, List or Table to this Section.
 boolean addAll(Collection<? extends Element> collection)
          Adds a collection of Elements to this Section.
 MarkedSection addSection()
          Creates a Section, adds it to this Section and returns it.
 MarkedSection addSection(float indentation)
          Creates a Section, adds it to this Section and returns it.
 MarkedSection addSection(float indentation, int numberDepth)
          Creates a Section, adds it to this Section and returns it.
 MarkedSection addSection(int numberDepth)
          Creates a Section, add it to this Section and returns it.
 float getIndentationLeft()
          Gets the indentation on the left side.
 float getIndentationRight()
          Gets the indentation on the right side.
 MarkedObject getTitle()
          Gets the title of this MarkedSection.
 void newPage()
          Adds a new page to the section.
 boolean process(ElementListener listener)
          Processes the element by adding it (or the different parts) to an ElementListener.
 void setBookmarkOpen(boolean bookmarkOpen)
          Setter for property bookmarkOpen.
 void setBookmarkTitle(String bookmarkTitle)
          Sets the bookmark title.
 void setIndentation(float indentation)
          Sets the indentation of the content of this Section.
 void setIndentationLeft(float indentation)
          Sets the indentation of this Section on the left side.
 void setIndentationRight(float indentation)
          Sets the indentation of this Section on the right side.
 void setNumberDepth(int numberDepth)
          Sets the depth of the sectionnumbers that will be shown preceding the title.
 void setTitle(MarkedObject title)
          Sets the title of this section.
 void setTriggerNewPage(boolean triggerNewPage)
          Setter for property triggerNewPage.
 
Methods inherited from class com.itextpdf.text.MarkedObject
getChunks, getMarkupAttributes, isContent, isNestable, setMarkupAttribute, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.itextpdf.text.Element
toString
 

Field Detail

title

protected MarkedObject title
This is the title of this section.

Constructor Detail

MarkedSection

public MarkedSection(Section section)
Creates a MarkedObject with a Section or Chapter object.

Parameters:
section - the marked section
Method Detail

add

public void add(int index,
                Element o)
Adds a Paragraph, List or Table to this Section.

Parameters:
index - index at which the specified element is to be inserted
o - an object of type Paragraph, List or Table=
Throws:
ClassCastException - if the object is not a Paragraph, List or Table
Since:
5.0.1 (signature changed to use Element)

add

public boolean add(Element o)
Adds a Paragraph, List, Table or another Section to this Section.

Parameters:
o - an object of type Paragraph, List, Table or another Section
Returns:
a boolean
Throws:
ClassCastException - if the object is not a Paragraph, List, Table or Section
Since:
5.0.1 (signature changed to use Element)

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.

Specified by:
process in interface Element
Overrides:
process in class MarkedObject
Parameters:
listener - an ElementListener
Returns:
true if the element was processed successfully

addAll

public boolean addAll(Collection<? extends Element> collection)
Adds a collection of Elements to this Section.

Parameters:
collection - a collection of Paragraphs, Lists and/or Tables
Returns:
true if the action succeeded, false if not.
Throws:
ClassCastException - if one of the objects isn't a Paragraph, List, Table

addSection

public MarkedSection addSection(float indentation,
                                int numberDepth)
Creates a Section, adds it to this Section and returns it.

Parameters:
indentation - the indentation of the new section
numberDepth - the numberDepth of the section
Returns:
a new Section object

addSection

public MarkedSection addSection(float indentation)
Creates a Section, adds it to this Section and returns it.

Parameters:
indentation - the indentation of the new section
Returns:
a new Section object

addSection

public MarkedSection addSection(int numberDepth)
Creates a Section, add it to this Section and returns it.

Parameters:
numberDepth - the numberDepth of the section
Returns:
a new Section object

addSection

public MarkedSection addSection()
Creates a Section, adds it to this Section and returns it.

Returns:
a new Section object

setTitle

public void setTitle(MarkedObject title)
Sets the title of this section.

Parameters:
title - the new title

getTitle

public MarkedObject getTitle()
Gets the title of this MarkedSection.

Returns:
a MarkObject with a Paragraph containing the title of a Section
Since:
iText 2.0.8

setNumberDepth

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.

Parameters:
numberDepth - the new numberDepth

setIndentationLeft

public void setIndentationLeft(float indentation)
Sets the indentation of this Section on the left side.

Specified by:
setIndentationLeft in interface Indentable
Parameters:
indentation - the indentation

setIndentationRight

public void setIndentationRight(float indentation)
Sets the indentation of this Section on the right side.

Specified by:
setIndentationRight in interface Indentable
Parameters:
indentation - the indentation

setIndentation

public void setIndentation(float indentation)
Sets the indentation of the content of this Section.

Parameters:
indentation - the indentation

setBookmarkOpen

public void setBookmarkOpen(boolean bookmarkOpen)
Setter for property bookmarkOpen.

Parameters:
bookmarkOpen - false if the bookmark children are not visible.

setTriggerNewPage

public void setTriggerNewPage(boolean triggerNewPage)
Setter for property triggerNewPage.

Parameters:
triggerNewPage - true if a new page has to be triggered.

setBookmarkTitle

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.

Parameters:
bookmarkTitle - the bookmark title

newPage

public void newPage()
Adds a new page to the section.

Since:
2.1.1

getIndentationLeft

public float getIndentationLeft()
Description copied from interface: Indentable
Gets the indentation on the left side.

Specified by:
getIndentationLeft in interface Indentable
Returns:
the indentation

getIndentationRight

public float getIndentationRight()
Description copied from interface: Indentable
Gets the indentation on the right side.

Specified by:
getIndentationRight in interface Indentable
Returns:
the indentation


Copyright © 2013. All Rights Reserved.