T
- Should always be itself, see AbstractComponent
Component
, Composite
, Container
, TextGUIElement
AbstractBasePane.ContentHolder
, AbstractBorder
public abstract class AbstractComposite<T extends Container> extends AbstractComponent<T> implements Composite, Container
Composite
implementations. A
Composite
component is one that encapsulates a single component, like borders. Because of this, a
Composite
can be seen as a special case of a Container
and indeed this abstract class does in fact
implement the Container
interface as well, to make the composites easier to work with internally.Constructor | Description |
---|---|
AbstractComposite() |
Default constructor
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
containsComponent(Component component) |
Returns
true if this container contains the supplied component either directly or indirectly through
intermediate containers. |
int |
getChildCount() |
Returns the number of children this container currently has
|
Collection<Component> |
getChildren() |
Returns collection that is to be considered a copy of the list of children contained inside of this object.
|
List<Component> |
getChildrenList() |
Returns list that is to be considered a copy of the list of children inside of this container.
|
Component |
getComponent() |
Returns the component that this Composite is wrapping
|
boolean |
handleInput(KeyStroke key) |
If an interactable component inside this container received a keyboard event that wasn't handled, the GUI system
will recursively send the event to each parent container to give each of them a chance to consume the event.
|
void |
invalidate() |
Marks the component as invalid and requiring to be re-drawn at next opportunity.
|
boolean |
isInvalid() |
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.
|
Interactable |
nextFocus(Interactable fromThis) |
Given an interactable, find the next one in line to receive focus.
|
Interactable |
previousFocus(Interactable fromThis) |
Given an interactable, find the previous one in line to receive focus.
|
boolean |
removeComponent(Component component) |
Removes the component from the container.
|
void |
setComponent(Component component) |
Sets the component which is inside this Composite.
|
void |
updateLookupMap(InteractableLookupMap interactableLookupMap) |
Takes a lookup map and updates it with information about where all the interactables inside of this container
are located.
|
addTo, calculatePreferredSize, createDefaultRenderer, draw, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, isInside, onAdded, onAfterDrawing, onBeforeDrawing, onRemoved, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, setTheme, toBasePane, toGlobal, withBorder
addTo, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, isInside, onAdded, onRemoved, setLayoutData, setPosition, setPreferredSize, setSize, setTheme, toBasePane, toGlobal, withBorder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
draw
public void setComponent(Component component)
Composite
setComponent
in interface Composite
component
- Component to wrappublic Component getComponent()
Composite
getComponent
in interface Composite
public int getChildCount()
Container
getChildCount
in interface Container
public List<Component> getChildrenList()
Container
getChildrenList
in interface Container
Container.getChildren()
public Collection<Component> getChildren()
Container
This method isn't deprecated but it should have originally been defined as returning a List instead of a
Collection. See getChildrenList
for a method with this signature.
getChildren
in interface Container
Container.getChildrenList()
public boolean containsComponent(Component component)
Container
true
if this container contains the supplied component either directly or indirectly through
intermediate containers.containsComponent
in interface Container
component
- Component to check if it's part of this containertrue
if the component is inside this Container, otherwise false
public boolean removeComponent(Component component)
Container
removeComponent
in interface Container
component
- Component to remove from the Containertrue
if the component existed inside the container and was removed, false
otherwisepublic boolean isInvalid()
TextGUIElement
isInvalid
in interface TextGUIElement
isInvalid
in class AbstractComponent<T extends Container>
true
if the component is invalid and needs redrawing, false
otherwisepublic void invalidate()
Component
invalidate
in interface Component
invalidate
in class AbstractComponent<T extends Container>
public Interactable nextFocus(Interactable fromThis)
Container
null
.public Interactable previousFocus(Interactable fromThis)
Container
null
.previousFocus
in interface Container
fromThis
- Component from which to get the previous interactable,
or if null, pick the last interactable in the listpublic boolean handleInput(KeyStroke key)
Container
false
if the implementer doesn't care about this particular keystroke and it will be automatically
sent up the hierarchy the to next container. If you return true
, the event will stop here and won't be
reported as unhandled.handleInput
in interface Container
key
- Keystroke that was ignored by the interactable inside this containertrue
if this event was handled by this container and shouldn't be processed anymore,
false
if the container didn't take any action on the event and want to pass it onpublic void updateLookupMap(InteractableLookupMap interactableLookupMap)
Container
updateLookupMap
in interface Container
interactableLookupMap
- Interactable map to updateCopyright © 2020. All rights reserved.