Package com.ardor3d.extension.ui
Class UIContainer
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Node
com.ardor3d.extension.ui.UIComponent
com.ardor3d.extension.ui.UIContainer
- All Implemented Interfaces:
UIKeyHandler
,Hintable
,Savable
- Direct Known Subclasses:
UIFrame
,UIPanel
,UIPopupMenu
,UISlider
,UISliderKnob
,UITooltip
Defines a component that can hold and manage other components or containers, using a layout manager to position and
potentially resize them.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static TextureRenderer
A texture renderer to use for cache operations.static int
Fields inherited from class com.ardor3d.extension.ui.UIComponent
_tooltipPopTime, _tooltipText, DEFAULT_FOREGROUND_COLOR
Fields inherited from class com.ardor3d.scenegraph.Spatial
_controllers, _delegateMap, _dirtyMark, _frustumIntersects, _listener, _localTransform, _name, _parent, _queueDistance, _renderStateList, _sceneHints, _userData, _worldBound, _worldTransform, ON_DIRTY_ATTACHED, ON_DIRTY_BOUNDING, ON_DIRTY_RENDERSTATE, ON_DIRTY_TRANSFORM, ON_DIRTY_TRANSFORM_ONLY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(UIComponent component) Add a component to this container.void
Override to provide an action to take when this component or its top level component are attached to a UIHud.void
Release our standin and cached texture for gc.boolean
contains
(UIComponent component) Checks to see if a given UIComponent is in this container.boolean
contains
(UIComponent component, boolean recurse) Checks to see if a given UIComponent is in this container or (if instructed) its subcontainers.void
detachAllChildren
removes all children attached to this node.void
Override to provide an action to take just before this component or its top level component are removed from a UIHud.void
draw
calls the onDraw method for each child maintained by this node.protected void
drawComponent
(Renderer renderer) Draw this component's contents using the given renderer.void
Set ourselves dirty.void
Let subcomponents know that style has been changed.getUIComponent
(int hudX, int hudY) boolean
isDirty()
boolean
isDoClip()
static boolean
boolean
void
layout()
Override this to perform actual layout.void
remove
(UIComponent component) Remove a component from this container.void
Removes all UI components from this container.void
setDirty
(boolean dirty) void
setDoClip
(boolean doClip) void
void
Set the minification filter for the standin.void
setUseStandin
(boolean use) void
Ask this component to update its minimum allowed size, based on its contents.Methods inherited from class com.ardor3d.extension.ui.UIComponent
addFontStyle, applySkin, cancelTooltipTimer, centerOn, centerOn, clearFontStyle, clearMaximumContentSize, clearMinimumContentSize, compact, fitComponentIn, gainedFocus, getBackdrop, getBorder, getCombinedOpacity, getContentHeight, getContentWidth, getCurrentOpacity, getDefaultFontFamily, getDefaultFontSize, getDefaultFontStyles, getFontStyles, getForegroundColor, getHud, getHudX, getHudY, getKeyFocusTarget, getLayoutData, getLocalComponentHeight, getLocalComponentWidth, getLocalFontStyles, getLocalForegroundColor, getLocalOpacity, getLocalX, getLocalY, getMargin, getMaximumContentHeight, getMaximumContentWidth, getMaximumLocalComponentHeight, getMaximumLocalComponentWidth, getMinimumContentHeight, getMinimumContentWidth, getMinimumLocalComponentHeight, getMinimumLocalComponentWidth, getPadding, getRelativeComponentBounds, getRelativeMaxComponentBounds, getRelativeMinComponentBounds, getTooltipPopTime, getTooltipText, getTopLevelComponent, getTotalBottom, getTotalLeft, getTotalRight, getTotalTop, hasVirginContentArea, insideMargin, isAttachedToHUD, isConsumeKeyEvents, isConsumeMouseEvents, isEnabled, isUseTransparency, isVisible, keyHeld, keyPressed, keyReleased, lostFocus, mouseClicked, mouseDeparted, mouseEntered, mouseMoved, mousePressed, mouseReleased, mouseWheel, pack, postdrawComponent, predrawComponent, requestFocus, setBackdrop, setBorder, setConsumeKeyEvents, setConsumeMouseEvents, setContentHeight, setContentSize, setContentWidth, setDefaultFontFamily, setDefaultFontSize, setDefaultFontStyles, setEnabled, setFontStyles, setForegroundColor, setHudX, setHudXY, setHudY, setKeyFocusTarget, setLayoutData, setLayoutMinimumContentSize, setLocalComponentHeight, setLocalComponentSize, setLocalComponentWidth, setLocalX, setLocalXY, setLocalY, setMargin, setMaximumContentHeight, setMaximumContentSize, setMaximumContentWidth, setMinimumContentHeight, setMinimumContentSize, setMinimumContentWidth, setOpacity, setPadding, setTooltipPopTime, setTooltipText, setUseTransparency, setVirginContentArea, setVisible, updateWorldTransform, updateWorldTransform, validateContentSize
Methods inherited from class com.ardor3d.scenegraph.Node
acceptVisitor, attachChild, attachChildAt, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getClassTag, getNumberOfChildren, hasChild, makeCopy, makeInstanced, propagateDirtyDown, read, sortLights, swapChildren, updateChildren, updateWorldBound, updateWorldRenderStates, write
Methods inherited from class com.ardor3d.scenegraph.Spatial
addController, addTranslation, addTranslation, applyWorldRenderStates, clearControllers, clearDirty, clearDirty, clearRenderState, getController, getControllerCount, getControllers, getCurrentRenderDelegate, getLastFrustumIntersection, getListener, getLocalLastFrustumIntersection, getLocalRenderState, getLocalRenderStates, getName, getParent, getParentHintable, getRenderDelegate, getRotation, getScale, getSceneHints, getTransform, getTranslation, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, isDirty, localToWorld, markDirty, markDirty, onDraw, propagateBoundToRoot, propagateDirtyUp, propagateStatesFromRoot, propageEventUp, removeController, removeController, removeFromParent, setLastFrustumIntersection, setListener, setName, setParent, setRenderDelegate, setRenderState, setRotation, setRotation, setScale, setScale, setScale, setTransform, setTranslation, setTranslation, setUserData, setWorldRotation, setWorldRotation, setWorldScale, setWorldScale, setWorldScale, setWorldTransform, setWorldTranslation, setWorldTranslation, toString, updateControllers, updateGeometricState, updateGeometricState, updateWorldRenderStates, worldToLocal
-
Field Details
-
STANDIN_TEXTURE_SIZE
public static int STANDIN_TEXTURE_SIZE -
_textureRenderer
A texture renderer to use for cache operations.
-
-
Constructor Details
-
UIContainer
public UIContainer()
-
-
Method Details
-
contains
Checks to see if a given UIComponent is in this container.- Parameters:
component
- the component to look for- Returns:
- true if the given component is in this container.
-
contains
Checks to see if a given UIComponent is in this container or (if instructed) its subcontainers.- Parameters:
component
- the component to look forrecurse
- if true, recursively check any sub-containers for the given component.- Returns:
- if the given component is found
-
add
Add a component to this container.- Parameters:
component
- the component to add
-
remove
Remove a component from this container.- Parameters:
component
- the component to remove
-
removeAllComponents
public void removeAllComponents()Removes all UI components from this container. If other types of Spatials are attached to this container, they are ignored. -
detachAllChildren
public void detachAllChildren()Description copied from class:Node
detachAllChildren
removes all children attached to this node.- Overrides:
detachAllChildren
in classNode
-
setLayout
- Parameters:
layout
- the new layout to use with this container. If null, no layout is done by this container.
-
getLayout
- Returns:
- the layout currently used by this container or null if no layout is used.
-
layout
public void layout()Description copied from class:UIComponent
Override this to perform actual layout.- Overrides:
layout
in classUIComponent
-
updateMinimumSizeFromContents
public void updateMinimumSizeFromContents()Description copied from class:UIComponent
Ask this component to update its minimum allowed size, based on its contents.- Overrides:
updateMinimumSizeFromContents
in classUIComponent
-
attachedToHud
public void attachedToHud()Description copied from class:UIComponent
Override to provide an action to take when this component or its top level component are attached to a UIHud.- Overrides:
attachedToHud
in classUIComponent
-
detachedFromHud
public void detachedFromHud()Description copied from class:UIComponent
Override to provide an action to take just before this component or its top level component are removed from a UIHud.- Overrides:
detachedFromHud
in classUIComponent
-
getUIComponent
- Overrides:
getUIComponent
in classUIComponent
- Parameters:
hudX
- the x screen coordinatehudY
- the y screen coordinate- Returns:
- this component (or an appropriate child coordinate in the case of a container) if the given screen coordinates fall inside the margin area of this component.
-
drawComponent
Description copied from class:UIComponent
Draw this component's contents using the given renderer.- Overrides:
drawComponent
in classUIComponent
- Parameters:
renderer
- the renderer
-
draw
Description copied from class:Node
draw
calls the onDraw method for each child maintained by this node.- Overrides:
draw
in classUIComponent
- Parameters:
renderer
- the renderer to draw to.- See Also:
-
isDirty
public boolean isDirty()- Returns:
- true if this container has had recent content changes that would require a repaint.
-
setDirty
public void setDirty(boolean dirty) - Parameters:
dirty
- true if this container has had recent content changes that would require a repaint.
-
fireComponentDirty
public void fireComponentDirty()Set ourselves dirty.- Overrides:
fireComponentDirty
in classUIComponent
-
fireStyleChanged
public void fireStyleChanged()Description copied from class:UIComponent
Let subcomponents know that style has been changed.- Overrides:
fireStyleChanged
in classUIComponent
-
clearStandin
public void clearStandin()Release our standin and cached texture for gc. If needed again, they will be created from scratch. -
setDoClip
public void setDoClip(boolean doClip) - Parameters:
doClip
- true (default) if we want this container to clip the drawing of its contents to the dimensions of its content area.
-
isDoClip
public boolean isDoClip() -
setUseStandin
public void setUseStandin(boolean use) - Parameters:
use
- if true, we will draw the container's contents to a cached texture and use that to display this container (on a simple quad) instead of drawing all of its components each time. When the container is marked as dirty, we will update the contents of the texture.
-
isUseStandin
public boolean isUseStandin()- Returns:
- true if we should use a cached texture copy to draw this container.
- See Also:
-
isDrawingStandin
public static boolean isDrawingStandin()- Returns:
- true if we are currently rendering a container to texture.
-
setMinificationFilter
Set the minification filter for the standin.- Parameters:
filter
- the minification filter to set
-
getMinificationFilter
- Returns:
- the minification filter used for standin.
-