Package com.google.minijoe.html.css

Examples of com.google.minijoe.html.css.Style


  /**
   * Draws the text.
   */
  public void drawContent(Graphics g, int dx, int dy) {
    // System.out.println("drawing tfw: "+text);
    Style style = element.getComputedStyle();
    Font font = style.getFont();
    int textColor = style.getValue(Style.COLOR);
    if (isFocused() && !element.isFocused()) {
      element.setFocused();
    }
    boolean focus = element.isFocused();

View Full Code Here


    if (type == Skin.INPUT_TYPE_BUTTON || type == Skin.INPUT_TYPE_IMAGE) {
      super.calculateWidth(containerWidth);
      return;
    }

    Style style = element.getComputedStyle();
    int fh = style.getFont().getHeight();

    int right = style.getPx(Style.MARGIN_RIGHT, containerWidth);
    int left = style.getPx(Style.MARGIN_LEFT, containerWidth);

    int w;

    if (style.lengthIsFixed(Style.WIDTH, false)) {
      w = left + style.getPx(Style.WIDTH, containerWidth) + right;
    } else {
      switch (type) {
        case Skin.INPUT_TYPE_CHECKBOX:
        case Skin.INPUT_TYPE_RADIOBUTTON:
        case Skin.INPUT_TYPE_OPTION:
        case Skin.INPUT_TYPE_SUBMIT:
        case Skin.INPUT_TYPE_RESET:
          w = Skin.get().calculateWidth(type, style.getFont(), text) + left + right;
          break;

        case Skin.INPUT_TYPE_SELECT:
          int longest = 0;
          String longestText = "";
          for (int i = 0; i < element.getChildCount(); i++) {
            if (element.getChildType(i) == Element.ELEMENT) {
              Element option = element.getElement(i);
              if ("option".equals(option.getName())) {
                String s = option.getText();
                if (text == null || option.getAttributeBoolean("selected")) {
                  text = s;
                }
                int l = style.getFont().stringWidth(s);
                if (l > longest) {
                  longest = l;
                  longestText = s;
                }
              }
            }
          }
          w = Skin.get().calculateWidth(type, style.getFont(), longestText) + left + right;
          break;

        case Skin.INPUT_TYPE_TEXTAREA:
          w = element.getAttributeInt("cols", 40) * fh / 2;
          break;
View Full Code Here

      super.doLayout(outerMaxWidth, viewportWidth, border, shrinkWrap);
      return;
    }

    this.containingWidth = outerMaxWidth;
    Style style = element.getComputedStyle();
    int top = style.getPx(Style.MARGIN_TOP, outerMaxWidth);
    int bottom = style.getPx(Style.MARGIN_BOTTOM, outerMaxWidth);
    int fh = style.getFont().getHeight();

    boxWidth = Math.min(outerMaxWidth, style.lengthIsFixed(Style.WIDTH, true)
        ? getSpecifiedWidth(outerMaxWidth) : getMinimumWidth(outerMaxWidth));

    switch(type) {
      case Skin.INPUT_TYPE_TEXTAREA:
        String rowsAttr = element.getAttributeValue("rows");
        int rows = rowsAttr == null ? 3 : Integer.parseInt(rowsAttr);
        boxHeight = rows * fh + 6 + top + bottom;
        break;
      default:
        boxHeight = Skin.get().calculateHeight(type, style.getFont()) + top + bottom;
    }   

    setWidth(boxWidth);
    setHeight(boxHeight);
  }
View Full Code Here

  if (type == Skin.INPUT_TYPE_BUTTON || type == Skin.INPUT_TYPE_IMAGE) {
      super.drawContent(g, dx, dy);
      return;
  }

    Style style = element.getComputedStyle();

    int top = style.getPx(Style.MARGIN_TOP, containingWidth);
    int right = style.getPx(Style.MARGIN_RIGHT, containingWidth);
    int bottom = style.getPx(Style.MARGIN_BOTTOM, containingWidth);
    int left = style.getPx(Style.MARGIN_LEFT, containingWidth);

    int w = boxWidth - left - right;
    int h = boxHeight - bottom - top;

    dx += left + boxX;
    dy += top + boxY;

    Font font = style.getFont();
    int color = style.getValue(Style.COLOR);
    boolean selected = false;

    switch(type) {
      case Skin.INPUT_TYPE_OPTION: 
        selected = element.getAttributeBoolean("selected");
View Full Code Here

TOP

Related Classes of com.google.minijoe.html.css.Style

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.