/** @param b */
  public void setUsePopup(boolean b, boolean useModal) {
    _usePopup = b;
    /* Claudio Pi - 5/25/04 Added for modal popup windows */
    _useModal = useModal;

    if (_usePopup) {
      _browseImage.setVisible(false);
      _browsePopupImageLink.setVisible(true);
    } else {
      _browseImage.setVisible(true);
      _browsePopupImageLink.setVisible(false);
    }
  }
 /**
  * Sets the flag for ability to respond to user input (true = does respond).
  *
  * @param enabled boolean
  */
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   if (_editHandle instanceof HtmlFormComponent)
     ((HtmlFormComponent) _editHandle).setEnabled(enabled);
   if (_usePopup) _browsePopupImageLink.setVisible(enabled);
   else _browseImage.setVisible(enabled);
 }
  /**
   * LookUp constructor.
   *
   * @param name - name of component
   * @param lookup_page - the page that will provide the lookup values
   * @param browseImage - the browse image to use. default is a magnifying glass
   * @param ds - DataStore that is being used with this component
   * @param tableName - table name to bind to
   * @param columnName - column name to bind to
   * @param dataType - data type of the main edit field ( use DataStore.DATATYPE_*)
   * @param pKey - flag that signifies if the column is a primary key column
   * @param p - page the component will be associated with
   */
  public HtmlLookUpComponent(
      String name,
      String lookup_page,
      String browseImage,
      DataStore ds,
      String tableName,
      String columnName,
      int dataType,
      boolean pKey,
      HtmlPage p) {
    super(name, p);

    _hiddenDescriptionHandle = new HtmlHiddenField("hiddenDescr", null, p);
    addCompositeComponent(_hiddenDescriptionHandle, DataStore.DATATYPE_STRING, false, null, null);
    _hiddenKeyHandle = new HtmlHiddenField("hiddenKey", null, p);
    addCompositeComponent(_hiddenKeyHandle, DataStore.DATATYPE_STRING, false, null, null);
    _hiddenKeyHandle.setVisible(false);

    setTheme(null);
    p.addPageListener(this);

    HtmlTextEdit edit = null;

    if (ds == null) {
      edit = new HtmlTextEdit("_edit", p);
      _editHandle = addCompositeComponent(edit, dataType, false, null, null);
    } else {
      _ds = ds;
      /** Don't add the same column twice to the data store. */
      if (_ds.getColumnIndex(tableName + "." + columnName) == -1) {
        if (_ds instanceof DataStore)
          ((DataStore) _ds).addColumn(tableName, columnName, dataType, pKey, true);
      }
      edit = new HtmlTextEdit(tableName + "_" + columnName, p);
      edit.setColumn(_ds, tableName + "." + columnName);

      _editHandle = addCompositeComponent(edit, dataType, true, tableName, columnName);
    }

    _browseImage = new HtmlSubmitImage("browseImage", browseImage, p);
    _browseImage.addSubmitListener(this);
    _browseImageHandle = addCompositeComponent(_browseImage, DATATYPE_ANY, false, null, null);

    _browsePopupImage = new HtmlImage("browsPopupImage", browseImage, p);
    _browsePopupImageLink = new HtmlLink("browsePopupImageLink", null, p);
    _browsePopupImageLink.add(_browsePopupImage);
    _browseImageHandle =
        addCompositeComponent(_browsePopupImageLink, DATATYPE_ANY, false, null, null);
    _browsePopupImageLink.setVisible(false);

    setLookUpPageURL(lookup_page);
    setDescriptionFont(null);
  }
 /**
  * Sets the flag for ability to respond to user input (true = does respond).
  *
  * @param enabled boolean
  */
 public void setReadOnly(boolean enabled) {
   // super.setEnabled(enabled);
   if (_editHandle instanceof HtmlTextEdit) ((HtmlTextEdit) _editHandle).setReadOnly(enabled);
   if (_usePopup) _browsePopupImageLink.setVisible(!enabled);
   else _browseImage.setVisible(!enabled);
 }