Class AbstractBasePane<T extends BasePane>
java.lang.Object
com.googlecode.lanterna.gui2.AbstractBasePane<T>
- Direct Known Subclasses:
AbstractWindow
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AbstractBasePane<T>.ContentHolderprivate booleanprivate Interactableprotected InteractableLookupMapprivate booleanprivate final CopyOnWriteArrayList<BasePaneListener<T>> private Interactableprivate booleanprivate Theme -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBasePaneListener(BasePaneListener<T> basePaneListener) private booleandoHandleInput(KeyStroke key) voiddraw(TextGUIGraphics graphics) Called by the GUI system (or something imitating the GUI system) to draw the root container.protected List<BasePaneListener<T>> Returns the component that is the content of the BasePane.Returns the position of where to put the terminal cursor according to this root container.Returns the component in the root container that currently has input focus.Returns theMenuBarassigned to this base pane/window, if any, otherwise returns {code null}.getTheme()Returns the text GUIThemeassociated with this base pane/window.booleanhandleInput(KeyStroke key) Called by the GUI system to delegate a keyboard input event.private booleanhandleMouseInput(MouseAction mouseAction) voidInvalidates the whole root container (including all of its child components) which will cause them all to be recalculated (for containers) and redrawn.booleanChecks if this root container (i.e.protected voidremoveBasePaneListener(BasePaneListener<T> basePaneListener) (package private) abstract Tself()voidsetComponent(Component component) Sets the top-level component inside this BasePane.voidsetEnableDirectionBasedMovements(boolean enableDirectionBasedMovements) If set to false, using the keyboard arrows keys will have the same effect as using the tab and reverse tab.voidsetFocusedInteractable(Interactable toFocus) Sets the component currently in focus within this root container, or sets no component in focus ifnullis passed in.protected voidsetFocusedInteractable(Interactable toFocus, Interactable.FocusChangeDirection direction) voidsetMenuBar(MenuBar menuBar) Sets the activeMenuBarfor this base pane/window.voidsetStrictFocusChange(boolean strictFocusChange) If set to true, up/down array keys will not translate to next/previous if there are no more components above/below.voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BasePane
fromGlobal, getTextGUI, toGlobal
-
Field Details
-
contentHolder
-
listeners
-
interactableLookupMap
-
focusedInteractable
-
invalid
private boolean invalid -
strictFocusChange
private boolean strictFocusChange -
enableDirectionBasedMovements
private boolean enableDirectionBasedMovements -
theme
-
mouseDownForDrag
-
-
Constructor Details
-
AbstractBasePane
protected AbstractBasePane()
-
-
Method Details
-
isInvalid
public boolean isInvalid()Description copied from interface:BasePaneChecks if this root container (i.e. any of its child components) has signaled that what it's currently displaying is out of date and needs re-drawing. -
invalidate
public void invalidate()Description copied from interface:BasePaneInvalidates the whole root container (including all of its child components) which will cause them all to be recalculated (for containers) and redrawn.- Specified by:
invalidatein interfaceBasePane
-
draw
Description copied from interface:BasePaneCalled by the GUI system (or something imitating the GUI system) to draw the root container. The TextGUIGraphics object should be used to perform the drawing operations. -
handleInput
Description copied from interface:BasePaneCalled by the GUI system to delegate a keyboard input event. The root container will decide what to do with this input, usually sending it to one of its sub-components, but if it isn't able to find any handler for this input it should returnfalseso that the GUI system can take further decisions on what to do with it.- Specified by:
handleInputin interfaceBasePane- Parameters:
key- Keyboard input- Returns:
trueIf the root container could handle the input, false otherwise
-
self
-
doHandleInput
-
handleMouseInput
-
getComponent
Description copied from interface:BasePaneReturns the component that is the content of the BasePane. This is probably the root of a hierarchy of nested Panels but it could also be a single component.- Specified by:
getComponentin interfaceBasePane- Specified by:
getComponentin interfaceComposite- Returns:
- Component which is the content of this BasePane
-
setComponent
Description copied from interface:BasePaneSets the top-level component inside this BasePane. If you want it to contain only one component, you can set it directly, but for more complicated GUIs you probably want to create a hierarchy of panels and set the first one here.- Specified by:
setComponentin interfaceBasePane- Specified by:
setComponentin interfaceComposite- Parameters:
component- Component which this BasePane is using as it's content
-
getFocusedInteractable
Description copied from interface:BasePaneReturns the component in the root container that currently has input focus. There can only be one component at a time being in focus.- Specified by:
getFocusedInteractablein interfaceBasePane- Returns:
- Interactable component that is currently in receiving input focus
-
getCursorPosition
Description copied from interface:BasePaneReturns the position of where to put the terminal cursor according to this root container. This is typically derived from which component has focus, ornullif no component has focus or if the root container doesn't want the cursor to be visible. Note that the coordinates are in local coordinate space, relative to the top-left corner of the root container. You can use your TextGUI implementation to translate these to global coordinates.- Specified by:
getCursorPositionin interfaceBasePane- Returns:
- Local position of where to place the cursor, or
nullif the cursor shouldn't be visible
-
setFocusedInteractable
Description copied from interface:BasePaneSets the component currently in focus within this root container, or sets no component in focus ifnullis passed in.- Specified by:
setFocusedInteractablein interfaceBasePane- Parameters:
toFocus- Interactable to focus, ornullto clear focus
-
setFocusedInteractable
protected void setFocusedInteractable(Interactable toFocus, Interactable.FocusChangeDirection direction) -
setStrictFocusChange
public void setStrictFocusChange(boolean strictFocusChange) Description copied from interface:BasePaneIf set to true, up/down array keys will not translate to next/previous if there are no more components above/below.- Specified by:
setStrictFocusChangein interfaceBasePane- Parameters:
strictFocusChange- Will not allow relaxed navigation if set totrue
-
setEnableDirectionBasedMovements
public void setEnableDirectionBasedMovements(boolean enableDirectionBasedMovements) Description copied from interface:BasePaneIf set to false, using the keyboard arrows keys will have the same effect as using the tab and reverse tab. Lanterna will map arrow down and arrow right to tab, going to the next component, and array up and array left to reverse tab, going to the previous component. If set to true, Lanterna will search for the next component starting at the cursor position in the general direction of the arrow. By default this is enabled.In Lanterna 2, direction based movements were not available.
- Specified by:
setEnableDirectionBasedMovementsin interfaceBasePane- Parameters:
enableDirectionBasedMovements- Should direction based focus movements be enabled?
-
getTheme
Description copied from interface:BasePaneReturns the text GUIThemeassociated with this base pane/window. This is either coming from theTextGUIthis object is associated with, the theme set as the override throughBasePane.setTheme(Theme)ornullif this base pane/window isn't added to anyTextGUIand doesn't have any override. -
setTheme
-
getMenuBar
Description copied from interface:BasePaneReturns theMenuBarassigned to this base pane/window, if any, otherwise returns {code null}.- Specified by:
getMenuBarin interfaceBasePane- Returns:
- The active menu bar or
null
-
addBasePaneListener
-
removeBasePaneListener
-
getBasePaneListeners
-