public abstract class AbstractBasePane extends Object implements BasePane
BasePane
has the common code shared by all different concrete
implementations.Modifier and Type | Class and Description |
---|---|
protected class |
AbstractBasePane.ContentHolder |
Modifier and Type | Field and Description |
---|---|
protected AbstractBasePane.ContentHolder |
contentHolder |
protected InteractableLookupMap |
interactableLookupMap |
Modifier | Constructor and Description |
---|---|
protected |
AbstractBasePane() |
Modifier and Type | Method and Description |
---|---|
void |
draw(TextGUIGraphics graphics)
Called by the GUI system (or something imitating the GUI system) to draw the root container.
|
Component |
getComponent()
Returns the component that is the content of the BasePane.
|
TerminalPosition |
getCursorPosition()
Returns the position of where to put the terminal cursor according to this root container.
|
Interactable |
getFocusedInteractable()
Returns the component in the root container that currently has input focus.
|
boolean |
handleInput(KeyStroke key)
Called by the GUI system to delegate a keyboard input event.
|
void |
invalidate()
Invalidates the whole root container (including all of its child components) which will cause them all to be
recalculated (for containers) and redrawn.
|
boolean |
isInvalid()
Checks if this root container (i.e.
|
void |
setComponent(Component component)
Sets the top-level component inside this BasePane.
|
void |
setEnableDirectionBasedMovements(boolean enableDirectionBasedMovements)
If set to false, using the keyboard arrows keys will have the same effect as using the tab and reverse tab.
|
void |
setFocusedInteractable(Interactable toFocus)
Sets the component currently in focus within this root container, or sets no component in focus if
null
is passed in. |
protected void |
setFocusedInteractable(Interactable toFocus,
Interactable.FocusChangeDirection direction) |
void |
setStrictFocusChange(boolean strictFocusChange)
If set to true, up/down array keys will not translate to next/previous if there are no more components
above/below.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromGlobal, getTextGUI, toGlobal
protected final AbstractBasePane.ContentHolder contentHolder
protected InteractableLookupMap interactableLookupMap
public boolean isInvalid()
BasePane
public void invalidate()
BasePane
invalidate
in interface BasePane
public void draw(TextGUIGraphics graphics)
BasePane
public boolean handleInput(KeyStroke key)
BasePane
false
so that the GUI system can take further decisions on what to do with it.handleInput
in interface BasePane
key
- Keyboard inputtrue
If the root container could handle the input, false otherwisepublic Component getComponent()
BasePane
getComponent
in interface BasePane
getComponent
in interface Composite
public void setComponent(Component component)
BasePane
setComponent
in interface BasePane
setComponent
in interface Composite
component
- Component which this BasePane is using as it's contentpublic Interactable getFocusedInteractable()
BasePane
getFocusedInteractable
in interface BasePane
public TerminalPosition getCursorPosition()
BasePane
null
if 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.getCursorPosition
in interface BasePane
null
if the cursor shouldn't be visiblepublic void setFocusedInteractable(Interactable toFocus)
BasePane
null
is passed in.setFocusedInteractable
in interface BasePane
toFocus
- Interactable to focus, or null
to clear focusprotected void setFocusedInteractable(Interactable toFocus, Interactable.FocusChangeDirection direction)
public void setStrictFocusChange(boolean strictFocusChange)
BasePane
setStrictFocusChange
in interface BasePane
strictFocusChange
- Will not allow relaxed navigation if set to true
public void setEnableDirectionBasedMovements(boolean enableDirectionBasedMovements)
BasePane
In Lanterna 2, direction based movements were not available.
setEnableDirectionBasedMovements
in interface BasePane
enableDirectionBasedMovements
- Should direction based focus movements be enabled?Copyright © 2016. All rights reserved.