|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.ui.tablelayout.BaseTableLayout<T>
public abstract class BaseTableLayout<T>
Base layout functionality. Subclasses must implement newTableLayout()
.
Field Summary | |
---|---|
int |
align
|
static int |
BOTTOM
|
Cell |
cellDefaults
The cell values that will be used as the defaults for all cells. |
java.util.ArrayList<Cell> |
cells
The cells for this table only. |
static int |
CENTER
|
java.lang.String |
debug
|
static java.lang.String |
DEBUG_ALL
|
static java.lang.String |
DEBUG_CELL
|
static java.lang.String |
DEBUG_TABLE
|
static java.lang.String |
DEBUG_WIDGET
|
java.lang.String |
height
|
static int |
LEFT
|
static java.lang.String |
MAX
|
static java.lang.String |
MIN
|
java.lang.String |
padBottom
|
java.lang.String |
padLeft
|
java.lang.String |
padRight
|
java.lang.String |
padTop
|
static java.lang.String |
PREF
|
static int |
RIGHT
|
int |
tableLayoutHeight
|
int |
tableLayoutWidth
|
int |
tableLayoutX
|
int |
tableLayoutY
|
int |
tableMinHeight
|
int |
tableMinWidth
|
int |
tablePrefHeight
|
int |
tablePrefWidth
|
static int |
TOP
|
java.lang.String |
width
|
static int |
X
|
static int |
Y
|
Constructor Summary | |
---|---|
BaseTableLayout()
|
Method Summary | |
---|---|
Cell |
addCell(T widget)
Adds a new cell to the table with the specified widget. |
abstract void |
addChild(T parent,
T child,
java.lang.String layoutString)
Adds a child to the specified parent. |
static void |
addClassPrefix(java.lang.String prefix)
Used by newWidget(String) to resolve class names. |
abstract void |
addDebugRectangle(java.lang.String type,
int x,
int y,
int w,
int h)
Adds a rectangle that should be drawn for debugging. |
void |
clear()
Removes all widgets and cells from the table and resets the cell and column defaults. |
abstract void |
clearDebugRectangles()
Clears all debugging rectangles. |
protected java.lang.Object |
convertType(java.lang.Object parentObject,
java.lang.String value,
java.lang.Class type,
java.lang.String memberName)
Attempts to convert a string value to a non-string type to match a field or method on the specified parentObject. |
Cell |
getCell(java.lang.String name)
Returns the cell with the specified name, anywhere in the table hierarchy. |
Cell |
getCell(T widget)
Returns the cell for the specified widget, anywhere in the table hierarchy. |
java.util.List<Cell> |
getCells()
Returns all cells, anywhere in the table hierarchy. |
java.util.List<Cell> |
getCells(java.lang.String namePrefix)
Returns all cells with the specified name prefix, anywhere in the table hierarchy. |
Cell |
getColumnDefaults(int column)
Gets the cell values that will be used as the defaults for all cells in the specified column. |
abstract int |
getMaxHeight(T widget)
|
abstract int |
getMaxWidth(T widget)
|
abstract int |
getMinHeight(T widget)
|
abstract int |
getMinWidth(T widget)
|
abstract int |
getPrefHeight(T widget)
|
abstract int |
getPrefWidth(T widget)
|
abstract T |
getTable()
Returns the widget that will be laid out. |
T |
getWidget(java.lang.String name)
Returns the widget with the specified name, anywhere in the table hierarchy. |
java.util.List<T> |
getWidgets()
Returns all widgets, anywhere in the table hierarchy. |
java.util.List<T> |
getWidgets(java.lang.String namePrefix)
Returns all widgets with the specified name prefix, anywhere in the table hierarchy. |
int |
height(float value)
Interprets the specified value as a size. |
int |
height(java.lang.String value)
Interprets the specified value as a height. |
abstract void |
invalidate()
Marks the TableLayout as needing to layout again. |
void |
layout()
Performs the actual layout. |
protected T |
newInstance(java.lang.String className)
Returns an instance of the specified class. |
abstract T |
newStack()
Returns a new widget that sizes all of its children to its size. |
abstract BaseTableLayout |
newTableLayout()
Returns a new TableLayout that will be nested under this table. |
T |
newWidget(java.lang.String className)
Creates a new widget from the specified class name. |
void |
parse(java.lang.String tableDescription)
Parses a table description and adds the widgets and cells to the table. |
T |
register(java.lang.String name,
T widget)
Sets the name of a widget so it may be referenced in parse(String) . |
abstract void |
removeChild(T parent,
T child)
|
void |
setCellProperty(Cell c,
java.lang.String name,
java.util.List<java.lang.String> values)
Sets a property on the cell. |
void |
setParent(BaseTableLayout parent)
Sets that this table is nested under the specified parent. |
void |
setProperty(T object,
java.lang.String name,
java.util.List<java.lang.String> values)
Sets a property on the widget. |
void |
setTableProperty(java.lang.String name,
java.util.List<java.lang.String> values)
Sets a property on the table. |
void |
setWidget(Cell cell,
T widget)
|
void |
setWidget(java.lang.String name,
T widget)
Sets the widget in the cell with the specified name. |
Cell |
startRow()
Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults for all cells in the new row. |
protected java.lang.String |
validateSize(java.lang.String size)
Validates the specified size is properly formatted. |
int |
width(float value)
Interprets the specified value as a size. |
int |
width(java.lang.String value)
Interprets the specified value as a width. |
T |
wrap(java.lang.Object object)
Wraps the specified object in a widget. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CENTER
public static final int TOP
public static final int BOTTOM
public static final int LEFT
public static final int RIGHT
public static final int X
public static final int Y
public static final java.lang.String MIN
public static final java.lang.String PREF
public static final java.lang.String MAX
public static final java.lang.String DEBUG_ALL
public static final java.lang.String DEBUG_TABLE
public static final java.lang.String DEBUG_CELL
public static final java.lang.String DEBUG_WIDGET
public java.lang.String width
public java.lang.String height
public java.lang.String padTop
public java.lang.String padLeft
public java.lang.String padBottom
public java.lang.String padRight
public int align
public java.lang.String debug
public int tableLayoutX
public int tableLayoutY
public int tableLayoutWidth
public int tableLayoutHeight
public int tableMinWidth
public int tableMinHeight
public int tablePrefWidth
public int tablePrefHeight
public final java.util.ArrayList<Cell> cells
public final Cell cellDefaults
Constructor Detail |
---|
public BaseTableLayout()
Method Detail |
---|
public abstract void addChild(T parent, T child, java.lang.String layoutString)
layoutString
- May be null.public abstract void removeChild(T parent, T child)
public abstract BaseTableLayout newTableLayout()
parent
of the
returned layout must be set.
public abstract T newStack()
public abstract int getMinWidth(T widget)
public abstract int getMinHeight(T widget)
public abstract int getPrefWidth(T widget)
public abstract int getPrefHeight(T widget)
public abstract int getMaxWidth(T widget)
public abstract int getMaxHeight(T widget)
public abstract void invalidate()
public abstract void clearDebugRectangles()
public abstract void addDebugRectangle(java.lang.String type, int x, int y, int w, int h)
public abstract T getTable()
public void setParent(BaseTableLayout parent)
public T register(java.lang.String name, T widget)
parse(String)
.
public void parse(java.lang.String tableDescription)
public Cell addCell(T widget)
widget
- May be null to add a cell without a widget.public Cell startRow()
public Cell getColumnDefaults(int column)
public void clear()
public T getWidget(java.lang.String name)
public java.util.List<T> getWidgets()
public java.util.List<T> getWidgets(java.lang.String namePrefix)
public Cell getCell(T widget)
public Cell getCell(java.lang.String name)
public java.util.List<Cell> getCells(java.lang.String namePrefix)
public java.util.List<Cell> getCells()
public void setWidget(Cell cell, T widget)
public void setWidget(java.lang.String name, T widget)
public void layout()
protected java.lang.String validateSize(java.lang.String size)
width(String)
and
height(String)
. All sizes that are stored as strings pass through this method, providing a hook to validate sizes
at parse time rather than layout time. The default implementation just returns the specified string. If the specified String
is invalid, an exception should be thrown.
public T newWidget(java.lang.String className)
wrap(Object)
.
java.lang.RuntimeException
- if the class could be found or otherwise failed to be instantiated.addClassPrefix(String)
protected T newInstance(java.lang.String className) throws java.lang.Exception
java.lang.Exception
- if the class cannot be found or instantiated.public T wrap(java.lang.Object object)
java.lang.RuntimeException
- if the object could not be wrapped.public void setProperty(T object, java.lang.String name, java.util.List<java.lang.String> values)
java.lang.RuntimeException
- if the property could not be set.public void setTableProperty(java.lang.String name, java.util.List<java.lang.String> values)
java.lang.RuntimeException
- if the property could not be set.public void setCellProperty(Cell c, java.lang.String name, java.util.List<java.lang.String> values)
java.lang.RuntimeException
- if the property could not be set.public int width(java.lang.String value)
width(float)
. Zero is used for null and
empty string. If the suffix is "%", the value is converted to an int, divided by 100, and multiplied by
tableLayoutWidth
. If the suffix is "px", the value is converted to int without the suffix and returned unscaled.
value
- May be null.public int width(float value)
public int height(java.lang.String value)
height(float)
. Zero is used for null
and empty string. If the suffix is "%", the value is converted to an int, divided by 100, and multiplied by
tableLayoutHeight
. If the suffix is "px", the value is converted to int without the suffix and returned unscaled.
value
- May be null.public int height(float value)
protected java.lang.Object convertType(java.lang.Object parentObject, java.lang.String value, java.lang.Class type, java.lang.String memberName)
public static void addClassPrefix(java.lang.String prefix)
newWidget(String)
to resolve class names.
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |