DefaultWindowManager
public interface WindowManager
WindowBasedTextGUI
to manage the position and placement
of windows. The window manager doesn't contain the list of windows so it normally does not need to maintain much
state but it is passed all required objects as the window model changes.DefaultWindowManager
Modifier and Type | Method | Description |
---|---|---|
WindowDecorationRenderer |
getWindowDecorationRenderer(Window window) |
Returns the
WindowDecorationRenderer for a particular window |
boolean |
isInvalid() |
Will be polled by the the
WindowBasedTextGUI to see if the window manager believes an update is required. |
void |
onAdded(WindowBasedTextGUI textGUI,
Window window,
List<Window> allWindows) |
Called whenever a window is added to the
WindowBasedTextGUI . |
void |
onRemoved(WindowBasedTextGUI textGUI,
Window window,
List<Window> allWindows) |
Called whenever a window is removed from a
WindowBasedTextGUI . |
void |
prepareWindows(WindowBasedTextGUI textGUI,
List<Window> allWindows,
TerminalSize screenSize) |
Called by the GUI system before iterating through all windows during the drawing process.
|
boolean isInvalid()
WindowBasedTextGUI
to see if the window manager believes an update is required.
For example, it could be that there is no input, no events and none of the components are invalid, but the window
manager decides for some other reason that the GUI needs to be updated, in that case you should return
true
here. Please note that returning false
will not prevent updates from happening, it's just
stating that the window manager isn't aware of some internal state change that would require an update.true
if the window manager believes the GUI needs to be update, false
otherwiseWindowDecorationRenderer getWindowDecorationRenderer(Window window)
WindowDecorationRenderer
for a particular windowwindow
- Window to get the decoration renderer forWindowDecorationRenderer
for the windowvoid onAdded(WindowBasedTextGUI textGUI, Window window, List<Window> allWindows)
WindowBasedTextGUI
. This gives the window manager an opportunity
to setup internal state, if required, or decide on an initial position of the windowtextGUI
- GUI that the window was added toowindow
- Window that was addedallWindows
- All windows, including the new window, in the GUIvoid onRemoved(WindowBasedTextGUI textGUI, Window window, List<Window> allWindows)
WindowBasedTextGUI
. This gives the window manager an
opportunity to clear internal state if needed.textGUI
- GUI that the window was removed fromwindow
- Window that was removedallWindows
- All windows, excluding the removed window, in the GUIvoid prepareWindows(WindowBasedTextGUI textGUI, List<Window> allWindows, TerminalSize screenSize)
Window.setPosition(..)
and Window.setDecoratedSize(..)
. Be sure to inspect the window hints
assigned to the window, in case you want to try to honour them. Use the
getWindowDecorationRenderer(Window)
method to get the currently assigned window decoration rendering
class which can tell you the decorated size of a window given it's content size.textGUI
- Text GUI that is about to draw the windowsallWindows
- All windows that are going to be drawn, in the order they will be drawnscreenSize
- Size of the terminal that is available to draw onCopyright © 2020. All rights reserved.