コード例 #1
0
 /**
  * Fetches the attributes to use when rendering. This is implemented to multiplex the attributes
  * specified in the model with a StyleSheet.
  */
 public AttributeSet getAttributes() {
   if (attr == null) {
     StyleSheet sheet = getStyleSheet();
     attr = sheet.getViewAttributes(this);
   }
   return attr;
 }
コード例 #2
0
  /** Update any cached values that come from attributes. */
  protected void setPropertiesFromAttributes() {

    // update attributes
    StyleSheet sheet = getStyleSheet();
    attr = sheet.getViewAttributes(this);

    // Reset the painter
    painter = sheet.getBoxPainter(attr);
    if (attr != null) {
      setInsets(
          (short) painter.getInset(TOP, this),
          (short) painter.getInset(LEFT, this),
          (short) painter.getInset(BOTTOM, this),
          (short) painter.getInset(RIGHT, this));
    }

    // Get the width/height
    cssWidth = (CSS.LengthValue) attr.getAttribute(CSS.Attribute.WIDTH);
    cssHeight = (CSS.LengthValue) attr.getAttribute(CSS.Attribute.HEIGHT);
  }