LinearLayout

open class LinearLayout<T : GameComponentView>(    posX: Number = 0,     posY: Number = 0,     width: Number = DEFAULT_LINEAR_LAYOUT_WIDTH,     height: Number = DEFAULT_LINEAR_LAYOUT_HEIGHT,     spacing: Number = DEFAULT_LINEAR_LAYOUT_SPACING,     visual: Visual = Visual.EMPTY,     orientation: Orientation = Orientation.HORIZONTAL,     alignment: Alignment = Alignment.TOP_LEFT) : GameComponentContainer<T>

A LinearLayout may be used to visualize a zone containing GameComponentViews.

GameComponentViews inside the container get placed according to the specified Orientation and Alignment. A spacing between components may be specified which may also be negative e.g. components like playing cards should overlap.

Visualization:

The Visual is used to visualize a background.

If all components are still within bounds with the user defined spacing, the user defined spacing gets used to space the components. Otherwise, the biggest possible spacing is used so that all components are still withing bounds of the LinearLayout.

Parameters

posX

horizontal coordinate for this LinearLayout. Default: 0.

posY

vertical coordinate for this LinearLayout. Default: 0.

width

width for this LinearLayout. Default: DEFAULT_LINEAR_LAYOUT_WIDTH.

height

height for this LinearLayout. Default: DEFAULT_LINEAR_LAYOUT_HEIGHT.

spacing

spacing between contained GameComponentViews. Default: DEFAULT_LINEAR_LAYOUT_SPACING.

visual

Visual to be used for this LinearLayout.

orientation

orientation for this LinearLayout. Default: Orientation.HORIZONTAL.

alignment

specifies how the contained GameComponentViews should be aligned. Default: Alignment.TOP_LEFT.

Constructors

Link copied to clipboard
fun LinearLayout(    posX: Number = 0,     posY: Number = 0,     width: Number = 0,     height: Number = 0,     spacing: Number = 0,     visual: Visual = Visual.EMPTY,     orientation: Orientation = Orientation.HORIZONTAL,     verticalAlignment: VerticalAlignment = VerticalAlignment.TOP,     horizontalAlignment: HorizontalAlignment = HorizontalAlignment.LEFT)

Secondary constructor taking separate alignment components.

Link copied to clipboard
fun LinearLayout(    posX: Number = 0,     posY: Number = 0,     width: Number = DEFAULT_LINEAR_LAYOUT_WIDTH,     height: Number = DEFAULT_LINEAR_LAYOUT_HEIGHT,     spacing: Number = DEFAULT_LINEAR_LAYOUT_SPACING,     visual: Visual = Visual.EMPTY,     orientation: Orientation = Orientation.HORIZONTAL,     alignment: Alignment = Alignment.TOP_LEFT)

Creates a LinearLayout.

Functions

Link copied to clipboard
fun add(component: T, index: Int = observableComponents.size)
Link copied to clipboard
fun addAll(vararg components: T)

Adds all GameComponentViews passed as varargs to this GameComponentContainer.

fun addAll(collection: Collection<T>)

Adds all GameComponentViews contained in collection to this GameComponentContainer.

Link copied to clipboard
fun addComponentsListener(listener: ValueObserver<List<T>>)

Adds a ValueObserver on the observableComponents list.

Link copied to clipboard
fun clear(): List<T>
Link copied to clipboard
fun clearComponentsListener()

Removes all listeners from the observableComponents list.

Link copied to clipboard
open fun forEach(p0: Consumer<in T>)
Link copied to clipboard
fun isEmpty(): Boolean

Returns whether the components list is empty.

Link copied to clipboard
fun isNotEmpty(): Boolean

Returns whether the components list is not empty.

Link copied to clipboard
open operator override fun iterator(): Iterator<T>

Returns an iterator over the elements of this GameComponentContainer.

Link copied to clipboard
fun numberOfComponents(): Int

Returns the size of the components list.

Link copied to clipboard
fun offset(offsetX: Number, offsetY: Number)

Adds an offset to this ComponentView's Position.

Link copied to clipboard
fun remove(component: T): Boolean

Removes the GameComponentView specified by the parameter from this GameComponentContainer.

Link copied to clipboard
fun removeAll(predicate: (T) -> Boolean): Boolean

Removes all GameComponentViews matching the predicate from this GameComponentContainer.

fun removeAll(collection: Collection<T>): Boolean

Removes all GameComponentViews contained in collection from this GameComponentContainer.

Link copied to clipboard
fun removeComponentsListener(listener: ValueObserver<List<T>>)

