public class StyleHelper
extends java.lang.Object
Style
Modifier and Type | Method and Description |
---|---|
static Rectangle |
computeContentBounds(Rectangle boundsHint,
Style style)
Unwraps the different style outlines then apply the style dimension to get the content effective bounds from the
global bounds.
|
static void |
computePreferredSize(Rectangle boundsHint,
Rectangle contentBounds,
Style style)
Applies the style dimension then wraps the different style outlines to get the global bounds from the content
effective bounds.
|
static Font |
getFont(FontProfile fontProfile)
Utility method to get the font matching a font profile using the font loader.
|
static Font |
getFont(Style style)
Utility method to get the font matching a front profile from a style using the font loader.
|
static Image |
getImage(java.lang.String path)
Utility method to get the image from a style using the image loader.
|
static Stylesheet |
getStylesheet()
Gets the stylesheet instance.
|
static void |
renderWithoutContent(GraphicsContext g,
Rectangle bounds,
Style style)
Applies the different outlines and the background to a graphics context.
|
public static Stylesheet getStylesheet()
public static Font getFont(@NonNull Style style)
style
- the style that contains the font profile.public static Font getFont(@NonNull FontProfile fontProfile)
fontProfile
- the font profile.@Nullable public static Image getImage(@NonNull java.lang.String path)
path
- the path of the image to load.@NonNull public static Rectangle computeContentBounds(@NonNull Rectangle boundsHint, Style style)
The bounds hint is modified.
Precondition: the given style is complete.
boundsHint
- the bounds hint.style
- the style to apply.Outline.unwrap(Rectangle)
public static void computePreferredSize(@NonNull Rectangle boundsHint, @NonNull Rectangle contentBounds, Style style)
The content bounds is modified.
Precondition: the given style is complete.
boundsHint
- the bounds hint.contentBounds
- the content bounds.style
- the style to apply.Outline.wrap(Rectangle)
public static void renderWithoutContent(@NonNull GraphicsContext g, @NonNull Rectangle bounds, @NonNull Style style)
The order is: margin, background, border, padding.
Precondition: the given style is complete.
g
- the graphics context to modify.bounds
- the available bounds.style
- the style to apply.Outline.apply(GraphicsContext, Rectangle)
,
Background.apply(GraphicsContext, Rectangle, int)