i-net Clear Reports

com.inet.report
Class Paragraph

java.lang.Object
  extended by com.inet.report.ReportComponent
      extended by com.inet.report.Element
          extended by com.inet.report.Paragraph
All Implemented Interfaces:
BorderProperties, GeneralProperties, ParagraphProperties, NodeParser, com.inet.report.ReferenceHolder, java.io.Serializable, java.lang.Cloneable

public class Paragraph
extends Element
implements ParagraphProperties

The Paragraph class represents a line in a Text and is a set of TextPart elements and FieldPart elements. I.e. a Paragraph that consists of a text formatted with blue color, a field, a text formatted with red color and a text formatted with blue color, has to be split into four parts; three TextPart elements and one FieldPart element. The last part of a Paragraph is terminated with a newline. After a FieldPart element, a TextPart element that contains a newline is required.

This class is part of the RDC.

See Also:
Text, TextPart, FieldPart, Serialized Form

Field Summary
 
Fields inherited from class com.inet.report.Element
BOX, CHART, CROSSTAB, CROSSTABCELL, CROSSTABCOLUMN, CROSSTABROW, CROSSTABSECTION, DATABASE_PICTURE, FIELD, FIELDPART, JAVABEAN, LINE, PARAGRAPH, PICTURE, SIGNATURE, SUBREPORT, TEXT, TEXTPART
 
Fields inherited from interface com.inet.report.ParagraphProperties
INDENT_DEFAULT, LINE_SPACING_ABSOLUTE, LINE_SPACING_RELATIVE
 
Fields inherited from interface com.inet.report.BorderProperties
LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_DOUBLE, LINE_STYLE_SINGLE, NO_LINE
 
Fields inherited from interface com.inet.report.GeneralProperties
ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_DEFAULT, ALIGN_HORIZONTAL_JUSTIFIED, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_RIGHT
 
Method Summary
 FieldPart addFieldPart(Field newField)
          Creates a new field part element and adds it into this paragraph.
 TextPart addTextPart(java.lang.String newText)
          Creates a new text part element and adds it into this paragraph.
 int getFirstLineIndent()
          Returns the value of the property 'first line indent'.
 FormulaField getFirstLineIndentFormula()
          Returns the formula whose return value determines the property 'first line indent'.
 int getLeftIndent()
          Returns the value of the property 'left indent'.
 FormulaField getLeftIndentFormula()
          Returns the formula whose return value determines the property 'left indent'.
 int getLineSpacingAbsolute()
          Returns the absolute distance between baselines of the lines in this paragraph, measured in twips.
 FormulaField getLineSpacingAbsoluteFormula()
          Returns the formula whose return value determines the absolute distance between baselines of the lines in this paragraph, measured in twips.
 double getLineSpacingRelative()
          Returns the factor by which the default line spacing is to be multiplied for this paragraph.
 FormulaField getLineSpacingRelativeFormula()
          Returns the formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph.
 Element getPart(int idx)
          Returns the TextPart or the FieldPart at the specified index.
 int getPartCount()
          Returns the number of TextParts and FieldParts of this paragraph.
 int getRightIndent()
          Returns the value of the property 'rightIndent'.
 FormulaField getRightIndentFormula()
          Returns the formula whose return value determines the property 'right indent'.
 Text getText()
          Returns the parent Text element.
 int indexOf()
          Returns the index of this Paragraph inside the parent Text element.
 FieldPart insertFieldPart(int pos, Field newfield)
          Inserts a FieldPart element into this Paragraph.
 TextPart insertTextPart(int pos, java.lang.String newtext)
          Inserts a text element into this Paragraph.
 void moveParts(int srcPos, Paragraph dest, int destPos, int length)
          Move FieldParts and TextParts from this Paragraph, beginning at the specified position, to the specified position of the destination Paragraph.
 void normalize()
          Deprecated. As of i-net Crystal-Clear 9.1, replaced by normalize(boolean)
 void normalize(boolean replacePrompts)
          Normalizes this paragraph.
 java.lang.String paramString()
          Creates and return a String representation for debugging.
 NodeParser parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map parserMap)
          FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML Parses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself.
 void parseText(java.lang.String text, java.util.Map parserMap)
          FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML This method is called if text was encountered in the context of this node.
 void removePart(int idx)
          Removes the TextPart or the FieldPart at the specified index.
 void setFirstLineIndent(int newValue)
          Sets the value of the property 'first line indent'.
 void setFirstLineIndentFormula(FormulaField formula)
          Sets the formula whose return value determines the property 'first line indent'.
 void setLeftIndent(int newLeftIndent)
          Sets the value of the property 'left indent'.
 void setLeftIndentFormula(FormulaField formula)
          Sets the formula whose return value determines the property 'left indent'.
 void setLineSpacingAbsolute(int lineSpacingAbsolute)
          Sets the absolute distance between baselines of the lines in this paragraph, measured in twips.
 void setLineSpacingAbsoluteFormula(FormulaField formula)
          Sets the formula whose return value determines the absolute distance between baselines of the lines in this paragraph, measured in twips.
 void setLineSpacingRelative(double lineSpacingRelative)
          Sets the factor by which the default line spacing is to be multiplied for this paragraph.
 void setLineSpacingRelativeFormula(FormulaField formula)
          Sets the formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph.
 void setRightIndent(int newRightIndent)
          Sets the value of the property 'rightIndent'.
 void setRightIndentFormula(FormulaField formula)
          Sets the formula whose return value determines the property 'right indent'.
 
