Package app.ui.windows
Class Window
java.lang.Object
app.ui.windows.Window
- Direct Known Subclasses:
CampListView,ChangePasswordView,LoginView,StaffMainView,StudentMainView,WindowOverlayClass
Class representing a basic window in a user interface.
This class provides a foundation for creating windows in a user interface with text-based graphics.
It includes methods for adding, removing, and managing widgets within the window, handling user input,
and rendering the window's content on a screen.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.googlecode.lanterna.TextColor[][]protected char[][]protected ArrayList<WindowOverlayClass> protected com.googlecode.lanterna.TextColor[][]protected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOverlay(WindowOverlayClass windowOverlayClass) Adds an overlay to the window.intAdds a widget to the window.intaddWidgetAfter(Widget widget, int afterWhich) addWidgetAfter method for the window.voidclearArea(com.googlecode.lanterna.screen.Screen screen, int startX, int endX, int startY, int endY) clearArea method for the window.voidclearOuterArea(com.googlecode.lanterna.screen.Screen screen, int x, int y, double transparency) voiddraw(com.googlecode.lanterna.screen.Screen screen, int x, int y, double transparency) intgetLenX()Gets the length of the window in the X direction.intgetLenY()Gets the length of the window in the Y direction.intswitchToWindow method for the window.intgetWidgetIndex(Widget widget) getWidgetIndex method for the window.intgetX()Gets the X position of the window.intgetY()Gets the Y position of the window.voidkeyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke) keyStroke method for the window.voidkeyStrokeHelper(com.googlecode.lanterna.input.KeyStroke keyStroke) keyStrokeHelper method for the window.voidThe main loop for processing window messages.voidThe helper method for processing window messages.voidonExit()onExit method for the window.intremoveWidget(Widget widget) removeWidget method for the window.voidSelects the next selectable widget in the window.voidSelects the previous selectable widget in the window.voidsetClear()setClear method for the window.voidsetPointer(Widget widget) setPointer method for the window.voidsetY(int y) voidswitchFrom(Window oldWindow, com.googlecode.lanterna.screen.Screen screen, int x, int y, double percentage, double directionX, double directionY) switchFrom method for the window.
-
Field Details
-
buffer
protected char[][] buffer -
printColor
protected com.googlecode.lanterna.TextColor[][] printColor -
backColor
protected com.googlecode.lanterna.TextColor[][] backColor -
widgets
-
switchToWindow
protected int switchToWindow -
overlays
-
-
Constructor Details
-
Window
Constructor for Window class.- Parameters:
y- The Y position of the window.x- The X position of the window.windowName- The name of the window.
-
-
Method Details
-
setY
public void setY(int y) -
getY
public int getY()Gets the Y position of the window.- Returns:
- The Y position.
-
getX
public int getX()Gets the X position of the window.- Returns:
- The X position.
-
messageLoop
public void messageLoop()The main loop for processing window messages. This method should be overridden by subclasses to define specific behavior. -
messageLoopHelper
public void messageLoopHelper()The helper method for processing window messages. This method should be overridden by subclasses to define specific behavior. -
onExit
public void onExit()onExit method for the window. This method should be overridden by subclasses to define specific behavior. -
getSwitchToWindow
public int getSwitchToWindow()switchToWindow method for the window. This method should be overridden by subclasses to define specific behavior.- Returns:
- The window to switch to.
-
getLenX
public int getLenX()Gets the length of the window in the X direction.- Returns:
- The length of the window in the X direction.
-
getLenY
public int getLenY()Gets the length of the window in the Y direction.- Returns:
- The length of the window in the Y direction.
-
selectNext
public void selectNext()Selects the next selectable widget in the window. -
selectPrev
public void selectPrev()Selects the previous selectable widget in the window. -
keyStroke
public void keyStroke(com.googlecode.lanterna.input.KeyStroke keyStroke) keyStroke method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
keyStroke- The key stroke to process.
-
keyStrokeHelper
public void keyStrokeHelper(com.googlecode.lanterna.input.KeyStroke keyStroke) keyStrokeHelper method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
keyStroke- The key stroke to process.
-
switchFrom
public void switchFrom(Window oldWindow, com.googlecode.lanterna.screen.Screen screen, int x, int y, double percentage, double directionX, double directionY) switchFrom method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
oldWindow- The window to switch from.screen- The screen to draw on.x- The X position of the window.y- The Y position of the window.percentage- The percentage of the transition.directionX- The X direction of the transition.directionY- The Y direction of the transition.
-
clearArea
public void clearArea(com.googlecode.lanterna.screen.Screen screen, int startX, int endX, int startY, int endY) clearArea method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
screen- The screen to draw on.startX- The X position of the start of the area to clear.endX- The X position of the end of the area to clear.startY- The Y position of the start of the area to clear.endY- The Y position of the end of the area to clear.
-
addWidget
Adds a widget to the window.- Parameters:
widget- The widget to be added.- Returns:
- The ID assigned to the widget.
-
getWidgetIndex
getWidgetIndex method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
widget- The widget to get the index of.- Returns:
- The index of the widget.
-
removeWidget
removeWidget method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
widget- The widget to remove.- Returns:
- The ID of the widget.
-
addWidgetAfter
addWidgetAfter method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
widget- The widget to add.afterWhich- The index of the widget to add after.- Returns:
- The ID of the widget.
-
setClear
public void setClear()setClear method for the window. This method should be overridden by subclasses to define specific behavior. -
clearOuterArea
public void clearOuterArea(com.googlecode.lanterna.screen.Screen screen, int x, int y, double transparency) -
draw
public void draw(com.googlecode.lanterna.screen.Screen screen, int x, int y, double transparency) -
setPointer
setPointer method for the window. This method should be overridden by subclasses to define specific behavior.- Parameters:
widget- The widget to set as the pointer.
-
addOverlay
Adds an overlay to the window.- Parameters:
windowOverlayClass- The overlay to be added.
-