Class StyleAttributeMap.Builder
java.lang.Object
jfx.incubator.scene.control.richtext.model.StyleAttributeMap.Builder
- Enclosing class:
StyleAttributeMap
StyleAttributeMap are immutable, so a Builder is required to create a new instance
- Since:
- 24
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates an immutable instance ofStyleAttributeMap
with the attributes set by this Builder.merge
(StyleAttributeMap attrs) Merges the specified attributes with the attributes in this instance.set
(StyleAttribute<V> a, V value) Sets the value for the specified attribute.setBackground
(Color color) Sets the paragraph background attribute to the specified color.setBold
(boolean on) Sets the bold attribute.Sets the BULLET attribute.setFirstLineIndent
(double size) Sets the FIRST_LINE_INDENT attribute.setFontFamily
(String name) Sets the font family attribute.setFontSize
(double size) Sets the font size attribute.setItalic
(boolean on) Sets the italic attribute.setLineSpacing
(double value) Sets the line spacing paragraph attribute.Sets the paragraph direction attribute.setSpaceAbove
(double value) Sets the space above paragraph attribute.setSpaceBelow
(double value) Sets the space below paragraph attribute.setSpaceLeft
(double value) Sets the space left paragraph attribute.setSpaceRight
(double value) Sets the space right paragraph attribute.setStrikeThrough
(boolean on) Sets the strike-through attribute.Sets the text alignment attribute to the specified color.setTextColor
(Color color) Sets the text color attribute to the specified color.setUnderline
(boolean on) Sets the underline attribute.
-
Method Details
-
build
Creates an immutable instance ofStyleAttributeMap
with the attributes set by this Builder.- Returns:
- the new instance
-
set
Sets the value for the specified attribute. This method will throw anIllegalArgumentException
if the value cannot be cast to the type specified by the attribute.- Type Parameters:
V
- the attribute value type- Parameters:
a
- the attributevalue
- the attribute value- Returns:
- this Builder instance
-
merge
Merges the specified attributes with the attributes in this instance. The new values override any existing ones.- Parameters:
attrs
- the attributes to merge, may be null- Returns:
- this Builder instance
-
setBackground
Sets the paragraph background attribute to the specified color. It is recommended to specify a translucent background color in order to avoid obstructing the selection and the current line highlights.- Parameters:
color
- the color- Returns:
- this Builder instance
-
setBold
Sets the bold attribute.- Parameters:
on
- true for bold typeface- Returns:
- this Builder instance
-
setBullet
Sets the BULLET attribute.- Parameters:
bullet
- the bullet character- Returns:
- this Builder instance
-
setFirstLineIndent
Sets the FIRST_LINE_INDENT attribute.- Parameters:
size
- the first line indent value- Returns:
- this Builder instance
-
setFontFamily
Sets the font family attribute.- Parameters:
name
- the font family name- Returns:
- this Builder instance
-
setFontSize
Sets the font size attribute.- Parameters:
size
- the font size in points- Returns:
- this Builder instance
-
setLineSpacing
Sets the line spacing paragraph attribute.- Parameters:
value
- the line spacing value- Returns:
- this Builder instance
-
setItalic
Sets the italic attribute.- Parameters:
on
- true for italic typeface- Returns:
- this Builder instance
-
setRTL
Sets the paragraph direction attribute.- Parameters:
d
- the paragraph direction- Returns:
- this Builder instance
-
setSpaceAbove
Sets the space above paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.- Parameters:
value
- the space amount- Returns:
- this Builder instance
-
setSpaceBelow
Sets the space below paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.- Parameters:
value
- the space amount- Returns:
- this Builder instance
-
setSpaceLeft
Sets the space left paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.- Parameters:
value
- the space amount- Returns:
- this Builder instance
-
setSpaceRight
Sets the space right paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.- Parameters:
value
- the space amount- Returns:
- this Builder instance
-
setStrikeThrough
Sets the strike-through attribute.- Parameters:
on
- true for strike-through typeface- Returns:
- this Builder instance
-
setTextAlignment
Sets the text alignment attribute to the specified color.- Parameters:
a
- the alignment- Returns:
- this Builder instance
-
setTextColor
Sets the text color attribute to the specified color.- Parameters:
color
- the color- Returns:
- this Builder instance
-
setUnderline
Sets the underline attribute.- Parameters:
on
- true for underline- Returns:
- this Builder instance
-