Methods inherited from class com.inet.report.Element
addListener, copy, copyXML2, getBottomLineStyle, getBottomLineStyleFormula, getCanGrowCount, getCanGrowFormula, getCloseBorderOnPageBreakFormula, getDropShadowFormula, getEngine, getField, getForeColor, getForeColorFormula, getHorAlign, getHorAlignFormula, getHyperlinkUrl, getHyperlinkUrlFormula, getLeftLineStyle, getLeftLineStyleFormula, getParent, getPropertyFormulas, getRightLineStyle, getRightLineStyleFormula, getSuppressIfDuplicatedFormula, getTightHorizontalFormula, getToolTipsText, getToolTipsTextFormula, getTopLineStyle, getTopLineStyleFormula, isCanGrow, isCloseBorderOnPageBreak, isDropShadow, isSuppressIfDuplicated, isTightHorizontal, removeListener, setBottomLineStyle, setBottomLineStyleFormula, setCanGrow, setCanGrowCount, setCanGrowFormula, setCloseBorderOnPageBreak, setCloseBorderOnPageBreakFormula, setDropShadow, setDropShadowFormula, setField, setForeColor, setForeColorFormula, setHorAlign, setHorAlignFormula, setHyperlinkUrl, setHyperlinkUrlFormula, setIndex, setLeftLineStyle, setLeftLineStyleFormula, setRightLineStyle, setRightLineStyleFormula, setSuppressIfDuplicated, setSuppressIfDuplicatedFormula, setTightHorizontal, setTightHorizontalFormula, setToolTipsText, setToolTipsTextFormula, setTopLineStyle, setTopLineStyleFormula
 
Methods inherited from class com.inet.report.ReportComponent
getBackColor, getBackColorFormula, getHeight, getKeepTogetherFormula, getSuppressFormula, getType, getWidth, getX, getY, isKeepTogether, isSuppress, setBackColor, setBackColorFormula, setHeight, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula, setWidth, setX, setY
 
Methods inherited from interface com.inet.report.BorderProperties
getBackColor, getBackColorFormula, setBackColor, setBackColorFormula
 
Methods inherited from interface com.inet.report.GeneralProperties
getKeepTogetherFormula, getSuppressFormula, isKeepTogether, isSuppress, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula
 
Methods inherited from interface com.inet.report.parser.NodeParser
isDOMParser, parseDOM, parseEndElement
 

Method Detail

getText

public Text getText()
Returns the parent Text element.

Returns:
The parent of this Paragraph.

addTextPart

public TextPart addTextPart(java.lang.String newText)
Creates a new text part element and adds it into this paragraph. If parameter text is null, it will be replaced by an empty String.

Parameters:
newText - the text of the text part as String
Returns:
the created text part element

insertTextPart

public TextPart insertTextPart(int pos,
                               java.lang.String newtext)
Inserts a text element into this Paragraph. The new text element will be placed at the desired position. Invalid positions will be adjusted to the nearest boundary of this Paragraph.

