|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.gui.Component
com.threerings.opengl.gui.Container
com.threerings.opengl.gui.UserInterface
public class UserInterface
A user interface component configured from a resource.
| Nested Class Summary | |
|---|---|
static interface |
UserInterface.Controller
An interface that can be implemented by a controller class, specified by name in the UserInterfaceConfig, to automatically wire-up functionality to a UI. |
| Nested classes/interfaces inherited from class com.threerings.opengl.gui.Container |
|---|
Container.ChildOp |
| Field Summary | |
|---|---|
protected UserInterfaceConfig |
_config
The configuration of this interface. |
protected UserInterface.Controller |
_controller
Our controller, if any. |
protected Root |
_root
The root to which we were added. |
protected DynamicScope |
_scope
The user interface scope. |
protected com.google.common.collect.ListMultimap<String,Component> |
_tagged
The sets of components registered under each tag. |
| Fields inherited from class com.threerings.opengl.gui.Container |
|---|
_children, _layout |
| Fields inherited from class com.threerings.opengl.gui.Component |
|---|
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES |
| 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. |
|
|
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. |
|
|
getComponents(String tag,
Class<C> clazz)
Returns the Components registered with the specified tag. |
|
UserInterfaceConfig |
getConfig()
Returns a reference to the configuration. |
|
protected UserInterfaceConfig.Original |
getOriginal()
Convenience to get a non-null Original implementation. |
|
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. |
|
protected void |
registerComponent(String tag,
Component comp)
Registers a component with the specified tag. |
|
protected void |
registerComponents(Map<String,Collection<Component>> tagged)
Registers a group of components mapped by tag. |
|
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. |
|
protected void |
updateFromConfig()
Updates the interface to match its new or modified configuration. |
|
protected void |
wasAdded()
This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up). |
|
protected void |
wasRemoved()
This method is called when we are removed from a hierarchy that is connected to a top-level window. |
|
| Methods inherited from class com.threerings.opengl.gui.Container |
|---|
add, add, add, add, applyOperation, computePreferredSize, getComponent, getComponentCount, getComponentIndex, getDefaultStyleConfig, getFirstDescendantFocus, getHitComponent, getLastDescendantFocus, getLayoutManager, getNextFocus, getPreviousFocus, layout, remove, remove, removeAll, renderComponent, replace, setAlpha, setEnabled, setHoverable, setLayoutManager, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DynamicScope _scope
protected UserInterfaceConfig _config
protected UserInterface.Controller _controller
protected com.google.common.collect.ListMultimap<String,Component> _tagged
protected Root _root
| Constructor Detail |
|---|
public UserInterface(GlContext ctx)
public UserInterface(GlContext ctx,
String name)
public UserInterface(GlContext ctx,
String name,
String firstKey,
Object firstValue,
Object... otherArgs)
public UserInterface(GlContext ctx,
ConfigReference<UserInterfaceConfig> ref)
public UserInterface(GlContext ctx,
UserInterfaceConfig config)
| Method Detail |
|---|
public DynamicScope getScope()
public void setConfig(String name)
public void setConfig(ConfigReference<UserInterfaceConfig> ref)
public void setConfig(String name,
String firstKey,
Object firstValue,
Object... otherArgs)
public void setConfig(UserInterfaceConfig config)
public UserInterfaceConfig getConfig()
public void setEnabled(String tag,
boolean enabled)
public void setVisible(String tag,
boolean visible)
public void setText(String tag,
String text)
TextComponents bearing the specified
tag.
public String getText(String tag)
TextComponent.
public boolean isSelected(String tag)
ToggleButton.
public void addListener(String tag,
ComponentListener listener)
public void removeListener(String tag,
ComponentListener listener)
public void removeAllListeners(String tag)
public Component getComponent(String tag)
null if there are no such components.
public <C extends Component> C getComponent(String tag,
Class<C> clazz)
null if there are
no such components.
public <C extends Component> Iterable<C> getComponents(String tag,
Class<C> clazz)
public Iterable<Component> getComponents(String tag)
public Map<String,Collection<Component>> getTagged()
public boolean replace(String tag,
Component newc)
public void configUpdated(ConfigEvent<ManagedConfig> event)
ConfigUpdateListener
configUpdated in interface ConfigUpdateListener<ManagedConfig>configUpdated in class Componentprotected void wasAdded()
Component
wasAdded in class Containerprotected void wasRemoved()
ComponentComponent.wasAdded(), this is a fine place
to do so.
wasRemoved in class Containerprotected void updateFromConfig()
protected UserInterfaceConfig.Original getOriginal()
@Scoped protected void registerComponents(Map<String,Collection<Component>> tagged)
@Scoped
protected void registerComponent(String tag,
Component comp)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||