com.esri.arcgis.addins.desktop
Class Button

java.lang.Object
  extended by com.esri.arcgis.addins.desktop.Button
Direct Known Subclasses:
Tool

public abstract class Button
extends Object

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:


Constructor Summary
Button()
           
 
Method Summary
 void init(IApplication app)
          Initializes this button with the ArcGIS application it is hosted in.
 boolean isChecked()
          Returns whether this button is checked.
 boolean isEnabled()
          Returns whether this button is enabled.
abstract  void onClick()
          Called when the button is clicked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Button

public Button()
Method Detail

onClick

public abstract void onClick()
                      throws IOException,
                             AutomationException
Called when the button is clicked. Subclasses must implement this method to define the action performed when the button is clicked

Throws:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

init

public void init(IApplication app)
          throws 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:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

isChecked

public boolean isChecked()
                  throws IOException,
                         AutomationException
Returns whether this button is checked.

The default implementation returns false to indicate that the button is always unchecked.

Override this method if the button is not always unchecked.

Returns:
true if checked, and false if unchecked
Throws:
IOException
AutomationException

isEnabled

public boolean isEnabled()
                  throws IOException,
                         AutomationException
Returns whether this button is enabled.

The default implementation returns true to indicate that the button is always enabled.

Override this method if the button is not always enabled.

Returns:
true if enabled, and false if disabled
Throws:
IOException
AutomationException