Class SimpleContainer
- java.lang.Object
-
- be.yildizgames.common.util.BaseRegisterable
-
- be.yildizgames.module.graphic.gui.internal.BaseElement
-
- be.yildizgames.module.graphic.gui.internal.BaseWidget
-
- be.yildizgames.module.graphic.gui.internal.impl.SimpleContainer
-
public abstract class SimpleContainer extends BaseWidget implements Container
A container holding Widget.- Author:
- Grégory Van Den Borre
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface be.yildizgames.module.graphic.gui.internal.Element
Element.Alignment
-
-
Field Summary
-
Fields inherited from class be.yildizgames.module.graphic.gui.internal.BaseWidget
emptyZones
-
Fields inherited from class be.yildizgames.module.graphic.gui.internal.BaseElement
MAX_OPACITY, virtualHeight
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleContainer(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material backgroundMaterial, boolean widget)Full container.protectedSimpleContainer(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material backgroundMaterial, SimpleContainer parent, boolean widget)Full container.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChildrenLeft(int left)Move all children left or right by adding a value to its current x value.voidaddChildrenPosition(int left, int top)Move all children by adding a value to its current position.protected abstract voidaddChildrenPositionImpl(int left, int top)Implementation specific add children position.voidaddChildrenTop(int top)Move all children up or down by adding a value to its current y value.protected voidaddEmptyZoneImpl(be.yildizgames.common.geometry.Rectangle zone)voidaddWidget(ContainerChild child)voiddisableHighlight()abstract StringgetElementName(int x, int y)StringgetElementName(be.yildizgames.module.window.input.MousePosition position)Retrieve a child element from its position.List<Widget>getElements(be.yildizgames.common.geometry.Rectangle rectangle)Retrieve all child elements contained in a rectangle.MaterialgetMaterial()WidgetgetNextFocusableElement()Get the next child with focusable status.Optional<Widget>getWidgetAt(int x, int y)Optional<Widget>getWidgetAt(be.yildizgames.module.window.input.MousePosition position)ZordergetZ()voidhideContent()Hide all the container sub elements.protected voidhighlightImpl(boolean over)Does nothing.voidignore(ContainerChild widget)voidremove(BaseContainerChild element)Remove and delete a Widget from the GuiContainer.voidremove(ContainerChild child)voidsetContentVisible(boolean visible)Show or hide the content of this container.voidsetCurrentFocus(ContainerChild widget)Set a child widget as focused.voidsetCurrentFocus(Widget focus)voidsetMaterial(Material newMaterial)Set the GuiContainer material.protected abstract voidsetMaterialImpl(Material newMaterial)Set the Material in implementation.voidsetZ(Zorder z)Set the container Z order.protected abstract voidsetZImpl(Zorder z)Implementation specific to set the Z order.voidshowContent()Show all the container sub elements.voidzoom(float zoomFactor)Make a zoom on the container.protected abstract voidzoomImpl(float factor)Zoom the GuiContainer in implementation.-
Methods inherited from class be.yildizgames.module.graphic.gui.internal.BaseWidget
addEmptyZone, addKeyboardListener, addMouseDoubleLeftClickListener, addMouseDragListener, addMouseLeftClickListener, addMouseMoveListener, addMouseReleaseListener, addMouseRightClickListener, addMouseWheelListener, addOnMouseOverListener, align, contains, contains, disableEmptyZone, enableEmptyZone, findParent, focus, forceContainsFalse, getAbsoluteLeft, getAbsolutePosition, getAbsoluteTop, highlight, isContainer, isFocusable, isMouseOver, keyPressed, mouseLeftClick, playAnimation, registerAnimation, removeAllClickListeners, setFocusable, setHighlightable, setMouseClickActive, setMouseOver, specialKeyPressed, stopAnimation, toString
-
Methods inherited from class be.yildizgames.module.graphic.gui.internal.BaseElement
addToLeft, addToPosition, addToTop, delete, getBottom, getCoordinates, getHeight, getLeft, getOpacity, getRight, getTop, getWidth, hide, hideImpl, isVisible, multiplySize, resetVirtualHeight, setCoordinates, setHeight, setLeft, setLeft, setLeft, setLeft, setPosition, setPosition, setPositionImpl, setSize, setSize, setSizeImpl, setTop, setTop, setTop, setTop, setVirtualHeight, setVisible, setWidth, show, showImpl, updateAddPositionValue
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface be.yildizgames.module.graphic.gui.container.Container
disableEmptyZone, enableEmptyZone, getAbsolutePosition, keyPressed
-
Methods inherited from interface be.yildizgames.module.graphic.gui.internal.Element
addToLeft, addToPosition, addToTop, getBottom, getCoordinates, getHeight, getLeft, getRight, getTop, getWidth, hide, isVisible, resetVirtualHeight, setCoordinates, setHeight, setLeft, setLeft, setLeft, setLeft, setPosition, setPosition, setSize, setSize, setTop, setTop, setTop, setTop, setVirtualHeight, setVisible, setWidth, show
-
Methods inherited from interface be.yildizgames.module.graphic.gui.Widget
addEmptyZone, addKeyboardListener, addMouseDoubleLeftClickListener, addMouseDragListener, addMouseLeftClickListener, addMouseMoveListener, addMouseReleaseListener, addMouseRightClickListener, addMouseWheelListener, addOnMouseOverListener, align, contains, contains, focus, getAbsoluteLeft, getAbsoluteTop, highlight, isFocusable, playAnimation, registerAnimation, removeAllClickListeners, stopAnimation
-
-
-
-
Constructor Detail
-
SimpleContainer
protected SimpleContainer(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material backgroundMaterial, SimpleContainer parent, boolean widget)
Full container.- Parameters:
name- Container name, must be unique.coordinates- Container size and position.backgroundMaterial- The Material to use for background.parent- Parent container.widget- Flag to set this container being considered as container or widget.
-
SimpleContainer
protected SimpleContainer(String name, be.yildizgames.module.coordinate.BaseCoordinate coordinates, Material backgroundMaterial, boolean widget)
Full container.- Parameters:
name- Container name, must be unique.coordinates- Container size and position.backgroundMaterial- The Material to use for background.widget- Flag to set this container being considered as container or widget.
-
-
Method Detail
-
zoom
public final void zoom(float zoomFactor)
Make a zoom on the container.- Parameters:
zoomFactor- Zoom value.
-
showContent
public final void showContent()
Show all the container sub elements.- Specified by:
showContentin interfaceContainer
-
hideContent
public final void hideContent()
Hide all the container sub elements.- Specified by:
hideContentin interfaceContainer
-
getElementName
public final String getElementName(be.yildizgames.module.window.input.MousePosition position)
Retrieve a child element from its position.- Parameters:
position- Element position.- Returns:
- The element at the given position.
-
getElementName
public abstract String getElementName(int x, int y)
-
getElements
public final List<Widget> getElements(be.yildizgames.common.geometry.Rectangle rectangle)
Retrieve all child elements contained in a rectangle.- Parameters:
rectangle- Rectangle containing the elements.- Returns:
- All Widget in the rectangle.
-
addChildrenLeft
public final void addChildrenLeft(int left)
Move all children left or right by adding a value to its current x value.- Parameters:
left- Value to add to the children current x position.
-
addChildrenTop
public final void addChildrenTop(int top)
Move all children up or down by adding a value to its current y value.- Parameters:
top- Value to add to the children current y position.
-
addChildrenPosition
public final void addChildrenPosition(int left, int top)Move all children by adding a value to its current position.- Parameters:
left- Value to add to the children current x position.top- Value to add to the children current y position.
-
addEmptyZoneImpl
protected final void addEmptyZoneImpl(be.yildizgames.common.geometry.Rectangle zone)
- Specified by:
addEmptyZoneImplin classBaseWidget
-
addChildrenPositionImpl
protected abstract void addChildrenPositionImpl(int left, int top)Implementation specific add children position.- Parameters:
left- Value to add to the children current x position.top- Value to add to the children current y position.
-
ignore
public final void ignore(ContainerChild widget)
-
remove
public final void remove(BaseContainerChild element)
Remove and delete a Widget from the GuiContainer.- Parameters:
element- Element to remove.
-
highlightImpl
protected final void highlightImpl(boolean over)
Does nothing.- Specified by:
highlightImplin classBaseWidget- Parameters:
over- Unused.
-
zoomImpl
protected abstract void zoomImpl(float factor)
Zoom the GuiContainer in implementation.- Parameters:
factor- Factor of zoom.
-
setCurrentFocus
public final void setCurrentFocus(ContainerChild widget)
Set a child widget as focused.- Parameters:
widget- Child to focus.
-
getNextFocusableElement
public final Widget getNextFocusableElement()
Get the next child with focusable status.- Specified by:
getNextFocusableElementin interfaceContainer- Returns:
- The focusable child following the current focused child,
nullif none found.
-
setMaterial
public final void setMaterial(Material newMaterial)
Set the GuiContainer material.- Specified by:
setMaterialin interfaceContainer- Parameters:
newMaterial- Material to use for background..
-
setMaterialImpl
protected abstract void setMaterialImpl(Material newMaterial)
Set the Material in implementation.- Parameters:
newMaterial- New Material to use.
-
setContentVisible
public final void setContentVisible(boolean visible)
Show or hide the content of this container.- Parameters:
visible-truewill display the content,falsewill hide it.
-
setZ
public final void setZ(Zorder z)
Set the container Z order.
-
setZImpl
protected abstract void setZImpl(Zorder z)
Implementation specific to set the Z order.- Parameters:
z- Z order.
-
disableHighlight
public final void disableHighlight()
- Specified by:
disableHighlightin interfaceContainer
-
getWidgetAt
public final Optional<Widget> getWidgetAt(be.yildizgames.module.window.input.MousePosition position)
- Specified by:
getWidgetAtin interfaceContainer
-
getWidgetAt
public final Optional<Widget> getWidgetAt(int x, int y)
- Specified by:
getWidgetAtin interfaceContainer
-
getMaterial
public final Material getMaterial()
-
addWidget
public final void addWidget(ContainerChild child)
-
remove
public final void remove(ContainerChild child)
-
setCurrentFocus
public final void setCurrentFocus(Widget focus)
- Specified by:
setCurrentFocusin interfaceContainer
-
-