com.threerings.opengl.gui
Class Container

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>
Direct Known Subclasses:
ChatOverlay, List, ScrollBar, ScrollButton, ScrollingList, ScrollPane, Spinner, TabbedPane, TextArea, UserInterface, Window

public class Container
extends Component

A user interface element that is meant to contain other interface elements.


Field Summary
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Constructor Summary
Container(GlContext ctx)
          Creates a container with no layout manager.
Container(GlContext ctx, LayoutManager layout)
          Creates a container with the supplied layout manager.
 
Method Summary
 void add(Component child)
          Adds a child to this container.
 void add(Component child, Object constraints)
          Adds a child to this container with the specified layout constraints.
 void add(int index, Component child)
          Adds a child to this container at the specified position.
 void add(int index, Component child, Object constraints)
          Adds a child to this container at the specified position, with the specified layout constraints.
 Component getComponent(int index)
          Returns the indexth component from this container.
 int getComponentCount()
          Returns the number of components contained in this container.
 int getComponentIndex(Component component)
          Returns the index of the specified component in this container or -1 if the component count not be found.
 Component getHitComponent(int mx, int my)
          Returns the component "hit" by the specified mouse coordinates which might be this component or any of its children.
 LayoutManager getLayoutManager()
          Returns the layout manager configured for this container.
 void remove(Component child)
          Removes the specified child from this container.
 void remove(int index)
          Removes the child at a specific position from this container.
 void removeAll()
          Removes all children of this container.
 boolean replace(Component oldc, Component newc)
          Replaces a given old component with a new component (if the old component exits).
 void setAlpha(float alpha)
          Sets the alpha level for this component.
 void setEnabled(boolean enabled)
          Sets this components enabled state.
 void setHoverable(boolean hoverable)
          Sets this component's hoverability state.
 void setLayoutManager(LayoutManager layout)
          Configures this container with an entity that will set the size and position of its children.
 void validate()
          Instructs this component to lay itself out and then mark itself as valid.
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, configUpdated, 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

Container

public Container(GlContext ctx)
Creates a container with no layout manager. One should subsequently be set via a call to setLayoutManager(com.threerings.opengl.gui.layout.LayoutManager).


Container

public Container(GlContext ctx,
                 LayoutManager layout)
Creates a container with the supplied layout manager.

Method Detail

setLayoutManager

public void setLayoutManager(LayoutManager layout)
Configures this container with an entity that will set the size and position of its children.


getLayoutManager

public LayoutManager getLayoutManager()
Returns the layout manager configured for this container.


add

public void add(Component child)
Adds a child to this container.


add

public void add(int index,
                Component child)
Adds a child to this container at the specified position.


add

public void add(Component child,
                Object constraints)
Adds a child to this container with the specified layout constraints.


add

public void add(int index,
                Component child,
                Object constraints)
Adds a child to this container at the specified position, with the specified layout constraints.


remove

public void remove(int index)
Removes the child at a specific position from this container.


replace

public boolean replace(Component oldc,
                       Component newc)
Replaces a given old component with a new component (if the old component exits).

Returns:
true if the old component was replaced, false otherwise.

remove

public void remove(Component child)
Removes the specified child from this container.


getComponentCount

public int getComponentCount()
Returns the number of components contained in this container.


getComponent

public Component getComponent(int index)
Returns the indexth component from this container.


getComponentIndex

public int getComponentIndex(Component component)
Returns the index of the specified component in this container or -1 if the component count not be found.


removeAll

public void removeAll()
Removes all children of this container.


setAlpha

public void setAlpha(float alpha)
Description copied from class: Component
Sets the alpha level for this component.

Overrides:
setAlpha in class Component

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: Component
Sets this components enabled state. A component that is not enabled should not respond to user interaction and should render itself in such a way as not to afford user interaction.

Overrides:
setEnabled in class Component

setHoverable

public void setHoverable(boolean hoverable)
Description copied from class: Component
Sets this component's hoverability state.

Overrides:
setHoverable in class Component

getHitComponent

public Component getHitComponent(int mx,
                                 int my)
Description copied from class: Component
Returns the component "hit" by the specified mouse coordinates which might be this component or any of its children. This method should return null if the supplied mouse coordinates are outside the bounds of this component.

Overrides:
getHitComponent in class Component

validate

public void validate()
Description copied from class: Component
Instructs this component to lay itself out and then mark itself as valid.

Overrides:
validate in class Component


Copyright © 2011. All Rights Reserved.