com.threerings.opengl.gui
Class Root

java.lang.Object
  extended by com.threerings.opengl.util.SimpleRenderable
      extended by com.threerings.opengl.util.SimpleOverlay
          extended by com.threerings.opengl.gui.Root
All Implemented Interfaces:
Compositable, Enqueueable, Tickable
Direct Known Subclasses:
CanvasRoot, DisplayRoot

public abstract class Root
extends SimpleOverlay
implements Tickable

Connects the BUI system into the JME scene graph.


Field Summary
static String DEFAULT_CURSOR
          The name of the default cursor config.
 
Constructor Summary
Root(GlContext ctx)
           
 
Method Summary
 void addGlobalEventListener(EventListener listener)
          Registers a listener that will be notified of all events prior to their being dispatched normally.
 void addTickParticipant(Tickable participant)
          Adds a tick participant to the list.
 void addWindow(Window window)
          Registers a top-level window with the input system.
 void addWindow(Window window, boolean topLayer)
          Registers a top-level window with the input system.
 void clearDrag()
          Clears out any drag operation in progress.
 void dispose()
          Releases the resources held by this root.
 Clipboard getClipboard()
          Returns a reference to the clipboard.
 String getClipboardText()
          Returns the text in the clipboard, or null for none.
abstract  int getDisplayHeight()
          Returns the height of the display area.
abstract  int getDisplayWidth()
          Returns the width of the display area.
 Component getFocus()
          Returns the component that currently has the focus, or null.
 int getModifiers()
          Returns the current set of event modifiers.
 int getMouseX()
          Returns the x coordinate of the mouse cursor.
 int getMouseY()
          Returns the y coordinate of the mouse cursor.
 com.threerings.openal.Sound getSound(String path)
          Retrieves an instance of the sound at the specified path from the sound group.
 com.threerings.openal.SoundGroup getSoundGroup()
          Returns the sound group to use for feedback effects.
 long getTickStamp()
          Returns the current timestamp used to stamp event times.
 float getTooltipTimeout()
          Returns the tool tip timeout.
 Window getTopWindow()
          Returns a reference to the topmost window, or null if there are no windows.
 Window getWindow(int index)
          Returns the window at the specified index.
 int getWindowCount()
          Returns the total number of windows added to this node.
 boolean isDragging()
          Checks whether a drag operation is in progress.
 boolean isOnTop(Window window)
          Returns true if the specified window is on top.
 void moveToTop(Window window)
          Ensures that the specified window is on top.
 void playSound(String path)
          Plays a sound by path.
 void popDefaultEventTarget(Component component)
          Pops the default event target off the stack.
 void pushDefaultEventTarget(Component component)
          Configures a component to receive all events that are not sent to some other component.
 void removeAllWindows()
          Removes all windows from the root node.
 void removeGlobalEventListener(EventListener listener)
          Removes a global event listener registration.
 void removeTickParticipant(Tickable participant)
          Removes a tick participant from the list.
 void removeWindow(Window window)
          Removes a window from participation in the input system.
 void requestFocus(Component component)
          Requests that the specified component be given the input focus.
 void resortWindows()
          Called when an added window's layer is changed.
 void rootInvalidated(Component root)
          This is called by a window or a scroll pane when it has become invalid.
 void setClipboardText(String text)
          Sets the text in the clipboard.
 void setCursor(Cursor cursor)
          Sets the cursor to display (or null to use the default cursor).
 void setModalShade(Color4f color)
          Sets the color of the shade behind the first active modal window.
 void setMouseDown(int button)
          Sets the mouse as being pressed at the current position.
 void setMousePosition(int x, int y)
          Sets the mouse position.
 void setMouseUp(int button)
          Sets the mouse as being released at the current position.
 void setTooltipPreferredWidth(int width)
          Sets the preferred width of tooltip windows.
 void setTooltipTimeout(float seconds)
          Configures the number of seconds that the mouse must rest over a component to trigger a tooltip.
 void startDrag(TransferHandler handler, Component source, int action)
          Initiates a drag operation.
 void tick(float elapsed)
          Updates the state of this object based on the elapsed time in seconds.
 void tipTextChanged(Component component)
          A large component that changes its tooltip while it is the hover component in the normal course of events can call this method to force an update to the tooltip window.
 String toString()
          Generates a string representation of this instance.
 
Methods inherited from class com.threerings.opengl.util.SimpleOverlay
composite
 
Methods inherited from class com.threerings.opengl.util.SimpleRenderable
enqueue, getStates
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CURSOR

public static final String DEFAULT_CURSOR
The name of the default cursor config.

See Also:
Constant Field Values
Constructor Detail

Root

public Root(GlContext ctx)
Method Detail

dispose

public void dispose()
Releases the resources held by this root.


getSoundGroup

public com.threerings.openal.SoundGroup getSoundGroup()
Returns the sound group to use for feedback effects.


