Class 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 a ComponentBuilderData object. From this object the WidgetHandler 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 associated ComponentBuilderData 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 Detail

      • DefaultToolTipManager

        public DefaultToolTipManager​(ComponentBuilderData compData)
        Creates a new instance of DefaultToolTipManager and initializes it with the given ComponentBuilderData object.
        Parameters:
        compData - the ComponentBuilderData object (must not be null)
        Throws:
        IllegalArgumentException - if the ComponentBuilderData 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 associated ComponentBuilderData.
        Returns:
        the ComponentBuilderData
      • getAdditionalToolTip

        public String getAdditionalToolTip​(Object component)
        Queries the additional tool tip for the specified component.
        Specified by:
        getAdditionalToolTip in interface ToolTipManager
        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 interface ToolTipManager
        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 interface ToolTipManager
        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 interface ToolTipManager
        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 interface ToolTipManager
        Parameters:
        component - the component
        tip - 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 interface ToolTipManager
        Parameters:
        componentName - the name of the component
        tip - 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 interface ToolTipManager
        Parameters:
        component - the component
        tip - 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 interface ToolTipManager
        Parameters:
        componentName - the name of the component
        tip - 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 the setAdditionalTipSeparator(String) method.
        Parameters:
        stdTip - the standard tool tip
        addTip - the additional tool tip
        Returns:
        the combined tool tip