Klasse Paragraph

Alle implementierten Schnittstellen:
GeneralProperties, ParagraphProperties, NodeParser, com.inet.report.ReferenceHolder, Serializable, 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.
Siehe auch:
  • Methodendetails

    • getText

      public Text getText()
      Returns the parent Text element.
      Gibt zurück:
      The parent of this Paragraph.
      Seit:
      6.0
    • addTextPart

      public @Nonnull TextPart addTextPart(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.
      Parameter:
      newText - the text of the text part as String
      Gibt zurück:
      the created text part element
      Seit:
      6.0
    • insertTextPart

      public @Nonnull TextPart insertTextPart(int pos, 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.
      Parameter:
      pos - The position where the text element shall be stored.
      newtext - The new text element that shall be stored.
      Gibt zurück:
      the inserted TextPart
      Seit:
      7.0
    • addFieldPart

      public @Nonnull FieldPart addFieldPart(Field newField)
      Creates a new field part element and adds it into this paragraph.
      Parameter:
      newField - The field which should be added into the paragraph.
      Gibt zurück:
      the created field part element.
      Seit:
      6.0
      Siehe auch:
    • insertFieldPart

      public @Nonnull 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.
      Parameter:
      pos - The position where the element shall be stored.
      newfield - The new field that shall be stored.
      Gibt zurück:
      the inserted FieldPart
      Seit:
      7.0
    • getPart

      public Element getPart(int idx)
      Returns the TextPart or the FieldPart at the specified index.
      Parameter:
      idx - The index of the FieldPart or of the TextPart that should returned.
      Gibt zurück:
      the part at the given index
      Seit:
      6.0
      Siehe auch:
    • getPartCount

      public int getPartCount()
      Returns the number of TextParts and FieldParts of this paragraph.
      Gibt zurück:
      the number of child parts
      Seit:
      6.0
      Siehe auch:
    • removePart

      public void removePart(int idx)
      Removes the TextPart or the FieldPart at the specified index.
      Parameter:
      idx - The index of the FieldPart or of the TextPart that should removed.
      Löst aus:
      IndexOutOfBoundsException - if idx is out of bounds.
      Seit:
      6.0
      Siehe auch:
    • moveParts

      public void moveParts(int srcPos, Paragraph dest, int destPos, int length) throws IndexOutOfBoundsException, 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.
      Parameter:
      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.
      Löst aus:
      IndexOutOfBoundsException - if srcPos, destPost or length is out of bounds.
      IllegalArgumentException - If the Paragraph come from different Engines
      Seit:
      9.1
    • paramString

      public String paramString()
      Creates and return a String representation for debugging.
      Setzt außer Kraft:
      paramString in Klasse Element
      Gibt zurück:
      String representation of this Element for debugging purposes
    • indexOf

      public int indexOf()
      Returns the index of this Paragraph inside the parent Text element.
      Setzt außer Kraft:
      indexOf in Klasse Element
      Gibt zurück:
      the index position in the Text element
      Seit:
      6.0
      Siehe auch:
    • setReferences

      public void setReferences()
      FOR INTERNAL USE ONLY
      Angegeben von:
      setReferences in Schnittstelle com.inet.report.ReferenceHolder
      Setzt außer Kraft:
      setReferences in Klasse Element
      Seit:
      6.0
    • resetReferences

      public void resetReferences()
      FOR INTERNAL USE ONLY
      Angegeben von:
      resetReferences in Schnittstelle com.inet.report.ReferenceHolder
      Setzt außer Kraft:
      resetReferences in Klasse ReportComponent
    • 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).
      Angegeben von:
      getFirstLineIndent in Schnittstelle ParagraphProperties
      Gibt zurück:
      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).
      Angegeben von:
      setFirstLineIndent in Schnittstelle ParagraphProperties
      Parameter:
      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).
      Angegeben von:
      getLeftIndent in Schnittstelle ParagraphProperties
      Gibt zurück:
      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).
      Angegeben von:
      setLeftIndent in Schnittstelle ParagraphProperties
      Parameter:
      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).
      Angegeben von:
      getRightIndent in Schnittstelle ParagraphProperties
      Gibt zurück:
      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).
      Angegeben von:
      setRightIndent in Schnittstelle ParagraphProperties
      Parameter:
      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.
      Angegeben von:
      setLineSpacingAbsolute in Schnittstelle ParagraphProperties
      Parameter:
      lineSpacingAbsolute - Absolute distance between baselines in this paragraph, measured in twips, or LINE_SPACING_RELATIVE in order to restore the default setting.
      Siehe auch:
    • 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.
      Angegeben von:
      getLineSpacingAbsolute in Schnittstelle ParagraphProperties
      Gibt zurück:
      Absolute distance between baselines in this paragraph, measured in twips, or LINE_SPACING_RELATIVE
      Siehe auch:
    • 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".
      Angegeben von:
      setLineSpacingRelative in Schnittstelle ParagraphProperties
      Parameter:
      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")
      Siehe auch:
    • 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.
      Angegeben von:
      getLineSpacingRelative in Schnittstelle ParagraphProperties
      Gibt zurück:
      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.
      Siehe auch:
    • 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.
      • font color and formula
      • fonr name and formula
      • font size and formula
      • font style and formula
      • strikeout and formula
      • underline and formula
      Parameter:
      replacePrompts - replace prompt fields with it current value
      Seit:
      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).
      Angegeben von:
      getFirstLineIndentFormula in Schnittstelle ParagraphProperties
      Gibt zurück:
      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).
      Angegeben von:
      getLeftIndentFormula in Schnittstelle ParagraphProperties
      Gibt zurück:
      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.
      Angegeben von:
      getLineSpacingAbsoluteFormula in Schnittstelle ParagraphProperties
      Gibt zurück:
      Absolute distance between baselines in this paragraph, measured in twips
      Siehe auch:
    • 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.
      Angegeben von:
      getLineSpacingRelativeFormula in Schnittstelle ParagraphProperties
      Gibt zurück:
      formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph
      Siehe auch:
    • 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).
      Angegeben von:
      getRightIndentFormula in Schnittstelle ParagraphProperties
      Gibt zurück:
      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).
      Angegeben von:
      setFirstLineIndentFormula in Schnittstelle ParagraphProperties
      Parameter:
      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).
      Angegeben von:
      setLeftIndentFormula in Schnittstelle ParagraphProperties
      Parameter:
      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.
      Angegeben von:
      setLineSpacingAbsoluteFormula in Schnittstelle ParagraphProperties
      Parameter:
      formula - formula whose return value determines the absolute distance between baselines in this paragraph, measured in twips
      Siehe auch:
    • 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.
      Angegeben von:
      setLineSpacingRelativeFormula in Schnittstelle ParagraphProperties
      Parameter:
      formula - formula whose return value determines the factor by which the default line spacing is to be multiplied for this paragraph
      Siehe auch:
    • 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).
      Angegeben von:
      setRightIndentFormula in Schnittstelle ParagraphProperties
      Parameter:
      formula - The formula whose return value determines the property 'right indent'.
    • parseElement

      public NodeParser parseElement(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String,Object> parserMap) throws FatalParserException
      FOR INTERNAL USE ONLY 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.

      Angegeben von:
      parseElement in Schnittstelle NodeParser
      Setzt außer Kraft:
      parseElement in Klasse Element
      Parameter:
      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.
      Gibt zurück:
      The NodeParser sub-element if one needed to be created, or null if none was created.
      Löst aus:
      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(String text, Map<String,Object> parserMap)
      FOR INTERNAL USE ONLY 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)

      Angegeben von:
      parseText in Schnittstelle NodeParser
      Setzt außer Kraft:
      parseText in Klasse Element
      Parameter:
      text - text encountered and to be stored
      parserMap - The map of current Parser.
    • getSubComponents

      public List<? extends ReportComponent> getSubComponents()
      Returns all ReportComponents that are descendants of this one. E.G. this will return all Element of a Section. But it's as well useful for CrossTabs or Text elements which have additional elements.
      Angegeben von:
      getSubComponents in Klasse ReportComponent
      Gibt zurück:
      a list with all sub components which can be empty as well; will be null if the component has no descendants