Removes a listener from the observableComponents list.

Link copied to clipboard
fun removeFromParent(): ComponentView

Removes this component from its parent.

Link copied to clipboard
fun reposition(posX: Number, posY: Number)

Repositions this ComponentView to the specified coordinates.

Link copied to clipboard
fun resize(width: Number, height: Number)

Resizes this ComponentView to the specified width and height.

Link copied to clipboard
fun rotate(degrees: Number)

Rotates this ComponentView by the given number of degrees.

Link copied to clipboard
fun scale(scalar: Number)

Scales this ComponentView by the given scalar.

Link copied to clipboard
fun scaleX(scalar: Number)

Scales this ComponentView's width by the given scalar.

Link copied to clipboard
fun scaleY(scalar: Number)

Scales this ComponentView's height by the given scalar.

Link copied to clipboard
open override fun setZIndex(component: T, zIndex: Int)

Puts the component in the appropriate place compared to the other observableComponents by the zIndex.

Link copied to clipboard
open fun spliterator(): Spliterator<T>
Link copied to clipboard
fun toBack()

Puts the ComponentView to the back inside its parent and Changes its zIndex accordingly.

open override fun toBack(component: T)

Puts the component to the back inside the LayeredContainer and Changes its zIndex accordingly.

Link copied to clipboard
fun toFront()

Puts the ComponentView to the front inside its parent and Changes its zIndex accordingly.

open override fun toFront(component: T)

Puts the component to the front inside the LayeredContainer and Changes its zIndex accordingly.

Properties

Link copied to clipboard
var actualHeight: Double

The actual height for this ComponentView considering scale.

Link copied to clipboard
var actualPosX: Double

Horizontal position of this ComponentView considering scale.

Link copied to clipboard
var actualPosY: Double

Vertical position of this ComponentView considering scale.

Link copied to clipboard
var actualWidth: Double

The actual width for this ComponentView considering scale.

Link copied to clipboard
var alignment: Alignment
Link copied to clipboard
val alignmentProperty: Property<Alignment>
Link copied to clipboard
var components: List<T>

GameComponentViews that are contained in this GameComponentContainer.

Link copied to clipboard
var dropAcceptor: (DragEvent) -> Boolean?

Returns whether this ComponentView is a valid drop target for the dragged component in the given DragEvent or not.

Link copied to clipboard
var height: Double

The height for this ComponentView.

Link copied to clipboard
val heightProperty: DoubleProperty

Property for the height of this ComponentView.

Link copied to clipboard
var isDisabled: Boolean

Controls if user input events cause input functions of this ComponentView to get invoked.

Link copied to clipboard
val isDisabledProperty: BooleanProperty

Property that controls if user input events cause input functions of this ComponentView to get invoked.

Link copied to clipboard
var isDraggable: Boolean

Controls whether component is draggable or not.

Link copied to clipboard
val isDraggableProperty: BooleanProperty

Property that controls whether component is draggable or not.

Link copied to clipboard
var isDragged: Boolean

Reflects whether component is currently dragged or not.

Link copied to clipboard
val isDraggedProperty: ReadonlyBooleanProperty

Property that reflects whether component is currently dragged or not.

Link copied to clipboard
var isFocusable: Boolean

Controls whether this ComponentView is focusable or not.

Link copied to clipboard
val isFocusableProperty: BooleanProperty

Property that controls whether this ComponentView is focusable or not.

Link copied to clipboard
var isVisible: Boolean

Visibility of this ComponentView.

Link copied to clipboard
val isVisibleProperty: BooleanProperty

Property for the visibility of this ComponentView.

Link copied to clipboard
var layoutBounds: CoordinatePlain

Returns a CoordinatePlain containing the component's corner Coordinates and its layout bounds.

Link copied to clipboard
var name: String

Name field only for debugging purposes. Has no effect on rendering.

Link copied to clipboard
var onAdd: T.() -> Unit?

onAdd gets invoked anytime after a GameComponentView is added to this GameComponentContainer with the added GameComponentView as its receiver.

Link copied to clipboard
var onDragDropped: (DragEvent) -> Unit?

Gets invoked with a DragEvent whenever a drag and drop gesture finishes over this ComponentView and the dropAcceptor returns true for the given DragEvent.

Link copied to clipboard
var onDragGestureEnded: (DropEvent, Boolean) -> Unit?

Gets invoked with a DragEvent whenever a drag gesture has ended on this rendered ComponentView.

Link copied to clipboard
var onDragGestureEntered: (DragEvent) -> Unit?

