Class ElementPropertyContainerIPropertyContainer>
- Type Parameters:
-
T
- this type
- All Implemented Interfaces:
-
IPropertyContainer
- Direct Known Subclasses:
-
AbstractElement
,RootElement
,Style
layout object
implementations.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteOwnProperty
(int property) Deletes the own property of this entity.T1 getDefaultProperty
(int property) Gets the default property from this entity.T1 getOwnProperty
(int property) Gets own property from this entity.T1 getProperty
(int property) Gets the property from this entity.Gets a rule for splitting strings when they don't fit into one line.Gets the stroke color for the current element.Gets the stroke width for the current element.Gets the text rendering mode, a variable that determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three.boolean
hasOwnProperty
(int property) Checks if this entity has the specified property, i.e.boolean
hasProperty
(int property) Checks if this entity has the specified property.setBackgroundColor
(Color backgroundColor) Specifies a background color for the Element.setBackgroundColor
(Color backgroundColor, float opacity) Specifies a background color for the Element.setBackgroundColor
(Color backgroundColor, float extraLeft, float extraTop, float extraRight, float extraBottom) Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored.setBackgroundColor
(Color backgroundColor, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom) Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored.Specifies a background image for the Element.setBackgroundImage
(List<BackgroundImage> imagesList) Specifies a list of background images for the Element.setBaseDirection
(BaseDirection baseDirection) This attribute specifies the base direction of directionally neutral text (i.e., text that doesn't have inherent directionality as defined in Unicode) in an element's content and attribute values.Sets a border for all four edges of this Element with customizable color, width, pattern type.setBorderBottom
(Border border) Sets a border for the bottom limit of this Element with customizable color, width, pattern type.setBorderBottomLeftRadius
(BorderRadius borderRadius) Sets a border radius for the bottom left corner of this Element.setBorderBottomRightRadius
(BorderRadius borderRadius) Sets a border radius for the bottom right corner of this Element.setBorderLeft
(Border border) Sets a border for the left limit of this Element with customizable color, width, pattern type.setBorderRadius
(BorderRadius borderRadius) Sets a border radius for all four edges of this Element.setBorderRight
(Border border) Sets a border for the right limit of this Element with customizable color, width, pattern type.setBorderTop
(Border border) Sets a border for the upper limit of this Element with customizable color, width, pattern type.setBorderTopLeftRadius
(BorderRadius borderRadius) Sets a border radius for the top left corner of this Element.setBorderTopRightRadius
(BorderRadius borderRadius) Sets a border radius for the top right corner of this Element.setCharacterSpacing
(float charSpacing) Defines a custom spacing distance between all characters of a textual element.setDestination
(String destination) Sets a destination name that will be created when this element is drawn to content.setFixedPosition
(float left, float bottom, float width) Sets values for a absolute repositioning of the Element.setFixedPosition
(float left, float bottom, UnitValue width) Sets values for an absolute repositioning of the Element.setFixedPosition
(int pageNumber, float left, float bottom, float width) Sets values for a absolute repositioning of the Element.setFixedPosition
(int pageNumber, float left, float bottom, UnitValue width) Sets values for a absolute repositioning of the Element.Sets the font of this Element.setFontColor
(Color fontColor) Sets the font color of this Element.setFontColor
(Color fontColor, float opacity) Sets the font color of this Element and the opacity of the text.setFontColor
(TransparentColor transparentColor) setFontFamily
(String... fontFamilyNames) Sets the preferable font families for this Element.setFontFamily
(List<String> fontFamilyNames) Sets the preferable font families for this Element.setFontKerning
(FontKerning fontKerning) Enable or disable kerning.setFontScript
(Character.UnicodeScript script) Sets the writing system for this text element.setFontSize
(float fontSize) Sets the font size of this Element, measured in points.setHorizontalAlignment
(HorizontalAlignment horizontalAlignment) Sets the horizontal alignment of this Element.setHyphenation
(HyphenationConfig hyphenationConfig) Sets a custom hyphenation configuration which will hyphenate words automatically accordingly to the language and country.Sets default line-through attributes for text.setOpacity
(Float opacity) Sets an opacity of the given element.void
setProperty
(int property, Object value) Sets a property for this entity.setRelativePosition
(float left, float top, float right, float bottom) Sets values for a relative repositioning of the Element.setSplitCharacters
(ISplitCharacters splitCharacters) Sets a rule for splitting strings when they don't fit into one line.setStrokeColor
(Color strokeColor) Sets the stroke color for the current element.setStrokeWidth
(float strokeWidth) Sets the stroke width for the current element.setTextAlignment
(TextAlignment alignment) Sets the text alignment of this Element.setTextRenderingMode
(int textRenderingMode) Sets the text rendering mode, a variable that determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three.Sets default underline attributes for text.setUnderline
(float thickness, float yPosition) Sets an horizontal line that can be an underline or a strikethrough.setUnderline
(Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle) Sets an horizontal line that can be an underline or a strikethrough.setUnderline
(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle) Sets an horizontal line that can be an underline or a strikethrough.setWordSpacing
(float wordSpacing) Defines a custom spacing distance between words of a textual element.Simulates bold style for a font.Simulates italic style for a font.
-
Field Details
-
properties
-
-
Constructor Details
-
ElementPropertyContainer
public ElementPropertyContainer()
-
-
Method Details
-
setProperty
Description copied from interface:IPropertyContainer
Sets a property for this entity.- Specified by:
-
setProperty
in interfaceIPropertyContainer
- Parameters:
-
property
- the property to be set -
value
- the value of the property
-
hasProperty
public boolean hasProperty(int property) Description copied from interface:IPropertyContainer
Checks if this entity has the specified property. Compared toIPropertyContainer.hasOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance- Specified by:
-
hasProperty
in interfaceIPropertyContainer
- Parameters:
-
property
- the property to be checked - Returns:
-
true
if this instance has given property,false
otherwise
-
hasOwnProperty
public boolean hasOwnProperty(int property) Description copied from interface:IPropertyContainer
Checks if this entity has the specified property, i.e. if it was set to this very element earlier- Specified by:
-
hasOwnProperty
in interfaceIPropertyContainer
- Parameters:
-
property
- the property to be checked - Returns:
-
true
if this instance has given own property,false
otherwise
-
deleteOwnProperty
public void deleteOwnProperty(int property) Description copied from interface:IPropertyContainer
Deletes the own property of this entity.- Specified by:
-
deleteOwnProperty
in interfaceIPropertyContainer
- Parameters:
-
property
- the property to be deleted
-
getProperty
publicT1 getProperty (int property) Description copied from interface:IPropertyContainer
Gets the property from this entity. Compared toIPropertyContainer.getOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance- Specified by:
-
getProperty
in interfaceIPropertyContainer
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the value of the given property.
null
will be returned if the property value was not found
-
getOwnProperty
publicT1 getOwnProperty (int property) Description copied from interface:IPropertyContainer
Gets own property from this entity. The property must have been set earlier to this entity. If the property is not found,null
will be returned.- Specified by:
-
getOwnProperty
in interfaceIPropertyContainer
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the value of the given own property.
null
will be returned if the property value was not found
-
getDefaultProperty
publicT1 getDefaultProperty (int property) Description copied from interface:IPropertyContainer
Gets the default property from this entity.- Specified by:
-
getDefaultProperty
in interfaceIPropertyContainer
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the default property value. If the default property is not defined,
null
will be returned
-
setRelativePosition
Sets values for a relative repositioning of the Element. Also has as a side effect that the Element'sProperty.POSITION
is changed torelative
. The default implementation inAbstractRenderer
treatsleft
andtop
as the most important values. Only ifleft == 0
willright
be used for the calculation; ditto for top vs. bottom.- Parameters:
-
left
- movement to the left -
top
- movement upwards on the page -
right
- movement to the right -
bottom
- movement downwards on the page - Returns:
- this Element.
- See Also:
-
setFixedPosition
Sets values for a absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element and it grows upwards. Also has as a side effect that the Element'sProperty.POSITION
is changed tofixed
.- Parameters:
-
left
- horizontal position of the bottom-left corner on the page -
bottom
- vertical position of the bottom-left corner on the page -
width
- a floating point value measured in points. - Returns:
- this Element.
-
setFixedPosition
Sets values for an absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element, and it grows upwards. Also has as a side effect that the Element'sProperty.POSITION
is changed tofixed
.- Parameters:
-
left
- horizontal position of the bottom-left corner on the page -
bottom
- vertical position of the bottom-left corner on the page -
width
- aUnitValue
- Returns:
- this Element.
-
setFixedPosition
Sets values for a absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element and it grows upwards. Also has as a side effect that the Element'sProperty.POSITION
is changed tofixed
.- Parameters:
-
pageNumber
- the page where the element must be positioned -
left
- horizontal position of the bottom-left corner on the page -
bottom
- vertical position of the bottom-left corner on the page -
width
- a floating point value measured in points. - Returns:
- this Element.
-
setFixedPosition
Sets values for a absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element and it grows upwards. Also has as a side effect that the Element'sProperty.POSITION
is changed tofixed
.- Parameters:
-
pageNumber
- the page where the element must be positioned -
left
- horizontal position of the bottom-left corner on the page -
bottom
- vertical position of the bottom-left corner on the page -
width
- a floating point value measured in points. - Returns:
- this Element.
-
setHorizontalAlignment
Sets the horizontal alignment of this Element.- Parameters:
-
horizontalAlignment
- an enum value of typeHorizontalAlignment
- Returns:
- this Element.
-
setFont
Sets the font of this Element.This property overrides the value set by
setFontFamily(java.lang.String...)
. Font is set either via exactPdfFont
instance or via font-family name that should correspond to the font inFontProvider
, but not both.- Parameters:
-
font
- afont
- Returns:
- this Element.
-
setFontFamily
Sets the preferable font families for this Element. Note thatFontProvider
shall be set as well. SeeRootElement.setFontProvider(FontProvider)
This property overrides the value set by
setFont(PdfFont)
. Font is set either via exactPdfFont
instance or via font-family name that should correspond to the font inFontProvider
, but not both.All
String
that are passed as argument are directly handled as a collection of font family names, without any pre-processing. Every font family name is treated as a preferable font-family to be used inside the element. ThefontFamilyNames
argument is interpreted as as an ordered list, where every next font-family should be used if font for the previous one was not found or doesn't contain required glyphs.- Parameters:
-
fontFamilyNames
- defines an ordered list of preferable font families for this Element. - Returns:
- this Element.
- See Also:
-
setFontFamily
Sets the preferable font families for this Element. Note thatFontProvider
shall be set as well. SeeRootElement.setFontProvider(FontProvider)
This property overrides the value set by
setFont(PdfFont)
. Font is set either via exactPdfFont
instance or via font-family name that should correspond to the font inFontProvider
, but not both.All
String
that are passed as argument are directly handled as a collection of font family names, without any pre-processing. Every font family name is treated as a preferable font-family to be used inside the element. ThefontFamilyNames
argument is interpreted as as an ordered list, where every next font-family should be used if font for the previous one was not found or doesn't contain required glyphs.- Parameters:
-
fontFamilyNames
- defines an ordered list of preferable font families for this Element. - Returns:
- this Element.
- See Also:
-
setFontColor
Sets the font color of this Element.- Parameters:
-
fontColor
- aColor
for the text in this Element. - Returns:
- this Element.
-
setFontColor
Sets the font color of this Element and the opacity of the text.- Parameters:
-
fontColor
- aColor
for the text in this Element. -
opacity
- an opacity for the text in this Element; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent. - Returns:
- this Element.
-
setFontColor
-
setFontSize
Sets the font size of this Element, measured in points.- Parameters:
-
fontSize
- a floating point value - Returns:
- this Element.
-
setTextAlignment
Sets the text alignment of this Element.- Parameters:
-
alignment
- an enum value of typeTextAlignment
- Returns:
- this Element.
-
setCharacterSpacing
Defines a custom spacing distance between all characters of a textual element. The character-spacing parameter is added to the glyph's horizontal or vertical displacement (depending on the writing mode).- Parameters:
-
charSpacing
- a floating point value - Returns:
- this Element.
-
setWordSpacing
Defines a custom spacing distance between words of a textual element. This value works exactly like the character spacing, but only kicks in at word boundaries.- Parameters:
-
wordSpacing
- a floating point value - Returns:
- this Element.
-
setFontKerning
Enable or disable kerning. Some fonts may specify kern pairs, i.e. pair of glyphs, between which the amount of horizontal space is adjusted. This adjustment is typically negative, e.g. in "AV" pair the glyphs will typically be moved closer to each other.- Parameters:
-
fontKerning
- an enum value as a boolean wrapper specifying whether or not to apply kerning - Returns:
- this Element.
-
setBackgroundColor
Specifies a background color for the Element.- Parameters:
-
backgroundColor
- the background color - Returns:
- this Element.
-
setBackgroundColor
Specifies a background color for the Element.- Parameters:
-
backgroundColor
- the background color -
opacity
- the background color opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent. - Returns:
- this Element.
-
setBackgroundColor
public T setBackgroundColor(Color backgroundColor, float extraLeft, float extraTop, float extraRight, float extraBottom) Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored.- Parameters:
-
backgroundColor
- the background color -
extraLeft
- extra coloring to the left side -
extraTop
- extra coloring at the top -
extraRight
- extra coloring to the right side -
extraBottom
- extra coloring at the bottom - Returns:
- this Element.
-
setBackgroundColor
public T setBackgroundColor(Color backgroundColor, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom) Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored.- Parameters:
-
backgroundColor
- the background color -
opacity
- the background color opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent -
extraLeft
- extra coloring to the left side -
extraTop
- extra coloring at the top -
extraRight
- extra coloring to the right side -
extraBottom
- extra coloring at the bottom - Returns:
- this Element.
-
setBackgroundImage
Specifies a background image for the Element.- Parameters:
-
image
-BackgroundImage
- Returns:
- this Element.
-
setBackgroundImage
Specifies a list of background images for the Element.- Parameters:
-
imagesList
- List ofBackgroundImage
- Returns:
- this Element.
-
setBorder
Sets a border for all four edges of this Element with customizable color, width, pattern type.- Parameters:
-
border
- a customizedBorder
- Returns:
- this Element.
-
setBorderTop
Sets a border for the upper limit of this Element with customizable color, width, pattern type.- Parameters:
-
border
- a customizedBorder
- Returns:
- this Element.
-
setBorderRight
Sets a border for the right limit of this Element with customizable color, width, pattern type.- Parameters:
-
border
- a customizedBorder
- Returns:
- this Element.
-
setBorderBottom
Sets a border for the bottom limit of this Element with customizable color, width, pattern type.- Parameters:
-
border
- a customizedBorder
- Returns:
- this Element.
-
setBorderLeft
Sets a border for the left limit of this Element with customizable color, width, pattern type.- Parameters:
-
border
- a customizedBorder
- Returns:
- this Element.
-
setBorderRadius
Sets a border radius for all four edges of this Element.- Parameters:
-
borderRadius
- a customizedBorderRadius
- Returns:
- this Element.
-
setBorderBottomLeftRadius
Sets a border radius for the bottom left corner of this Element.- Parameters:
-
borderRadius
- a customizedBorderRadius
- Returns:
- this Element.
-
setBorderBottomRightRadius
Sets a border radius for the bottom right corner of this Element.- Parameters:
-
borderRadius
- a customizedBorderRadius
- Returns:
- this Element.
-
setBorderTopLeftRadius
Sets a border radius for the top left corner of this Element.- Parameters:
-
borderRadius
- a customizedBorderRadius
- Returns:
- this Element.
-
setBorderTopRightRadius
Sets a border radius for the top right corner of this Element.- Parameters:
-
borderRadius
- a customizedBorderRadius
- Returns:
- this Element.
-
setSplitCharacters
Sets a rule for splitting strings when they don't fit into one line. The default implementation isDefaultSplitCharacters
- Parameters:
-
splitCharacters
- an implementation ofISplitCharacters
- Returns:
- this Element.
-
getSplitCharacters
Gets a rule for splitting strings when they don't fit into one line.- Returns:
-
the current string splitting rule, an implementation of
ISplitCharacters
-
getTextRenderingMode
Gets the text rendering mode, a variable that determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three.- Returns:
- the current text rendering mode
- See Also:
-
setTextRenderingMode
Sets the text rendering mode, a variable that determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three.- Parameters:
-
textRenderingMode
- anint
value - Returns:
- this Element.
- See Also:
-
getStrokeColor
Gets the stroke color for the current element. The stroke color is the color of the outlines or edges of a shape.- Returns:
- the current stroke color
-
setStrokeColor
Sets the stroke color for the current element. The stroke color is the color of the outlines or edges of a shape.- Parameters:
-
strokeColor
- a new stroke color - Returns:
- this Element.
-
getStrokeWidth
Gets the stroke width for the current element. The stroke width is the width of the outlines or edges of a shape.- Returns:
- the current stroke width
-
setStrokeWidth
Sets the stroke width for the current element. The stroke width is the width of the outlines or edges of a shape.- Parameters:
-
strokeWidth
- a new stroke width - Returns:
- this Element.
-
simulateBold
Simulates bold style for a font. Be aware that using correct bold font is highly preferred over this option.- Returns:
- this element
-
simulateItalic
Simulates italic style for a font. Be aware that using correct italic (oblique) font is highly preferred over this option.- Returns:
- this element
-
setLineThrough
Sets default line-through attributes for text. SeesetUnderline(Color, float, float, float, float, int)
for more fine tuning.- Returns:
- this element
-
setUnderline
Sets default underline attributes for text. See other overloads for more fine tuning.- Returns:
- this element
-
setUnderline
Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically and has always the text width. Multiple call to this method will produce multiple lines.- Parameters:
-
thickness
- the absolute thickness of the line -
yPosition
- the absolute y position relative to the baseline - Returns:
- this element
-
setUnderline
public T setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle) Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically due to position parameter. Multiple call to this method will produce multiple lines.The thickness of the line will be
thickness + thicknessMul * fontSize
. The position of the line will bebaseLine + yPosition + yPositionMul * fontSize
.- Parameters:
-
color
- the color of the line ornull
to follow the text color -
thickness
- the absolute thickness of the line -
thicknessMul
- the thickness multiplication factor with the font size -
yPosition
- the absolute y position relative to the baseline -
yPositionMul
- the position multiplication factor with the font size -
lineCapStyle
- the end line cap style. Allowed values are enumerated inPdfCanvasConstants.LineCapStyle
- Returns:
- this element
-
setUnderline
public T setUnderline(Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle) Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically due to position parameter. Multiple call to this method will produce multiple lines.The thickness of the line will be
thickness + thicknessMul * fontSize
. The position of the line will bebaseLine + yPosition + yPositionMul * fontSize
.- Parameters:
-
color
- the color of the line ornull
to follow the text color -
opacity
- the opacity of the line; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent -
thickness
- the absolute thickness of the line -
thicknessMul
- the thickness multiplication factor with the font size -
yPosition
- the absolute y position relative to the baseline -
yPositionMul
- the position multiplication factor with the font size -
lineCapStyle
- the end line cap style. Allowed values are enumerated inPdfCanvasConstants.LineCapStyle
- Returns:
- this element
-
setBaseDirection
This attribute specifies the base direction of directionally neutral text (i.e., text that doesn't have inherent directionality as defined in Unicode) in an element's content and attribute values.- Parameters:
-
baseDirection
- base direction - Returns:
- this element
-
setHyphenation
Sets a custom hyphenation configuration which will hyphenate words automatically accordingly to the language and country.- Parameters:
-
hyphenationConfig
- The hyphenation configuration - Returns:
- this element
-
setFontScript
Sets the writing system for this text element.- Parameters:
-
script
- a new script type - Returns:
- this Element.
-
setDestination
Sets a destination name that will be created when this element is drawn to content.- Parameters:
-
destination
- the destination name to be created - Returns:
- this Element.
-
setOpacity
Sets an opacity of the given element. It will affect element content, borders and background. Note, that it will also affect all element children, as they are the content of the given element.- Parameters:
-
opacity
- a float between 0 and 1, where 1 stands for fully opaque element and 0 - for fully transparent - Returns:
- this Element.
-