Ejemplo n.º 1
0
 public HtmlInsets getMarginInsets() {
   HtmlInsets mi = this.marginInsets;
   if (mi != INVALID_INSETS) {
     return mi;
   }
   AbstractCSS2Properties props = this.getCssProperties();
   if (props == null) {
     mi = null;
   } else {
     mi = HtmlValues.getMarginInsets(props, this);
   }
   if (mi == null) {
     int hspace = 0;
     int vspace = 0;
     boolean createNew = false;
     String hspaceText = this.element.getAttribute("hspace");
     if (hspaceText != null && hspaceText.length() != 0) {
       createNew = true;
       try {
         hspace = Integer.parseInt(hspaceText);
       } catch (NumberFormatException nfe) {
         // TODO: Percentages?
       }
     }
     String vspaceText = this.element.getAttribute("vspace");
     if (vspaceText != null && vspaceText.length() != 0) {
       createNew = true;
       try {
         vspace = Integer.parseInt(vspaceText);
       } catch (NumberFormatException nfe) {
         // TODO: Percentages?
       }
     }
     if (createNew) {
       mi = new HtmlInsets();
       mi.top = vspace;
       mi.topType = HtmlInsets.TYPE_PIXELS;
       mi.bottom = vspace;
       mi.bottomType = HtmlInsets.TYPE_PIXELS;
       mi.left = hspace;
       mi.leftType = HtmlInsets.TYPE_PIXELS;
       mi.right = hspace;
       mi.rightType = HtmlInsets.TYPE_PIXELS;
     }
   }
   this.marginInsets = mi;
   return mi;
 }