Package app.ui.widgets
Class WidgetPageSelection
java.lang.Object
app.ui.widgets.Widget
app.ui.widgets.WidgetPageSelection
- All Implemented Interfaces:
IDrawable
WidgetPageSelection represents a paginated selection widget in a UI.
This widget allows displaying a list of options spread across multiple pages.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSelections(ArrayList<ArrayList<String>> selections) Adds the list of selections to the widget.voidClears the currently selected option.voiddraw(char[][] buffer, com.googlecode.lanterna.TextColor[][] printColor, com.googlecode.lanterna.TextColor[][] backColor) Draws the widget on the screen.intGets the index of the currently selected option.Gets the list of buttons in the widget.voidupdateList(ArrayList<ArrayList<String>> selections) Updates the list of selections in the widget.Methods inherited from class app.ui.widgets.Widget
drawText, getLen, getSelected, getSkipSelection, getText, getWidgetID, getX, getY, isHide, setHide, setSkipSelection, setText, setWidgetID
-
Constructor Details
-
WidgetPageSelection
public WidgetPageSelection(int x, int y, int len, int height, String text, ArrayList<ArrayList<String>> selections, Window mainWindow) Constructor for creating a WidgetPageSelection.- Parameters:
x- The x-coordinate of the widget.y- The y-coordinate of the widget.len- Length of the widget.height- Height of the widget.text- Text associated with the widget.selections- List of selection options.mainWindow- The main window in which the widget is displayed.
-
-
Method Details
-
updateList
Updates the list of selections in the widget.- Parameters:
selections- New list of selections to be updated.
-
getSelectedOption
public int getSelectedOption()Gets the index of the currently selected option.- Returns:
- Index of selected option.
-
clearSelectedOption
public void clearSelectedOption()Clears the currently selected option. -
getSelectionsButton
Gets the list of buttons in the widget.- Returns:
- List of buttons in the widget.
-
addSelections
Adds the list of selections to the widget.- Parameters:
selections- List of selections to be added.
-
draw
public void draw(char[][] buffer, com.googlecode.lanterna.TextColor[][] printColor, com.googlecode.lanterna.TextColor[][] backColor) Draws the widget on the screen.
-