public class GridUiNavigation extends java.lang.Object implements UiNavigation
UiNavigation
implementation that treats all UiElement
s as
placed inside a gridConstructor and Description |
---|
GridUiNavigation(int xsColumns)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(Actionable actionable)
Adds a
Actionable to end of the navigation |
Actionable |
get(int x,
int y) |
Actionable |
getCursor()
Returns the
Actionable highlighted by the cursor |
int |
getTotalColumns()
Returns the total amount of columns for the current
ScreenSize |
int |
getTotalRows()
Returns the total amount of rows for the current
ScreenSize |
void |
layout(ScreenSize screenSize)
Re-orders elements based on screen size if necessary
|
Actionable |
navigate(int keycode)
Update (if required) navigation from key input
|
void |
remove(Actionable actionable)
Removes a
Actionable from the navigation and shifts any following
Actionable s by 1 place |
void |
removeAll()
Removes all
Actionable instances from the navigation |
Actionable |
resetCursor()
Resets the selection back to the first
Actionable |
void |
set(int index,
Actionable actionable)
Replace an
Actionable at a specific index |
void |
set(int x,
int y,
Actionable actionable)
Replaces the
Actionable at the specified grid coordinate |
void |
setWidth(ScreenSize screenSize,
int columns)
Sets the amount columns of the grid on a specific
ScreenSize |
java.lang.String |
toString() |
public GridUiNavigation(int xsColumns)
xsColumns
- The amount of columns of the grid on a ScreenSize.XS
screenpublic void layout(ScreenSize screenSize)
UiNavigation
layout
in interface UiNavigation
screenSize
- The current ScreenSize
public void add(Actionable actionable)
UiNavigation
Actionable
to end of the navigationadd
in interface UiNavigation
actionable
- The Actionable
to addpublic void remove(Actionable actionable)
UiNavigation
Actionable
from the navigation and shifts any following
Actionable
s by 1 placeremove
in interface UiNavigation
actionable
- The Actionable
to removepublic void removeAll()
UiNavigation
Actionable
instances from the navigationremoveAll
in interface UiNavigation
public void set(int index, Actionable actionable)
UiNavigation
Actionable
at a specific indexset
in interface UiNavigation
index
- The index to replaceactionable
- The new Actionable
public Actionable get(int x, int y)
public void set(int x, int y, Actionable actionable)
Actionable
at the specified grid coordinatex
- The grid x coordinatey
- The grid y coordinateactionable
- The new Actionable
public Actionable navigate(int keycode)
UiNavigation
navigate
in interface UiNavigation
keycode
- The key that was pressedActionable
public Actionable getCursor()
UiNavigation
Actionable
highlighted by the cursorgetCursor
in interface UiNavigation
Actionable
public Actionable resetCursor()
UiNavigation
Actionable
resetCursor
in interface UiNavigation
Actionable
public void setWidth(ScreenSize screenSize, int columns)
ScreenSize
screenSize
- The ScreenSize
columns
- The amount of columns in the gridpublic int getTotalColumns()
ScreenSize
public int getTotalRows()
ScreenSize
public java.lang.String toString()
toString
in class java.lang.Object