|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.lowagie.text.Section
A Section
is a part of a Document
containing
other Section
s, Paragraph
s, List
and/or Table
s.
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);
Nested Class Summary |
Nested classes inherited from class java.util.AbstractList |
|
Field Summary | |
protected boolean |
bookmarkOpen
false if the bookmark children are not visible |
protected String |
bookmarkTitle
The bookmark title if different from the content title |
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 int |
numberDepth
This is the number of sectionnumbers that has to be shown before the section title. |
protected ArrayList |
numbers
This is the complete list of sectionnumbers of this section and the parents of this section. |
protected float |
sectionIndent
The additional indentation of the content of this section. |
private static long |
serialVersionUID
|
protected int |
subsections
This is the number of subsections. |
protected Paragraph |
title
This is the title of this section. |
protected boolean |
triggerNewPage
true if the section has to trigger a new page |
Fields inherited from class java.util.ArrayList |
|
Fields inherited from class java.util.AbstractList |
modCount |
Fields inherited from interface com.lowagie.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, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE |
Constructor Summary | |
protected |
Section()
Constructs a new Section . |
(package private) |
Section(Paragraph title,
int numberDepth)
Constructs a new Section . |
Method Summary | |
void |
add(int index,
Object o)
Adds a Paragraph , List or Table
to this Section . |
boolean |
add(Object o)
Adds a Paragraph , List , Table or another Section
to this Section . |
boolean |
addAll(Collection collection)
Adds a collection of Element s
to this Section . |
Section |
addSection(float indentation,
Paragraph title)
Creates a Section , adds it to this Section and returns it. |
Section |
addSection(float indentation,
Paragraph title,
int numberDepth)
Creates a Section , adds it to this Section and returns it. |
Section |
addSection(float indentation,
String title)
Adds a Section to this Section and returns it. |
Section |
addSection(float indentation,
String title,
int numberDepth)
Adds a Section to this Section and returns it. |
Section |
addSection(Paragraph title)
Creates a Section , adds it to this Section and returns it. |
Section |
addSection(Paragraph title,
int numberDepth)
Creates a Section , add it to this Section and returns it. |
Section |
addSection(Properties attributes)
Creates a given Section following a set of attributes and adds it to this one. |
Section |
addSection(String title)
Adds a Section to this Section and returns it. |
Section |
addSection(String title,
int numberDepth)
Adds a Section to this Section and returns it. |
int |
depth()
Returns the depth of this section. |
Paragraph |
getBookmarkTitle()
Gets the bookmark title. |
ArrayList |
getChunks()
Gets all the chunks in this element. |
float |
indentation()
Returns the indentation of the content of this Section . |
float |
indentationLeft()
Returns the indentation of this Section on the left side. |
float |
indentationRight()
Returns the indentation of this Section on the right side. |
boolean |
isBookmarkOpen()
Getter for property bookmarkOpen. |
boolean |
isChapter()
Checks if this object is a Chapter . |
boolean |
isSection()
Checks if this object is a Section . |
static boolean |
isTag(String tag)
Checks if a given tag corresponds with this object. |
static boolean |
isTitle(String tag)
Checks if a given tag corresponds with a title tag for this object. |
boolean |
isTriggerNewPage()
Getter for property bookmarkOpen. |
int |
numberDepth()
Returns the numberdepth of this Section . |
boolean |
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener . |
void |
set(Properties attributes)
Alters the attributes of this Section . |
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. |
private void |
setNumbers(int number,
ArrayList numbers)
Sets the number of this section. |
void |
setTitle(Paragraph title)
Sets the title of this section. |
void |
setTriggerNewPage(boolean triggerNewPage)
Setter for property triggerNewPage. |
Paragraph |
title()
Returns the title, preceeded by a certain number of sectionnumbers. |
int |
type()
Gets the type of the text element. |
Methods inherited from class java.util.ArrayList |
addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.lowagie.text.Element |
toString |
Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
Field Detail |
private static final long serialVersionUID
protected Paragraph title
protected int numberDepth
protected float indentationLeft
protected float indentationRight
protected float sectionIndent
protected int subsections
protected ArrayList numbers
protected boolean bookmarkOpen
protected boolean triggerNewPage
protected String bookmarkTitle
Constructor Detail |
protected Section()
Section
.
Section(Paragraph title, int numberDepth)
Section
.
title
- a Paragraph
numberDepth
- the numberDepthMethod Detail |
private void setNumbers(int number, ArrayList numbers)
number
- the number of this sectionnumbers
- an ArrayList
, containing the numbers of the Parentpublic boolean process(ElementListener listener)
ElementListener
.
process
in interface Element
listener
- the ElementListener
true
if the element was processed successfullypublic int type()
type
in interface Element
public ArrayList getChunks()
getChunks
in interface Element
ArrayList
public void add(int index, Object o)
Paragraph
, List
or Table
to this Section
.
add
in interface List
index
- index at which the specified element is to be insertedo
- an object of type Paragraph
, List
or Table
=
ClassCastException
- if the object is not a Paragraph
, List
or Table
public boolean add(Object o)
Paragraph
, List
, Table
or another Section
to this Section
.
add
in interface TextElementArray
o
- an object of type Paragraph
, List
, Table
or another Section
ClassCastException
- if the object is not a Paragraph
, List
, Table
or Section
public boolean addAll(Collection collection)
Element
s
to this Section
.
addAll
in interface List
collection
- a collection of Paragraph
s, List
s and/or Table
s
true
if the action succeeded, false
if not.
ClassCastException
- if one of the objects isn't a Paragraph
, List
, Table
public Section addSection(float indentation, Paragraph title, int numberDepth)
Section
, adds it to this Section
and returns it.
indentation
- the indentation of the new sectiontitle
- the title of the new sectionnumberDepth
- the numberDepth of the section
public Section addSection(float indentation, Paragraph title)
Section
, adds it to this Section
and returns it.
indentation
- the indentation of the new sectiontitle
- the title of the new section
public Section addSection(Paragraph title, int numberDepth)
Section
, add it to this Section
and returns it.
title
- the title of the new sectionnumberDepth
- the numberDepth of the section
public Section addSection(Paragraph title)
Section
, adds it to this Section
and returns it.
title
- the title of the new section
public Section addSection(float indentation, String title, int numberDepth)
Section
to this Section
and returns it.
indentation
- the indentation of the new sectiontitle
- the title of the new sectionnumberDepth
- the numberDepth of the section
public Section addSection(String title, int numberDepth)
Section
to this Section
and returns it.
title
- the title of the new sectionnumberDepth
- the numberDepth of the section
public Section addSection(float indentation, String title)
Section
to this Section
and returns it.
indentation
- the indentation of the new sectiontitle
- the title of the new section
public Section addSection(String title)
Section
to this Section
and returns it.
title
- the title of the new section
public Section addSection(Properties attributes)
Section
following a set of attributes and adds it to this one.
attributes
- the attributes
public void set(Properties attributes)
Section
.
attributes
- the attributespublic void setTitle(Paragraph title)
title
- the new titlepublic void setNumberDepth(int numberDepth)
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.
numberDepth
- the new numberDepthpublic void setIndentationLeft(float indentation)
Section
on the left side.
indentation
- the indentationpublic void setIndentationRight(float indentation)
Section
on the right side.
indentation
- the indentationpublic void setIndentation(float indentation)
Section
.
indentation
- the indentationpublic boolean isChapter()
Chapter
.
true
if it is a Chapter
,
false
if it is a Section
.public boolean isSection()
Section
.
true
if it is a Section
,
false
if it is a Chapter
.public int numberDepth()
Section
.
public float indentationLeft()
Section
on the left side.
public float indentationRight()
Section
on the right side.
public float indentation()
Section
.
public int depth()
public Paragraph title()
Paragraph
public static boolean isTitle(String tag)
tag
- the given tag
public static boolean isTag(String tag)
tag
- the given tag
public boolean isBookmarkOpen()
public void setBookmarkOpen(boolean bookmarkOpen)
bookmarkOpen
- false if the bookmark children are not
visible.public boolean isTriggerNewPage()
public void setTriggerNewPage(boolean triggerNewPage)
triggerNewPage
- true if a new page has to be triggered.public Paragraph getBookmarkTitle()
public void setBookmarkTitle(String bookmarkTitle)
bookmarkTitle
- the bookmark title
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |