com.esri.arcgis.addins.desktop
Class ComboBox

java.lang.Object
  extended by com.esri.arcgis.addins.desktop.ComboBox

public abstract class ComboBox
extends Object

Abstract base implementation of ArcGIS combo boxes.

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

      <ComboBox id="test_combobox" 
                editable="true" 
                sizeString="WWWWW" 
                rows="10" 
                itemSizeString="WWWWWWWWWW" 
                hintText="hint" 
                class="arcgissamples.addins.button.MyComboBox"
                caption="comboBox" 
                category="Framework AddIn Samples" 
                image="Images/Addlayer.png" 
                tip="tip" 
                message="message">
        </ComboBox>  
 

Subclasses must implement the following methods:

Subclasses may override the following methods as required:
Subclasses should call the following methods to add, remove, select or clear the entries in the combo box, or to get the currently selected item:


Field Summary
 IComboBoxHook hook
           
 
Constructor Summary
ComboBox()
           
 
Method Summary
 int add(String str)
          Call this method from the derived class to add an element to the combo box
 void clear()
          Call this method from the derived class to clear (delete all element from) the combo box
 int getSelected()
          Call this method from the derived class to get the currently selected item in the combo box
abstract  void initialize()
          Called when the combo box is initialized.
 boolean isEnabled()
          Returns whether this combo box is enabled.
abstract  void onEditChange(String editString)
          Called by system when the edit box is typed into (if editable)
abstract  void onEnter()
          Called by system when the Enter key is pressed in the edit box (if editable)
abstract  void onFocus(boolean setFocus)
          Called by system when the combo box gets or loses focus
abstract  void onSelChange(int cookie)
          Called by system when a selection changes
 void remove(int cookie)
          Call this method from the derived class to delete an element from the combo box
 void select(int cookie)
          Call this method from the derived class to select an element in the combo box
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hook

public IComboBoxHook hook
Constructor Detail

ComboBox

public ComboBox()
Method Detail

initialize

public abstract void initialize()
Called when the combo box is initialized. Subclasses must implement this method to add entries to the combo box using the add() method.

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

onEditChange

public abstract void onEditChange(String editString)
                           throws IOException,
                                  AutomationException
Called by system when the edit box is typed into (if editable)

Parameters:
editString - the String typed into the edit box
Throws:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

onSelChange

public abstract void onSelChange(int cookie)
                          throws IOException,
                                 AutomationException
Called by system when a selection changes

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

onFocus

public abstract void onFocus(boolean setFocus)
                      throws IOException,
                             AutomationException
Called by system when the combo box gets or loses focus

Parameters:
setFocus - - true when combo box gets focus, false when it loses focus
Throws:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

onEnter

public abstract void onEnter()
                      throws IOException,
                             AutomationException
Called by system when the Enter key is pressed in the edit box (if editable)

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

isEnabled

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

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

Override this method if the combo box is not always enabled.

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

add

public final int add(String str)
              throws AutomationException,
                     IOException
Call this method from the derived class to add an element to the combo box

Parameters:
str - - the item to be added to the combo box
Returns:
an int (cookie) that represents the added item
Throws:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

remove

public final void remove(int cookie)
                  throws AutomationException,
                         IOException
Call this method from the derived class to delete an element from the combo box

Parameters:
cookie - - the item to be deleted (use the cookie obtained from the add() method)
Throws:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

clear

public final void clear()
                 throws AutomationException,
                        IOException
Call this method from the derived class to clear (delete all element from) the combo box

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

select

public final void select(int cookie)
                  throws AutomationException,
                         IOException
Call this method from the derived class to select an element in the combo box

Parameters:
cookie - - the item to be selected (use the cookie obtained from the add() method)
Throws:
IOException - if there are interop problems.
AutomationException - if the component throws an ArcObjects exception.

getSelected

public final int getSelected()
                      throws AutomationException,
                             IOException
Call this method from the derived class to get the currently selected item in the combo box

Returns:
the item selected (returns the cookie representing the item)
Throws:
AutomationException
IOException