Class TextProperties
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.TextProperties
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 Summary
Modifier and TypeMethodDescriptionbackground(org.eclipse.swt.graphics.Color background) Sets the background color for the text control.voidcopy(TextProperties textProperties) Copies properties from another TextProperties instance.enable(boolean enable) Sets a static enablement condition for the text control.enable(BooleanSupplier enable) Sets a dynamic enablement condition supplier for the text control.font(org.eclipse.swt.graphics.Font font) Sets the font for the text control.org.eclipse.swt.graphics.ColorReturns the background color for the text control.org.eclipse.swt.graphics.FontgetFont()Returns the font for the text control.intReturns the number of text lines for the control.intgetStyle()Returns the SWT style bits for the text control, adjusted for multi-line if needed.intgetWidth()Returns the width setting for the text control.booleanisEnable()Returns whether the text control should be enabled.linesCount(int linesCount) Sets the number of text lines for the control.static TextPropertiesCreates a new TextProperties instance with default values.voidsetSectionEnable(boolean sectionEnable) Sets the section-level enablement flag for the text control.style(int style) Sets the base SWT style bits for the text control.width(int width) Sets the width of the text control.
-
Method Details
-
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
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
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
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
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
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
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
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
Copies properties from another TextProperties instance.- Parameters:
textProperties- the source properties to copy from
-