com.esri.arcgis.framework
Class Templates

java.lang.Object
  extended by com.esri.arcgis.framework.Templates
All Implemented Interfaces:
ITemplates, com.esri.arcgis.interop.RemoteObjRef, Serializable

public class Templates
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, ITemplates

Templates collection object.

Description

The Templates collection references the template objects that are currently loaded with the application.

A Template is a document that is used as a starting point for creating new documents. It carries customizations of several types—user interface, VBA project, and application-specific data. ArcMap has two or three templates loaded with an application. If the document is based on the Normal template, two items are in the templates collection. If the document is based on a project template, three items are in the templates collection. ArcCatalog always has one item in the templates collection; this item represents Normal.gxt.

Use the IApplication.Templates property to get a reference to the Templates collection.

Remarks

Note, the esriDisplay library contains an object called Template that is unrelated to this Templates collection.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

See Also:
Serialized Form

Constructor Summary
Templates(Object obj)
          Construct a Templates using a reference to such an object returned from ArcGIS Engine or Server.
 
Method Summary
 boolean equals(Object o)
          Compare this object with another
 int getCount()
          The number of templates associated with the current document.
 String getItem(int index)
          The pathname to the template at the given index.
 int hashCode()
          the hashcode for this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

Templates

public Templates(Object obj)
          throws IOException
Construct a Templates using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to Templates.
Casting to this class from the return value of a method will not work, as this class represents an abstract class in ArcObjects.
*
Templates o = (Templates)obj; // will not work

Templates o = new Templates(obj); // Use this constructor instead
* @param obj an object returned from ArcGIS Engine or Server

Throws:
IOException - if there are interop problems Templates theTemplates = (Templates) obj;
Method Detail

equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getCount

public int getCount()
             throws IOException,
                    AutomationException
The number of templates associated with the current document.

Remarks

In ArcCatalog, Count is always 1. The Normal template is the only template or document loaded.
In ArcMap, Count is either 2 or 3. The Normal template and a document are always loaded. If there is also a base template loaded then the count becomes 3.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getCount in interface ITemplates
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItem

public String getItem(int index)
               throws IOException,
                      AutomationException
The pathname to the template at the given index.

Product Availability

Available with ArcGIS Desktop.

Specified by:
getItem in interface ITemplates
Parameters:
index - The index (in)
Returns:
The pathName
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.