Spec-Zone.ru › OpenJavaFX 24

Class StyleAttributeMap

java.lang.Object
jfx.incubator.scene.control.richtext.model.StyleAttributeMap
public final class StyleAttributeMap extends Object
This immutable object contains a map of StyleAttributes.
Since:
24

Nested Class Summary

Modifier and Type Class Description
static class  StyleAttributeMap.Builder
StyleAttributeMap are immutable, so a Builder is required to create a new instance

Field Summary

Modifier and Type Field Description
static final StyleAttribute<Color> BACKGROUND
Paragraph background color attribute.
static final StyleAttribute<Boolean> BOLD
Bold typeface text attribute.
static final StyleAttribute<String> BULLET
Bullet point paragraph attribute.
static final StyleAttributeMap EMPTY
Empty attribute set.
static final StyleAttribute<Double> FIRST_LINE_INDENT
First line indent paragraph attribute, in pixels.
static final StyleAttribute<String> FONT_FAMILY
Font family text attribute.
static final StyleAttribute<Double> FONT_SIZE
Font size text attribute, in pixels.
static final StyleAttribute<Boolean> ITALIC
Italic type face text attribute.
static final StyleAttribute<Double> LINE_SPACING
Line spacing paragraph attribute.
static final StyleAttribute<ParagraphDirection> PARAGRAPH_DIRECTION
Paragraph direction attribute.
static final StyleAttribute<Double> SPACE_ABOVE
Space above (top padding) paragraph attribute.
static final StyleAttribute<Double> SPACE_BELOW
Space below (bottom padding) paragraph attribute.
static final StyleAttribute<Double> SPACE_LEFT
Space to the left (left padding) paragraph attribute.
static final StyleAttribute<Double> SPACE_RIGHT
Space to the right (right padding) paragraph attribute.
static final StyleAttribute<Boolean> STRIKE_THROUGH
Strike-through text attribute.
static final StyleAttribute<TextAlignment> TEXT_ALIGNMENT
Text alignment paragraph attribute.
static final StyleAttribute<Color> TEXT_COLOR
Text color attribute.
static final StyleAttribute<Boolean> UNDERLINE
Underline text attribute.

Method Summary

Modifier and Type Method Description
static StyleAttributeMap.Builder builder()
Creates a new Builder instance.
StyleAttributeMap combine(StyleAttributeMap attrs)
Creates a new StyleAttributeMap instance by first copying attributes from this instance, then adding (and/or overwriting) the attributes from the specified instance.
boolean contains(StyleAttribute<?> a)
Returns true if the attribute is present; false otherwise.
<V> V get(StyleAttribute<V> a)
Returns the attribute value, or null if no such attribute is present.
Set<Map.Entry<StyleAttribute<?>,Object>> getAttributeEntrySet()
Returns an immutable Set view of the mappings contained in this map.
Set<StyleAttribute<?>> getAttributes()
Returns the set of StyleAttributes.
Color getBackground()
This convenience method returns the value of BACKGROUND attribute, or null.
boolean getBoolean(StyleAttribute<Boolean> a)
Returns true if the specified attribute contains Boolean.TRUE, false in any other case.
String getBullet()
This convenience method returns the value of BULLET attribute, or null.
double getDouble(StyleAttribute<? extends Number> a, double defaultValue)
Returns the value of the specified attribute, or defaultValue if the specified attribute is not present or is not a Number.
Double getFirstLineIndent()
This convenience method returns the value of the FIRST_LINE_INDENT attribute.
String getFontFamily()
This convenience method returns true if the value of the FONT_FAMILY attribute is Boolean.TRUE, false otherwise.
final Double getFontSize()
This convenience method returns the value of the FONT_SIZE attribute.
Double getLineSpacing()
This convenience method returns the value of the LINE_SPACING attribute, or null.
ParagraphDirection getParagraphDirection()
This convenience method returns the value of PARAGRAPH_DIRECTION paragraph attribute, or null if the value is not set.
Double getSpaceAbove()
This convenience method returns the value of the SPACE_ABOVE attribute, or null.
Double getSpaceBelow()
This convenience method returns the value of the SPACE_BELOW attribute, or null.
Double getSpaceLeft()
This convenience method returns the value of the SPACE_LEFT attribute, or null.
Double getSpaceRight()
This convenience method returns the value of the SPACE_RIGHT attribute, or null.
TextAlignment getTextAlignment()
This convenience method returns the value of TEXT_ALIGNMENT attribute, or null.
Color getTextColor()
This convenience method returns the value of TEXT_COLOR attribute, or null.
boolean isBold()
This convenience method returns true if the value of BOLD attribute is Boolean.TRUE, false otherwise.
boolean isEmpty()
Returns true if this instance contains no attributes.
boolean isItalic()
This convenience method returns true if the value of ITALIC attribute is Boolean.TRUE, false otherwise.
boolean isStrikeThrough()
This convenience method returns true if the value of STRIKE_THROUGH attribute is Boolean.TRUE, false otherwise.
boolean isUnderline()
This convenience method returns true if the value of UNDERLINE attribute is Boolean.TRUE, false otherwise.
static <V> StyleAttributeMap of(StyleAttribute<V> attribute, V value)
Convenience method creates the instance with a single attribute.

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

