- java.lang.Object
-
- com.itextpdf.text.MarkedObject
-
- com.itextpdf.text.MarkedSection
-
- All Implemented Interfaces:
Element
public class MarkedSection extends MarkedObject
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
Fields Modifier and Type Field Description protected MarkedObjecttitleThis 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, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
-
Constructor Summary
Constructors Constructor Description MarkedSection(Section section)Creates a MarkedObject with a Section or Chapter object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Object o)Adds aParagraph,ListorTableto thisSection.booleanadd(java.lang.Object o)Adds aParagraph,List,Tableor anotherSectionto thisSection.booleanaddAll(java.util.Collection collection)Adds a collection ofElements to thisSection.MarkedSectionaddSection()Creates aSection, adds it to thisSectionand returns it.MarkedSectionaddSection(float indentation)Creates aSection, adds it to thisSectionand returns it.MarkedSectionaddSection(float indentation, int numberDepth)Creates aSection, adds it to thisSectionand returns it.MarkedSectionaddSection(int numberDepth)Creates aSection, add it to thisSectionand returns it.MarkedObjectgetTitle()Gets the title of this MarkedSection.voidnewPage()Adds a new page to the section.booleanprocess(ElementListener listener)Processes the element by adding it (or the different parts) to anElementListener.voidsetBookmarkOpen(boolean bookmarkOpen)Setter for property bookmarkOpen.voidsetBookmarkTitle(java.lang.String bookmarkTitle)Sets the bookmark title.voidsetIndentation(float indentation)Sets the indentation of the content of thisSection.voidsetIndentationLeft(float indentation)Sets the indentation of thisSectionon the left side.voidsetIndentationRight(float indentation)Sets the indentation of thisSectionon the right side.voidsetNumberDepth(int numberDepth)Sets the depth of the sectionnumbers that will be shown preceding the title.voidsetTitle(MarkedObject title)Sets the title of this section.voidsetTriggerNewPage(boolean triggerNewPage)Setter for property triggerNewPage.-
Methods inherited from class com.itextpdf.text.MarkedObject
getChunks, getMarkupAttributes, isContent, isNestable, setMarkupAttribute, type
-
-
-
-
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, java.lang.Object o)Adds aParagraph,ListorTableto thisSection.- Parameters:
index- index at which the specified element is to be insertedo- an object of typeParagraph,ListorTable=- Throws:
java.lang.ClassCastException- if the object is not aParagraph,ListorTable
-
add
public boolean add(java.lang.Object o)
Adds aParagraph,List,Tableor anotherSectionto thisSection.- Parameters:
o- an object of typeParagraph,List,Tableor anotherSection- Returns:
- a boolean
- Throws:
java.lang.ClassCastException- if the object is not aParagraph,List,TableorSection
-
process
public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener.- Specified by:
processin interfaceElement- Overrides:
processin classMarkedObject- Parameters:
listener- anElementListener- Returns:
trueif the element was processed successfully
-
addAll
public boolean addAll(java.util.Collection collection)
Adds a collection ofElements to thisSection.- Parameters:
collection- a collection ofParagraphs,Lists and/orTables- Returns:
trueif the action succeeded,falseif not.- Throws:
java.lang.ClassCastException- if one of the objects isn't aParagraph,List,Table
-
addSection
public MarkedSection addSection(float indentation, int numberDepth)
Creates aSection, adds it to thisSectionand returns it.- Parameters:
indentation- the indentation of the new sectionnumberDepth- the numberDepth of the section- Returns:
- a new Section object
-
addSection
public MarkedSection addSection(float indentation)
Creates aSection, adds it to thisSectionand returns it.- Parameters:
indentation- the indentation of the new section- Returns:
- a new Section object
-
addSection
public MarkedSection addSection(int numberDepth)
Creates aSection, add it to thisSectionand returns it.- Parameters:
numberDepth- the numberDepth of the section- Returns:
- a new Section object
-
addSection
public MarkedSection addSection()
Creates aSection, adds it to thisSectionand 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 thisSectionon the left side.- Parameters:
indentation- the indentation
-
setIndentationRight
public void setIndentationRight(float indentation)
Sets the indentation of thisSectionon the right side.- Parameters:
indentation- the indentation
-
setIndentation
public void setIndentation(float indentation)
Sets the indentation of the content of thisSection.- 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(java.lang.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
-
-