java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.TextProperties

public class TextProperties extends Object
A builder class for configuring properties of SWT Text controls. Provides fluent interface methods to set various text field properties including style, dimensions, colors, fonts.
Author:
Ionov Ivan
  • Method Details

    • newInstance

      public static TextProperties newInstance()
      Creates a new TextProperties instance with default values.
      Returns:
      a new TextProperties instance
    • getStyle

      public int getStyle()
      Returns the SWT style bits for the text control, adjusted for multi-line if needed.
      Returns:
      the SWT style bits with multi-line and scroll flags if linesCount > 1
    • style

      public TextProperties style(int style)
      Sets the base SWT style bits for the text control.
      Parameters:
      style - the SWT style bits to apply
      Returns:
      this TextProperties instance for method chaining
    • getWidth

      public int getWidth()
      Returns the width setting for the text control.
      Returns:
      the width in pixels
    • width

      public TextProperties width(int width)
      Sets the width of the text control.
      Parameters:
      width - the width in pixels
      Returns:
      this TextProperties instance for method chaining
    • getLinesCount

      public int getLinesCount()
      Returns the number of text lines for the control.
      Returns:
      the number of lines (affects multi-line styling)
    • linesCount

      public TextProperties linesCount(int linesCount)
      Sets the number of text lines for the control. Values greater than 1 will enable multi-line styling.
      Parameters:
      linesCount - the number of text lines
      Returns:
      this TextProperties instance for method chaining
    • getBackground

      public org.eclipse.swt.graphics.Color getBackground()
      Returns the background color for the text control.
      Returns:
      the background color
    • background

      public TextProperties background(org.eclipse.swt.graphics.Color background)
      Sets the background color for the text control.
      Parameters:
      background - the background color to use
      Returns:
      this TextProperties instance for method chaining
    • getFont

      public org.eclipse.swt.graphics.Font getFont()
      Returns the font for the text control.
      Returns:
      the font, or null if using default font
    • font

      public TextProperties font(org.eclipse.swt.graphics.Font font)
      Sets the font for the text control.
      Parameters:
      font - the font to use, or null for default font
      Returns:
      this TextProperties instance for method chaining
    • isEnable

      public boolean isEnable()
      Returns whether the text control should be enabled. Considers both the section enablement and the dynamic enable condition.
      Returns:
      true if the control should be enabled, false otherwise
    • enable

      public TextProperties enable(boolean enable)
      Sets a static enablement condition for the text control.
      Parameters:
      enable - true to enable the control, false to disable it
      Returns:
      this TextProperties instance for method chaining
    • enable

      public TextProperties enable(BooleanSupplier enable)
      Sets a dynamic enablement condition supplier for the text control.
      Parameters:
      enable - a BooleanSupplier that provides the enablement condition
      Returns:
      this TextProperties instance for method chaining
    • setSectionEnable

      public void setSectionEnable(boolean sectionEnable)
      Sets the section-level enablement flag for the text control.
      Parameters:
      sectionEnable - true if the containing section is enabled, false otherwise
    • copy

      public void copy(TextProperties textProperties)
      Copies properties from another TextProperties instance.
      Parameters:
      textProperties - the source properties to copy from