com.esri.adf.web.data
Class WebToc

java.lang.Object
  extended by com.esri.adf.web.data.TocModel
      extended by com.esri.adf.web.data.WebToc
All Implemented Interfaces:
WebContextInitialize, WebContextObserver, Serializable

public class WebToc
extends TocModel
implements WebContextInitialize, WebContextObserver

The WebToc represents the business object that works with the TocControl using the TocFunctionality objects configured with the GISResources.

See Also:
Serialized Form

Field Summary
protected  WebContext context
          The associated WebMap object for this WebToc.
protected  Class customReourceContentClass
           
protected  String customResourceContentClassName
          The name of the custom class (which should be a sub-class of TocResourceContent) to use for the resource nodes
protected  int expandLevel
          The number of levels to expand by default.
protected  Hashtable<TocFunctionality,TocNode> funcsNodes
           
protected  String imageFormat
          The format of the TOC images.
protected  int nextResourceNodeIndex
           
protected  ArrayList<TocNode> resourceNodes
           
protected static String TOC_MODEL_TYPE
           
protected  ArrayList<TocFunctionality> tocFuncs
           
protected  boolean useMIMEData
          Indicates whether MIME data is used.
 
Fields inherited from class com.esri.adf.web.data.TocModel
init, showContextMenu, visible
 
Constructor Summary
WebToc()
          Initializes the WebToc.
 
Method Summary
 void destroy()
           The cleaup chores (such as releasing held resources) of attributes of a WebContext should be performed in this method.
 String getCustomResourceContentClassName()
          Returns the name of the custom class (which should be a sub-class of TocREsourceContent) to use for the resource nodes
 int getExpandLevel()
          Returns the number of levels to be expanded by default.
 String getImageFormat()
          Returns the format of the TOC images.
 Collection<TocNode> getRootNodes()
          Returns a collection of the top level TocNodes of the TOC.
 List<TocFunctionality> getTocFunctionalities()
           
 String getTocModelType()
           
 WebContext getWebContext()
           
 void init(TocFunctionality tocFunc)
          Initializes the WebToc for the specified toc functionality.
 void init(WebContext webContext)
          Initializes the WebToc by associating itself with this context.
 boolean isUseMIMEData()
          Returns an indicator whether the control returns MIME data or not.
 void setCustomResourceContentClassName(String customResourceContentClassName)
          Sets the name of the custom class (which should be a sub-class of TocResourceContent) to use for the resource nodes
 void setExpandLevel(int expandLevel)
          Sets the number of levels to be expanded by default.
 void setImageFormat(String imageFormat)
          Sets the format of the TOC images.
 void setUseMIMEData(boolean useMIMEData)
          Sets whether the control returns MIME data or not.
 void update(WebContext ctxt, Object arg)
           This method is called by the WebContext on its registered WebContextObservers when users call the refresh() methods on the context.
 
Methods inherited from class com.esri.adf.web.data.TocModel
addTimer, findNode, findNode, getTimers, isInit, isShowContextMenu, isShowOpenResultLink, isVisible, removeNode, setInit, setShowContextMenu, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected WebContext context
The associated WebMap object for this WebToc.


imageFormat

protected String imageFormat
The format of the TOC images.


TOC_MODEL_TYPE

protected static final String TOC_MODEL_TYPE
See Also:
Constant Field Values

useMIMEData

protected boolean useMIMEData
Indicates whether MIME data is used. True by default.


expandLevel

protected int expandLevel
The number of levels to expand by default. The default value is -1, expand all.


resourceNodes

protected ArrayList<TocNode> resourceNodes

tocFuncs

protected ArrayList<TocFunctionality> tocFuncs

funcsNodes

protected Hashtable<TocFunctionality,TocNode> funcsNodes

customResourceContentClassName

protected String customResourceContentClassName
The name of the custom class (which should be a sub-class of TocResourceContent) to use for the resource nodes


