Module com.googlecode.lanterna
Package com.googlecode.lanterna.gui2
Class AbstractBasePane.ContentHolder
java.lang.Object
com.googlecode.lanterna.gui2.AbstractComponent<Container>
com.googlecode.lanterna.gui2.AbstractComposite<Container>
com.googlecode.lanterna.gui2.AbstractBasePane.ContentHolder
- All Implemented Interfaces:
Component
,Composite
,Container
,TextGUIElement
- Enclosing class:
AbstractBasePane<T extends BasePane>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ComponentRenderer
<Container> When you create a custom component, you need to implement this method and return a Renderer which is responsible for taking care of sizing the component, rendering it and choosing where to place the cursor (if Interactable).Returns the BasePane that this container belongs to.private MenuBar
Returns the TextGUI that this component is currently part of.void
Marks the component as invalid and requiring to be re-drawn at next opportunity.boolean
Checks if this element (or any of its child components, if any) has signaled that what it's currently displaying is out of date and needs re-drawing.boolean
removeComponent
(Component component) Removes the component from the container.void
setComponent
(Component component) Sets the component which is inside this Composite.private void
setMenuBar
(MenuBar menuBar) toBasePane
(TerminalPosition position) Translates a position local to the container to the base pane's coordinate space.toGlobal
(TerminalPosition position) Translates a position local to the container to global coordinate space.void
updateLookupMap
(InteractableLookupMap interactableLookupMap) Takes a lookup map and updates it with information about where all the interactables inside of this container are located.Methods inherited from class com.googlecode.lanterna.gui2.AbstractComposite
containsComponent, getChildCount, getChildren, getChildrenList, getComponent, handleInput, nextFocus, previousFocus
Methods inherited from class com.googlecode.lanterna.gui2.AbstractComponent
addTo, calculatePreferredSize, draw, getGlobalPosition, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTheme, getThemeDefinition, hasParent, isInside, isVisible, onAdded, onAfterDrawing, onBeforeDrawing, onRemoved, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, setTheme, setVisible, withBorder
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.googlecode.lanterna.gui2.Component
addTo, getGlobalPosition, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTheme, getThemeDefinition, hasParent, isInside, isVisible, onAdded, onRemoved, setLayoutData, setPosition, setPreferredSize, setSize, setTheme, setVisible, withBorder
Methods inherited from interface com.googlecode.lanterna.gui2.TextGUIElement
draw
-
Field Details
-
Constructor Details
-
ContentHolder
ContentHolder()
-
-
Method Details
-
getMenuBar
-
isInvalid
public boolean isInvalid()Description copied from interface:TextGUIElement
Checks if this element (or any of its child components, if any) has signaled that what it's currently displaying is out of date and needs re-drawing.- Specified by:
isInvalid
in interfaceTextGUIElement
- Overrides:
isInvalid
in classAbstractComposite<Container>
- Returns:
true
if the component is invalid and needs redrawing,false
otherwise
-
invalidate
public void invalidate()Description copied from interface:Component
Marks the component as invalid and requiring to be re-drawn at next opportunity. Container components should take this as a hint to layout the child components again.- Specified by:
invalidate
in interfaceComponent
- Overrides:
invalidate
in classAbstractComposite<Container>
-
updateLookupMap
Description copied from interface:Container
Takes a lookup map and updates it with information about where all the interactables inside of this container are located.- Specified by:
updateLookupMap
in interfaceContainer
- Overrides:
updateLookupMap
in classAbstractComposite<Container>
- Parameters:
interactableLookupMap
- Interactable map to update
-
setComponent
Description copied from interface:Composite
Sets the component which is inside this Composite. If you call this method with null, it removes the component wrapped by this Composite.- Specified by:
setComponent
in interfaceComposite
- Overrides:
setComponent
in classAbstractComposite<Container>
- Parameters:
component
- Component to wrap
-
removeComponent
Description copied from interface:Container
Removes the component from the container. This should remove the component from the Container's internal data structure as well as call the onRemoved(..) method on the component itself if it was found inside the container.- Specified by:
removeComponent
in interfaceContainer
- Overrides:
removeComponent
in classAbstractComposite<Container>
- Parameters:
component
- Component to remove from the Container- Returns:
true
if the component existed inside the container and was removed,false
otherwise
-
getTextGUI
Description copied from interface:Component
Returns the TextGUI that this component is currently part of. If the component hasn't been added to any container or in any other way placed into a GUI system, this method will return null.- Specified by:
getTextGUI
in interfaceComponent
- Overrides:
getTextGUI
in classAbstractComponent<Container>
- Returns:
- The TextGUI that this component belongs to, or null if none
-
createDefaultRenderer
Description copied from class:AbstractComponent
When you create a custom component, you need to implement this method and return a Renderer which is responsible for taking care of sizing the component, rendering it and choosing where to place the cursor (if Interactable). This value is intended to be overridden by custom themes.- Specified by:
createDefaultRenderer
in classAbstractComponent<Container>
- Returns:
- Renderer to use when sizing and drawing this component
-
toGlobal
Description copied from interface:Component
Translates a position local to the container to global coordinate space. This should be the absolute coordinate in the terminal screen, taking no windows or containers into account. If the component belongs to no base pane, it will returnnull
.- Specified by:
toGlobal
in interfaceComponent
- Overrides:
toGlobal
in classAbstractComponent<Container>
- Parameters:
position
- Position to translate (relative to the container's top-left corner)- Returns:
- Position in global (or absolute) coordinates, or
null
if the component is an orphan
-
toBasePane
Description copied from interface:Component
Translates a position local to the container to the base pane's coordinate space. For a window-based GUI, this be a coordinate in the window's coordinate space. If the component belongs to no base pane, it will returnnull
.- Specified by:
toBasePane
in interfaceComponent
- Overrides:
toBasePane
in classAbstractComponent<Container>
- Parameters:
position
- Position to translate (relative to the container's top-left corner)- Returns:
- Position in base pane space, or
null
if the component is an orphan
-
getBasePane
Description copied from interface:Component
Returns the BasePane that this container belongs to. In a window-based GUI system, this will be a Window.- Specified by:
getBasePane
in interfaceComponent
- Overrides:
getBasePane
in classAbstractComponent<Container>
- Returns:
- The base pane this component is placed on, or
null
if none