Let's get back to Oracle Maps topic again, in this post I will describe how spatial logic in JDeveloper 11g can be combined with traditional non-spatial operations. Before reading this post, I suggest to read my previous post - Oracle Maps in JDeveloper 11g - Even More Simple, I describe there how to develop and run basic Oracle Maps application.
Developed sample application - OraMaps11.zip, demonstrates how Search functionality can be implemented with Spatial technology. I'm using MVDEMO datasource for this application, you can download this datasource from OTN. Sample application implements a form with a table for search results, however there is no traditional search parameters in this form. Search criteria is defined using Oracle Maps functionality. Based on this criteria, query in database is executed and table with results is refreshed. It also allowed to update rows available in results table, changes are reflected in generated map as well.
Ok, let's describe this with pictures. Here you see Oracle Maps screen and table with Search results:
Oracle Maps comes with Circular selection tool, you don't need to develop it, just use it. So, five customers are selected spatially - results table is refreshed and shows information only about those five selected customers:
Now let's select only one customer - EMBARCADERO CENTER 3, Sales here are around 181:
If row contained in results table is updated, related point on the map is updated as well. I have updated Sales to 70, and you can notice it's reflected on the map:
Oracle Maps comes not only with Circular selection, but with Rectangular, Multy-Point and simple Click selection. Rectangular selection:
And refreshed table with selection results:
And it's really not complex to develop all this stuff. There are three main points:
1. Map Theme Selection Listener
I have defined Selection Listener for Customers theme. This listener receives all events related to Customers theme selection:
You can find code for this listener in Backing bean class. Developed code manages keys for selected points, invokes query and executes results table visual refresh.
2. Search results table refresh
When keys for selected points are prepared, selectCustomers method in Model layer is executed to query database and refresh View object:
This method is defined in Page Definition file and is invoked from Backing bean class:
In order to refresh table visually, from Selection Listener available in Backing bean class, it's enough to use only one line of code:
3. Search results editing
To update edited rows in Search results table, standard Commit action is used. However, it's important here to refresh both after Commit action is done - table and map. So, I have enabled PartialSubmit for Save button and provided PartialTriggering for table and map components pointing to Save button.
In my future posts, I will describe more sample application related to Spatial functionality.