Class LabelProperties
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.LabelProperties
A builder class for configuring properties of SWT Label controls.
Provides fluent interface methods to set various label properties including
text, dimensions, colors, fonts, images.
- Author:
- Ionov Ivan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration defining the types of label controls that can be created. -
Method Summary
Modifier and TypeMethodDescriptionbackground(org.eclipse.swt.graphics.Color background) Sets the background color for the label.voidcopyFrom(LabelProperties labelProperties) Copies properties from another LabelProperties instance.enable(boolean enable) static LabelPropertiesfillLine()Creates a full-width label configuration.font(org.eclipse.swt.graphics.Font font) Sets the font for the label.foreground(org.eclipse.swt.graphics.Color foreground) Sets the foreground color for the label.org.eclipse.swt.graphics.ColorReturns the background color for the label.org.eclipse.swt.graphics.FontgetFont()Returns the font for the label.org.eclipse.swt.graphics.ColorReturns the foreground color for the label.intReturns the height setting for the label.org.eclipse.swt.graphics.ImagegetImage()Returns the image for image-type labels.intgetStyle()Returns the SWT style bits for the label.getText()Returns the text supplier for the label.Returns the tooltip text for the label.getType()Returns the label type.intgetWidth()Returns the width setting for the label.height(int height) Sets the height of the label.static LabelPropertiesimage(org.eclipse.swt.graphics.Image image) Creates an image label configuration with the specified image.static LabelPropertiesCreates an image label with container configuration.booleanisEnable()booleanReturns whether width calculation should be skipped for this label.static LabelPropertieslabel()Creates a standard label configuration.static LabelPropertiesCreates a separator line configuration.skipCalculatingWidth(boolean skipCalculatingWidth) Sets whether width calculation should be skipped for this label.style(int style) Sets the SWT style bits for the label.Sets static text for the label.Sets a dynamic text supplier for the label.voidtooltip(ToolTipProperties toolTipProperties) Sets the tooltip text for the label.width(int width) Sets the width of the label.
-
Method Details
-
getWidth
public int getWidth()Returns the width setting for the label.- Returns:
- the width in pixels, or -1 for default width
-
width
Sets the width of the label.- Parameters:
width- the width in pixels, or -1 for default width- Returns:
- this LabelProperties instance for method chaining
-
getStyle
public int getStyle()Returns the SWT style bits for the label.- Returns:
- the SWT style bits
-
style
Sets the SWT style bits for the label.- Parameters:
style- the SWT style bits to apply- Returns:
- this LabelProperties instance for method chaining
-
getFont
public org.eclipse.swt.graphics.Font getFont()Returns the font for the label.- Returns:
- the font, or null if using default font
-
font
Sets the font for the label.- Parameters:
font- the font to use, or null for default font- Returns:
- this LabelProperties instance for method chaining
-
getType
Returns the label type.- Returns:
- the LabelType enum value
-
label
Creates a standard label configuration.- Returns:
- a new LabelProperties instance configured as a standard label
-
separator
Creates a separator line configuration.- Returns:
- a new LabelProperties instance configured as a separator
-
fillLine
Creates a full-width label configuration.- Returns:
- a new LabelProperties instance configured as a full-width label
-
getImage
public org.eclipse.swt.graphics.Image getImage()Returns the image for image-type labels.- Returns:
- the image, or null if no image is set
-
image
Creates an image label configuration with the specified image.- Parameters:
image- the image to display- Returns:
- a new LabelProperties instance configured as an image label
-
imageWithContainer
Creates an image label with container configuration.- Returns:
- a new LabelProperties instance configured as an image with container
-
copyFrom
Copies properties from another LabelProperties instance.- Parameters:
labelProperties- the source properties to copy from
-
getText
Returns the text supplier for the label.- Returns:
- a Supplier that provides the label text
-
text
Sets a dynamic text supplier for the label.- Parameters:
text- a Supplier that provides the label text- Returns:
- this LabelProperties instance for method chaining
-
text
Sets static text for the label.- Parameters:
text- the static text to display- Returns:
- this LabelProperties instance for method chaining
-
getHeight
public int getHeight()Returns the height setting for the label.- Returns:
- the height in pixels
-
height
Sets the height of the label.- Parameters:
height- the height in pixels- Returns:
- this LabelProperties instance for method chaining
-
getBackground
public org.eclipse.swt.graphics.Color getBackground()Returns the background color for the label.- Returns:
- the background color
-
background
Sets the background color for the label.- Parameters:
background- the background color to use- Returns:
- this LabelProperties instance for method chaining
-
getForeground
public org.eclipse.swt.graphics.Color getForeground()Returns the foreground color for the label.- Returns:
- the foreground color
-
foreground
Sets the foreground color for the label.- Parameters:
foreground- the foreground color to use- Returns:
- this LabelProperties instance for method chaining
-
getTooltip
Returns the tooltip text for the label.- Returns:
- the tooltip text, or null if no tooltip is set
-
tooltip
Sets the tooltip text for the label.- Parameters:
tooltip- the tooltip text to display- Returns:
- this LabelProperties instance for method chaining
-
tooltip
-
isSkipCalculatingWidth
public boolean isSkipCalculatingWidth()Returns whether width calculation should be skipped for this label.- Returns:
- true if width calculation should be skipped, false otherwise
-
skipCalculatingWidth
Sets whether width calculation should be skipped for this label.- Parameters:
skipCalculatingWidth- true to skip width calculation, false to enable it- Returns:
- this LabelProperties instance for method chaining
-
isEnable
public boolean isEnable() -
enable
-
tooltip
-
getToolTipProperties
-