Class DefaultToolTipManager
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.components.DefaultToolTipManager
-
- All Implemented Interfaces:
ToolTipManager
public class DefaultToolTipManager extends Object implements ToolTipManager
A default implementation of the
ToolTipManager
interface.This class provides fully functional implementations for all methods defined by the
ToolTipManager
interface. An instance is initialized with a reference to aComponentBuilderData
object. From this object theWidgetHandler
objects associated with the components to manipulate are obtained. The instance also maintains data about the tool tips (both the static and the dynamic ones) of all components managed by the associatedComponentBuilderData
object.Implementation note: This class is not thread-safe. It must only be accessed from the event dispatch thread. It can only be associated with a single
ComponentBuilderData
object.- Version:
- $Id: DefaultToolTipManager.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description DefaultToolTipManager(ComponentBuilderData compData)
Creates a new instance ofDefaultToolTipManager
and initializes it with the givenComponentBuilderData
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
combineTips(String stdTip, String addTip)
Creates a combined tool tip from the standard tool tip and the additional tool tip.String
getAdditionalTipSeparator()
Returns the separator between the standard and the additional tool tip.String
getAdditionalToolTip(Object component)
Queries the additional tool tip for the specified component.String
getAdditionalToolTip(String componentName)
Returns the additional tool tip for the component with the given name.ComponentBuilderData
getComponentBuilderData()
Returns the associatedComponentBuilderData
.String
getToolTip(Object component)
Queries the standard tool tip for the specified component.String
getToolTip(String componentName)
Returns the standard tool tip for the component with the given name.void
setAdditionalTipSeparator(String additionalTipSeparator)
Sets the separator between the standard and the additional tool tip.void
setAdditionalToolTip(Object component, String tip)
Sets the additional tool tip for the specified component.void
setAdditionalToolTip(String componentName, String tip)
Sets the additional tool tip for the component with the given name.void
setToolTip(Object component, String tip)
Sets the tool tip for the specified component.void
setToolTip(String componentName, String tip)
Sets the standard tool tip for the component with the given name.
-
-
-
Constructor Detail
-
DefaultToolTipManager
public DefaultToolTipManager(ComponentBuilderData compData)
Creates a new instance ofDefaultToolTipManager
and initializes it with the givenComponentBuilderData
object.- Parameters:
compData
- theComponentBuilderData
object (must not be null)- Throws:
IllegalArgumentException
- if theComponentBuilderData
object is null
-
-
Method Detail
-
getAdditionalTipSeparator
public String getAdditionalTipSeparator()
Returns the separator between the standard and the additional tool tip.- Returns:
- the tool tip separator
-
setAdditionalTipSeparator
public void setAdditionalTipSeparator(String additionalTipSeparator)
Sets the separator between the standard and the additional tool tip. If a component has both a standard and an additional tool tip, the final tool tip that is to be passed to the component is constructed by appending the additional tool tip to the standard tool tip using this string as separator. If no separator is set, a new line character is used as default.- Parameters:
additionalTipSeparator
- the tool tip separator
-
getComponentBuilderData
public final ComponentBuilderData getComponentBuilderData()
Returns the associatedComponentBuilderData
.- Returns:
- the
ComponentBuilderData
-
getAdditionalToolTip
public String getAdditionalToolTip(Object component)
Queries the additional tool tip for the specified component.- Specified by:
getAdditionalToolTip
in interfaceToolTipManager
- Parameters:
component
- the component in question- Returns:
- the additional tool tip for this component
-
getAdditionalToolTip
public String getAdditionalToolTip(String componentName)
Returns the additional tool tip for the component with the given name.- Specified by:
getAdditionalToolTip
in interfaceToolTipManager
- Parameters:
componentName
- the name of the component- Returns:
- the additional tool tip for this component
- Throws:
GUIRuntimeException
- if the name cannot be resolved
-
getToolTip
public String getToolTip(Object component)
Queries the standard tool tip for the specified component.- Specified by:
getToolTip
in interfaceToolTipManager
- Parameters:
component
- the component in question- Returns:
- the standard tool tip of this component
-
getToolTip
public String getToolTip(String componentName)
Returns the standard tool tip for the component with the given name.- Specified by:
getToolTip
in interfaceToolTipManager
- Parameters:
componentName
- the name of the component- Returns:
- the standard tool tip for this component
- Throws:
GUIRuntimeException
- if the name cannot be resolved
-
setAdditionalToolTip
public void setAdditionalToolTip(Object component, String tip)
Sets the additional tool tip for the specified component.- Specified by:
setAdditionalToolTip
in interfaceToolTipManager
- Parameters:
component
- the componenttip
- the new additional tool tip
-
setAdditionalToolTip
public void setAdditionalToolTip(String componentName, String tip)
Sets the additional tool tip for the component with the given name.- Specified by:
setAdditionalToolTip
in interfaceToolTipManager
- Parameters:
componentName
- the name of the componenttip
- the new additional tool tip- Throws:
GUIRuntimeException
- if the component name cannot be resolved
-
setToolTip
public void setToolTip(Object component, String tip)
Sets the tool tip for the specified component.- Specified by:
setToolTip
in interfaceToolTipManager
- Parameters:
component
- the componenttip
- the new tool tip
-
setToolTip
public void setToolTip(String componentName, String tip)
Sets the standard tool tip for the component with the given name.- Specified by:
setToolTip
in interfaceToolTipManager
- Parameters:
componentName
- the name of the componenttip
- the new standard tool tip- Throws:
GUIRuntimeException
- if the component name cannot be resolved
-
combineTips
protected String combineTips(String stdTip, String addTip)
Creates a combined tool tip from the standard tool tip and the additional tool tip. This method is called whenever the tool tip of a widget needs to be changed and both components are specified. The default implementation appends the additional tip to the standard one using the separator defined by thesetAdditionalTipSeparator(String)
method.- Parameters:
stdTip
- the standard tool tipaddTip
- the additional tool tip- Returns:
- the combined tool tip
-
-