Package dk.gtz.graphedit.view.log
Class TextStyle
java.lang.Object
dk.gtz.graphedit.view.log.TextStyle
Holds information about the style of a text fragment.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new text style instanceTextStyle
(Optional<Boolean> bold, Optional<Boolean> italic, Optional<Boolean> underline, Optional<Boolean> strikethrough, Optional<Integer> fontSize, Optional<String> fontFamily, Optional<String> textColor, Optional<String> backgroundColor) Construct a new text style istance -
Method Summary
Modifier and TypeMethodDescriptionstatic String
cssColor
(javafx.scene.paint.Color color) Create a new text style with a specified text colorboolean
int
hashCode()
static TextStyle
Create a new text style with a random text colorsetBackgroundColor
(String backgroundColor) Set the text background color attribute of the text stylesetBold
(boolean bold) Set the bold attribute of the text stylesetFontFamily
(String fontFamily) Set the font of the text stylesetFontSize
(int fontSize) Set the font size attribute of the text stylesetItalic
(boolean italic) Set the italic attribute of the text stylesetStrikethrough
(boolean strikethrough) Set the strikethrough attribute of the text stylesetTextColor
(String textColor) Set the text color attribute of the text stylesetTextColorWeb
(String webColor) Set the text color attribute of the text style using hex-codessetUnderline
(boolean underline) Set the underline attribute of the text styletoCss()
Convert the current settings into one big javafx css expressiontoString()
updateWith
(TextStyle mixin) Mix / merge a different text style with this one.
-
Field Details
-
EMPTY
A text style with only default values -
WHITE
A text style using white text color
-
-
Constructor Details
-
TextStyle
public TextStyle()Construct a new text style instance -
TextStyle
public TextStyle(Optional<Boolean> bold, Optional<Boolean> italic, Optional<Boolean> underline, Optional<Boolean> strikethrough, Optional<Integer> fontSize, Optional<String> fontFamily, Optional<String> textColor, Optional<String> backgroundColor) Construct a new text style istance- Parameters:
bold
- Should the text be bolditalic
- Should the text be italicunderline
- Should the text be underlinedstrikethrough
- Should the text be strikethroughfontSize
- Text size of the text stylefontFamily
- The font to usetextColor
- The css color to usebackgroundColor
- The css background color to use
-
-
Method Details
-
randomTextColor
Create a new text style with a random text color- Returns:
- A new randomly colored text style
-
cssColor
Create a new text style with a specified text color- Parameters:
color
- The color to use- Returns:
- A new colored text style
-
hashCode
public int hashCode() -
equals
-
toString
-
toCss
Convert the current settings into one big javafx css expression- Returns:
- A new css expression string
-
updateWith
Mix / merge a different text style with this one.- Parameters:
mixin
- The other text style to merge with- Returns:
- A new merged / mixed text style
-
setBold
Set the bold attribute of the text style- Parameters:
bold
- Whether or not the text should be bold- Returns:
- a new text style
-
setItalic
Set the italic attribute of the text style- Parameters:
italic
- Whether or not the text should be italic- Returns:
- a new text style
-
setUnderline
Set the underline attribute of the text style- Parameters:
underline
- Whether or not the text should be underlined- Returns:
- a new text style
-
setStrikethrough
Set the strikethrough attribute of the text style- Parameters:
strikethrough
- Whether or not the text should be strikethrough- Returns:
- a new text style
-
setFontSize
Set the font size attribute of the text style- Parameters:
fontSize
- The size (in pt's) of the text- Returns:
- a new text style
-
setFontFamily
Set the font of the text style- Parameters:
fontFamily
- The font to use- Returns:
- a new text style
-
setTextColor
Set the text color attribute of the text style- Parameters:
textColor
- The new color of the text- Returns:
- a new text style
-
setTextColorWeb
Set the text color attribute of the text style using hex-codes- Parameters:
webColor
- Hexcode formatted color of the text- Returns:
- a new text style
-
setBackgroundColor
Set the text background color attribute of the text style- Parameters:
backgroundColor
- The new background color of the text- Returns:
- a new text style
-