Parameters:
pos - The position where the text element shall be stored.
newtext - The new text element that shall be stored.
Returns:
the inserted TextPart

addFieldPart

public FieldPart addFieldPart(Field newField)
Creates a new field part element and adds it into this paragraph.

Parameters:
newField - The field which should be added into the paragraph.
Returns:
the created field part element.
See Also:
DatabaseField, FormulaField, PromptField, GroupField, SummaryField, SQLField

insertFieldPart

public FieldPart insertFieldPart(int pos,
                                 Field newfield)
Inserts a FieldPart element into this Paragraph. The new field will be placed at the desired position. Invalid positions will be adjusted to the nearest boundary of this Paragraph.

Parameters:
pos - The position where the element shall be stored.
newfield - The new field that shall be stored.
Returns:
the inserted FieldPart

getPart

public Element getPart(int idx)
Returns the TextPart or the FieldPart at the specified index.

Parameters:
idx - The index of the FieldPart or of the TextPart that should returned.
Returns:
the part at the given index
See Also:
TextPart, FieldPart, addFieldPart(Field), addTextPart(String), getPartCount(), removePart(int)

getPartCount

public int getPartCount()
Returns the number of TextParts and FieldParts of this paragraph.

Returns:
the number of child parts
See Also:
TextPart, FieldPart, addFieldPart(Field), addTextPart(String), getPart(int), removePart(int)

removePart

public void removePart(int idx)
Removes the TextPart or the FieldPart at the specified index.

Parameters:
idx - The index of the FieldPart or of the TextPart that should removed.
Throws:
java.lang.IndexOutOfBoundsException - if idx is out of bounds.
See Also:
TextPart, FieldPart, addFieldPart(Field), addTextPart(String), getPart(int), getPartCount()

moveParts

public void moveParts(int srcPos,
                      Paragraph dest,
                      int destPos,
                      int length)
               throws java.lang.IndexOutOfBoundsException,
                      java.lang.IllegalArgumentException
Move FieldParts and TextParts from this Paragraph, beginning at the specified position, to the specified position of the destination Paragraph. Both Paragraph must come from the same Engine. It work also with the same Paragraph if the destPos is outside of the source range.

Parameters:
srcPos - starting position in this Paragraph. This is the index of FieldPart and TextPart starting with 0.
dest - the destination Paragraph
destPos - starting position in the destination Paragraph. This is the index of FieldPart and TextPart starting with 0.
length - count of parts that should be moved.
Throws:
java.lang.IndexOutOfBoundsException - if srcPos, destPost or length is out of bounds.
java.lang.IllegalArgumentException - If the Paragraph come from different Engines
Since:
9.1

paramString

public java.lang.String paramString()
Creates and return a String representation for debugging.

Overrides:
paramString in class Element
Returns:
String representation of this Element for debugging purposes

indexOf

public int indexOf()
Returns the index of this Paragraph inside the parent Text element.

Overrides:
indexOf in class Element
Returns:
the index position in the Text element
See Also:
Element.setIndex(int)

getFirstLineIndent

public int getFirstLineIndent()
Returns the value of the property 'first line indent'. This is the distance that the first line of the paragraph is indented from the left margin of the paragraph (in twips).

Specified by:
getFirstLineIndent in interface ParagraphProperties
Returns:
The value of the property 'first line indent'.

setFirstLineIndent

public void setFirstLineIndent(int newValue)
Sets the value of the property 'first line indent'. This is the distance that the first line of the paragraph is indented from the left margin of the paragraph (in twips).

Specified by:
setFirstLineIndent in interface ParagraphProperties
Parameters:
newValue - The new value of the property 'first line indent'. May be negative (which would cause the first line to be left of the left margin).

getLeftIndent

public int getLeftIndent()
Returns the value of the property 'left indent'. This is the distance that the the paragraph is indented from the left margin of the element (in twips).

Specified by:
getLeftIndent in interface ParagraphProperties
Returns:
The value of the property 'left indent'.

setLeftIndent

public void setLeftIndent(int newLeftIndent)
Sets the value of the property 'left indent'. This is the distance that the the paragraph is indented from the left margin of the element (in twips).

Specified by:
setLeftIndent in interface ParagraphProperties
Parameters:
newLeftIndent - The new value of the property 'left indent'.

