Ejemplo n.º 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);
    }
  }
Ejemplo n.º 2
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);
    }
  }