BACKGROUND

public static final StyleAttribute<Color> BACKGROUND
Paragraph background color attribute.

BULLET

public static final StyleAttribute<String> BULLET
Bullet point paragraph attribute.

BOLD

public static final StyleAttribute<Boolean> BOLD
Bold typeface text attribute.

FIRST_LINE_INDENT

public static final StyleAttribute<Double> FIRST_LINE_INDENT
First line indent paragraph attribute, in pixels.

FONT_FAMILY

public static final StyleAttribute<String> FONT_FAMILY
Font family text attribute.

FONT_SIZE

public static final StyleAttribute<Double> FONT_SIZE
Font size text attribute, in pixels.

ITALIC

public static final StyleAttribute<Boolean> ITALIC
Italic type face text attribute.

LINE_SPACING

public static final StyleAttribute<Double> LINE_SPACING
Line spacing paragraph attribute.

PARAGRAPH_DIRECTION

public static final StyleAttribute<ParagraphDirection> PARAGRAPH_DIRECTION
Paragraph direction attribute. This attribute is considered only when text wrapping is enabled.

SPACE_ABOVE

public static final StyleAttribute<Double> SPACE_ABOVE
Space above (top padding) paragraph attribute.

SPACE_BELOW

public static final StyleAttribute<Double> SPACE_BELOW
Space below (bottom padding) paragraph attribute.

SPACE_LEFT

public static final StyleAttribute<Double> SPACE_LEFT
Space to the left (left padding) paragraph attribute.

SPACE_RIGHT

public static final StyleAttribute<Double> SPACE_RIGHT
Space to the right (right padding) paragraph attribute.

STRIKE_THROUGH

public static final StyleAttribute<Boolean> STRIKE_THROUGH
Strike-through text attribute.

TEXT_ALIGNMENT

public static final StyleAttribute<TextAlignment> TEXT_ALIGNMENT
Text alignment paragraph attribute.

TEXT_COLOR

public static final StyleAttribute<Color> TEXT_COLOR
Text color attribute.

UNDERLINE

public static final StyleAttribute<Boolean> UNDERLINE
Underline text attribute.

EMPTY

public static final StyleAttributeMap EMPTY
Empty attribute set.

Method Details

of

public static <V> StyleAttributeMap of(StyleAttribute<V> attribute, V value)
Convenience method creates the instance with a single attribute.
Type Parameters:
V - the attribute value type
Parameters:
attribute - the attribute
value - the attribute value
Returns:
the new instance

isEmpty

public boolean isEmpty()
Returns true if this instance contains no attributes.
Returns:
true is no attributes are present

get

public <V> V get(StyleAttribute<V> a)
Returns the attribute value, or null if no such attribute is present.
Type Parameters:
V - the attribute value type
Parameters:
a - attribute
Returns:
attribute value or null

getAttributes

public Set<StyleAttribute<?>> getAttributes()
Returns the set of StyleAttributes.
Returns:
attribute set

getAttributeEntrySet

