com.threerings.opengl.gui
Class UserInterface

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.UserInterface
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>

public class UserInterface
extends Container

A user interface component configured from a resource.


Field Summary
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Constructor Summary
UserInterface(GlContext ctx)
          Creates a new user interface.
UserInterface(GlContext ctx, ConfigReference<UserInterfaceConfig> ref)
          Creates a new interface with the referenced configuration.
UserInterface(GlContext ctx, String name)
          Creates a new interface with the named configuration.
UserInterface(GlContext ctx, String name, String firstKey, Object firstValue, Object... otherArgs)
          Creates a new interface with the named configuration and arguments.
UserInterface(GlContext ctx, UserInterfaceConfig config)
          Creates a new interface with the given configuration.
 
Method Summary
 void addListener(String tag, ComponentListener listener)
          Shortcut method to add a listener to all components with the specified tag.
 void configUpdated(ConfigEvent<ManagedConfig> event)
          Called when a configuration has been updated.
 Component getComponent(String tag)
          Returns a reference to the first component registered with the specified tag, or null if there are no such components.
<C extends Component>
C
getComponent(String tag, Class<C> clazz)
          Returns a reference to the first component registered with the specified tag and implementing the specified class or interface, or null if there are no such components.
 Iterable<Component> getComponents(String tag)
          Returns the Components registered with the specified tag.
<C extends Component>
Iterable<C>
getComponents(String tag, Class<C> clazz)
          Returns the Components registered with the specified tag.
 UserInterfaceConfig getConfig()
          Returns a reference to the configuration.
 DynamicScope getScope()
          Returns a reference to the interface's scope.
 Map<String,Collection<Component>> getTagged()
          Returns a reference to the tagged component map.
 String getText(String tag)
          Shortcut method for retrieving the text of a tagged TextComponent.
 boolean isSelected(String tag)
          Shortcut method for retrieving the selected state of a tagged ToggleButton.
 void removeAllListeners(String tag)
          Shortcut method to remove all listeners from all components with the specified tag.
 void removeListener(String tag, ComponentListener listener)
          Shortcut method to remove a listener from all components with the specified tag.
 boolean replace(String tag, Component newc)
          Replaces the component at the tag with a new component.
 void setConfig(ConfigReference<UserInterfaceConfig> ref)
          Sets the configuration.
 void setConfig(String name)
          Sets the configuration.
 void setConfig(String name, String firstKey, Object firstValue, Object... otherArgs)
          Sets the configuration.
 void setConfig(UserInterfaceConfig config)
          Sets the configuration.
 void setEnabled(String tag, boolean enabled)
          Shortcut method for setting the enabled status of all components bearing the specified tag.
 void setText(String tag, String text)
          Shortcut method for setting the text of all TextComponents bearing the specified tag.
 void setVisible(String tag, boolean visible)
          Shortcut method for setting the visibility status of all components bearing the specified tag.
 
Methods inherited from class com.threerings.opengl.gui.Container
add, add, add, add, getComponent, getComponentCount, getComponentIndex, getHitComponent, getLayoutManager, remove, remove, removeAll, replace, setAlpha, setEnabled, setHoverable, setLayoutManager, validate
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, dispatchEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFocusTarget, getHeight, getInsets, getParent, getPreferredSize, getProperty, getState, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getX, getY, hasFocus, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, requestFocus, scrollRectToVisible, setBackground, setBounds, setCursor, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserInterface

public UserInterface(GlContext ctx)
Creates a new user interface.


UserInterface

public UserInterface(GlContext ctx,
                     String name)
Creates a new interface with the named configuration.


UserInterface

public UserInterface(GlContext ctx,
                     String name,
                     String firstKey,
                     Object firstValue,
                     Object... otherArgs)
Creates a new interface with the named configuration and arguments.


UserInterface

public UserInterface(GlContext ctx,
                     ConfigReference<UserInterfaceConfig> ref)
Creates a new interface with the referenced configuration.


UserInterface

public UserInterface(GlContext ctx,
                     UserInterfaceConfig config)
Creates a new interface with the given configuration.

Method Detail

getScope

public DynamicScope getScope()
Returns a reference to the interface's scope.


setConfig

public void setConfig(String name)
Sets the configuration.


setConfig

public void setConfig(ConfigReference<UserInterfaceConfig> ref)
Sets the configuration.


setConfig

public void setConfig(String name,
                      String firstKey,
                      Object firstValue,
                      Object... otherArgs)
Sets the configuration.


setConfig

public void setConfig(UserInterfaceConfig config)
Sets the configuration.


getConfig

public UserInterfaceConfig getConfig()
Returns a reference to the configuration.


setEnabled

public void setEnabled(String tag,
                       boolean enabled)
Shortcut method for setting the enabled status of all components bearing the specified tag.


setVisible

public void setVisible(String tag,
                       boolean visible)
Shortcut method for setting the visibility status of all components bearing the specified tag.


setText

public void setText(String tag,
                    String text)
Shortcut method for setting the text of all TextComponents bearing the specified tag.


getText

public String getText(String tag)
Shortcut method for retrieving the text of a tagged TextComponent.


isSelected

public boolean isSelected(String tag)
Shortcut method for retrieving the selected state of a tagged ToggleButton.


addListener

public void addListener(String tag,
                        ComponentListener listener)
Shortcut method to add a listener to all components with the specified tag.


removeListener

public void removeListener(String tag,
                           ComponentListener listener)
Shortcut method to remove a listener from all components with the specified tag.


removeAllListeners

public void removeAllListeners(String tag)
Shortcut method to remove all listeners from all components with the specified tag.


getComponent

public Component getComponent(String tag)
Returns a reference to the first component registered with the specified tag, or null if there are no such components.


getComponent

public <C extends Component> C getComponent(String tag,
                                            Class<C> clazz)
Returns a reference to the first component registered with the specified tag and implementing the specified class or interface, or null if there are no such components.


getComponents

public <C extends Component> Iterable<C> getComponents(String tag,
                                                       Class<C> clazz)
Returns the Components registered with the specified tag.


getComponents

public Iterable<Component> getComponents(String tag)
Returns the Components registered with the specified tag.


getTagged

public Map<String,Collection<Component>> getTagged()
Returns a reference to the tagged component map.


replace

public boolean replace(String tag,
                       Component newc)
Replaces the component at the tag with a new component.


configUpdated

public void configUpdated(ConfigEvent<ManagedConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<ManagedConfig>
Overrides:
configUpdated in class Component


Copyright © 2011. All Rights Reserved.