gt:             if (field.isIndexed() && field.isDisplayed()) {
context: /*
   * This library is part of OpenCms -
   * the Open Source Content Management System
   *
   * Copyright (c) Alkacon Software GmbH (http://www.alkacon.com)
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or (at your option) any later version.
   *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * For further information about Alkacon Software GmbH, please see the
   * company website: http://www.alkacon.com
   *
   * For further information about OpenCms, please see the
   * project website: http://www.opencms.org
   * 
   * You should have received a copy of the GNU Lesser General Public
   * License along with this library; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
  package org.opencms.workplace.tools.searchindex;
  
  import org.opencms.i18n.CmsMessages;
  import org.opencms.jsp.CmsJspActionElement;
  import org.opencms.main.CmsIllegalStateException;
  import org.opencms.main.OpenCms;
  import org.opencms.search.CmsSearch;
  import org.opencms.search.CmsSearchIndex;
  import org.opencms.search.CmsSearchParameters;
  import org.opencms.search.fields.CmsSearchField;
  import org.opencms.util.CmsStringUtil;
  import org.opencms.widgets.CmsCalendarWidget;
  import org.opencms.widgets.CmsCheckboxWidget;
  import org.opencms.widgets.CmsDisplayWidget;
  import org.opencms.widgets.CmsInputWidget;
  import org.opencms.widgets.CmsMultiSelectWidget;
  import org.opencms.widgets.CmsSelectWidget;
  import org.opencms.widgets.CmsSelectWidgetOption;
  import org.opencms.widgets.CmsVfsFileWidget;
  import org.opencms.workplace.CmsDialog;
  import org.opencms.workplace.CmsWidgetDialogParameter;
  import org.opencms.workplace.CmsWorkplaceSettings;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.Map;
  
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.jsp.PageContext;
  
  /**
   * A <code>{@link org.opencms.workplace.CmsWidgetDialog}</code> that performs a 
   * search on the <code>{@link org.opencms.search.CmsSearchIndex}</code> identified 
   * by request parameter 
   * <code>{@link org.opencms.workplace.tools.searchindex.A_CmsEditSearchIndexDialog#PARAM_INDEXNAME}</code> 
   * using an instance of <code>{@link org.opencms.search.CmsSearchParameters}</code> 
   * as widget object to fill. 
   * <p>
   * 
   * @since 6.0.0
   */
  public class CmsSearchWidgetDialog extends A_CmsEditSearchIndexDialog {
  
      /** The request parameter for the search object. **/
      public static final String PARAM_SEARCH_OBJECT = "searchobject";
  
      /** The request parameter for the search parameters. **/
      public static final String PARAM_SEARCH_PARAMS = "searchparams";
  
      /** The search instance used with the search parameters. **/
      protected CmsSearch m_search;
  
      /** The search parameter instance used for storing widget values and performing search.    */
      protected CmsSearchParameters m_searchParams;
  
      /**
       * Public constructor with JSP action element.<p>
       * 
       * @param jsp an initialized JSP action element
       */
      public CmsSearchWidgetDialog(CmsJspActionElement jsp) {
  
          super(jsp);
  
      }
  
      /**
       * Public constructor with JSP variables.<p>
       * 
       * @param context the JSP page context
       * @param req the JSP request
       * @param res the JSP response
       */
      public CmsSearchWidgetDialog(PageContext context, HttpServletRequest req, HttpServletResponse res) {
  
          this(new CmsJspActionElement(context, req, res));
  
      }
  
      /**
       * Overrides this action that is performed in case an element 
       * has been added to a widget parameter 
       * (<code>{@link org.opencms.workplace.CmsWidgetDialog#ACTION_ELEMENT_ADD}</code>) 
       * or removed 
       * (<code>{@link org.opencms.workplace.CmsWidgetDialog#ACTION_ELEMENT_REMOVE}</code>) 
       * from a widget parameter to additionally commit these values to the 
       * underlying lists.<p>
       * 
       * This is necessary because this dialog performs a search for every request 
       * (not only if OK is pressed, also if a category or field is added/removed). 
       * The search directly uses the underlying Lists of categories, fields,... . 
       * More precise: The very same lists that are in the search parameter instance used 
       * for search are contained as base collections of the widget parameters. 
       * Therefore before every search the changes of categories, fields,... have to 
       * be committed here.<p>
       * 
       * @see org.opencms.workplace.CmsWidgetDialog#actionToggleElement()
       */
      public void actionToggleElement() {
  
          super.actionToggleElement();
          commitWidgetValues();
      }
  
      /**
       * Builds the standard javascript for submitting the dialog.<p> 
       * 
       * Overridden to allow additional validation and encoding of the 
       * search query. <p>
       * 
       * @return the standard javascript for submitting the dialog
       */
      public String dialogScriptSubmit() {
  
          StringBuffer html = new StringBuffer(512);
          html.append(submitJS());
          html.append("function submitAction(actionValue, theForm, formName) {\n");
          html.append("\tif (theForm == null) {\n");
          html.append("\t\ttheForm = document.forms[formName];\n");
          html.append("\t}\n");
          html.append("\tvar queryOK = validateQuery();\n");
          html.append("\ttheForm." + CmsDialog.PARAM_FRAMENAME + ".value = window.name;\n");
          html.append("\tif (queryOK) {\n");
          html.append("\t\tif (actionValue == '" + CmsDialog.DIALOG_OK + "') {\n");
          //        html.append("\t\t\talert('action :'+actionValue);\n");
          html.append("\t\t\tloadingOn();\n");
          html.append("\t\t\treturn queryOK;\n");
          html.append("\t\t}\n");
          html.append("\t\ttheForm." + CmsDialog.PARAM_ACTION + ".value = actionValue;\n");
          html.append("\t\tsubmitForm(theForm);\n");
          html.append("\t}\n");
          html.append("\treturn queryOK;\n");
          html.append("}\n");
          return html.toString();
      }
  
      /**
       * Returns the fields parameter value.<p>
       *
       * @return the fields parameter value
       */
      public String getFields() {
  
          return CmsStringUtil.collectionAsString(m_searchParams.getFields(), ",");
      }
  
      /**
       * Returns the creation date the resources have to have as maximum.<p>
       *
       * @return the creation date the resources have to have as maximum
       */
      public String getMaxDateCreated() {
  
          if (m_searchParams.getMaxDateCreated() == Long.MAX_VALUE) {
              return "";
          }
          return Long.toString(m_searchParams.getMaxDateCreated());
      }
  
      /**
       * Returns the last modification date the resources have to have as maximum.<p>
       *
       * @return the last modification date the resources have to have as maximum
       */
      public String getMaxDateLastModified() {
  
          if (m_searchParams.getMaxDateLastModified() == Long.MAX_VALUE) {
              return "";
          }
          return Long.toString(m_searchParams.getMaxDateLastModified());
      }
  
      /**
       * Returns the creation date the resources have to have as minimum.<p>
       *
       * @return the creation date the resources have to have as minimum
       */
      public String getMinDateCreated() {
  
          if (m_searchParams.getMinDateCreated() == Long.MIN_VALUE) {
              return "";
          }
          return Long.toString(m_searchParams.getMinDateCreated());
      }
  
      /**
       * Returns the last modification date the resources have to have as minimum.<p>
       *
       * @return the last modification date the resources have to have as minimum
       */
      public String getMinDateLastModified() {
  
          if (m_searchParams.getMinDateLastModified() == Long.MIN_VALUE) {
              return "";
          }
          return Long.toString(m_searchParams.getMinDateLastModified());
      }
  
      /**
       * Returns the list of searchable fields used in the workplace search index.<p> 
       * 
       * @return the list of searchable fields used in the workplace search index
       */
      public List getSearchFields() {
  
          CmsSearchIndex index = OpenCms.getSearchManager().getIndex(getParamIndexName());
          List result = new ArrayList();
          Iterator i = index.getFieldConfiguration().getFields().iterator();
          while (i.hasNext()) {
              CmsSearchField field = (CmsSearchField)i.next();
  