Example #1
0
  public String getFormString() {
    if (_form != null) return _form;
    HtmlComponent comp = getParent();

    while (comp != null) {
      if (comp instanceof JspForm) {
        _form = "document.forms['" + getPortletNameSpace() + comp.getName() + "'].";
        break;
      }
      comp = comp.getParent();
    }
    if (_form == null)
      if (_formNo == -1) _form = "document.forms[0].";
      else _form = "document.forms[" + _formNo + "].";
    return _form;
  }
Example #2
0
  /**
   * This will return the full name of the component. The full name is the name of the component
   * appended to the names of its parent components and seperated by underscores. For example if
   * this is a button named "button1" inside a table named "table1" the full name for this component
   * would be "table1_button1".
   */
  public String getFullName() {
    if (_fullName == null) {
      HtmlComponent parent = _parent;
      String name = _name;
      // no need to create a new string for every time through the loop
      String parentName = null;
      //
      while (parent != null) {
        parentName = parent.getName();
        if (parentName != null) {
          if (parentName != "") {
            name = parentName + "_" + name;
          }
        }
        parent = parent.getParent();
      }
      _fullName = getPortletNameSpace() + name;
    }

    return _fullName;
  }