Geoportal Search Widget for Flex

Release 9.3.1 E-mail This Topic Printable Version Give Us Feedback

How to Use

The ArcGIS API for Flex allows for the creation of Rich Internet applications on top of ArcGIS Server. It is based on the free Adobe Flex framework. ESRI provides a sample viewer application that can be integrated with the Geoportal extension, using the Geoportal Search Widget for Flex. For instructions on how to add the Geoportal Search Widget to your existing sample viewer, see the section below on How to Add the Geoportal Widget to an Existing Flex Viewer.



The Geoportal extension ships with an example viewer that is preconfigured with the Geoportal Search Widget. To launch the example viewer, go to the examples page (http://server_name/geoportal/widgets/example.jsp) and launch the Flex Viewer from the link on the page. The "Find Data" window will automatically be opened when the application is launched; this Find Data window is the Geoportal Search Widget for Flex.

How to Add the Geoportal Widget to an Existing Flex Viewer

The Flex Viewer that ships with the Geoportal extension is a sample. If you are hosting your own ESRI Flex Sample Viewer and would like to add the Geoportal Search Widget to that application, follow the steps below. Note: in these instructions, the [Geoportal Install Directory] refers to the directory created when the Geoportal Distribution setup.exe was run, which by default was C:\ESRI\Geoportal Extension 9.3.1. The [Your ESRI Flex Sample Viewer Root Directory] refers to the root directory where your own ESRI Flex Sample Viewer has been deployed. The Geoportal Widget swf and swc files have been built with flex version 3.1.0.
  1. You can add the Geoportal Search Widget to your ESRI Flex Sample Viewer without recompiling, or you can add it to the actual ESRI Flex Sample Viewer code.
    • If you want to copy the widget to your ESRI Flex Sample Viewer without compiling, then do this first step: Navigate to the [Geoportal Install Directory]/Widgets/FlexExample/swf/com/esri directory and copy the gpt folder. Paste this gpt folder into the [Your ESRI Flex Sample Viewer Root Directory]/com/esri folder.
    • If you want to copy the widget to your ESRI Flex Sample Viewer code, then you will need to do two initial steps: 1) Navigate to the [Geoportal Install Directory]/Widgets/swc/ directory and copy the GeoportalSearchWidget.swc file. Paste this file into the [Your ESRI Flex Sample Viewer Root Directory]/libs directory. 2) Navigate to the [Geoportal Install Directory]/Widgets/swc/com/esri directory and copy the gpt folder. Paste this folder into the [Your ESRI Flex Sample Viewer Root Directory]/src/com/esri directory.
  2. Navigate to the [Your ESRI Flex Sample Viewer Root Directory] folder and open the config.xml file in a text editor. Add the following block of code under the <widgets> element:

    <widget label="Find Data"

    preload="maximized"

    icon="com/esri/solutions/flexviewer/assets/images/icons/i_search.png"

    menu="menuWidgets"

    config="com/esri/gpt/flexviewer/widgets/GeoportalSearchWidget.xml">

    com/esri/gpt/flexviewer/widgets/AGSGptRSSWidget.swf</widget>

  3. Navigate to the [Your ESRI Flex Sample Viewer Root Directory]/com/esri/gpt/flexviewer/widgets folder, and open the GeoportalSearchWidget.xml file in a text editor. This file contains a number of settings you can specify to customize your Geoportal Search Widget. Most of these settings are optional, and are listed in the table below. Before configuring the optional settings, you must do the following:
  4. If you desire to change the look and feel of your search widget or how it behaves, configure any of the following optional elements. Elements not listed in this table should not be altered:
    Element Name Description Accepted Values
    <label> refers to labels in the Search Widget. The value attribute is what the user sees. Do not change the name attribute. value should be a string
    <searchTimeout> max time in seconds a search will be allowed to run before it times out integer
    <addLayerTimeout> max time in seconds adding a layer will be allowed to run before it times out integer
    <iconSearch> filepath to the search icon in the Search Widget interface string
    <iconResult> filepath to the table icon in the Search Widget interface string
    <iconHelp> filepath to the help icon in the Search Widget interface string
    <zoomFactor> how much buffer to add to the view of the extent so that the borders of the extent and some surrounding area can be seen when you choose Zoom to Extent for a search result integer
    <urlHelp> url to the help webpage. You can update this to point to a file hosted by your organization. The default is the Geoportal extension's Search Widget help. url string
    <color id="mainBboxesPlain"> defines look and feel for bounding boxes showing the extent of returned search results variable - several parameters are defined here
    <color id="mainBboxesHighlight" defines look and feel for a highlighted bounding box showing the extent of a selected search result variable - several parameters are defined here
  5. The Adobe Flash player will not allow the ESRI Flex Sample Viewer (or any Flash program) to access another site for information unless that site has a crossdomain.xml that defines access policy. To get around this Flash restriction, the Geoportal Search Widget for Flex can use a proxy. If the proxy is not used, then all of the search and the map service endpoint domains must have a crossdomain.xml file explicitly allowing access from the domain the ESRI Flex Sample Viewer runs on. If the ESRI Flex Sample Viewer and the map services found are going to be on the same domain then a crossdomain file and/or a proxy is not needed and you can skip this step.



    Different builds of the ESRI Flex Sample Viewer may have different ways of configuring the proxy. Below are two examples that can work for the Flex Viewer on builds 05.22.09 to 06.12.09, if your ESRI Flex Sample Viewer is deployed within a Java Application Server such as Tomcat. To find the build number, open the WHATSNEW.txt file from your ESRI Flex Sample Viewer root directory and read the first few lines. Note: The Geoportal extension is not related to the ESRI Flex Sample Viewer except in providing the Search Widget. Therefore, configuration instructions for the ESRI Flex Sample Viewer itself are provided as an example, and further proxy configuration details are not described.
    • Example A: Replace proxy.jsp with the proxy.jsp from the Geoportal Example Flex Viewer
      • Overwrite the proxy.jsp file in your Flex Viewer root directory with the proxy.jsp file from the [Geoportal Install Directory]/Widgets folder.
    • Example B: Reference proxy.jsp
      • Copy the the proxy.jsp file from the [Geoportal Install Directory]/Widgets folder into one of your Java web applications.
      • Verify that your Flex Viewer is in the same domain as where you are hosting this proxy.jsp.
      • Open the GeoportalSearchWidget.xml file (from [Your Flex Viewer Root Directory]/com/esri/gpt/flexviewer/widgets folder) and update the <useProxy> element's proxyUrl attribute with the following url: "http://yourdomain/yourcontext/proxy.jsp?url=" . The updated element is shown below:

        <useProxy

        proxyUrl="http://yourdomain/yourcontext/proxy.jsp?url="></useProxy>
      • Change "yourdomain" to reference the server hosting your Flex Viewer, and change "yourcontext" to the web application hosting your proxy.jsp file.
      • Save the GeoportalSearchWidget.xml file.
  6. Launch your ESRI Flex Sample Viewer and try out the Geoportal Search Widget.