Class StyleManager

java.lang.Object
no.ntnu.principes.util.styles.StyleManager

public class StyleManager extends Object
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.
  • Constructor Details

    • StyleManager

      public StyleManager()
  • Method Details

    • getThemeProvider

      public static StyleManager.ThemeProvider getThemeProvider()
    • apply

      public static StyleManager.NodeStyleManager apply(javafx.scene.Node node, String... styles)
      Applies CSS style classes to a node.
      Parameters:
      node - The node to apply styles to
      styles - The style classes to apply
      Returns:
      A NodeStyleManager for further styling
    • unapply

      public static StyleManager.NodeStyleManager unapply(javafx.scene.Node node, String... styles)
      Removes CSS style classes from a node.
      Parameters:
      node - The node to remove styles from
      styles - 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 configure
      priority - The growth priority
      Returns:
      A NodeStyleManager for further styling
    • growHorizontal

      public static StyleManager.NodeStyleManager[] growHorizontal(javafx.scene.layout.Region... nodes)
      Sets multiple nodes to grow horizontally with ALWAYS priority.
      Parameters:
      nodes - The nodes to configure
      Returns:
      An array of NodeStyleManagers for further styling
    • shrinkHorizontal

      public static StyleManager.NodeStyleManager[] shrinkHorizontal(javafx.scene.layout.Region... nodes)
      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 configure
      priority - The growth priority
      Returns:
      A NodeStyleManager for further styling
    • growVertical

      public static StyleManager.NodeStyleManager growVertical(javafx.scene.layout.Region... nodes)
      Sets multiple nodes to grow vertically with ALWAYS priority.
      Parameters:
      nodes - The nodes to configure
      Returns:
      The NodeStyleManager for the last node
    • shrinkVertical

      public static StyleManager.NodeStyleManager shrinkVertical(javafx.scene.layout.Region... nodes)
      Sets multiple nodes to never grow vertically.
      Parameters:
      nodes - The nodes to configure
      Returns:
      The NodeStyleManager for the last node
    • grow

      public static StyleManager.NodeStyleManager grow(javafx.scene.layout.Region... nodes)
      Sets multiple nodes to grow both horizontally and vertically.
      Parameters:
      nodes - The nodes to configure
      Returns:
      The NodeStyleManager for the last node
    • shrink

      public static StyleManager.NodeStyleManager shrink(javafx.scene.layout.Region... nodes)
      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 configure
      padding - 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 configure
      top - The top padding value
      right - The right padding value
      bottom - The bottom padding value
      left - 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 configure
      insets - 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 configure
      horizontal - The horizontal (left and right) padding value
      vertical - The vertical (top and bottom) padding value
      Returns:
      A NodeStyleManager for further styling
    • margin

      public static StyleManager.NodeStyleManager margin(javafx.scene.layout.Region node, double margin)
      Sets uniform margin on all sides of a node.
      Parameters:
      node - The node to configure
      margin - 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 configure
      top - The top margin value
      right - The right margin value
      bottom - The bottom margin value
      left - 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 configure
      insets - 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 configure
      horizontal - The horizontal (left and right) margin value
      vertical - The vertical (top and bottom) margin value
      Returns:
      A NodeStyleManager for further styling