Example #1
0
 /**
  * Creates a new block box from the given element with the given parent. No style is assigned to
  * the resulting box.
  *
  * @param parent The parent box in the tree of boxes.
  * @param n The element that this box belongs to.
  * @param replaced When set to <code>true</code>, a replaced block box will be created. Otherwise,
  *     a normal non-replaced block will be created.
  * @return The new block box.
  */
 protected BlockBox createBlock(BlockBox parent, Element n, boolean replaced) {
   BlockBox root;
   if (replaced) {
     BlockReplacedBox rbox =
         new BlockReplacedBox(
             (Element) n,
             (Graphics2D) parent.getGraphics().create(),
             parent.getVisualContext().create());
     rbox.setViewport(viewport);
     rbox.setContentObj(
         new ReplacedImage(rbox, rbox.getVisualContext(), baseurl, n.getAttribute("src")));
     root = rbox;
   } else {
     root =
         new BlockBox(
             (Element) n,
             (Graphics2D) parent.getGraphics().create(),
             parent.getVisualContext().create());
     root.setViewport(viewport);
   }
   root.setBase(baseurl);
   root.setParent(parent);
   root.setContainingBlock(parent);
   root.setClipBlock(viewport);
   root.setOrder(next_order++);
   return root;
 }