playSound

public void playSound(String path)
Plays a sound by path.


getSound

public com.threerings.openal.Sound getSound(String path)
Retrieves an instance of the sound at the specified path from the sound group.


getTickStamp

public long getTickStamp()
Returns the current timestamp used to stamp event times.


getModifiers

public int getModifiers()
Returns the current set of event modifiers.


getClipboard

public Clipboard getClipboard()
Returns a reference to the clipboard.


getClipboardText

public String getClipboardText()
Returns the text in the clipboard, or null for none.


setClipboardText

public void setClipboardText(String text)
Sets the text in the clipboard.


addWindow

public void addWindow(Window window)
Registers a top-level window with the input system.


addWindow

public void addWindow(Window window,
                      boolean topLayer)
Registers a top-level window with the input system.

Parameters:
topLayer - if true, will set the window layer to the top most layer if it's current layer is less than that.

isOnTop

public boolean isOnTop(Window window)
Returns true if the specified window is on top.


moveToTop

public void moveToTop(Window window)
Ensures that the specified window is on top.


getTopWindow

public Window getTopWindow()
Returns a reference to the topmost window, or null if there are no windows.


resortWindows

public void resortWindows()
Called when an added window's layer is changed. Adjusts the ordering of the windows in the stack.


removeAllWindows

public void removeAllWindows()
Removes all windows from the root node.


removeWindow

public void removeWindow(Window window)
Removes a window from participation in the input system.


addTickParticipant

public void addTickParticipant(Tickable participant)
Adds a tick participant to the list.


removeTickParticipant

public void removeTickParticipant(Tickable participant)
Removes a tick participant from the list.


setTooltipTimeout

public void setTooltipTimeout(float seconds)
Configures the number of seconds that the mouse must rest over a component to trigger a tooltip. If the value is set to zero, tips will appear immediately.


getTooltipTimeout

public float getTooltipTimeout()
Returns the tool tip timeout. See setTooltipTimeout(float) for details.


setTooltipPreferredWidth

public void setTooltipPreferredWidth(int width)
Sets the preferred width of tooltip windows. The default is to prefer a width slightly less wide that the entire window.


addGlobalEventListener

public void addGlobalEventListener(EventListener listener)
Registers a listener that will be notified of all events prior to their being dispatched normally.


removeGlobalEventListener

public void removeGlobalEventListener(EventListener listener)
Removes a global event listener registration.


rootInvalidated

public void rootInvalidated(Component root)
This is called by a window or a scroll pane when it has become invalid. The root node should schedule a revalidation of this component on the next tick or the next time an event is processed.


pushDefaultEventTarget

public void pushDefaultEventTarget(Component component)
Configures a component to receive all events that are not sent to some other component. When an event is not consumed during normal processing, it is sent to the default event targets, most recently registered to least recently registered.


popDefaultEventTarget

public void popDefaultEventTarget(Component component)
Pops the default event target off the stack.


requestFocus

public void requestFocus(Component component)
Requests that the specified component be given the input focus. Pass null to clear the focus.


getFocus

public Component getFocus()
Returns the component that currently has the focus, or null.


getWindowCount

public int getWindowCount()
Returns the total number of windows added to this node.


getWindow

public Window getWindow(int index)
Returns the window at the specified index.


getDisplayWidth

public abstract int getDisplayWidth()
Returns the width of the display area.


getDisplayHeight

public abstract int getDisplayHeight()
Returns the height of the display area.


setCursor

public void setCursor(Cursor cursor)
Sets the cursor to display (or null to use the default cursor).


setMousePosition

public void setMousePosition(int x,
                             int y)
Sets the mouse position.


setMouseDown

@Beta
public void setMouseDown(int button)
Sets the mouse as being pressed at the current position.


setMouseUp

@Beta
public void setMouseUp(int button)
Sets the mouse as being released at the current position.


getMouseX

public int getMouseX()
Returns the x coordinate of the mouse cursor.


getMouseY

public int getMouseY()
Returns the y coordinate of the mouse cursor.


toString

public String toString()
Generates a string representation of this instance.

Overrides:
toString in class Object

tipTextChanged

public void tipTextChanged(Component component)
A large component that changes its tooltip while it is the hover component in the normal course of events can call this method to force an update to the tooltip window.


setModalShade

public void setModalShade(Color4f color)
Sets the color of the shade behind the first active modal window.


startDrag

public void startDrag(TransferHandler handler,
                      Component source,
                      int action)
Initiates a drag operation.


clearDrag

public void clearDrag()
Clears out any drag operation in progress.


isDragging

public boolean isDragging()
Checks whether a drag operation is in progress.


tick

public void tick(float elapsed)
Description copied from interface: Tickable
Updates the state of this object based on the elapsed time in seconds.

Specified by:
tick in interface Tickable


Copyright © 2011. All Rights Reserved.