MultiElementContainer
com.jsmacrosce.wagyourgui.containers.MultiElementContainer
Base for WagYourGUI groups that track widgets registered with a parent, along with shared geometry and font state.
Subclasses provide their own initialization and rendering behavior; this base does not automatically render registered widgets.
Given an existing subclass instance, this function hides its tracked widgets and returns their count without clearing or unregistering them. The stored visibility flag is not a universal rendering guard for subclasses.
js
function hideGroup(container) {
container.setVisible(false);
return container.getButtons().size();
}Type Parameters
T: parent type implementingIContainerParent
Constructors
new MultiElementContainer
new MultiElementContainer(int x, int y, int width, int height, Font textRenderer, T extends IContainerParent parent)#Stores the container geometry, font, and parent without initializing or registering widgets.
Parameters:
x: left coordinate in GUI spacey: top coordinate in GUI spacewidth: container width in GUI unitsheight: container height in GUI unitstextRenderer: non-null font used by subclassesparent: non-null parent used for widget registration and overlay routing
Fields
height
height: int#Stored height in GUI units; changing it does not resize registered widgets.
parent
Non-null parent reference used to register widgets and route overlay operations.
width
width: int#Stored width in GUI units; changing it does not resize registered widgets.
x
x: int#Stored left coordinate in GUI space; changing it does not move registered widgets.
y
y: int#Stored top coordinate in GUI space; changing it does not move registered widgets.
Methods
addRenderableWidget
addRenderableWidget(T extends GuiEventListener & Renderable & NarratableEntry drawableElement): T extends GuiEventListener & Renderable & NarratableEntry#Tracks a widget locally, registers it with the parent, and returns the supplied reference. The value must be an
AbstractWidget; an object satisfying only the declared interfaces fails the cast before tracking or delegation. The widget is tracked before parent registration, with no rollback if registration fails. Duplicates are not filtered, the parent's return value is ignored and the stored visibility flag is not applied.Parameters:
drawableElement: non-nullAbstractWidgetsupporting those interfaces
Type Parameters:
T: widget type supporting GUI input, rendering, and narration
Returns: the supplied widget reference
getButtons
getButtons(): List<AbstractWidget>#Returns the live mutable list of widgets tracked by this container; mutations do not register or unregister widgets with the parent.
Returns: the current mutable tracked-widget list, not a copy; external mutations affect later tracking-based operations
getFirstOverlayParent
getFirstOverlayParent(): IOverlayParent#Returns the parent lookup result for the nearest overlay-capable host in the standard parent hierarchy.
Returns: the parent's nearest overlay-capable host lookup result
getVisible
getVisible(): boolean#Returns this container's stored visibility flag, initially
true; this need not match every widget or determine whether a subclass submits content.Returns: the stored container visibility flag
init
init(): void#Clears this container's current tracked-widget list; it does not unregister those widgets from the parent, reset stored geometry or reset the visibility flag.
openOverlay
openOverlay(OverlayContainer overlay): void#Delegates opening the overlay to the parent, which applies its default overlay policy. Standard WagYourGUI hosts initialize it at the deepest available overlay level, saving and disabling that level's existing button active states.
Parameters:
overlay: non-null overlay to open through the parent
openOverlay(OverlayContainer overlay, boolean disableButtons): void#Delegates opening the overlay and button policy unchanged to the parent. In standard WagYourGUI hosts, the overlay is initialized at the deepest available level; disabling buttons affects only the hosting level.
Parameters:
overlay: non-null overlay to open through the parentdisableButtons: whether to save and disable existing button active states at the hosting level; false leaves those states unchanged
removeWidget
removeWidget(GuiEventListener button): void#Removes the first matching entry from this container's tracked list, then delegates the same widget to the parent even when it was not tracked locally. Duplicate entries may remain; a parent failure does not roll back local removal.
Parameters:
button: widget to remove
render
render(GuiGraphics drawContext, int mouseX, int mouseY, float delta): void#Subclass hook for rendering container-specific content; parent widget registration does not invoke this hook automatically. Subclasses decide what to render and whether to honor the stored visibility flag; there is no base rendering body.
Parameters:
drawContext: graphics context for drawingmouseX: mouse x-coordinate in GUI spacemouseY: mouse y-coordinate in GUI spacedelta: frame value supplied by the caller
setPos
setPos(int x, int y, int width, int height): void#Stores the container position and dimensions; this base implementation does not reposition or resize registered widgets.
Parameters:
x: left coordinate in GUI spacey: top coordinate in GUI spacewidth: width in GUI unitsheight: height in GUI units
setVisible
setVisible(boolean visible): void#Sets the visibility and active state of currently tracked widgets, then stores the container flag. Earlier independent visible and active states are overwritten rather than saved for restoration. Later registrations do not automatically inherit this flag; untracked widgets and child overlays are not changed.
Parameters:
visible:trueto show and activate tracked widgets, orfalseto hide and deactivate them