java.lang.Object
no.ntnu.principes.util.styles.StyleManager
Utility class for managing JavaFX node styles and layout constraints.
Provides methods for applying CSS styles, setting growth behaviors,
and configuring padding and margins for UI elements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCSS classes for button styling.static final classCSS classes for input field styling.static classInner class for chained styling operations on a single node.static final classCSS classes for overlay styling.static classstatic final classCSS classes for typography styling. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplies CSS style classes to a node.static StyleManager.ThemeProvidergrow(javafx.scene.layout.Region... nodes) Sets multiple nodes to grow both horizontally and vertically.static StyleManager.NodeStyleManager[]growHorizontal(javafx.scene.layout.Region... nodes) Sets multiple nodes to grow horizontally with ALWAYS priority.growHorizontal(javafx.scene.layout.Region node, javafx.scene.layout.Priority priority) Sets a node to grow horizontally with the specified priority.growVertical(javafx.scene.layout.Region... nodes) Sets multiple nodes to grow vertically with ALWAYS priority.growVertical(javafx.scene.layout.Region node, javafx.scene.layout.Priority priority) Sets a node to grow vertically with the specified priority.margin(javafx.scene.layout.Region node, double margin) Sets uniform margin on all sides of a node.margin(javafx.scene.layout.Region node, double horizontal, double vertical) Sets symmetric margin on a node.margin(javafx.scene.layout.Region node, double top, double right, double bottom, double left) Sets custom margin on each side of a node.margin(javafx.scene.layout.Region node, javafx.geometry.Insets insets) Sets margin on a node using an Insets object.padding(javafx.scene.layout.Region node, double padding) Sets uniform padding on all sides of a node.padding(javafx.scene.layout.Region node, double horizontal, double vertical) Sets symmetric padding on a node.padding(javafx.scene.layout.Region node, double top, double right, double bottom, double left) Sets custom padding on each side of a node.padding(javafx.scene.layout.Region node, javafx.geometry.Insets insets) Sets padding on a node using an Insets object.shrink(javafx.scene.layout.Region... nodes) Sets multiple nodes to never grow in either direction.static StyleManager.NodeStyleManager[]shrinkHorizontal(javafx.scene.layout.Region... nodes) Sets multiple nodes to never grow horizontally.shrinkVertical(javafx.scene.layout.Region... nodes) Sets multiple nodes to never grow vertically.Removes CSS style classes from a node.
-
Constructor Details
-
StyleManager
public StyleManager()
-
-
Method Details
-
getThemeProvider
-
apply
Applies CSS style classes to a node.- Parameters:
node- The node to apply styles tostyles- The style classes to apply- Returns:
- A NodeStyleManager for further styling
-
unapply
Removes CSS style classes from a node.- Parameters:
node- The node to remove styles fromstyles- The style classes to remove- Returns:
- A NodeStyleManager for further styling
-
growHorizontal
public static StyleManager.NodeStyleManager growHorizontal(javafx.scene.layout.Region node, javafx.scene.layout.Priority priority) Sets a node to grow horizontally with the specified priority.- Parameters:
node- The node to configurepriority- The growth priority- Returns:
- A NodeStyleManager for further styling
-
growHorizontal
Sets multiple nodes to grow horizontally with ALWAYS priority.- Parameters:
nodes- The nodes to configure- Returns:
- An array of NodeStyleManagers for further styling
-
shrinkHorizontal
Sets multiple nodes to never grow horizontally.- Parameters:
nodes- The nodes to configure- Returns:
- An array of NodeStyleManagers for further styling
-
growVertical
public static StyleManager.NodeStyleManager growVertical(javafx.scene.layout.Region node, javafx.scene.layout.Priority priority) Sets a node to grow vertically with the specified priority.- Parameters:
node- The node to configurepriority- The growth priority- Returns:
- A NodeStyleManager for further styling
-
growVertical
Sets multiple nodes to grow vertically with ALWAYS priority.- Parameters:
nodes- The nodes to configure- Returns:
- The NodeStyleManager for the last node
-
shrinkVertical
Sets multiple nodes to never grow vertically.- Parameters:
nodes- The nodes to configure- Returns:
- The NodeStyleManager for the last node
-
grow
Sets multiple nodes to grow both horizontally and vertically.- Parameters:
nodes- The nodes to configure- Returns:
- The NodeStyleManager for the last node
-
shrink
Sets multiple nodes to never grow in either direction.- Parameters:
nodes- The nodes to configure- Returns:
- The NodeStyleManager for the last node
-
padding
public static StyleManager.NodeStyleManager padding(javafx.scene.layout.Region node, double padding) Sets uniform padding on all sides of a node.- Parameters:
node- The node to configurepadding- The padding value to apply to all sides- Returns:
- A NodeStyleManager for further styling
-
padding
public static StyleManager.NodeStyleManager padding(javafx.scene.layout.Region node, double top, double right, double bottom, double left) Sets custom padding on each side of a node.- Parameters:
node- The node to configuretop- The top padding valueright- The right padding valuebottom- The bottom padding valueleft- The left padding value- Returns:
- A NodeStyleManager for further styling
-
padding
public static StyleManager.NodeStyleManager padding(javafx.scene.layout.Region node, javafx.geometry.Insets insets) Sets padding on a node using an Insets object.- Parameters:
node- The node to configureinsets- The Insets object defining the padding- Returns:
- A NodeStyleManager for further styling
-
padding
public static StyleManager.NodeStyleManager padding(javafx.scene.layout.Region node, double horizontal, double vertical) Sets symmetric padding on a node.- Parameters:
node- The node to configurehorizontal- The horizontal (left and right) padding valuevertical- The vertical (top and bottom) padding value- Returns:
- A NodeStyleManager for further styling
-
margin
Sets uniform margin on all sides of a node.- Parameters:
node- The node to configuremargin- The margin value to apply to all sides- Returns:
- A NodeStyleManager for further styling
-
margin
public static StyleManager.NodeStyleManager margin(javafx.scene.layout.Region node, double top, double right, double bottom, double left) Sets custom margin on each side of a node.- Parameters:
node- The node to configuretop- The top margin valueright- The right margin valuebottom- The bottom margin valueleft- The left margin value- Returns:
- A NodeStyleManager for further styling
-
margin
public static StyleManager.NodeStyleManager margin(javafx.scene.layout.Region node, javafx.geometry.Insets insets) Sets margin on a node using an Insets object.- Parameters:
node- The node to configureinsets- The Insets object defining the margin- Returns:
- A NodeStyleManager for further styling
-
margin
public static StyleManager.NodeStyleManager margin(javafx.scene.layout.Region node, double horizontal, double vertical) Sets symmetric margin on a node.- Parameters:
node- The node to configurehorizontal- The horizontal (left and right) margin valuevertical- The vertical (top and bottom) margin value- Returns:
- A NodeStyleManager for further styling
-