com.realtime.crossfire.jxclient.gui.gui
Class TooltipManager

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.gui.TooltipManager

public class TooltipManager
extends java.lang.Object

Manages the tooltip display. An AbstractLabel is moved/resized to display a tooltip text for an "active" GUI element.


Field Summary
private  GUIElement activeGuiElement
          The last known active gui element.
private  java.lang.Object activeGuiElementSync
          Synchronizes accesses to activeGuiElement.
private  AbstractLabel tooltip
          The tooltip label.
private static int TOOLTIP_DISTANCE
          Distance of tooltip from its associated GUI element.
private  int windowHeight
          The current window height.
private  int windowWidth
          The current window width.
 
Constructor Summary
TooltipManager()
           
 
Method Summary
private  void addTooltip()
          Adds or updates the tooltip (text and location) for the activeGuiElement.
private  void removeTooltip()
          Removes the tooltip label.
 void reset()
          Removes the tooltip.
 void setElement(GUIElement guiElement)
          Displays the tooltip for a GUI element.
 void setScreenSize(int windowWidth, int windowHeight)
          Updates the current window size.
 void setTooltip(AbstractLabel tooltip)
          Sets the tooltip label.
 void unsetElement(GUIElement guiElement)
          Removes the tooltip of a GUI element.
 void updateElement(GUIElement guiElement)
          Updates the tooltip text of a GUI element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeGuiElement

@Nullable
private GUIElement activeGuiElement
The last known active gui element. It is used to suppress unnecessary change events to the tooltip label.


activeGuiElementSync

@NotNull
private final java.lang.Object activeGuiElementSync
Synchronizes accesses to activeGuiElement.


tooltip

@Nullable
private AbstractLabel tooltip
The tooltip label. Set to null if the skin does not use tooltips.


TOOLTIP_DISTANCE

private static final int TOOLTIP_DISTANCE
Distance of tooltip from its associated GUI element.

See Also:
Constant Field Values

windowHeight

private int windowHeight
The current window height.


windowWidth

private int windowWidth
The current window width.

Constructor Detail

TooltipManager

public TooltipManager()
Method Detail

addTooltip

private void addTooltip()
Adds or updates the tooltip (text and location) for the activeGuiElement.


removeTooltip

private void removeTooltip()
Removes the tooltip label. Does nothing if no tooltip is active.


reset

public void reset()
Removes the tooltip. Does nothing if no tooltip is active.


setElement

public void setElement(@NotNull
                       GUIElement guiElement)
Displays the tooltip for a GUI element.

Parameters:
guiElement - the GUI element to show the tooltip of

setScreenSize

public void setScreenSize(int windowWidth,
                          int windowHeight)
Updates the current window size.

Parameters:
windowWidth - the window width
windowHeight - the window height

setTooltip

public void setTooltip(@Nullable
                       AbstractLabel tooltip)
Sets the tooltip label.

Parameters:
tooltip - the tooltip label, or null

unsetElement

public void unsetElement(@NotNull
                         GUIElement guiElement)
Removes the tooltip of a GUI element. Does nothing if the given GUI element is not active.

Parameters:
guiElement - the gui element to remove the tooltip of

updateElement

public void updateElement(@NotNull
                          GUIElement guiElement)
Updates the tooltip text of a GUI element. Does nothing if the given GUI element is not active.

Parameters:
guiElement - the gui element to process