public Set<Map.Entry<StyleAttribute<?>,Object>> getAttributeEntrySet()
Returns an immutable Set view of the mappings contained in this map.
Returns:
a set view of the mappings contained in this attribute map

contains

public boolean contains(StyleAttribute<?> a)
Returns true if the attribute is present; false otherwise.
Parameters:
a - the attribute
Returns:
true if the attribute is present

combine

public StyleAttributeMap combine(StyleAttributeMap attrs)
Creates a new StyleAttributeMap instance by first copying attributes from this instance, then adding (and/or overwriting) the attributes from the specified instance.
Parameters:
attrs - the attributes to combine
Returns:
the new instance combining the attributes

getBoolean

public boolean getBoolean(StyleAttribute<Boolean> a)
Returns true if the specified attribute contains Boolean.TRUE, false in any other case.
Parameters:
a - the attribute
Returns:
true if the attribute value is Boolean.TRUE

getDouble

public double getDouble(StyleAttribute<? extends Number> a, double defaultValue)
Returns the value of the specified attribute, or defaultValue if the specified attribute is not present or is not a Number.
Parameters:
a - the attribute
defaultValue - the default value
Returns:
the attribute value

getBackground

public Color getBackground()
This convenience method returns the value of BACKGROUND attribute, or null.
Returns:
the background color attribute value

getBullet

public String getBullet()
This convenience method returns the value of BULLET attribute, or null.
Returns:
the bullet paragraph attribute value

getFirstLineIndent

public Double getFirstLineIndent()
This convenience method returns the value of the FIRST_LINE_INDENT attribute.
Returns:
the first line indent value in points

getFontSize

public final Double getFontSize()
This convenience method returns the value of the FONT_SIZE attribute.
Returns:
the font size

getFontFamily

public String getFontFamily()
This convenience method returns true if the value of the FONT_FAMILY attribute is Boolean.TRUE, false otherwise.
Returns:
the font family name

getLineSpacing

public Double getLineSpacing()
This convenience method returns the value of the LINE_SPACING attribute, or null.
Returns:
the line spacing value

getSpaceAbove

public Double getSpaceAbove()
This convenience method returns the value of the SPACE_ABOVE attribute, or null.
Returns:
the space above paragraph attribute value

getSpaceBelow

public Double getSpaceBelow()
This convenience method returns the value of the SPACE_BELOW attribute, or null.
Returns:
the space below paragraph attribute value

getSpaceLeft

public Double getSpaceLeft()
This convenience method returns the value of the SPACE_LEFT attribute, or null.
Returns:
the space left paragraph attribute value

getSpaceRight

public Double getSpaceRight()
This convenience method returns the value of the SPACE_RIGHT attribute, or null.
Returns:
the space right paragraph attribute value

getTextAlignment

public TextAlignment getTextAlignment()
This convenience method returns the value of TEXT_ALIGNMENT attribute, or null.
Returns:
the paragraph alignment attribute value

getTextColor

public Color getTextColor()
This convenience method returns the value of TEXT_COLOR attribute, or null.
Returns:
the text color attribute value

isBold

public boolean isBold()
This convenience method returns true if the value of BOLD attribute is Boolean.TRUE, false otherwise.
Returns:
the bold attribute value

isItalic

public boolean isItalic()
This convenience method returns true if the value of ITALIC attribute is Boolean.TRUE, false otherwise.
Returns:
the italic attribute value

getParagraphDirection

public ParagraphDirection getParagraphDirection()
This convenience method returns the value of PARAGRAPH_DIRECTION paragraph attribute, or null if the value is not set.
Returns:
the paragraph direction attribute value, or null

isStrikeThrough

public boolean isStrikeThrough()
This convenience method returns true if the value of STRIKE_THROUGH attribute is Boolean.TRUE, false otherwise.
Returns:
the strike through attribute value

isUnderline

public boolean isUnderline()
This convenience method returns true if the value of UNDERLINE attribute is Boolean.TRUE, false otherwise.
Returns:
the underline attribute value

builder

public static StyleAttributeMap.Builder builder()
Creates a new Builder instance.
Returns:
the new Builder instance

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API