Gets invoked with a DragEvent whenever the mouse enters this ComponentView while performing a drag gesture.

Link copied to clipboard
var onDragGestureExited: (DragEvent) -> Unit?

Gets invoked with a DragEvent whenever the mouse leaves this ComponentView while performing a drag gesture.

Link copied to clipboard
var onDragGestureMoved: (DragEvent) -> Unit?

Gets invoked with a DragEvent whenever a mouse movement occurs during a drag gesture on this ComponentView.

Link copied to clipboard
var onDragGestureStarted: (DragEvent) -> Unit?

Gets invoked with a DragEvent whenever a drag gesture is started on this ComponentView.

Link copied to clipboard
var onKeyPressed: (KeyEvent) -> Unit?

Gets invoked with a KeyEvent whenever a key is pressed while this ComponentView has focus.

Link copied to clipboard
var onKeyReleased: (KeyEvent) -> Unit?

Gets invoked with a KeyEvent whenever a key is released while this ComponentView has focus.

Link copied to clipboard
var onKeyTyped: (KeyEvent) -> Unit?

Gets invoked with a KeyEvent whenever a Character is typed while this ComponentView has focus. Gets invoked after onKeyPressed.

Link copied to clipboard
var onMouseClicked: (MouseEvent) -> Unit?

Gets invoked with a MouseEvent whenever the mouse is clicked inside this ComponentView. Gets invoked after onMousePressed and onMouseReleased.

Link copied to clipboard
var onMouseEntered: (MouseEvent) -> Unit?

Gets invoked with a MouseEvent whenever the mouse enters this ComponentView.

Link copied to clipboard
var onMouseExited: (MouseEvent) -> Unit?

Gets invoked with a MouseEvent whenever the mouse leaves this ComponentView.

Link copied to clipboard
var onMousePressed: (MouseEvent) -> Unit?

Gets invoked with a MouseEvent whenever the mouse is pressed inside this ComponentView.

Link copied to clipboard
var onMouseReleased: (MouseEvent) -> Unit?

Gets invoked with a MouseEvent whenever the mouse is released inside this ComponentView.

Link copied to clipboard
var onRemove: T.() -> Unit?

onRemove gets invoked anytime after a GameComponentView is removed from this GameComponentContainer with the removed GameComponentView as its receiver.

Link copied to clipboard
var onScroll: (ScrollEvent) -> Unit?

Gets invoked with a ScrollEvent whenever the mouse wheel is turned while the mouse is inside this ComponentView.

Link copied to clipboard
var opacity: Double

Opacity of this ComponentView.

Link copied to clipboard
val opacityProperty: LimitedDoubleProperty

Property for the opacity of this ComponentView.

Link copied to clipboard
var orientation: Orientation
Link copied to clipboard
val orientationProperty: Property<Orientation>
Link copied to clipboard
var parent: ComponentView?

The parent of this ComponentView.

Link copied to clipboard
var posX: Double

Horizontal position of this ComponentView.

Link copied to clipboard
val posXProperty: DoubleProperty

Property for the horizontal position of this ComponentView.

Link copied to clipboard
var posY: Double

Vertical position of this ComponentView.

Link copied to clipboard
val posYProperty: DoubleProperty

Property for the vertical position of this ComponentView.

Link copied to clipboard
var rotation: Double

Rotation of this ComponentView in degrees.

Link copied to clipboard
val rotationProperty: DoubleProperty

Property for the rotation of this ComponentView in degrees.

Link copied to clipboard
var scale: Double

Scale of this ComponentView.

Link copied to clipboard
var scaleX: Double

Horizontal scale of this ComponentView.

Link copied to clipboard
val scaleXProperty: DoubleProperty

Property for the horizontal scale of this ComponentView.

Link copied to clipboard
var scaleY: Double

Vertical scale of this ComponentView.

Link copied to clipboard
val scaleYProperty: DoubleProperty

Property for the vertical scale of this ComponentView.

Link copied to clipboard
var spacing: Double

Spacing for this LinearLayout.

Link copied to clipboard
val spacingProperty: DoubleProperty

Property for the spacing of GameComponentViews in this LinearLayout.

Link copied to clipboard
open var visual: Visual

Current Visual.

Link copied to clipboard
var width: Double

The width for this ComponentView.

Link copied to clipboard
val widthProperty: DoubleProperty

Property for the width of this ComponentView.

Link copied to clipboard
var zIndex: Int

for the order of ComponentView inside of parent.#

Link copied to clipboard
val zIndexProperty: IntegerProperty

Property for the order of ComponentView inside of parent.#