Module com.googlecode.lanterna
Package com.googlecode.lanterna.gui2
Class AbstractBasePane.ContentHolder
- java.lang.Object
-
- com.googlecode.lanterna.gui2.AbstractComponent<T>
-
- 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>
protected class AbstractBasePane.ContentHolder extends AbstractComposite<Container>
-
-
Constructor Summary
Constructors Constructor Description ContentHolder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentRenderer<Container>createDefaultRenderer()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).BasePanegetBasePane()Returns the BasePane that this container belongs to.private MenuBargetMenuBar()TextGUIgetTextGUI()Returns the TextGUI that this component is currently part of.voidinvalidate()Marks the component as invalid and requiring to be re-drawn at next opportunity.booleanisInvalid()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.booleanremoveComponent(Component component)Removes the component from the container.voidsetComponent(Component component)Sets the component which is inside this Composite.private voidsetMenuBar(MenuBar menuBar)TerminalPositiontoBasePane(TerminalPosition position)Translates a position local to the container to the base pane's coordinate space.TerminalPositiontoGlobal(TerminalPosition position)Translates a position local to the container to global coordinate space.voidupdateLookupMap(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 Detail
-
menuBar
private MenuBar menuBar
-
-
Method Detail
-
setMenuBar
private void setMenuBar(MenuBar menuBar)
-
getMenuBar
private MenuBar getMenuBar()
-
isInvalid
public boolean isInvalid()
Description copied from interface:TextGUIElementChecks 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:
isInvalidin interfaceTextGUIElement- Overrides:
isInvalidin classAbstractComposite<Container>- Returns:
trueif the component is invalid and needs redrawing,falseotherwise
-
invalidate
public void invalidate()
Description copied from interface:ComponentMarks 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:
invalidatein interfaceComponent- Overrides:
invalidatein classAbstractComposite<Container>
-
updateLookupMap
public void updateLookupMap(InteractableLookupMap interactableLookupMap)
Description copied from interface:ContainerTakes a lookup map and updates it with information about where all the interactables inside of this container are located.- Specified by:
updateLookupMapin interfaceContainer- Overrides:
updateLookupMapin classAbstractComposite<Container>- Parameters:
interactableLookupMap- Interactable map to update
-
setComponent
public void setComponent(Component component)
Description copied from interface:CompositeSets the component which is inside this Composite. If you call this method with null, it removes the component wrapped by this Composite.- Specified by:
setComponentin interfaceComposite- Overrides:
setComponentin classAbstractComposite<Container>- Parameters:
component- Component to wrap
-
removeComponent
public boolean removeComponent(Component component)
Description copied from interface:ContainerRemoves 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:
removeComponentin interfaceContainer- Overrides:
removeComponentin classAbstractComposite<Container>- Parameters:
component- Component to remove from the Container- Returns:
trueif the component existed inside the container and was removed,falseotherwise
-
getTextGUI
public TextGUI getTextGUI()
Description copied from interface:ComponentReturns 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:
getTextGUIin interfaceComponent- Overrides:
getTextGUIin classAbstractComponent<Container>- Returns:
- The TextGUI that this component belongs to, or null if none
-
createDefaultRenderer
protected ComponentRenderer<Container> createDefaultRenderer()
Description copied from class:AbstractComponentWhen 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:
createDefaultRendererin classAbstractComponent<Container>- Returns:
- Renderer to use when sizing and drawing this component
-
toGlobal
public TerminalPosition toGlobal(TerminalPosition position)
Description copied from interface:ComponentTranslates 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:
toGlobalin interfaceComponent- Overrides:
toGlobalin classAbstractComponent<Container>- Parameters:
position- Position to translate (relative to the container's top-left corner)- Returns:
- Position in global (or absolute) coordinates, or
nullif the component is an orphan
-
toBasePane
public TerminalPosition toBasePane(TerminalPosition position)
Description copied from interface:ComponentTranslates 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:
toBasePanein interfaceComponent- Overrides:
toBasePanein classAbstractComponent<Container>- Parameters:
position- Position to translate (relative to the container's top-left corner)- Returns:
- Position in base pane space, or
nullif the component is an orphan
-
getBasePane
public BasePane getBasePane()
Description copied from interface:ComponentReturns the BasePane that this container belongs to. In a window-based GUI system, this will be a Window.- Specified by:
getBasePanein interfaceComponent- Overrides:
getBasePanein classAbstractComponent<Container>- Returns:
- The base pane this component is placed on, or
nullif none
-
-