parent.getStyle().setPosition(Position.RELATIVE);
parent.appendChild(relativeRuler = createRuler(EM, EX));
}
public void layout(Layer layer) {
Style style = layer.container.getStyle();
style.setProperty("left", layer.setLeft
? (layer.left + layer.leftUnit.getType()) : "");
style.setProperty("top", layer.setTop
? (layer.top + layer.topUnit.getType()) : "");
style.setProperty("right", layer.setRight
? (layer.right + layer.rightUnit.getType()) : "");
style.setProperty("bottom", layer.setBottom
? (layer.bottom + layer.bottomUnit.getType()) : "");
style.setProperty("width", layer.setWidth
? (layer.width + layer.widthUnit.getType()) : "");
style.setProperty("height", layer.setHeight
? (layer.height + layer.heightUnit.getType()) : "");
style = layer.child.getStyle();
switch (layer.hPos) {
case BEGIN:
style.clearLeft();
break;
case END:
style.clearLeft();
style.setRight(0, Unit.PX);
break;
case STRETCH:
style.setLeft(0, Unit.PX);
style.setRight(0, Unit.PX);
break;
}
switch (layer.vPos) {
case BEGIN:
style.clearTop();
break;
case END:
style.clearTop();
style.setBottom(0, Unit.PX);
break;
case STRETCH:
style.setTop(0, Unit.PX);
style.setBottom(0, Unit.PX);
break;
}
}