Esempio n. 1
0
  private DisplayStyle matches(DisplayStyle tmp) {
    Iterator it = csses.iterator();

    while (it.hasNext()) {
      DisplayStyle css = (DisplayStyle) it.next();

      if (css.equals(tmp)) {
        return css;
      }
    }

    csses.add(tmp);

    return null;
  }
Esempio n. 2
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;
  }