|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.esri.adf.web.data.results.WebResults
public class WebResults
The WebResults object is a container of arbitrary result objects. Any POJO representing a result
can be added to WebResults. Result objects shipped out of the box include
QueryResult, AddressCandidate,
GPTaskResult, etc.
A WebResults object is maintained by the WebContext and can be accessed
by using the WebContext.getWebResults() method. The result objects that you add to
WebResults can provide 4 pieces of information for the user (The first one is required, the rest are
optional):
java.util.Map of name-value attribute pairs)
So, for instance, the QueryResult provides these 4 pieces of information with
these methods:
QueryResult.getName()
QueryResult.getDetails()
QueryResult.zoom(),
QueryResult.highlight(),
QueryResult.clearGraphic()
QueryResult.clearGraphic()
java.util.List of QueryResults
to WebResults:
WebResults wresults = ctx.getWebResults();
//a List of QueryResult objects
List queryResults = ...; //perform queries such as find, identify, etc.
wresults.addResultsWithActionArray("Query Results", queryResults, "getName", "getDetails", new String[]{"zoom", "highlight", "clearGraphic"});
All results are wrapped in ResultNode objects. The WebResults internally maintains a tree of
these ResultNode objects. The ResultNode is the one which actually invokes the appropriate methods on
the actual results to retrieve the 4 pieces of information mentioned above.
The WebResultsObservers registered with WebResults using the
addObserver(WebResultsObserver) method will be notified whenever results are added, modified, replaced or
removed.
| Constructor Summary | |
|---|---|
WebResults()
|
|
| Method Summary | |
|---|---|
ResultNode |
addAddressCandidates(java.util.List<? extends AddressCandidate> candidates,
ResultDefinition definition)
|
void |
addObserver(WebResultsObserver observer)
Registers the observer as an observer of this instance of WebResults. |
ResultNode |
addQueryResults(java.util.List<? extends QueryResult> results,
ResultDefinition definition)
|
void |
addResultNode(ResultNode resultNode)
Adds a ResultNode to this instance of WebResults. |
ResultNode |
addResults(java.lang.String groupHeader,
java.util.List<?> results)
Adds a List of results to this WebResults object. |
ResultNode |
addResultsWithActionArray(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.lang.String[] actionMethodNames)
Adds a List of results to this WebResults object. |
ResultNode |
addResultsWithActionArray(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.lang.String[] actionMethodNames,
java.lang.String onRemoveMethodName)
Adds a List of results to this WebResults object. |
ResultNode |
addResultsWithActionMap(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.util.Map<java.lang.String,java.lang.String> actionMethodNames)
Adds a List of results to this WebResults object. |
ResultNode |
addResultsWithActionMap(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.util.Map<java.lang.String,java.lang.String> actionMethodNames,
java.lang.String onRemoveMethodName)
Adds a List of results to this WebResults object. |
void |
clearAll()
Removes all results from this instance of WebResults. |
java.util.List<ResultNode> |
getResultNodes()
Returns an unmodifiable List of top-level ResultNodes maintained by this instance of
WebResults. |
boolean |
isShowOpenResultLink()
Returns true if the renderer for this WebResults object should display a link to open results. |
void |
notifyObservers(int updateType,
ResultNode affectedNode,
java.lang.Object args)
Notifies all WebResultsObservers registered with this instance of WebResults. |
boolean |
removeObserver(WebResultsObserver observer)
Removes the observer from the list of registered WebResultsObservers. |
boolean |
removeResultNode(ResultNode resultNode)
Removes a ResultNode to this instance of WebResults. |
boolean |
replaceResultNode(ResultNode newNode,
ResultNode oldNode)
Replaces an existing ResultNode with a new node. |
void |
setShowOpenResultLink(boolean showOpenResultLink)
Set to true if the renderer for this WebResults object should display a link to open results. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WebResults()
| Method Detail |
|---|
public ResultNode addResults(java.lang.String groupHeader,
java.util.List<?> results)
Adds a List of results to this WebResults object.
Calling this method is equivalent to:
wresults.addResultsWithActionMap(groupHeader, results, "toString", null, null);
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_ADDED.
groupHeader - the header for this List of resultsresults - the List of results to be maintained by this instance of WebResults
ResultNode for the node representing this set of results
public ResultNode addResultsWithActionArray(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.lang.String[] actionMethodNames,
java.lang.String onRemoveMethodName)
Adds a List of results to this WebResults object.
Calling this method is equivalent to:
Map actionMethodsMap = new LinkedHashMap(); for (int i = 0; i < actionMethodNames.length; i++) actionMethodsMap.put(actionMethodNames[i], actionMethodNames[i]); wresults.addResultsWithActionMap(groupHeader, results, displayNameMethodName, detailsMethodName, actionMethodsMap);
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_ADDED.
groupHeader - the header for this List of resultsresults - the List of results to be maintained by this instance of WebResultsdisplayNameMethodName - the name of the method which returns the display text for the resultdetailsMethodName - the name of the method which returns the result details as a java.util.Map
of name-value pairsactionMethodNames - an array of names of methods for performing actions on the resultonRemoveMethodName - the name of the method to be called when the result is removed
ResultNode for the node representing this set of results
public ResultNode addResultsWithActionArray(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.lang.String[] actionMethodNames)
Adds a List of results to this WebResults object.
Calling this method is equivalent to:
Map actionMethodsMap = new LinkedHashMap(); for (int i = 0; i < actionMethodNames.length; i++) actionMethodsMap.put(actionMethodNames[i], actionMethodNames[i]); wresults.addResultsWithActionMap(groupHeader, results, displayNameMethodName, detailsMethodName, actionMethodsMap);
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_ADDED.
groupHeader - the header for this List of resultsresults - the List of results to be maintained by this instance of WebResultsdisplayNameMethodName - the name of the method which returns the display text for the resultdetailsMethodName - the name of the method which returns the result details as a java.util.Map
of name-value pairsactionMethodNames - an array of names of methods for performing actions on the result
ResultNode for the node representing this set of results
public ResultNode addResultsWithActionMap(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.util.Map<java.lang.String,java.lang.String> actionMethodNames,
java.lang.String onRemoveMethodName)
Adds a List of results to this WebResults object.
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_ADDED.
The actionMethodNames is a java.util.Map of <action display name>-<action
method name> pairs.
groupHeader - the header for this List of resultsresults - the List of results to be maintained by this instance of WebResultsdisplayNameMethodName - the name of the method which returns the display text for the resultdetailsMethodName - the name of the method which returns the result details as a java.util.Map
of name-value pairsactionMethodNames - a java.util.Map of <action display name>-<action method name>
pairsonRemoveMethodName - the name of the method to be called when the result is removed
ResultNode for the node representing this set of results
public ResultNode addResultsWithActionMap(java.lang.String groupHeader,
java.util.List<?> results,
java.lang.String displayNameMethodName,
java.lang.String detailsMethodName,
java.util.Map<java.lang.String,java.lang.String> actionMethodNames)
Adds a List of results to this WebResults object.
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_ADDED.
The actionMethodNames is a java.util.Map of <action display name>-<action
method name> pairs.
groupHeader - the header for this List of resultsresults - the List of results to be maintained by this instance of WebResultsdisplayNameMethodName - the name of the method which returns the display text for the resultdetailsMethodName - the name of the method which returns the result details as a java.util.Map
of name-value pairsactionMethodNames - a java.util.Map of <action display name>-<action method name>
pairs
ResultNode for the node representing this set of resultspublic void addResultNode(ResultNode resultNode)
Adds a ResultNode to this instance of WebResults.
resultNode - the ResultNode to be added to this instance of WebResultspublic boolean removeResultNode(ResultNode resultNode)
Removes a ResultNode to this instance of WebResults.
The onRemove methods of this result and its children will be called before the result is actually removed.
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_REMOVED.
resultNode - the ResultNode to be removed from this instance of WebResults
public boolean replaceResultNode(ResultNode newNode,
ResultNode oldNode)
Replaces an existing ResultNode with a new node.
The newNode will not be added if the oldNode was not found.
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.RESULT_REPLACED.
newNode - the new ResultNode which replaces the oldNodeoldNode - the ResultNode to be replaced with the newNode
public void clearAll()
Removes all results from this instance of WebResults.
The registered WebResultsObservers will be notified with an update of type
WebResultsObserver.ALL_RESULTS_CLEARED.
public java.util.List<ResultNode> getResultNodes()
Returns an unmodifiable List of top-level ResultNodes maintained by this instance of
WebResults.
List of top-level ResultNodespublic void addObserver(WebResultsObserver observer)
Registers the observer as an observer of this instance of WebResults.
This observer along with the other registered observers will be notified whenever results are added,
modified, replaced or removed.
observer - the WebResultsObserver to be registeredpublic boolean removeObserver(WebResultsObserver observer)
Removes the observer from the list of registered WebResultsObservers.
observer - the WebResultsObserver to be removed
observer was successfully removed
public void notifyObservers(int updateType,
ResultNode affectedNode,
java.lang.Object args)
Notifies all WebResultsObservers registered with this instance of WebResults.
This method iterates through all the registered observers and calls their
WebResultsObserver.webResultsUpdate(WebResults, int, ResultNode, Object) method.
updateType - the type of update (e.g. WebResultsObserver.RESULT_ADDED,
WebResultsObserver.RESULT_REMOVED, etc.affectedNode - the affected ResultNode (e.g. the node that was added, the node that was removed, etc.)args - an arbitrary argument object for observers to fine tune their reactions to this notificationpublic boolean isShowOpenResultLink()
Returns true if the renderer for this WebResults object should display a link to open results.
Certain results (such as GP results) can be downloaded to and then uploaded (opened) from the client. Clients can add an "Open Result" link to open such results. They can make that decision based on this property.
WebResults object should display a link to open resultspublic void setShowOpenResultLink(boolean showOpenResultLink)
Set to true if the renderer for this WebResults object should display a link to open results.
Certain results (such as GP results) can be downloaded to and then uploaded (opened) from the client. Clients can add an "Open Result" link to open such results. They can make that decision based on this property.
showOpenResultLink - true if the renderer for this WebResults object should display a link to open
resultspublic java.lang.String toString()
toString in class java.lang.Object
public ResultNode addQueryResults(java.util.List<? extends QueryResult> results,
ResultDefinition definition)
public ResultNode addAddressCandidates(java.util.List<? extends AddressCandidate> candidates,
ResultDefinition definition)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||