Esempio n. 1
0
  /**
   * This method removes a crumble object from the cookie crumble. And all ones that follow.
   *
   * @param key - name of crumble you are looking for
   */
  public void trimCrumble(String key) {
    if (key == null) {
      return;
    } else {
      JspCrumbleObject cro = (JspCrumbleObject) _hashCrumble.get(key);

      if (cro == null) {
        return;
      }

      int i = _arrCrumble.size() - 1;
      int stopIndex = _arrCrumble.indexOf(cro);

      for (; i >= stopIndex; i--) {
        cro = (JspCrumbleObject) _arrCrumble.remove(i);
        _hashCrumble.remove(cro.getName());
      }
    }
  }
Esempio n. 2
0
  /**
   * This method will generate the html for each component in the page
   *
   * @param p - PrintWriter
   * @param rowNo - rowNo
   * @throws Exception
   */
  public void generateHTML(PrintWriter p, int rowNo) throws Exception {
    if (!_visible) {
      return;
    }

    // for each item in list
    JspCrumbleObject cro = null;
    HtmlText htText = null;
    HtmlText separatorText = null;
    HtmlLink hlLink = null;

    _cont.removeAll();

    int arrSize = _arrCrumble.size();

    if (arrSize <= 0) {
      return;
    }

    //  MessageLog.writeDebugMessage(" 1 generateHTML arrSize=" + arrSize, this);
    String croText = null;
    String croHref = null;

    for (int i = 0; i < arrSize; i++) {
      //      MessageLog.writeDebugMessage(" 1 generateHTML i=" + i, this);
      // create a link with text in it
      cro = (JspCrumbleObject) _arrCrumble.get(i);
      htText = null;
      croHref = cro.getHref();
      croText = cro.getText();

      if (Util.isFilled(croHref)) {
        htText = new HtmlText(croText, getCrumbleLinkFont(), getPage());
        htText.setFixSpecialHtmlCharacters(isFixSpecialHtmlCharacters());
        hlLink = new HtmlLink("hlLink" + i, croHref, getPage());
        hlLink.add(htText);
      } else {
        htText = new HtmlText(croText, getCrumbleFont(), getPage());
        htText.setFixSpecialHtmlCharacters(isFixSpecialHtmlCharacters());
      }

      // add link
      // add :
      String separator = getSeparator();

      if (!Util.isFilled(separator)) {
        separator = " : ";
      }

      separatorText = new HtmlText(separator, getCrumbleLinkFont(), getPage());
      separatorText.setFixSpecialHtmlCharacters(isFixSpecialHtmlCharacters());

      if (Util.isFilled(croHref)) {
        _cont.add(hlLink);
      } else {
        _cont.add(htText);
      }

      if (i < (arrSize - 1)) {
        _cont.add(separatorText);
      }
    }

    _cont.generateHTML(p, rowNo);
  }
Esempio n. 3
0
 /**
  * This method adds a crumble object to the cookie crumble.
  *
  * @param cro
  */
 public void addCrumble(JspCrumbleObject cro) {
   _arrCrumble.add(cro);
   _hashCrumble.put(cro.getName(), cro);
 }