Class LeafBox

java.lang.Object
pi.graphics.boxes.Box
pi.graphics.boxes.LeafBox
All Implemented Interfaces:
Iterable<Box>
Direct Known Subclasses:
CompassBox, DimensionBox, EllipseBox, ImageBox, TextBox

public abstract class LeafBox extends Box
Eine Box, die keine weiteren Kinder hat.

Im Boxenbaum handelt es sich um einen Blattknoten.

  • Constructor Details

    • LeafBox

      public LeafBox()
  • Method Details

    • numberOfChilds

      public int numberOfChilds()
      Description copied from class: Box
      Gibt die Anzahl an Kinder-Boxen zurück.
      Specified by:
      numberOfChilds in class Box
      Returns:
      Die Anzahl an Kinder-Boxen.
    • calculateAnchors

      protected void calculateAnchors()
      Description copied from class: Box
      Berechnet 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:
      calculateAnchors in class Box