com.esri.adf.web.data.graphics
Class GraphicsResource

java.lang.Object
  extended by com.esri.adf.web.data.GISResource
      extended by com.esri.adf.web.data.graphics.GraphicsResource
All Implemented Interfaces:
WebContextInitialize, WebLifecycle, java.io.Serializable

public class GraphicsResource
extends GISResource

GraphicsResource is a GISResource that permits working with GraphicsLayers that originate and live solely in the ADF tier. GraphicsResource holds a list of GraphicsLayers.

See Also:
Serialized Form

Field Summary
protected  WebSpatialReference spatialReference
           
 
Fields inherited from class com.esri.adf.web.data.GISResource
alias, context, defaultSpatialReference, functionalities, init
 
Constructor Summary
GraphicsResource()
           
 
Method Summary
 int addGraphicsLayer(GraphicsLayer layer)
          Adds a GraphicsLayer to the internal list of GraphicsLayers.
 java.lang.String getAlias()
           Returns a reader friendly name for this resource.
 java.util.List<GraphicsLayer> getLayers(boolean leafNodesOnly)
          Returns a list of all graphics layers.
 void init(WebContext wcontext)
           This method is called by the WebContext to initialize the resource.
 void removeAllGraphicsLayer()
          Removes all graphics layers.
 void removeGraphicsLayer(GraphicsLayer layer)
          Removes a given graphics layer.
 void setDefaultSpatialReference(WebSpatialReference spatialReference)
           
 
Methods inherited from class com.esri.adf.web.data.GISResource
activate, addFunctionality, destroy, getDefaultSpatialReference, getFunctionalities, getFunctionality, getWebContext, passivate, setAlias, setFunctionalities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spatialReference

protected WebSpatialReference spatialReference
Constructor Detail

GraphicsResource

public GraphicsResource()
Method Detail

init

public void init(WebContext wcontext)
Description copied from class: GISResource

This method is called by the WebContext to initialize the resource. This is typically called when the context itself is initialized or when users add a new resource to the context by using the WebContext.addResource(String, GISResource) method. A GISResource is usable only after this method has been called.

This method iterates through all its supported GISFunctionalitys and calls the GISFunctionality.initFunctionality(GISResource) on them all.

Sub-classes that want to do custom initialization should override this method and make the super call first before doing the custom stuff:

 public void init(WebContext context) {
   super.init(context);
   myInit();
 }
 

Specified by:
init in interface WebContextInitialize
Overrides:
init in class GISResource
Parameters:
wcontext - the WebContext that maintains a reference to this resource
See Also:
WebContextInitialize.init(com.esri.adf.web.data.WebContext), GISFunctionality.initFunctionality(GISResource), WebContext.init(WebContext), WebContext.addResource(String, GISResource)

getAlias

public java.lang.String getAlias()
Description copied from class: GISResource

Returns a reader friendly name for this resource.

It is a good practice for users to explicitly set an alias when the resource is created programmatically or declaratively. Resource providers should provide an auto-generated alias anyway in case users don't explicitly set an alias themselves.

Overrides:
getAlias in class GISResource
Returns:
a reader friendly name for this resource

setDefaultSpatialReference

public void setDefaultSpatialReference(WebSpatialReference spatialReference)

addGraphicsLayer

public int addGraphicsLayer(GraphicsLayer layer)
Adds a GraphicsLayer to the internal list of GraphicsLayers.

Parameters:
layer - a layer to be added
Returns:
id of the added layer

removeGraphicsLayer

public void removeGraphicsLayer(GraphicsLayer layer)
Removes a given graphics layer.

Parameters:
layer - a layer to be removed

removeAllGraphicsLayer

public void removeAllGraphicsLayer()
Removes all graphics layers.


getLayers

public java.util.List<GraphicsLayer> getLayers(boolean leafNodesOnly)
Returns a list of all graphics layers.

Parameters:
leafNodesOnly - determines whether instances of GroupGraphicsLayer should be returned
Returns:
the list of graphics layers