customReourceContentClass

protected Class customReourceContentClass

nextResourceNodeIndex

protected int nextResourceNodeIndex
Constructor Detail

WebToc

public WebToc()
Initializes the WebToc.

Method Detail

getTocModelType

public String getTocModelType()
Specified by:
getTocModelType in class TocModel

init

public void init(WebContext webContext)
Initializes the WebToc by associating itself with this context. Concrete implementations may want to override this method to do other initialization tasks. This method is called by the ADF when the WebToc is initialized.

Specified by:
init in interface WebContextInitialize
Parameters:
webContext - WebContext
See Also:
WebContext.init(WebContext), WebContext.addResource(String, GISResource, int), WebContext.removeResource(GISResource)

init

public void init(TocFunctionality tocFunc)
Initializes the WebToc for the specified toc functionality.

Parameters:
tocFunc - the TocFunctionality to re-initialize

destroy

public void destroy()
Description copied from interface: WebContextInitialize

The cleaup chores (such as releasing held resources) of attributes of a WebContext should be performed in this method.

Typically this method is called by the WebContext when the context itself is destroyed.

The WebContext attribute is unusable after this method has been called.

Specified by:
destroy in interface WebContextInitialize
See Also:
WebContext.destroy()

setImageFormat

public void setImageFormat(String imageFormat)
Sets the format of the TOC images.

Parameters:
imageFormat - the image format

getImageFormat

public String getImageFormat()
Returns the format of the TOC images.

Returns:
String- the image format

getRootNodes

public Collection<TocNode> getRootNodes()
Returns a collection of the top level TocNodes of the TOC. These top level nodes typically represent data frames.

Specified by:
getRootNodes in class TocModel
Returns:
Collection- the collection of TocNodes

getCustomResourceContentClassName

public String getCustomResourceContentClassName()
Returns the name of the custom class (which should be a sub-class of TocREsourceContent) to use for the resource nodes

Returns:
the name of the custom class

setCustomResourceContentClassName

public void setCustomResourceContentClassName(String customResourceContentClassName)
Sets the name of the custom class (which should be a sub-class of TocResourceContent) to use for the resource nodes

Parameters:
customResourceContentClassName - the name of the custom class

getTocFunctionalities

public List<TocFunctionality> getTocFunctionalities()

setUseMIMEData

public void setUseMIMEData(boolean useMIMEData)
Sets whether the control returns MIME data or not. True by default.

Parameters:
useMIMEData - if true, MIME data is returned instead of an image URL string.

isUseMIMEData

public boolean isUseMIMEData()
Returns an indicator whether the control returns MIME data or not.

Returns:
boolean- if true, MIME data is used

setExpandLevel

public void setExpandLevel(int expandLevel)
Sets the number of levels to be expanded by default.

Parameters:
expandLevel - the expand level

getExpandLevel

public int getExpandLevel()
Returns the number of levels to be expanded by default.

Returns:
int - the expand level

getWebContext

public WebContext getWebContext()

update

public void update(WebContext ctxt,
                   Object arg)
Description copied from interface: WebContextObserver

This method is called by the WebContext on its registered WebContextObservers when users call the refresh() methods on the context.

To setup an object to be updated by the context, one needs to use the WebContext.addObserver(WebContextObserver) to register itself with the context. All context attributes are wired up to the WebContext. When users change state on any of the attributes and need to intimate other attributes of the context to react to the change they call either the WebContext.refresh() or WebContext.refresh(Object) methods. The context in turns calls the WebContextObserver.update(WebContext, Object) methods on all its registered observers.

Specified by:
update in interface WebContextObserver
Parameters:
ctxt - the WebContext that has been refreshed
arg - the argument passed to the WebContext's refresh(arg) method
See Also:
WebContext.refresh(Object), WebContext.addObserver(WebContextObserver), WebContext.removeObserver(WebContextObserver)