Package arc.scene.ui.layout
Class Table
java.lang.Object
arc.scene.Element
arc.scene.Group
arc.scene.ui.layout.WidgetGroup
arc.scene.ui.layout.Table
- All Implemented Interfaces:
Cullable
- Direct Known Subclasses:
Button
,ChatFragment
,ConsoleFragment
,CoreItemsDisplay
,Dialog
,ItemDisplay
,ItemsDisplay
,LCanvas
,LCanvas.StatementElem
,LiquidDisplay
,MapObjectivesCanvas.ObjectiveTilemap.ObjectiveTile
,Minimap
,SettingsMenuDialog.SettingsTable
,WaveGraph
A group that sizes and positions children using table constraints. By default, touchable is
Touchable.childrenOnly
.
The preferred and minimum sizes are that of the children when laid out in columns and rows.
-
Nested Class Summary
-
Field Summary
Fields inherited from class arc.scene.Group
children, cullingArea, transform
Fields inherited from class arc.scene.Element
color, cullable, fillParent, height, name, originX, originY, parent, parentAlpha, rotation, scaleX, scaleY, touchable, touchablility, translation, userObject, visibility, visible, width, x, y
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd()
Adds a cell without an element.void
add
(CharSequence text) Adds a new cell with a label.add
(CharSequence text, float scl) Adds a new cell with a label.add
(CharSequence text, Color color) Adds a new cell with a label.add
(CharSequence text, Color color, float scl) add
(CharSequence text, Label.LabelStyle labelStyle) Adds a new cell with a label.add
(CharSequence text, Label.LabelStyle labelStyle, float scl) Adds a new cell with a label.add
(T element) Adds a new cell to the table with the specified element.align
(int align) Alignment of the logical table within the table actor.area
(String text, TextField.TextFieldStyle style, Cons<String> listener) background
(Drawable background) bottom()
AddsAlign.bottom
and clearsAlign.top
for the alignment of the logical table within the table actor.button
(Cons<Button> cons, Button.ButtonStyle style, Runnable listener) button
(Drawable icon, ImageButton.ImageButtonStyle style, float isize, Runnable listener) button
(Drawable icon, ImageButton.ImageButtonStyle style, Runnable listener) button
(String text, Drawable image, TextButton.TextButtonStyle style, float imagesize, Runnable clicked) button
(String text, Drawable image, TextButton.TextButtonStyle style, Runnable clicked) button
(String text, TextButton.TextButtonStyle style, Runnable listener) buttonCenter
(String text, Drawable image, float imagesize, Runnable clicked) buttonCenter
(String text, Drawable image, TextButton.TextButtonStyle style, float imagesize, Runnable clicked) buttonCenter
(String text, Drawable image, Runnable clicked) center()
Sets the alignment of the logical table within the table actor toAlign.center
.void
Removes all actors and cells from the table.defaults()
The cell values that will be used as the defaults for all cells.void
draw()
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out.protected void
drawBackground
(float x, float y) Called to draw the background, before clipping is applied (if enabled).field
(String text, TextField.TextFieldFilter filter, Cons<String> listener) field
(String text, TextField.TextFieldStyle style, Cons<String> listener) fill()
Adds and fills a new table within this one.int
getAlign()
getCell
(T actor) Returns the cell for the specified actor in this table, or null.getCells()
Returns the cells for this table.boolean
getClip()
int
float
getColumnWidth
(int columnIndex) Returns the width of the specified column.float
float
float
float
float
float
float
float
int
getRow
(float y) Returns the row index for the y coordinate, or -1 if there are no cells.float
getRowHeight
(int rowIndex) Returns the height of the specified row.int
getRows()
hit
(float x, float y, boolean touchable) Returns the deepest actor that contains the specified point and istouchable
andvisible
, or null if no actor was hit.image()
image
(Prov<TextureRegion> reg) image
(TextureRegion region) void
Invalidates this actor's layout, causingElement.layout()
to happen the next timeElement.validate()
is called.label
(Prov<CharSequence> text) labelWrap
(Prov<CharSequence> text) void
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsElement.invalidate()
on any each child whose width or height has changed, and callsElement.validate()
on each child.left()
AddsAlign.left
and clearsAlign.right
for the alignment of the logical table within the table actor.margin
(float pad) Sets the marginTop, marginLeft, marginBottom, and marginRight around the table to the specified value.margin
(float top, float left, float bottom, float right) marginBottom
(float padBottom) Padding at the bottom edge of the table.marginLeft
(float padLeft) Padding at the left edge of the table.marginRight
(float padRight) Padding at the right edge of the table.marginTop
(float padTop) Padding at the top edge of the table.pane
(ScrollPane.ScrollPaneStyle style, Cons<Table> consumer) pane
(ScrollPane.ScrollPaneStyle style, Element element) Cell<?>
rect
(Table.DrawRect draw) boolean
removeChild
(Element element) Removes an actor from this group and unfocuses it.boolean
removeChild
(Element element, boolean unfocus) Removes an actor from this group.void
reset()
Removes all actors and cells from the table (same asclearChildren()
) and additionally resets all table properties and cell, column, and row defaults.right()
AddsAlign.right
and clearsAlign.left
for the alignment of the logical table within the table actor.row()
Indicates that subsequent cells should be added to a new row and returns this table.void
setBackground
(Drawable background) void
setClip
(boolean enabled) Causes the contents to be clipped if they exceed the table element's bounds.void
setRound
(boolean round) If true (the default), positions and sizes are rounded to integers.Adds a new cell to the table with the specified elements in aStack
.table()
top()
AddsAlign.top
and clearsAlign.bottom
for the alignment of the logical table within the table actor.Methods inherited from class arc.scene.ui.layout.WidgetGroup
childrenChanged, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate
Methods inherited from class arc.scene.Group
act, addChild, addChildAfter, addChildAt, addChildBefore, applyTransform, clear, computeTransform, drawChildren, fill, fill, fill, find, find, findVisible, forEach, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, setCullingArea, setScene, setTransform, swapActor, swapActor, toString
Methods inherited from class arc.scene.Element
actions, addAction, addCaptureListener, addListener, change, changed, clearActions, clearListeners, clicked, clicked, clicked, clicked, clipBegin, clipBegin, clipEnd, dragged, exited, fire, fireClick, getActions, getCaptureListeners, getHeight, getListeners, getMaxHeight, getMaxWidth, getRight, getRotation, getScene, getTop, getWidth, getX, getY, getZIndex, hasActions, hasKeyboard, hasMouse, hasParent, hasScroll, hovered, isAscendantOf, isDescendantOf, isDescendantOf, isTouchable, keepInStage, keyDown, keyDown, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, released, remove, removeAction, removeCaptureListener, removeListener, requestKeyboard, requestScroll, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, scrolled, setBounds, setColor, setColor, setHeight, setOrigin, setOrigin, setPosition, setPosition, setRotation, setRotationOrigin, setScale, setScale, setSize, setSize, setTranslation, setWidth, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, tapped, toBack, toFront, touchable, update, updateVisibility, visible
-
Constructor Details
-
Table
public Table() -
Table
-
Table
-
Table
-
-
Method Details
-
fill
Adds and fills a new table within this one. -
draw
public void draw()Description copied from class:WidgetGroup
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out.- Overrides:
draw
in classWidgetGroup
-
drawBackground
protected void drawBackground(float x, float y) Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable. -
background
- See Also:
-
getBackground
-
setBackground
- Parameters:
background
- May be null to clear the background.
-
hit
Description copied from class:Element
Returns the deepest actor that contains the specified point and istouchable
andvisible
, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the bottom left of the actor and width,height is the upper right).This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not occur on this Actor.
The default implementation returns this actor if the point is within this actor's bounds.
-
getClip
public boolean getClip() -
setClip
public void setClip(boolean enabled) Causes the contents to be clipped if they exceed the table element's bounds. Enabling clipping will setGroup.setTransform(boolean)
to true. -
invalidate
public void invalidate()Description copied from class:Element
Invalidates this actor's layout, causingElement.layout()
to happen the next timeElement.validate()
is called. This method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred, maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).- Overrides:
invalidate
in classWidgetGroup
-
add
Adds a new cell to the table with the specified element. -
add
-
collapser
-
collapser
-
collapser
-
collapser
-
table
-
table
-
table
-
table
-
table
-
label
-
labelWrap
-
labelWrap
-
pane
-
pane
-
pane
-
pane
-
add
Adds a new cell with a label. -
add
Adds a new cell with a label. -
add
Adds a new cell with a label. -
add
-
add
Adds a new cell with a label. -
add
Adds a new cell with a label. -
add
Adds a cell without an element. -
stack
Adds a new cell to the table with the specified elements in aStack
.- Parameters:
elements
- May be null to add a stack without any elements.
-
image
-
imageDraw
-
image
-
image
-
image
-
image
-
check
-
check
-
check
-
button
-
button
-
button
-
button
-
button
-
button
-
button
public Cell<ImageButton> button(Drawable icon, ImageButton.ImageButtonStyle style, float isize, Runnable listener) -
button
public Cell<ImageButton> button(Drawable icon, ImageButton.ImageButtonStyle style, Runnable listener) -
field
-
area
-
area
-
field
-
field
-
rect
-
buttonRow
-
button
-
button
-
button
public Cell<TextButton> button(String text, Drawable image, TextButton.TextButtonStyle style, float imagesize, Runnable clicked) -
button
public Cell<TextButton> button(String text, Drawable image, TextButton.TextButtonStyle style, Runnable clicked) -
buttonCenter
public Cell<TextButton> buttonCenter(String text, Drawable image, float imagesize, Runnable clicked) -
buttonCenter
-
buttonCenter
public Cell<TextButton> buttonCenter(String text, Drawable image, TextButton.TextButtonStyle style, float imagesize, Runnable clicked) -
slider
-
slider
-
slider
-
removeChild
Description copied from class:Group
Removes an actor from this group and unfocuses it. CallsGroup.removeChild(Element, boolean)
with true.- Overrides:
removeChild
in classGroup
-
removeChild
Description copied from class:Group
Removes an actor from this group. If the actor will not be used again and has actions, they should becleared
so the actions will be returned to theirpool
, if any. This is not done automatically.- Overrides:
removeChild
in classGroup
unfocus
- If true,Scene.unfocus(Element)
is called.- Returns:
- true if the actor was removed from this group.
-
clearChildren
public void clearChildren()Removes all actors and cells from the table.- Overrides:
clearChildren
in classGroup
-
reset
public void reset()Removes all actors and cells from the table (same asclearChildren()
) and additionally resets all table properties and cell, column, and row defaults. -
row
Indicates that subsequent cells should be added to a new row and returns this table. -
getCell
Returns the cell for the specified actor in this table, or null. -
getCells
Returns the cells for this table. -
getPrefWidth
public float getPrefWidth()- Overrides:
getPrefWidth
in classWidgetGroup
-
getPrefHeight
public float getPrefHeight()- Overrides:
getPrefHeight
in classWidgetGroup
-
getMinWidth
public float getMinWidth()- Overrides:
getMinWidth
in classWidgetGroup
-
getMinHeight
public float getMinHeight()- Overrides:
getMinHeight
in classWidgetGroup
-
defaults
The cell values that will be used as the defaults for all cells. -
margin
Sets the marginTop, marginLeft, marginBottom, and marginRight around the table to the specified value. -
margin
-
marginTop
Padding at the top edge of the table. -
marginLeft
Padding at the left edge of the table. -
marginBottom
Padding at the bottom edge of the table. -
marginRight
Padding at the right edge of the table. -
align
Alignment of the logical table within the table actor. Set toAlign.center
,Align.top
,Align.bottom
,Align.left
,Align.right
, or any combination of those. -
center
Sets the alignment of the logical table within the table actor toAlign.center
. This clears any other alignment. -
top
AddsAlign.top
and clearsAlign.bottom
for the alignment of the logical table within the table actor. -
left
AddsAlign.left
and clearsAlign.right
for the alignment of the logical table within the table actor. -
bottom
AddsAlign.bottom
and clearsAlign.top
for the alignment of the logical table within the table actor. -
right
AddsAlign.right
and clearsAlign.left
for the alignment of the logical table within the table actor. -
getMarginTop
public float getMarginTop() -
getMarginLeft
public float getMarginLeft() -
getMarginBottom
public float getMarginBottom() -
getMarginRight
public float getMarginRight() -
getAlign
public int getAlign() -
getRow
public int getRow(float y) Returns the row index for the y coordinate, or -1 if there are no cells.- Parameters:
y
- The y coordinate, where 0 is the top of the table.
-
setRound
public void setRound(boolean round) If true (the default), positions and sizes are rounded to integers. -
getRows
public int getRows() -
getColumns
public int getColumns() -
getRowHeight
public float getRowHeight(int rowIndex) Returns the height of the specified row. -
getColumnWidth
public float getColumnWidth(int columnIndex) Returns the width of the specified column. -
layout
public void layout()Description copied from class:Element
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsElement.invalidate()
on any each child whose width or height has changed, and callsElement.validate()
on each child. This method should almost never be called directly, insteadElement.validate()
should be used.- Overrides:
layout
in classWidgetGroup
-