Class ToolTipProperties
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.ToolTipProperties
A builder-style class for configuring tooltip properties including dimensions
and content elements. This class follows the fluent interface pattern to allow
method chaining for convenient configuration.
Example usage:
ToolTipProperties properties = ToolTipProperties.newInstance()
.height(300)
.width(600)
.elements(
HTML.header("Main header", 1),
HTML.header("Second header", 2),
HTML.textBlock("Text block"),
HTML.textBlock( HTML.linkOpenInBrowser("Text link", link)),
HTML.image(Image, "Name image")
);
- Author:
- Ionov Ivan
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackgroundColor(Color backgroundColor) Sets the background color of the tooltip.elements(HTMLConvertable... elements) Adds one or more HTMLConvertable elements to the tooltip content and returns this instance for method chaining.font(org.eclipse.swt.graphics.Font font) Sets the font for the tooltip text.fontWeight(String fontWeight) Sets the font weight for the tooltip text.foregroundColor(Color foregroundColor) Sets the foreground (text) color of the tooltip.Returns the background color of the tooltip.Returns an unmodifiable list of all HTMLConvertable elements currently configured for this tooltip.org.eclipse.swt.graphics.FontgetFont()Returns the font used for the tooltip text.Returns the font weight of the tooltip text.Returns the foreground (text) color of the tooltip.intReturns the current height of the tooltip in pixels.doubleintgetWidth()Returns the current width of the tooltip in pixels.height(int height) Sets the height of the tooltip and returns this instance for method chaining.lineHeight(double lineHeight) static ToolTipPropertiesCreates and returns a new instance of ToolTipProperties with default values.width(int width) Sets the width of the tooltip and returns this instance for method chaining.
-
Constructor Details
-
ToolTipProperties
public ToolTipProperties()
-
-
Method Details
-
newInstance
Creates and returns a new instance of ToolTipProperties with default values. Default values are: height = 200, wight = 500, and an empty elements list.- Returns:
- a new ToolTipProperties instance with default configuration
-
getHeight
public int getHeight()Returns the current height of the tooltip in pixels.- Returns:
- the tooltip height in pixels
-
height
Sets the height of the tooltip and returns this instance for method chaining.- Parameters:
height- the desired tooltip height in pixels- Returns:
- this ToolTipProperties instance for method chaining
-
getWidth
public int getWidth()Returns the current width of the tooltip in pixels.- Returns:
- the tooltip width in pixels
-
width
Sets the width of the tooltip and returns this instance for method chaining.- Parameters:
width- the desired tooltip width in pixels- Returns:
- this ToolTipProperties instance for method chaining
-
elements
Adds one or more HTMLConvertable elements to the tooltip content and returns this instance for method chaining. The elements will be displayed in the order they are provided.- Parameters:
elements- the HTMLConvertable elements to add to the tooltip- Returns:
- this ToolTipProperties instance for method chaining
- See Also:
-
getElements
Returns an unmodifiable list of all HTMLConvertable elements currently configured for this tooltip.- Returns:
- a list of HTMLConvertable elements in the tooltip
- See Also:
-
getBackgroundColor
Returns the background color of the tooltip.- Returns:
- the current background color, or null if not set
-
backgroundColor
Sets the background color of the tooltip.- Parameters:
backgroundColor- the background color to set- Returns:
- this ToolTipProperties instance to allow for method chaining
-
getForegroundColor
Returns the foreground (text) color of the tooltip.- Returns:
- the current foreground color, or null if not set
-
foregroundColor
Sets the foreground (text) color of the tooltip.- Parameters:
foregroundColor- the foreground color to set- Returns:
- this ToolTipProperties instance to allow for method chaining
-
getFont
public org.eclipse.swt.graphics.Font getFont()Returns the font used for the tooltip text.- Returns:
- the current font, or null if not set
-
font
Sets the font for the tooltip text.- Parameters:
font- the font to use for the tooltip text- Returns:
- this ToolTipProperties instance to allow for method chaining
-
getFontWeight
Returns the font weight of the tooltip text.- Returns:
- the current font weight as a string (e.g., "normal", "bold"), or null if not set
-
fontWeight
Sets the font weight for the tooltip text.- Parameters:
fontWeight- the font weight to set (e.g., "normal", "bold", "lighter", "bolder")- Returns:
- this ToolTipProperties instance to allow for method chaining
-
getLineHeight
public double getLineHeight() -
lineHeight
-