Example #1
0
  protected DisplayStyle getDisplayStyle(Script script) {
    Label label = (Label) this.getComponent();

    if (dirty) {
      lastLocalStyle =
          new DisplayStyle(
              label.getBackColor(),
              label.getForeColor(),
              label.getFont(),
              label.getBorder(),
              label.getHorizontalAlignment(),
              label.getVerticalAlignment(),
              label.getFormat(),
              label.isWordwrap());
    }

    DisplayStyle classStyle = null;

    if (dirty) {
      try {
        DisplayStyle newStyle = (DisplayStyle) this.lastLocalStyle.clone();

        if (classStyle != null) {
          newStyle.apply(classStyle, classStyle);
        }

        DisplayStyle matched = matches(newStyle);

        if (matched == null) {
          lastStyle = newStyle;

          getStyleManager(script).add(lastStyle);
        } else {
          lastStyle = matched;
        }
      } catch (CloneNotSupportedException e) {
        e.printStackTrace();
      }

      dirty = false;
    }

    return lastStyle;
  }
Example #2
0
  /**
   * DOCUMENT ME!
   *
   * @param context DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  public View print(Context context) {
    Script script = context.getScript();
    doBeforePrint(script);

    Label label = (Label) this.getComponent();
    TextView e = null;

    if (isVisible(script)) {
      DisplayStyle css = getDisplayStyle(script);

      String caption = getText(script);

      e = createView(script, caption, css);

      Hyperlink link = label.getHyperlink();

      if (link != null) {
        this.printHyperlink(script, e, link);
      }

      String tooltip = label.getTooltipText();

      if (tooltip != null) {
        this.printTooltipText(script, e, tooltip);
      }

      setAutoSize(e, script);

      this.setLayoutRule(e, script);
      e.setData(this.getLastValue());
    }

    doAfterPrint(script);

    this.done = this.unprinted == null;

    return e;
  }