getRightIndent

public int getRightIndent()
Returns the value of the property 'rightIndent'. This is the distance that the the paragraph is indented from the right margin of the element (in twips).

Specified by:
getRightIndent in interface ParagraphProperties
Returns:
The current value of the property 'rightIndent'. 

setRightIndent

public void setRightIndent(int newRightIndent)
Sets the value of the property 'rightIndent'. This is the distance that the the paragraph is indented from the right margin of the element (in twips).

Specified by:
setRightIndent in interface ParagraphProperties
Parameters:
newRightIndent - The new value of the property 'rightIndent'.

setLineSpacingAbsolute

public void setLineSpacingAbsolute(int lineSpacingAbsolute)
Sets the absolute distance between baselines of the lines in this paragraph, measured in twips. It is also possible to set LINE_SPACING_RELATIVE, which restores the default setting.

Specified by:
setLineSpacingAbsolute in interface ParagraphProperties
Parameters:
lineSpacingAbsolute - Absolute distance between baselines in this paragraph, measured in twips, or LINE_SPACING_RELATIVE in order to restore the default setting.
See Also:
ParagraphProperties.getLineSpacingAbsolute(), ParagraphProperties.LINE_SPACING_RELATIVE

getLineSpacingAbsolute

public int getLineSpacingAbsolute()
Returns the absolute distance between baselines of the lines in this paragraph, measured in twips. If a relative factor has been set, this will return the constant LINE_SPACING_RELATIVE.

Specified by:
getLineSpacingAbsolute in interface ParagraphProperties
Returns:
Absolute distance between baselines in this paragraph, measured in twips, or LINE_SPACING_RELATIVE
See Also:
ParagraphProperties.setLineSpacingAbsolute(int), ParagraphProperties.LINE_SPACING_RELATIVE

setLineSpacingRelative

public void setLineSpacingRelative(double lineSpacingRelative)
Sets the factor by which the default line spacing is to be multiplied for this paragraph. The default line spacing is determined by font and font size, and is then multiplied by this number. Setting LINE_SPACING_ABSOLUTE will cause the value to be reset to its default, which is "1".

Specified by:
setLineSpacingRelative in interface ParagraphProperties
Parameters:
lineSpacingRelative - Factor by which the default line spacing is to be multiplied for this paragraph, or LINE_SPACING_ABSOLUTE if the default value is to be set (equivalent to "1")
See Also:
ParagraphProperties.LINE_SPACING_ABSOLUTE, ParagraphProperties.getLineSpacingRelative()

getLineSpacingRelative

public double getLineSpacingRelative()
Returns the factor by which the default line spacing is to be multiplied for this paragraph. The default line spacing is determined by font and font size, and is then multiplied by this number. If an absolute value has been set, this will return LINE_SPACING_ABSOLUTE instead.

Specified by:
getLineSpacingRelative in interface ParagraphProperties
Returns:
Factor by which the default line spacing is to be multiplied for this paragraph, or LINE_SPACING_ABSOLUTE if an absolute line spacing distance has been set.
See Also:
ParagraphProperties.LINE_SPACING_ABSOLUTE, ParagraphProperties.getLineSpacingRelative()

normalize

@Deprecated
public void normalize()
Deprecated. As of i-net Crystal-Clear 9.1, replaced by normalize(boolean)

Normalizes this paragraph. This means that empty TextParts will be removed and TextParts with the same font properties will be merged. Currently the following properties will be compared to check if the TextParts can be merged.

Since:
7.2

normalize

public void normalize(boolean replacePrompts)
Normalizes this paragraph. This means that empty TextParts will be removed and TextParts with the same font properties will be merged. Currently the following properties will be compared to check if the TextParts can be merged.

Parameters:
replacePrompts - replace prompt fields with it current value
Since:
9.1

getFirstLineIndentFormula

public FormulaField getFirstLineIndentFormula()
Returns the formula whose return value determines the property 'first line indent'. This is the distance that the first line of the paragraph is indented from the left margin of the paragraph (in twips).

Specified by:
getFirstLineIndentFormula in interface ParagraphProperties
Returns:
The formula whose return value determines the property 'first line indent'.

getLeftIndentFormula

