Пример #1
0
  /**
   * Replaces the default browse image with one you specify
   *
   * @param comp - component that is replacing the browse image
   * @param dataType - data type of the component being replaced ( use DataStore.DATATYPE_*)
   * @param bound - flag that signifies if the component is bound to a datastore column
   * @param table - table component is bound to
   * @param column - column component is bound to
   */
  public void replaceBrowseImage(
      HtmlComponent comp, int dataType, boolean bound, String table, String column) {
    try {

      /** get the index of the edit field so we can replace it */
      if (_usePopup) {
        int browseIndex = _componentsVec.indexOf(_browsePopupImageHandle);
        if (browseIndex != -1) {
          replaceCompositeComponent(comp, _browsePopupImageHandle, dataType, bound, table, column);
          _componentsVec.setElementAt(comp, browseIndex);
          comp.setParent(this);
          _browsePopupImageHandle = comp;
        }
      } else {
        int browseIndex = _componentsVec.indexOf(_browseImageHandle);
        if (browseIndex != -1) {
          replaceCompositeComponent(comp, _browseImageHandle, dataType, bound, table, column);
          _componentsVec.setElementAt(comp, browseIndex);
          comp.setParent(this);
          _browseImageHandle = comp;
        }
      }
    } catch (Exception e) {
      MessageLog.writeErrorMessage("replaceBrowseImage", e, this);
    }
  }
Пример #2
0
 /**
  * This method returns whether or not the component is visible. If it is not visible, no HTML will
  * be generated.
  *
  * @param checkParents A boolean value, true mean that this component is considered visible if it
  *     and all it's parents are visible. A false value only checks the component itself.
  */
 public boolean getVisible(boolean checkParents) {
   if (!_visible) return false;
   boolean bVisible = _visible;
   if (checkParents) {
     HtmlComponent hc = getParent();
     while (hc != null) {
       if (hc.getVisible() == false) {
         bVisible = false;
         break;
       }
       hc = hc.getParent();
     }
   }
   return bVisible;
 }
Пример #3
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;
  }
Пример #4
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;
  }
Пример #5
0
  /**
   * Replaces the default edit field with one you specify
   *
   * @param comp - component that is replacing the edit field
   * @param dataType - data type of the component being replaced ( use DataStore.DATATYPE_*)
   * @param bound - flag that signifies if the component is bound to a datastore column
   * @param table - table component is bound to
   * @param column - column component is bound to
   */
  public void replaceEdit(
      HtmlComponent comp, int dataType, boolean bound, String table, String column) {
    try {

      /** get the index of the edit field so we can replace it */
      int editIndex = _componentsVec.indexOf(_editHandle);
      if (editIndex != -1) {
        replaceCompositeComponent(comp, _editHandle, dataType, bound, table, column);
        comp.setParent(this);
        _editHandle = comp;
      }
    } catch (Exception e) {
      MessageLog.writeErrorMessage("replaceEdit", e, this);
    }
  }
Пример #6
0
  /**
   * Add a form component value to the url line of a popup request
   *
   * @param comp The component to get the value from
   * @param requestParmName The name of the parameter to add to the URL line
   */
  public void addFormComponentValueToPopup(HtmlComponent comp, String requestParmName) {
    if (comp == null) return;
    if (_popupURLLineValues == null) _popupURLLineValues = new Vector<FormComponentInfo>();

    boolean isInDataTable = false;
    HtmlComponent parent = comp.getParent();
    while (parent != null) {
      if (parent instanceof JspDataTable
          || parent instanceof JspList
          || parent instanceof HtmlDataTable) {
        isInDataTable = true;
        break;
      }
      parent = parent.getParent();
    }

    if (comp instanceof HtmlLookUpComponent) comp = ((HtmlLookUpComponent) comp).getEditField();
    String name = comp.getFormString() + comp.getFullName();
    FormComponentInfo inf = new FormComponentInfo();
    inf.attName = requestParmName;
    inf.compName = name;
    inf.isInDataTable = isInDataTable;
    _popupURLLineValues.add(inf);
  }