Exemplo n.º 1
0
 private void alignLineAreas(BlockArea b, LayoutState ls) {
   BlockAlignment alignment = ls.getReferenceAlignment();
   ReferenceArea r = ls.getReferenceArea();
   double measure = r.isVertical() ? r.getWidth() : r.getHeight();
   double consumed = 0;
   int numChildren = 0;
   for (AreaNode c : b.getChildren()) {
     consumed += c.getBPD();
     ++numChildren;
   }
   double available = measure - consumed;
   if (available > 0) {
     if (alignment == BlockAlignment.BEFORE) {
       // no-op
     } else if (alignment == BlockAlignment.AFTER) {
       // no-op
     } else if (alignment == BlockAlignment.CENTER) {
       // no-op
     } else {
       justifyLineAreas(b, measure, consumed, numChildren, alignment);
     }
   } else if (available < 0) {
     b.setOverflow(-available);
   }
 }