public FormulaField getLeftIndentFormula()
Returns the formula whose return value determines the property 'left indent'. This is the distance that the the paragraph is indented from the left margin of the element (in twips).

Specified by:
getLeftIndentFormula in interface ParagraphProperties
Returns:
The formula whose return value determines the property 'left indent'.

getLineSpacingAbsoluteFormula

public FormulaField getLineSpacingAbsoluteFormula()
Returns the formula whose return value determines the absolute distance between baselines of the lines in this paragraph, measured in twips.

Specified by:
getLineSpacingAbsoluteFormula in interface ParagraphProperties
Returns:
Absolute distance between baselines in this paragraph, measured in twips
See Also:
ParagraphProperties.setLineSpacingAbsolute(int)

getLineSpacingRelativeFormula

public FormulaField getLineSpacingRelativeFormula()
Returns the formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph. The default line spacing is determined by font and font size, and is then multiplied by this formula's value.

Specified by:
getLineSpacingRelativeFormula in interface ParagraphProperties
Returns:
formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph
See Also:
ParagraphProperties.getLineSpacingRelative()

getRightIndentFormula

public FormulaField getRightIndentFormula()
Returns the formula whose return value determines the property 'right indent'. This is the distance that the the paragraph is indented from the right margin of the element (in twips).

Specified by:
getRightIndentFormula in interface ParagraphProperties
Returns:
The formula whose return value determines the property 'right indent'.

setFirstLineIndentFormula

public void setFirstLineIndentFormula(FormulaField formula)
Sets the formula whose return value determines the property 'first line indent'. This is the distance that the first line of the paragraph is indented from the left margin of the paragraph (in twips).

Specified by:
setFirstLineIndentFormula in interface ParagraphProperties
Parameters:
formula - The formula whose return value determines the property 'first line indent'.

setLeftIndentFormula

public void setLeftIndentFormula(FormulaField formula)
Sets the formula whose return value determines the property 'left indent'. This is the distance that the the paragraph is indented from the left margin of the element (in twips).

Specified by:
setLeftIndentFormula in interface ParagraphProperties
Parameters:
formula - The formula whose return value determines the property 'left indent'.

setLineSpacingAbsoluteFormula

public void setLineSpacingAbsoluteFormula(FormulaField formula)
Sets the formula whose return value determines the absolute distance between baselines of the lines in this paragraph, measured in twips.

Specified by:
setLineSpacingAbsoluteFormula in interface ParagraphProperties
Parameters:
formula - formula whose return value determines the absolute distance between baselines in this paragraph, measured in twips
See Also:
ParagraphProperties.setLineSpacingAbsolute(int)

setLineSpacingRelativeFormula

public void setLineSpacingRelativeFormula(FormulaField formula)
Sets the formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph. The default line spacing is determined by font and font size, and is then multiplied by this formula's value.

Specified by:
setLineSpacingRelativeFormula in interface ParagraphProperties
Parameters:
formula - formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph
See Also:
ParagraphProperties.setLineSpacingRelative(double)

setRightIndentFormula

public void setRightIndentFormula(FormulaField formula)
Sets the formula whose return value determines the property 'right indent'. This is the distance that the the paragraph is indented from the right margin of the element (in twips).

Specified by:
setRightIndentFormula in interface ParagraphProperties
Parameters:
formula - The formula whose return value determines the property 'right indent'.

parseElement

public NodeParser parseElement(com.inet.report.parser.XMLTag group,
                               java.lang.String tag,
                               org.xml.sax.Attributes atts,
                               java.util.Map parserMap)
                        throws FatalParserException
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML

Parses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.

Specified by:
parseElement in interface NodeParser
Parameters:
group - XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.
tag - The XMLTag to be parsed
atts - The set of attributes in the current XMLTag
parserMap - The map of current Parser.
Returns:
The NodeParser sub-element if one needed to be created, or null if none was created.
Throws:
FatalParserException - if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.

parseText

public void parseText(java.lang.String text,
                      java.util.Map parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML

This method is called if text was encountered in the context of this node. (Examples would be a formula's text or a text element's text)

Specified by:
parseText in interface NodeParser
Parameters:
text - text encountered and to be stored
parserMap - The map of current Parser.

i-net Clear Reports

Copyright © 1999-2011 by i-net software GmbH