Пример #1
0
 public void addElement(Element el, BoxBounds bounds) {
   Layer layer = new Layer(el, bounds);
   layers.add(layer);
   el.getStyle().setPosition(Style.Position.ABSOLUTE);
   presetLayerBounds(layer);
   container.appendChild(el);
 }
Пример #2
0
 /**
  * set container
  *
  * @param container container
  * @return content layer
  */
 public Element init(
     Element container, int insetLeft, int insetTop, int insetRight, int insetBottom) {
   this.container = container;
   if (!"absolute".equals(container.getStyle().getPosition())
       && !"relative".equals(container.getStyle().getPosition())) {
     container.getStyle().setPosition(Style.Position.RELATIVE);
   }
   Element contentLayer = DOM.createDiv();
   contentLayer.getStyle().setPosition(Style.Position.ABSOLUTE);
   if (insetTop > 0) contentLayer.getStyle().setPaddingTop(insetTop, Style.Unit.PX);
   if (insetLeft > 0) contentLayer.getStyle().setPaddingLeft(insetLeft, Style.Unit.PX);
   if (insetRight > 0) contentLayer.getStyle().setPaddingRight(insetRight, Style.Unit.PX);
   if (insetBottom > 0) contentLayer.getStyle().setPaddingBottom(insetBottom, Style.Unit.PX);
   container.appendChild(contentLayer);
   return contentLayer;
 }