private void generateDivHtml(PrintWriter p, int rowNo) throws DataStoreException {
   if (!_showDescription) return;
   if (_editDescription) return;
   p.print(_fontStartTag);
   p.print("<span id=\"div");
   p.print(getFullName());
   if (rowNo != -1) p.print("_" + rowNo);
   p.print("\">");
   if (_descriptionEval != null) {
     if (rowNo == -1) rowNo = _descriptionEval.getDataStore().getRow();
     Object o = _descriptionEval.evaluateRow(rowNo);
     if (o != null) {
       p.print(o);
       _hiddenDescriptionHandle.setValue(o.toString());
     } else {
       _hiddenDescriptionHandle.setValue(null);
     }
   } else {
     // Take the description from the hidden field value
     p.print(
         _hiddenDescriptionHandle.getValue() == null ? "" : _hiddenDescriptionHandle.getValue());
   }
   p.print("</span>");
   p.print(_fontEndTag);
 }
Exemple #2
0
  public void generateHTML(java.io.PrintWriter p, int rowNo) throws java.io.IOException {
    try {
      if (_dsEval != null) {
        Object res;

        if (rowNo > -1) res = _dsEval.evaluateRow(rowNo);
        else res = _dsEval.evaluateRow();

        if (res == null) _html = null;
        else _html = res.toString();
      }
    } catch (Exception e) {
    }
    if (!getVisible()) return;

    if (_in != null) {
      BufferedReader buf = new BufferedReader(new InputStreamReader(_in, "ISO8859_1"));
      char[] c = new char[1024];
      int bytesRead = 0;
      while (true) {
        bytesRead = buf.read(c, 0, 1024);
        if (bytesRead <= 0) break;
        p.write(c, 0, bytesRead);
      }
      buf.close();
      return;
    }

    if (_html == null) return;

    p.print(_html);
  }
  public void generateHTML(java.io.PrintWriter p, int rowNo) throws Exception {
    if (!getVisible()) {
      return;
    }

    processLocaleInfo();

    //
    String name = getFullName();

    if (rowNo > -1) {
      name += ("_" + rowNo);
    }

    //
    String jScript = "";
    String out = "";

    if ((_iFrame != null) && (_iFrameUrl == null)) {
      String uName = getPage().getClass().getName();
      int pos = uName.lastIndexOf(".");

      if (pos > -1) {
        uName = uName.substring(pos + 1);
      }

      uName += ("-" + _iFrame.getName() + "FrameComponent");
      _iFrameUrl = uName;
    }

    if (_dsEval != null) {
      if (rowNo > -1) {
        _source = _dsEval.evaluateRowFormat(rowNo);
      } else {
        _source = _dsEval.evaluateRowFormat();
      }
    }

    String source = _source;
    source = translateSiteMapURL(source);

    if (_generateImage) {
      // sr 11-01-2000 this replaces the call to generateImageURL() in the
      // constructor
      if (_imageURL == null) {
        _imageURL = generateImageURL();
      }

      source = _imageURL + "default.dgif";
      source = translateSiteMapURL(source);

      if (!_useCache) {
        source += ("?ct=" + _count++);
      }
    }

    // ALT
    String alt = _alt;

    if (_altEval != null) {
      if (rowNo > -1) {
        alt = _altEval.evaluateRowFormat(rowNo);
      } else {
        alt = _altEval.evaluateRowFormat();
      }
    }

    String onClick = _onClick;
    String valScript =
        HtmlValidatorText.generateOnClickJavaScriptForButtons(_onClick, _listeners, getFullName());

    if (valScript != null) {
      out += valScript;
      onClick =
          "return " + HtmlValidatorText.generateOnClickJavaScriptFunctionName(getFullName()) + ";";
    }

    //
    if (!_enabled) {
      if (_generateImage) {
        source = _imageURL + "disabled.dgif";
        source = translateSiteMapURL(source);
      }

      out +=
          ("<IMG NAME=\""
              + getFullName()
              + "\" BORDER=\""
              + _border
              + "\" NAME=\""
              + name
              + "\" SRC=\""
              + source
              + "\"");

      if (!Util.isNull(alt) && !Util.isEmpty(alt)) {
        out += (" ALT=\"" + alt + "\"");
      }

      // HSPACE
      if (_hSpace > -1) {
        out += (" HSPACE=\"" + _hSpace + "\"");
      }

      // VSPACE
      if (_vSpace > -1) {
        out += (" VSPACE=\"" + _vSpace + "\"");
      }

      // ALIGN
      if ((_align > ALIGN_NONE) && (_align < _alignTypes.length)) {
        out += (" ALIGN=\"" + _alignTypes[_align] + "\"");
      }

      if (Util.isFilled(getStyle())) {
        out += (" style=\"" + getStyle() + "\"");
      }

      // onmouseover EVENT
      if (_onmouseover != null) {
        out += (" ONMOUSEOVER=\"" + _onmouseover + "\"");
      }

      // onmouseout EVENT
      if (_onmouseout != null) {
        out += (" ONMOUSEOUT=\"" + _onmouseout + "\"");
      }

      if (_tabIndex != null) {
        out += (" tabindex=\"" + _tabIndex + "\"");
      }

      if (_accessKey != null) {
        out += (" accesskey=\"" + _accessKey + "\"");
      }

      out += ">";
    } else {
      if ((_iFrame == null)
          || ((jScript = getPage().getSubmitJavaScript(this, _iFrameUrl, _iFrame)) == null)) {
        out += ("<INPUT TYPE=\"IMAGE\" BORDER=\"" + _border + "\" NAME=\"" + name + "\"");

        // ALT
        if (!Util.isNull(alt) && !Util.isEmpty(alt)) {
          out += (" ALT=\"" + alt + "\"");
        }

        // HSPACE
        if (_hSpace > -1) {
          out += (" HSPACE=\"" + _hSpace + "\"");
        }

        // VSPACE
        if (_vSpace > -1) {
          out += (" VSPACE=\"" + _vSpace + "\"");
        }

        // ALIGN
        if ((_align > ALIGN_NONE) && (_align < _alignTypes.length)) {
          out += (" ALIGN=\"" + _alignTypes[_align] + "\"");
        }

        // STYLE
        if (Util.isFilled(getStyle())) {
          out += (" style=\"" + getStyle() + "\"");
        }

        // onmouseover EVENT
        if (_onmouseover != null) {
          out += (" ONMOUSEOVER=\"" + _onmouseover + "\"");
        }

        // onmouseout EVENT
        if (_onmouseout != null) {
          out += (" ONMOUSEOUT=\"" + _onmouseout + "\"");
        }

        if (_tabIndex != null) {
          out += (" tabindex=\"" + _tabIndex + "\"");
        }

        if (_accessKey != null) {
          out += (" accesskey=\"" + _accessKey + "\"");
        }

        // title
        if (_title != null) out += " TITLE=\"" + _title + "\"";

        out +=
            (" SRC=\""
                + source
                + "\""
                + (((onClick != null) && !onClick.trim().equals(""))
                    ? (" onClick=\"" + onClick + "\"")
                    : "")
                + ">");
      } else {
        out +=
            ("<A NAME=\"" + getFullName() + "LINKANCHOR\" HREF=\"javascript:" + jScript + "\" >");
        out +=
            ("<IMG NAME=\""
                + getFullName()
                + "\" BORDER=\""
                + _border
                + "\" NAME=\""
                + name
                + "\" SRC=\""
                + source
                + "\"");

        // ALT
        if (!Util.isNull(alt) && !Util.isEmpty(alt)) {
          out += (" ALT=\"" + alt + "\"");
        }

        // HSPACE
        if (_hSpace > -1) {
          out += (" HSPACE=\"" + _hSpace + "\"");
        }

        // VSPACE
        if (_vSpace > -1) {
          out += (" VSPACE=\"" + _vSpace + "\"");
        }

        // ALIGN
        if ((_align > ALIGN_NONE) && (_align < _alignTypes.length)) {
          out += (" ALIGN=\"" + _alignTypes[_align] + "\"");
        }

        //			STYLE
        if (Util.isFilled(getStyle())) {
          out += (" style=\"" + getStyle() + "\"");
        }

        if (_tabIndex != null) {
          out += (" tabindex=\"" + _tabIndex + "\"");
        }

        if (_accessKey != null) {
          out += (" accesskey=\"" + _accessKey + "\"");
        }

        // onmouseover EVENT
        if (_onmouseover != null) {
          out += (" ONMOUSEOVER=\"" + _onmouseover + "\"");
        }

        // onmouseout EVENT
        if (_onmouseout != null) {
          out += (" ONMOUSEOUT=\"" + _onmouseout + "\"");
        }

        out += "></A>";
      }
    }

    p.print(out);
  }