|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.framework.AppRef
public class AppRef
A reference to the currently running application.
If for some reason you can't easily get a reference to the Application object in your code, you can create a new AppRef object. For example, there are cases where you may implement an object that exists within the application framework but there is no way to traverse the application hierarchy from that object. In order to provide developers access to the application object there is a singleton object that provides a pointer to the running application object.
Note you can only use the AppRef object if your code is running inside one of the ArcGIS application processes.
Constructor Summary | |
---|---|
AppRef()
Constructs a AppRef using ArcGIS Engine. |
|
AppRef(Object obj)
Construct a AppRef using a reference to such an object returned from ArcGIS Engine or Server. |
Method Summary | |
---|---|
boolean |
equals(Object o)
Compare this object with another |
IExtension |
findExtensionByCLSID(IUID extensionCLSID)
Finds an extension by its CLSID. |
IExtension |
findExtensionByName(String extensionName)
Finds an extension by its name. |
String |
getCaption()
The caption of this application. |
static String |
getClsid()
getClsid. |
ICommandItem |
getCurrentTool()
The currently selected tool. |
IDocument |
getDocument()
The document that is currently loaded in the application. |
int |
getHWnd()
The handle of the application's window. |
String |
getName()
The name of this application. |
IStatusBar |
getStatusBar()
The statusbar of this application. |
ITemplates |
getTemplates()
The templates collection. |
Object |
getVBE()
The Visual Basic Environment. |
int |
hashCode()
the hashcode for this object |
boolean |
isDialogVisible(int dialogID)
Indicates if the specified dialog is visible in the application. |
boolean |
isVisible()
Indicates if the application window is visible. |
void |
lockCustomization(String password,
ICustomizationFilter custFilter)
Locks the application's user interface against any customizations. |
void |
newDocument(boolean selectTemplate,
String templatePath)
Creates a new document in this application. |
void |
openDocument(String path)
Opens a document in this application. |
void |
printDocument()
Displays the Print dialog. |
void |
printPreview()
Displays how the document will look like when it is printed. |
void |
refreshWindow()
Redraws the application window. |
void |
saveAsDocument(String saveAsPath,
boolean saveAsCopy)
Saves the document that is currently open in this application to a different file. |
void |
saveDocument(String saveAsPath)
Saves the document that is currently open in this application. |
void |
setCaption(String caption)
The caption of this application. |
void |
setCurrentToolByRef(ICommandItem tool)
The currently selected tool. |
void |
setVisible(boolean visible)
Indicates if the application window is visible. |
Object |
showDialog(int dialogID,
Object bShow)
Displays the specified dialog in the application. |
void |
shutdown()
Terminates the application. |
void |
unlockCustomization(String password)
Unlocks previous user interface customization lock. |
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 |
---|
public AppRef() throws IOException, UnknownHostException
IOException
- if there are interop problems
UnknownHostException
- if there are interop problemspublic AppRef(Object obj) throws IOException
obj
to AppRef
.
obj
- an object returned from ArcGIS Engine or Server
IOException
- if there are interop problems
AppRef theAppRef = (AppRef) obj;
Method Detail |
---|
public static String getClsid()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String getName() throws IOException, AutomationException
Returns the string ArcMap for the ArcMap application.
Returns the string ArcCatalog for the ArcCatalog application.
getName
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IDocument getDocument() throws IOException, AutomationException
In ArcMap, the Document is the currently loaded document.
In ArcCatalog, the Document is the Normal template.
Both ArcMap and ArcCatalog applications are composed of several things including a document. The document is an object which controls the representation of data. In ArcMap, the document object is the MxDocument CoClass and in ArcCatalog it is the GxDocument CoClass. Access to these CoClasses is provided through this property.
getDocument
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IDocument
,
GxDocument
,
com.esri.arcgis.arcmapUI.MxDocument
public IStatusBar getStatusBar() throws IOException, AutomationException
The status bar is the horizontal area at the bottom of an ArcGIS application window. It provides information about the selected command. For example, if you select a layer in the table of contents in ArcMap, the status bar will tell you how many features are currently selected. It may also display a progress bar while something is being processed.
The IStatusBar interface allows you to set the properties of the status bar.
getStatusBar
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IStatusBar
public Object showDialog(int dialogID, Object bShow) throws IOException, AutomationException
Refer to the esriMxDlgIDs Constants help topic for a listing of the dialog ids in ArcMap.
Refer to the esriGxDlgIDs Constants help topic for a listing of the dialog ids in ArcCatalog.
This example shows the TOC in ArcMap if it is not already visible. You would get m_app from the hook in ICommand::OnCreate().
showDialog
in interface IApplication
dialogID
- The dialogID (in)bShow
- A Variant (in, optional, pass null if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.arcmapUI.esriMxDlgIDs
,
com.esri.arcgis.arccatalogui.esriGxDlgIDs
public boolean isDialogVisible(int dialogID) throws IOException, AutomationException
Refer to the esriMxDlgIDs Constants help topic for a listing of the dialog ids in ArcMap.
Refer to the esriGxDlgIDs Constants help topic for a listing of the dialog ids in ArcCatalog.
isDialogVisible
in interface IApplication
dialogID
- The dialogID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.arcmapUI.esriMxDlgIDs
,
com.esri.arcgis.arccatalogui.esriGxDlgIDs
public ICommandItem getCurrentTool() throws IOException, AutomationException
getCurrentTool
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ICommandItem
public void setCurrentToolByRef(ICommandItem tool) throws IOException, AutomationException
This VBA macro makes the Identify tool the currently selected tool in ArcMap.
Public Sub SetCurrentTool()
Dim pItem As ICommandItem
' Use the built-in ArcId module to find unique identifier
' for the Identify tool
Set pItem = CommandBars.Find(arcid.Query_Identify)
Set Application.CurrentTool = pItem
End Sub
setCurrentToolByRef
in interface IApplication
tool
- A reference to a com.esri.arcgis.framework.ICommandItem (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ICommandItem
public Object getVBE() throws IOException, AutomationException
The VBE is the root object that provides access to all other objects represented in Visual Basic for Applications that is embedded in the application.
getVBE
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void newDocument(boolean selectTemplate, String templatePath) throws IOException, AutomationException
selectTemplate Specify True if you want the New document dialog to be opened to allow the user to select a template. [Optional]
templatePath is a string representing the path and filename of the template to base the new document on if selectTemplate is False. [Optional]
If selectTemplate is True, the New document dialog is displayed.
If templatePath is not specified, the New document dialog is displayed regardless of the value of selectTemplate.
Note, this method does not work in ArcCatalog.
The following example creates a new document in ArcMap using the Normal template. You would get m_app from the hook in ICommand::OnCreate().
newDocument
in interface IApplication
selectTemplate
- The selectTemplate (in, optional, pass false if not required)templatePath
- The templatePath (in, optional, pass null if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void openDocument(String path) throws IOException, AutomationException
Path is a string representing the path and filename of the document to be opened. [Optional]
If no Path is specified, the Open dialog is displayed.
Note, this method does not work in ArcCatalog.
openDocument
in interface IApplication
path
- The path (in, optional, pass null if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void saveDocument(String saveAsPath) throws IOException, AutomationException
saveAsPath is a string representing a path and filename for the document that is being saved. [Optional]
If this document is a new document that has not been saved yet and a saveAsPath is not specified, the Save As dialog will be displayed.
saveDocument
in interface IApplication
saveAsPath
- The saveAsPath (in, optional, pass null if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void saveAsDocument(String saveAsPath, boolean saveAsCopy) throws IOException, AutomationException
saveAsPath is a string representing a new path and filename for the document that is being saved. [Optional]
saveAsCopy specify True if you want to save a copy of the document to a new filename but keep the original document open in the application; otherwise False. [Optional]
Note, this method does not work in ArcCatalog.
saveAsDocument
in interface IApplication
saveAsPath
- The saveAsPath (in, optional, pass null if not required)saveAsCopy
- The saveAsCopy (in, optional, pass false if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void printPreview() throws IOException, AutomationException
Note, this method does not work in ArcCatalog.
printPreview
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void printDocument() throws IOException, AutomationException
Note, this method does not work in ArcCatalog.
printDocument
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void lockCustomization(String password, ICustomizationFilter custFilter) throws IOException, AutomationException
password is a string representing a password. The string must be at least five characters long.
custFilter is a customization filter object which implements the ICustomizationFilter interface. [Optional]
lockCustomization
in interface IApplication
password
- The password (in)custFilter
- A reference to a com.esri.arcgis.framework.ICustomizationFilter (in, optional, pass null if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ICustomizationFilter
public void unlockCustomization(String password) throws IOException, AutomationException
password is a string representing the password that was used to lock customization. The string must be at least five characters long.
unlockCustomization
in interface IApplication
password
- The password (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void refreshWindow() throws IOException, AutomationException
refreshWindow
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public ITemplates getTemplates() throws IOException, AutomationException
The Templates object is a collection of the templates that are currently loaded in the application. In ArcCatalog, the Normal template, Normal.gxt, is the only template that is ever loaded. In ArcMap, there is either two or three templates loaded. The Normal template, Normal.mxt, is always loaded. Also, the document is considered a template is this case; there is always a document loaded in ArcMap. Optionally, the document can be based on another template referred to as a base template.
getTemplates
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ITemplates
public int getHWnd() throws IOException, AutomationException
getHWnd
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IExtension findExtensionByName(String extensionName) throws IOException, AutomationException
extensionName specifies the name of an extension as a string.
To find the Name of an ESRI extension, refer to the following technical document:
ArcGIS Developer Help > Technical Documents > Names and IDs > Extensions
If an extension is registered as a Just-In-Time extension, FindExtensionByName may return nothing. The safest way to get a reference to any extension is to use FindExtensionByCLSID.
findExtensionByName
in interface IApplication
extensionName
- The extensionName (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IExtension
public IExtension findExtensionByCLSID(IUID extensionCLSID) throws IOException, AutomationException
ExtensionCLSID specifies the unique identifier (UID) of an extension.
COM coclasses are identified by a globally unique identifier (GUID). There are two formats for the GUID for a coclass: a class ID (CLSID) and a ProgID. The ProgID is a text alias for a CLSID. The UID coclass can be used to represent the GUID of an extension object. You can set the IUID.Value property to either the CLSID or the ProgID.
To find the CLSID and ProgID of an ESRI extension, refer to the following technical document:
ArcGIS Developer Help > Technical Documents > Names and IDs > Extensions
For your custom extensions, the ProgID is a string composed of the name of your project used to make the extension and the class name of the extension. For example if you have a Visual Basic project called MyCustomExt and there is a class module for your extension called clsMyExtension in that project, then the ProgID for this command would be "MyCustomExt.clsMyExtension". To find the CLSID for this command, you could search the system registry for this ProgID.
findExtensionByCLSID
in interface IApplication
extensionCLSID
- A reference to a com.esri.arcgis.system.IUID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IExtension
,
IUID
public void shutdown() throws IOException, AutomationException
shutdown
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isVisible() throws IOException, AutomationException
Set the Visible property to True to make the application window visible.
isVisible
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setVisible(boolean visible) throws IOException, AutomationException
Set the Visible property to True to make the application window visible.
setVisible
in interface IApplication
visible
- The visible (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCaption(String caption) throws IOException, AutomationException
Public Sub SetCaption()
Application.Caption = "My Custom Application"
End Sub
setCaption
in interface IApplication
caption
- The caption (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getCaption() throws IOException, AutomationException
The Caption is the string that appears as the title of the application's main window.
getCaption
in interface IApplication
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |