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.enabled(boolean enabled) Sets a static enablement condition for the text control.enabled(BooleanSupplier enabled) 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.Returns the message shown when the text control is empty.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.booleanReturns whether the text control should be enabled.linesCount(int linesCount) Sets the number of text lines for the control.Sets the message shown when the text control is empty.static TextPropertiesCreates a new TextProperties instance with default values.sectionEnabled(boolean sectionEnabled) 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
-
getMessage
Returns the message shown when the text control is empty.- Returns:
- the message text
-
message
Sets the message shown when the text control is empty.- Parameters:
message- the message text- 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
-
isEnabled
public boolean isEnabled()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
-
enabled
Sets a static enablement condition for the text control.- Parameters:
enabled- true to enable the control, false to disable it- Returns:
- this TextProperties instance for method chaining
-
enabled
Sets a dynamic enablement condition supplier for the text control.- Parameters:
enabled- a BooleanSupplier that provides the enablement condition- Returns:
- this TextProperties instance for method chaining
-
sectionEnabled
Sets the section-level enablement flag for the text control.- Parameters:
sectionEnabled- true if the containing section is enabled, false otherwise- Returns:
- this TextProperties instance for method chaining
-
copy
Copies properties from another TextProperties instance.- Parameters:
textProperties- the source properties to copy from
-