|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.esri.adf.web.data.WebContext
public class WebContext
The WebContext maintains references to the GISResource
s as well as to
attributes (GIS business objects) such as WebMap
,
WebGraphics
, WebQuery
, etc.
Additionally, the WebContext
is responsible for making the callback methods implemented by the resources
and attributes at appropriate junctures of the ADF application. The callback methods are declared in the
WebContextInitialize
, WebContextObserver
and
WebLifecycle
interfaces.
Users can add custom GIS business objects to the context as attributes of the WebContext
programmatically:
WebContext ctx = ...; MyAttribute myAttr = new MyAttribute(); ctx.setAttribute("myAttr", myAttr);
Users can also register attributes on the context in JSF managed bean configuration files as such:
<managed-bean> <managed-bean-name>myAttr</managed-bean-name> <managed-bean-class>myPackage.MyAttribute</managed-bean-class> <managed-bean-scope>none</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>myContext</managed-bean-name> <managed-bean-class>com.esri.adf.web.data.WebContext</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> ... <managed-property> <property-name>attributes</property-name> ... <map-entries> <map-entry> <key>myAttr</key> <value>#{myAttr}</value> </map-entry> </map-entries> </managed-property> </managed-bean>
Once you have registered your object as an attribute of the context, the WebContext
will make the
appropriate callbacks into your object as it does with all attributes.
The WebContext
also defines methods to dynamically add and remove
GISResource
s from the context.
WebContext ctx = ...; AGSMapResource ags = new AGSMapResource(); ags.setEndPointURL("http://myserver/mywebservice"); ags.addFunctionality("map", new AGSMapFunctionality()); ctx.addResource("ags1", ags, 0); ... ... ctx.removeResource(ags);
Users can work with multiple contexts in the same session. All contexts are stored in a
WebSession
object which ensures that all WebContext
s it maintains are
cleanly destroyed when the user session terminates.
Field Summary | |
---|---|
protected Map<String,Object> |
attributes
The GIS business objects maintained by this WebContext |
static String |
DEFAULT_GRAPHICS_RESOURCE_KEY
The key for the default GraphicsResource . |
protected WebGeocode |
geocode
The WebGeocode referenced by this context. |
protected WebGraphics |
graphics
The WebGraphics referenced by this context. |
protected boolean |
init
true if this context has already been initialized. |
protected WebMap |
map
The WebMap referenced by this context. |
protected String |
name
|
protected List<WebContextObserver> |
observers
The List of WebContextObserver s registered with this context. |
protected WebOverview |
overview
The WebOverview referenced by this context. |
protected WebQuery |
query
The WebQuery referenced by this context. |
protected Map<String,GISResource> |
resources
The List of GISResource s maintained by this context. |
protected WebResults |
results
The WebResults referenced by this context. |
protected WebSession |
session
The WebSession that maintains a reference to this context. |
protected WebSpatialReference |
spatialReference
The spatial reference associated with this context. |
protected boolean |
supportMultipleSRs
If true , this context supports GISResource s in different spatial references. |
protected WebToc |
toc
The WebToc referenced by this context. |
static String |
WEB_GEOCODE_KEY
The key for the WebGeocode attribute of the WebContext in the attributes Map . |
static String |
WEB_GRAPHICS_KEY
The key for the WebGraphics attribute of the WebContext in the attributes Map . |
static String |
WEB_MAP_KEY
The key for the WebMap attribute of the WebContext in the attributes Map . |
static String |
WEB_OVERVIEW_KEY
The key for the WebOverview attribute of the WebContext in the attributes Map . |
static String |
WEB_QUERY_KEY
The key for the WebQuery attribute of the WebContext in the attributes Map . |
static String |
WEB_RESULTS_KEY
The key for the WebResults attribute of the WebContext in the attributes Map . |
static String |
WEB_TOC_KEY
The key for the WebToc attribute of the WebContext in the attributes Map . |
Constructor Summary | |
---|---|
WebContext()
|
Method Summary | |
---|---|
void |
activate()
This method should be called when this context is to be activated. |
void |
addObserver(WebContextObserver observer)
Adds a WebContextObserver to this context. |
void |
addResource(String resourceId,
GISResource resource)
Adds a new GISResource to this context. |
void |
addResource(String resourceId,
GISResource resource,
int index)
Adds a new GISResource to this context. |
void |
destroy()
This method should be called when this context is to be destroyed. |
Object |
getAttribute(String attrName)
Returns the attribute of this context referenced by the key name |
Map<String,Object> |
getAttributes()
Returns the attributes associated with this context. |
String |
getDateFormat()
|
GraphicsResource |
getDefaultGraphicsResource()
Returns the default graphics resource that available in this object. |
String |
getName()
|
String |
getNullValueDisplay()
|
GISResource |
getResourceById(String resourceId)
Returns the resource from WebContext object based on the specified resource id. |
String |
getResourceId(GISResource resource)
|
Map<String,GISResource> |
getResources()
Returns the Map of GISResource s associated with this context |
WebSpatialReference |
getSpatialReference()
Returns the spatial reference associated with this context. |
String |
getSpatialReferenceDefinitionString()
Returns the definition string of the spatial reference associated with this context. |
int |
getSpatialReferenceId()
Returns the ID of the spatial reference associated with this context. |
String |
getSpatialReferenceResourceId()
Returns the ID of the resource whose spatial reference should be used by the WebContext |
GroupThreadPool |
getThreadPool()
Returns the GroupThreadPool associated with this context. |
int |
getThreadPoolSize()
Returns the size of the thread pool to execute parallel group tasks. |
WebGeocode |
getWebGeocode()
Returns the WebGeocode referenced by this context. |
WebGraphics |
getWebGraphics()
Returns the WebGraphics referenced by this context. |
WebMap |
getWebMap()
Returns the WebMap referenced by this context. |
WebOverview |
getWebOverview()
Returns the WebOverview referenced by this context. |
WebQuery |
getWebQuery()
The WebQuery referenced by this context. |
WebResults |
getWebResults()
The WebResults referenced by this context. |
WebSession |
getWebSession()
Returns the WebSession that maintains a reference to this context. |
WebToc |
getWebToc()
Returns the WebToc referenced by this context. |
void |
init(WebContext context)
Initializes all the GISResource s (which in turn also intializes the GISFunctionality s that it
maintains) maintained by this context |
boolean |
isInit()
Return true if this context has already been initialized |
boolean |
isSupportMultipleSRs()
Returns true if this context supports GISResource s in different spatial references. |
void |
moveResource(int toIndex,
GISResource resource)
Moves a GISResource in this context to the specified index and then re-initializes all the
WebContextInitialize attributes currently associated with the context. |
void |
passivate()
This method should be called when this context is to be passivated. |
WebGeometry |
project(WebGeometry geometry)
Convenience method which projects the given WebGeometry to the spatial reference of this context only
if this context supports multiple SRs |
WebGeometry |
project(WebGeometry geometry,
WebSpatialReference toSpatialReference)
Convenience method which projects the given WebGeometry only if this context supports multiple SRs |
WebExtent |
projectExtent(WebExtent extent)
Convenience method which projects the given WebExtent to the spatial reference of this context only if
this context supports multiple SRs |
WebExtent |
projectExtent(WebExtent extent,
WebSpatialReference toSpatialReference)
Convenience method which projects the given WebExtent only if this context supports multiple SRs |
WebPoint |
projectPoint(WebPoint point)
Convenience method which projects the given WebPoint to the spatial reference of this context only if
this context supports multiple SRs |
WebPoint |
projectPoint(WebPoint point,
WebSpatialReference toSpatialReference)
Convenience method which projects the given WebPoint only if this context supports multiple SRs |
void |
refresh()
Refreshes this context by updating all registered WebContextObserver s. |
void |
refresh(Object arg)
Refreshes this context by updating all registered WebContextObserver s with arg as the
argument. |
boolean |
removeObserver(WebContextObserver observer)
Removes the observer from the set of WebContextObserver s associated with this context. |
boolean |
removeResource(GISResource resource)
Removes a GISResource from this context. |
void |
setAttribute(String attrName,
Object attrValue)
Sets value as an attribute of this context. |
void |
setAttributes(Map<String,?> attributes)
Adds these attributes to the Map of attributes maintained by this context. |
void |
setDateFormat(String dateFormat)
|
void |
setGeometryOperations(GeometryOperations operations)
Specifies which implementation of GeometryOperations should be used. |
void |
setInit(boolean init)
If true it initializes all the GISResource s (which in turn also intializes the
GISFunctionality s that it maintains) and attributes referenced by this context. |
void |
setName(String name)
|
void |
setNullValueDisplay(String nullValueDisplay)
|
void |
setResources(Map<String,GISResource> resources)
Sets the Map of GISResource s associated with this context |
void |
setSpatialReference(WebSpatialReference spatialReference)
Sets the spatial reference associated with this context. |
void |
setSpatialReferenceDefinitionString(String definitionString)
Sets the spatial reference associated with this context by its definition string. |
void |
setSpatialReferenceId(int id)
Sets the spatial reference associated with this context by its ID. |
void |
setSpatialReferenceResourceId(String spatialReferenceResourceId)
Sets the ID of the resource whose spatial reference should be used by the WebContext. |
void |
setSupportMultipleSRs(boolean supportsMultipleSRs)
If true , this context supports GISResource s in different spatial references. |
void |
setThreadPool(GroupThreadPool pool)
|
void |
setThreadPoolSize(int poolSize)
Sets the size of the thread pool to execute parallel group tasks |
void |
setWebGeocode(WebGeocode geocode)
Sets the WebGeocode referenced by this context. |
void |
setWebGraphics(WebGraphics graphics)
Sets the WebGraphics referenced by this context. |
void |
setWebMap(WebMap map)
Sets the WebMap referenced by this context. |
void |
setWebOverview(WebOverview overview)
Sets the WebOverview referenced by this context. |
void |
setWebQuery(WebQuery query)
The WebQuery referenced by this context. |
void |
setWebResults(WebResults results)
The WebResults referenced by this context. |
void |
setWebSession(WebSession session)
Sets the WebSession that maintains a reference to this context. |
void |
setWebToc(WebToc toc)
Sets the WebToc referenced by this context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String WEB_MAP_KEY
The key for the WebMap
attribute of the WebContext
in the attributes Map
.
The WebMap
attribute can also be accessed using the setWebMap(WebMap)
and getWebMap()
methods.
public static final String WEB_GEOCODE_KEY
The key for the WebGeocode
attribute of the WebContext
in the attributes Map
.
The WebGeocode
attribute can also be accessed using the setWebGeocode(WebGeocode)
and
getWebGeocode()
methods.
public static final String WEB_OVERVIEW_KEY
The key for the WebOverview
attribute of the WebContext
in the attributes Map
.
The WebOverview
attribute can also be accessed using the setWebOverview(WebOverview)
and
getWebOverview()
methods.
public static final String WEB_TOC_KEY
The key for the WebToc
attribute of the WebContext
in the attributes Map
.
The WebToc
attribute can also be accessed using the setWebToc(WebToc)
and getWebToc()
methods.
public static final String WEB_GRAPHICS_KEY
The key for the WebGraphics
attribute of the WebContext
in the attributes Map
.
The WebGraphics
attribute can also be accessed using the setWebGraphics(WebGraphics)
and
getWebGraphics()
methods.
public static final String WEB_RESULTS_KEY
The key for the WebResults
attribute of the WebContext
in the attributes Map
.
The WebResults
attribute can also be accessed using the setWebResults(WebResults)
and
getWebResults()
methods.
public static final String WEB_QUERY_KEY
The key for the WebQuery
attribute of the WebContext
in the attributes Map
.
The WebQuery
attribute can also be accessed using the setWebQuery(WebQuery)
and
getWebQuery()
methods.
public static final String DEFAULT_GRAPHICS_RESOURCE_KEY
The key for the default GraphicsResource
.
The default graphics resource can be accessed using the getDefaultGraphicsResource()
.
protected Map<String,Object> attributes
The GIS business objects maintained by this WebContext
Out of the box attributes (such as WebMap
, WebGraphics
,
WebQuery
, etc.) as well as custom business objects can be maintained by the
context.
protected WebSession session
The WebSession
that maintains a reference to this context.
Users can work with multiple contexts in the same session. All contexts are stored in a
WebSession
object which ensures that all WebContext
s it maintains are
cleanly destroyed when the user session terminates.
protected WebMap map
The WebMap
referenced by this context.
The WebMap
can be accessed using the setWebMap(WebMap)
and getWebMap()
methods or as an
attribute of the context (WebMap)context.getAttribute("map");
protected WebGeocode geocode
The WebGeocode
referenced by this context.
The WebGeocode
can be accessed using the setWebGeocode(WebGeocode)
and getWebGeocode()
methods or as an attribute of the context (WebGeocode)context.getAttribute("geocode");
protected WebToc toc
The WebToc
referenced by this context.
The WebToc
can be accessed using the setWebToc(WebToc)
and getWebToc()
methods or as an
attribute of the context (WebToc)context.getAttribute("toc");
protected WebOverview overview
The WebOverview
referenced by this context.
The WebOverview
can be accessed using the setWebOverview(WebOverview)
and
getWebOverview()
methods or as an attribute of the context
(WebOverview)context.getAttribute("overview");
protected WebGraphics graphics
The WebGraphics
referenced by this context.
The WebGraphics
can be accessed using the setWebGraphics(WebGraphics)
and
getWebGraphics()
methods or as an attribute of the context
(WebGraphics)context.getAttribute("graphics");
protected WebResults results
The WebResults
referenced by this context.
The WebResults
can be accessed using the setWebResults(WebResults)
and getWebResults()
methods or as an attribute of the context (WebResults)context.getAttribute("results");
protected WebQuery query
The WebQuery
referenced by this context.
The WebQuery
can be accessed using the setWebQuery(WebQuery)
and getWebQuery()
methods or
as an attribute of the context (WebQuery)context.getAttribute("query");
protected boolean init
true
if this context has already been initialized.
The context is typically initialized by the ContextControl
when it calls
the setInit(boolean)
method.
protected List<WebContextObserver> observers
The List
of WebContextObserver
s registered with this context.
Users can register and unregister observers by using the addObserver(WebContextObserver)
and
removeObserver(WebContextObserver)
methods respectively.
protected Map<String,GISResource> resources
The List
of GISResource
s maintained by this context.
Users can add and remove resources from this context by calling the addResource(String, GISResource)
and
removeResource(GISResource)
methods respectively.
protected boolean supportMultipleSRs
true
, this context supports GISResource
s in different spatial references. true
by default.
protected WebSpatialReference spatialReference
The spatial reference associated with this context.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
protected String name
Constructor Detail |
---|
public WebContext()
Method Detail |
---|
public boolean isInit()
Return true
if this context has already been initialized
The context is typically initialized by the ContextControl
when it calls
the setInit(boolean)
method.
true
if this context has already been initializedpublic void setInit(boolean init)
If true
it initializes all the GISResource
s (which in turn also intializes the
GISFunctionality
s that it maintains) and attributes referenced by this context.
Note that if the context has already been initialized, i.e. if isInit()
is true, this method does none of
the above.
init
- if true and if isInit()
is false, this context will be initializedpublic void init(WebContext context)
Initializes all the GISResource
s (which in turn also intializes the GISFunctionality
s that it
maintains) maintained by this context
This method is typically called by the setInit(boolean)
method.
init
in interface WebContextInitialize
context
- this WebContext
WebContextInitialize.init(com.esri.adf.web.data.WebContext)
public void addResource(String resourceId, GISResource resource, int index)
Adds a new GISResource
to this context.
If this resource already exists, it does nothing and simply returns. Otherwise, it adds the resource, initializes
it and then re-initializes all the WebContextInitialize
attributes currently associated with the context.
If the index is within bounds, it adds the new resource at that position. Otherwise it adds it at the bottom.
resourceId
- the ID of the GISResource
to add to this contextresource
- the GISResource
to add to this contextindex
- the position where to add the resource
NullPointerException
- if the resource
is nullWebContextInitialize.init(com.esri.adf.web.data.WebContext)
public void addResource(String resourceId, GISResource resource)
Adds a new GISResource
to this context.
If this resource already exists, it does nothing and simply returns. Otherwise, it adds the resource, initializes
it and then re-initializes all the WebContextInitialize
attributes currently associated with the context.
This method adds the resource at the very bottom.
Same effect as calling addResource(resource, -1)
resourceId
- the ID of the GISResource
to add to this contextresource
- the GISResource
to add to this contextWebContextInitialize.init(com.esri.adf.web.data.WebContext)
public boolean removeResource(GISResource resource)
Removes a GISResource
from this context.
If this resource does not exist, it returns false. Otherwise, it calls the GISResource.destroy()
method on
the resource, removes the resource, re-initializes all the WebContextInitialize
attributes currently
associated with the context and then returns true.
resource
- the GISResource
to remove from this context
true
if the resource
was successfully removed
NullPointerException
- if the resource
is nullWebContextInitialize.init(com.esri.adf.web.data.WebContext)
public void moveResource(int toIndex, GISResource resource)
Moves a GISResource
in this context to the specified index and then re-initializes all the
WebContextInitialize
attributes currently associated with the context.
toIndex
- the index to which the resource is movedresource
- the GISResource
to be moved
IndexOutOfBoundsException
- if the toIndex
is not in range
IllegalArgumentException
- if the resource
is not found in this contextWebContextInitialize.init(com.esri.adf.web.data.WebContext)
public Map<String,GISResource> getResources()
Returns the Map
of GISResource
s associated with this context
Map
of GISResource
s associated with this contextpublic void setResources(Map<String,GISResource> resources)
Sets the Map
of GISResource
s associated with this context
Typically this Map
is set either declaratively in a JSF managed bean configuration file or
programmatically before this context is initialized. Once the context has been initialized, you should use the
addResource(String, GISResource)
and removeResource(GISResource)
methods instead
resources
- the Map
of GISResource
s associated with this contextaddResource(String, GISResource)
,
removeResource(GISResource)
public int getThreadPoolSize()
Returns the size of the thread pool to execute parallel group tasks.
GroupThreadPool
public void setThreadPoolSize(int poolSize)
Sets the size of the thread pool to execute parallel group tasks
Setting a new pool size will nullify the current GroupThreadPool
and will result in the creation of a new
GroupThreadPool
.
poolSize
- the size of the thread pool to execute parallel group tasksGroupThreadPool
public GroupThreadPool getThreadPool()
Returns the GroupThreadPool
associated with this context.
Users should typically use this pool to execute similar tasks across multiple GISResource
s in parallel.
Below is a code snippet illustrating a typical use case. For more details see the documentation for the
GroupThreadPool
class
WebContext ctx = ...; GroupThreadPool pool = ctx.getThreadPool(); pool.execute(runnableTask1); //every call to execute() will submit a new task to the pool pool.execute(runnableTask2); //the pool then executes these tasks according to its policies ... pool.execute(runnableTaskN); <b>pool.awaitTermination();</b> //this call will block until all submitted tasks are completed
GroupThreadPool
associated with this contextGroupThreadPool
,
GroupThreadPool.awaitTermination()
public void setThreadPool(GroupThreadPool pool)
public WebSession getWebSession()
Returns the WebSession
that maintains a reference to this context.
Users can work with multiple contexts in the same session. All contexts are stored in a
WebSession
object which ensures that all WebContext
s it maintains are
cleanly destroyed when the user session terminates.
WebSession
that maintains a reference to this contextpublic void setWebSession(WebSession session)
Sets the WebSession
that maintains a reference to this context.
This method generates a new ID for this context and puts this context in the session
Users can work with multiple contexts in the same session. All contexts are stored in a
WebSession
object which ensures that all WebContext
s it maintains are
cleanly destroyed when the user session terminates.
session
- the WebSession
that maintains a reference to this contextpublic void setWebMap(WebMap map)
Sets the WebMap
referenced by this context.
The WebMap
can be accessed using the setWebMap(WebMap)
and getWebMap()
methods or as an
attribute of the context (WebMap)context.getAttribute("map");
map
- the WebMap
referenced by this contextpublic WebMap getWebMap()
Returns the WebMap
referenced by this context.
The WebMap
can be accessed using the setWebMap(WebMap)
and getWebMap()
methods or as an
attribute of the context (WebMap)context.getAttribute("map");
WebMap
referenced by this contextpublic void setWebGeocode(WebGeocode geocode)
Sets the WebGeocode
referenced by this context.
The WebGeocode
can be accessed using the setWebGeocode(WebGeocode)
and getWebGeocode()
methods or as an attribute of the context (WebGeocode)context.getAttribute("geocode");
geocode
- the WebGeocode
referenced by this contextpublic WebGeocode getWebGeocode()
Returns the WebGeocode
referenced by this context.
The WebGeocode
can be accessed using the setWebGeocode(WebGeocode)
and getWebGeocode()
methods or as an attribute of the context (WebGeocode)context.getAttribute("geocode");
WebGeocode
referenced by this contextpublic void setWebToc(WebToc toc)
Sets the WebToc
referenced by this context.
The WebToc
can be accessed using the setWebToc(WebToc)
and getWebToc()
methods or as an
attribute of the context (WebToc)context.getAttribute("toc");
toc
- the WebToc
referenced by this contextpublic WebToc getWebToc()
Returns the WebToc
referenced by this context.
The WebToc
can be accessed using the setWebToc(WebToc)
and getWebToc()
methods or as an
attribute of the context (WebToc)context.getAttribute("toc");
WebToc
referenced by this contextpublic void setWebOverview(WebOverview overview)
Sets the WebOverview
referenced by this context.
The WebOverview
can be accessed using the setWebOverview(WebOverview)
and
getWebOverview()
methods or as an attribute of the context
(WebOverview)context.getAttribute("overview");
overview
- the WebOverview
referenced by this contextpublic WebOverview getWebOverview()
Returns the WebOverview
referenced by this context.
The WebOverview
can be accessed using the setWebOverview(WebOverview)
and
getWebOverview()
methods or as an attribute of the context
(WebOverview)context.getAttribute("overview");
WebOverview
referenced by this contextpublic void setAttribute(String attrName, Object attrValue)
Sets value
as an attribute of this context. The attribute so set can be accessed with
name
as its key.
The WebContext.WEB_<NAME>_KEY
constants defined on the WebContext
are reserved for
attributes of the corresponding type. So the WebMap
attribute is reserved under the name
WEB_MAP_KEY
, the WebGeocode
attribute is reserved under the name WEB_GEOCODE_KEY
, and so
on. Attempting to set attributes of a wrong type under these reserved keys will result in
ClassCastException
s
A null
value
will remove the name
d attribute from this context.
Once you have registered your object as an attribute of the context, the WebContext
will make the
appropriate callbacks into your object as it does with all attributes. The callback methods for context attributes
are declared in the WebContextInitialize
, WebContextObserver
and WebLifecycle
interfaces.
attrName
- the attribute nameattrValue
- the value of the attribute
IllegalArgumentException
- if name
is nullWebContextInitialize
,
WebContextObserver
,
WebLifecycle
public Object getAttribute(String attrName)
Returns the attribute of this context referenced by the key name
attrName
- the attribute name
name
IllegalArgumentException
- is name
is nullsetAttribute(String, Object)
public void setAttributes(Map<String,?> attributes)
Adds these attributes
to the Map
of attributes maintained by this context.
Typically the attributes are set either declaratively in a JSF managed bean configuration file or programmatically
before this context is initialized. Once the context has been initialized, you should use the
setAttribute(String, Object)
and getAttribute(String)
methods instead
Once you have registered objects as attributes of the context, the WebContext
will make the
appropriate callbacks into your object as it does with all attributes. The callback methods for context attributes
are declared in the WebContextInitialize
, WebContextObserver
and WebLifecycle
interfaces.
attributes
- the attributes to be maintained by this contextsetAttribute(String, Object)
,
WebContextInitialize
,
WebContextObserver
,
WebLifecycle
public Map<String,Object> getAttributes()
Returns the attributes associated with this context.
setAttributes(Map)
,
getAttribute(String)
public void addObserver(WebContextObserver observer)
Adds a WebContextObserver
to this context.
The WebContext
will call the WebContextObserver.update(WebContext, Object)
methods on all its
registered observers when someone call the refresh()
or refresh(Object)
methods on this context.
This gives all observers of this context an opportunity to update themselves accordingly when the context is
refreshed and in doing so keep themselves in sync with the other observers of the context
observer
- the WebContextObserver
to be registeredWebContextObserver.update(WebContext, Object)
,
refresh()
,
refresh(Object)
,
removeObserver(WebContextObserver)
public boolean removeObserver(WebContextObserver observer)
Removes the observer
from the set of WebContextObserver
s associated with this context.
The WebContext
will no longer call the observer's update()
method once this call is made.
observer
- the WebContextObserver
to be removed
true
if the observer
was successfully removedpublic void refresh()
Refreshes this context by updating all registered WebContextObserver
s.
Users call this method when they have changed the state of one of the attributes (be it out of the box attributes
such as WebMap
or custom ones) and want other attributes of the context to react to this change. As a
result of calling this method, the update(this, null)
of all registered observers will get called.
Same as refresh(null)}
refresh(Object)
,
WebContextObserver
public void refresh(Object arg)
Refreshes this context by updating all registered WebContextObserver
s with arg
as the
argument. Observers can lookup this arg
and update themselves accordingly.
Users call this method when they have changed the state of one of the attributes (be it out of the box attributes
such as WebMap
or custom ones) and want other attributes of the context to react to this change. As a
result of calling this method, the update(this, arg)
of all registered observers will get called.
arg
- the argument passed to the update()
method of the registered WebContextObserver
spublic void destroy()
This method should be called when this context is to be destroyed. This method is typically called by the
WebSession
when the session is terminated.
This method does the following 3 things to destroy the context:
destroy()
on all attributes that implement WebContextInitialize
WebContextObserver
sdestroy()
on all the referenced GISResource
s
The WebContext
is no longer usable once it has been destroyed.
destroy
in interface WebContextInitialize
WebContextInitialize.destroy()
,
GISResource.destroy()
public void activate()
This method should be called when this context is to be activated. This method is typically called by the ADF when it starts to service a user request.
This method does the following 2 things to activate the context:
activate()
on all the referenced GISResource
sactivate()
on all attributes that implement WebLifecycle
The WebContext
is usable to service a request only after it has been activated.
activate
in interface WebLifecycle
WebLifecycle.activate()
,
GISResource.activate()
public void passivate()
This method should be called when this context is to be passivated. This method is typically called by the ADF once it is done servicing a user request.
This method does the following 2 things to passivate the context:
passivate()
on all attributes that implement WebLifecycle
passivate()
on all the referenced GISResource
s
The WebContext
is not usable once it has been passivated. To make it usable again one needs to reactivate
it by calling the activate()
method.
passivate
in interface WebLifecycle
WebLifecycle.passivate()
,
GISResource.passivate()
public void setWebGraphics(WebGraphics graphics)
Sets the WebGraphics
referenced by this context.
The WebGraphics
can be accessed using the setWebGraphics(WebGraphics)
and
getWebGraphics()
methods or as an attribute of the context
(WebGraphics)context.getAttribute("graphics");
graphics
- the WebGraphics
referenced by this contextpublic WebGraphics getWebGraphics()
Returns the WebGraphics
referenced by this context.
The WebGraphics
can be accessed using the setWebGraphics(WebGraphics)
and
getWebGraphics()
methods or as an attribute of the context
(WebGraphics)context.getAttribute("graphics");
WebGraphics
referenced by this contextpublic void setWebResults(WebResults results)
The WebResults
referenced by this context.
The WebResults
can be accessed using the setWebResults(WebResults)
and getWebResults()
methods or as an attribute of the context (WebResults)context.getAttribute("results");
results
- the WebResults
referenced by this contextpublic WebResults getWebResults()
The WebResults
referenced by this context.
The WebResults
can be accessed using the setWebResults(WebResults)
and getWebResults()
methods or as an attribute of the context (WebResults)context.getAttribute("results");
WebResults
referenced by this contextpublic void setWebQuery(WebQuery query)
The WebQuery
referenced by this context.
The WebQuery
can be accessed using the setWebQuery(WebQuery)
and getWebQuery()
methods or
as an attribute of the context (WebQuery)context.getAttribute("query");
query
- the WebQuery
referenced by this contextpublic WebQuery getWebQuery()
The WebQuery
referenced by this context.
The WebQuery
can be accessed using the setWebQuery(WebQuery)
and getWebQuery()
methods or
as an attribute of the context (WebQuery)context.getAttribute("query");
WebQuery
referenced by this contextpublic WebSpatialReference getSpatialReference()
Returns the spatial reference associated with this context.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
public void setSpatialReference(WebSpatialReference spatialReference)
Sets the spatial reference associated with this context.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
WebContext context = ...; WebMap map = context.getWebMap(); WebOverview overview = context.getWebOverview(); WebSpatialReference newSR = WebSpatialReference.getWebSpatialReference(this.getProjectionId()); context.setSpatialReference(newSR); map.init(context); WebPolygon horizon = newSR.getHorizon(false); if (horizon != null) { WebExtent horizonRect = null; if (horizon != null) { horizonRect = GeometryUtil.computeWebExtent(horizon); horizonRect.setSpatialReference(horizon.getSpatialReference()); horizonRect = WebUtil.reaspect(horizonRect, map.getWidth(), map.getHeight()); map.setFullExtent(horizonRect); map.setInitExtent(horizonRect); } } overview.exportImage(); context.refresh();
spatialReference
- the spatial reference associated with this contextpublic void setSpatialReferenceId(int id)
Sets the spatial reference associated with this context by its ID.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
id
- the ID of the spatial reference associated with this contextpublic int getSpatialReferenceId()
Returns the ID of the spatial reference associated with this context.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
public void setSpatialReferenceDefinitionString(String definitionString)
Sets the spatial reference associated with this context by its definition string.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
definitionString
- the definition string of the spatial reference associated with this contextpublic String getSpatialReferenceDefinitionString()
Returns the definition string of the spatial reference associated with this context.
If set and if supportMultipleSRs
is true, the map image exported by the WebMap
should be in
this SR.
public boolean isSupportMultipleSRs()
Returns true
if this context supports GISResource
s in different spatial references.
true
by default.
true
, this context supports GISResource
s in different spatial references.
true
by default.public void setSupportMultipleSRs(boolean supportsMultipleSRs)
If true
, this context supports GISResource
s in different spatial references. true
by default.
supportsMultipleSRs
- if true
, this context supports GISResource
s in different spatial
references. true
by default.public WebExtent projectExtent(WebExtent extent, WebSpatialReference toSpatialReference)
Convenience method which projects the given WebExtent
only if this context supports multiple SRs
extent
- the WebExtent
to be projectedtoSpatialReference
- the WebSpatialReference
to project the extent
to
WebExtent
public WebExtent projectExtent(WebExtent extent)
Convenience method which projects the given WebExtent
to the spatial reference of this context only if
this context supports multiple SRs
extent
- the WebExtent
to be projected
WebExtent
projected in the SR of this contextpublic WebPoint projectPoint(WebPoint point, WebSpatialReference toSpatialReference)
Convenience method which projects the given WebPoint
only if this context supports multiple SRs
point
- the WebPoint
to be projectedtoSpatialReference
- the WebSpatialReference
to project the point
to
WebPoint
public WebPoint projectPoint(WebPoint point)
Convenience method which projects the given WebPoint
to the spatial reference of this context only if
this context supports multiple SRs
point
- the WebPoint
to be projected
WebPoint
projected in the SR of this contextpublic WebGeometry project(WebGeometry geometry, WebSpatialReference toSpatialReference)
Convenience method which projects the given WebGeometry
only if this context supports multiple SRs
geometry
- the WebGeometry
to be projectedtoSpatialReference
- the WebSpatialReference
to project the extent
to
WebGeometry
public WebGeometry project(WebGeometry geometry)
Convenience method which projects the given WebGeometry
to the spatial reference of this context only
if this context supports multiple SRs
geometry
- the WebGeometry
to be projected
WebGeometry
projected in the SR of this contextpublic void setName(String name)
public String getName()
public String getResourceId(GISResource resource)
public GISResource getResourceById(String resourceId)
resourceId
- the resource id
public GraphicsResource getDefaultGraphicsResource()
GraphicsResource
public String getSpatialReferenceResourceId()
public void setDateFormat(String dateFormat)
dateFormat
- the dateFormat to setpublic String getDateFormat()
public void setNullValueDisplay(String nullValueDisplay)
nullValueDisplay
- the nullValueDisplay to setpublic String getNullValueDisplay()
public void setSpatialReferenceResourceId(String spatialReferenceResourceId)
spatialReferenceResourceId
- the ID of the resource whose spatial reference should be used by the WebContextpublic void setGeometryOperations(GeometryOperations operations)
WebGeometryOperations
.
operations
- the instance used for performing geometric operations
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |