Ejemplo n.º 1
0
  /**
   * Gets a new or existing HTMLText and initialize its bounding box. If this hasn't previously been
   * generated, its processed now by initializing its format tokens.
   *
   * @param applet Applet holding this. This is used to locate text in the window.
   * @param g Graphics to retrieve the font metrics from.
   * @param zone Zone holding this properties.
   * @param transfo Transformation to locate this.
   * @param center Center of this before transformation.
   * @param supCtr Center of this parent Satellite (Place center).
   * @param key A key to get this HTMLText if it's already stored in zone.
   * @return A new or existing HTMLText whose bounds are initilized.
   * @throws UnsupportedEncodingException
   */
  protected HTMLText getHText(
      WPSApplet applet,
      Graphics g,
      ActiveZone zone,
      Transfo transfo,
      Point center,
      Point supCtr,
      Long key) // throws UnsupportedEncodingException
      {
    HTMLText htmlTxt = null;
    Object data = zone.m_datas.get(key);

    if (center == null) center = supCtr;

    if (data == null) {
      String lines = parseString(TEXT_VAL, zone, true);

      if (lines.length() > 0) {
        FontX font = getFont(FONT_VAL, zone);

        htmlTxt =
            new HTMLText(
                getColor(IN_COL_VAL, zone),
                getColor(OUT_COL_VAL, zone),
                ((ColorX) getValue(TEXT_COL_VAL, zone)).m_color,
                font.getInt(FontX.SIZE_VAL, zone),
                font.getFlags(zone),
                font.getString(FontX.NAME_VAL, zone),
                Integer.parseInt(getString(BLUR_COL_VAL, zone)),
                getInt(ROUNDED_COL_VAL, zone),
                getFlags(zone),
                new Insets(0, 2, 0, 2));
        htmlTxt.parseText(g, lines);
        htmlTxt.setTextBnds(
            applet.getSize(), getFlags(zone), zone.m_flags, transfo, supCtr, center);
      }
    } else {
      htmlTxt = (HTMLText) data;
      htmlTxt.setTextBnds(applet.getSize(), getFlags(zone), zone.m_flags, transfo, supCtr, center);
    }

    return htmlTxt;
  }