Package pi.graphics.boxes
Class LeafBox
java.lang.Object
pi.graphics.boxes.Box
pi.graphics.boxes.LeafBox
- Direct Known Subclasses:
CompassBox,DimensionBox,EllipseBox,ImageBox,TextBox
Eine Box, die keine weiteren Kinder hat.
Im Boxenbaum handelt es sich um einen Blattknoten.
-
Field Summary
Fields inherited from class pi.graphics.boxes.Box
childs, definedHeight, definedWidth, disabled, height, measureDimensionTwice, parent, supportsDefinedDimension, width, x, y -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBerechnet rekursiv alle Ankerpunkte (linkes oberes Eck) der untergeordneten Kinder-Boxen.intGibt die Anzahl an Kinder-Boxen zurück.Methods inherited from class pi.graphics.boxes.Box
anchor, calculateDimension, debug, disable, disabled, enable, height, height, iterator, measure, measureAnchors, measureDimension, remeasure, render, toggle, toString, toStringFormatter, width, width, x, x, y, yMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LeafBox
public LeafBox()
-
-
Method Details
-
numberOfChilds
public int numberOfChilds()Description copied from class:BoxGibt die Anzahl an Kinder-Boxen zurück.- Specified by:
numberOfChildsin classBox- Returns:
- Die Anzahl an Kinder-Boxen.
-
calculateAnchors
protected void calculateAnchors()Description copied from class:BoxBerechnet rekursiv alle Ankerpunkte (linkes oberes Eck) der untergeordneten Kinder-Boxen. Die inneren Blattboxen brauchen diese Methode nicht zu implementieren.Single-Child-Code-Beispiel
protected void calculateAnchors() { child.x = x + margin; child.y = y + margin; }Multiple-Child-Code-Beispiel
protected void calculateAnchors() { int yCursor = y; for (Box child : childs) { child.x = x; child.y = yCursor; yCursor += child.height; } }- Specified by:
calculateAnchorsin classBox
-