com.esri.arcgis.addinframework
Class InternalButton

java.lang.Object
  extended by com.esri.arcgis.addinframework.AddIn
      extended by com.esri.arcgis.addinframework.InternalButton
All Implemented Interfaces:
ICommand, java.io.Serializable
Direct Known Subclasses:
InternalButtonComponentTip, InternalComboBox, InternalTool, InternalToolPalette

public class InternalButton
extends AddIn
implements ICommand

Abstract base implementation of ArcGIS application buttons.

This class should be subclassed by clients wishing to define new buttons. The name of the subclass should be given as the "class" attribute in a Button extension contributed to the ArcGIS application framework. For example, the add-in's config.xml markup might contain:

      <Commands>
        <Button id="com.acme.addins.AcmeButton" 
            class="com.acme.addins.AcmeButton" 
            caption="Bookmark" 
            category="Map Tools" 
            image="images/bookmark.png">
          <Tip>Creates a bookmark</Tip>
          <Message>Creates a bookmark</Message>
        </Button>
      </Commands>  
 

Subclasses must implement the following methods:

Subclasses may override the following methods as required:

See Also:
Serialized Form

Constructor Summary
InternalButton()
           
 
Method Summary
 void init(IApplication app)
          Initializes this button with the ArcGIS application it is hosted in.
 boolean isChecked()
          Indicates if this command is checked.
 boolean isEnabled()
          Indicates if this command is enabled.
 void onClick()
          Occurs when this command is clicked.
 void seed(java.lang.Object delegate)
           
 
Methods inherited from class com.esri.arcgis.addinframework.AddIn
getApp, nativeGetPictureFromIStream, nativeGetPictureFromStream, read, readCursorFromStream, readPictureFromIStream, readPictureFromStream, readSubnode, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.systemUI.ICommand
getBitmap, getCaption, getCategory, getHelpContextID, getHelpFile, getMessage, getName, getTooltip, onCreate
 

Constructor Detail

InternalButton

public InternalButton()
Method Detail

seed

public void seed(java.lang.Object delegate)
Specified by:
seed in class AddIn

onClick

public void onClick()
             throws java.io.IOException,
                    AutomationException
Occurs when this command is clicked.

Remarks

When implementing ICommand to create a custom command, write the code that performs the action when the command is clicked in the OnClick method.

Example:

public void onClick() {     
   //In this example, a message is displayed in console.     
   System.out.println("Clicked on my command");
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onClick in interface ICommand
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

init

public void init(IApplication app)
          throws java.io.IOException,
                 AutomationException
Initializes this button with the ArcGIS application it is hosted in.

This method is automatically called by the host ArcGIS application when the button is initialized. It marks the start of the button's lifecycle. Clients must not call this method.

Parameters:
app - the ArcGIS application that hosts this button
Throws:
java.io.IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

isChecked

public boolean isChecked()
                  throws java.io.IOException,
                         AutomationException
Indicates if this command is checked.

Remarks

The Checked property indicates the state of this Command. If a command item appears depressed on a commandbar, the command is checked. The active tool will appear checked. Also commands that serve as a toggle will be checked when that toggle is on.
A system event is periodically called to set the state of the commands on the commandbars indicating which ones are checked.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isChecked in interface ICommand
Returns:
The checked
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEnabled

public boolean isEnabled()
                  throws java.io.IOException,
                         AutomationException
Indicates if this command is enabled.

Remarks

When implementing ICommand to create a custom command, add some logic to the Enabled property to specify in what state the application should be in for the command to be enabled.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isEnabled in interface ICommand
Returns:
The enabled
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.