com.esri.arcgis.controls
Class ToolbarItem

java.lang.Object
  extended by com.esri.arcgis.controls.ToolbarItem
All Implemented Interfaces:
IToolbarItem, IToolbarItem2, com.esri.arcgis.interop.RemoteObjRef, ISupportErrorInfo, Serializable

public class ToolbarItem
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IToolbarItem, IToolbarItem2, ISupportErrorInfo

ToolbarItems used by the ToolbarControl.

Description

A ToolbarItem represents a Command, Tool, ToolControl, Menu or Palette item on the ToolbarControl. These items generally appear as buttons however, a ToolControl will provide its own window, and will typically be a combo box.

Product Availability

Available with ArcGIS Engine.

See Also:
Serialized Form

Constructor Summary
ToolbarItem(Object obj)
          Construct a ToolbarItem using a reference to such an object returned from ArcGIS Engine or Server.
 
Method Summary
 boolean equals(Object o)
          Compare this object with another
 ICommand getCommand()
          The command used by the item.
 Object getCustomProperty()
          A property to associate data with an item.
 int getGroupSpacing()
          The width of the group separator in pixels if present.
 Object getItemObject()
          The Command, Tool, ToolControl, ToolbarMenu, ToolbarPalette or MultiItem used by the item.
 IToolbarMenu getMenu()
          If the item is a menu, this property is a ToolbarMenu object.
 IMultiItem getMultiItem()
          If the item is a multi-item, this property is a MultiItem object.
 IToolbarPalette getPalette()
          If the item is a palette, this property is a ToolbarPalette object.
 int getStyle()
          The style of the item.
 int getType()
          The type of item
 IUID getUID()
          The UID of the command used by the item, which may be empty.
 int hashCode()
          the hashcode for this object
 void interfaceSupportsErrorInfo(GUID riid)
          interfaceSupportsErrorInfo
 boolean isGroup()
          Indicates if a group separator exists to the left of the item on the ToolbarControl.
 void setCustomProperty(Object pVal)
          A property to associate data with an item.
 void setGroup(boolean pVal)
          Indicates if a group separator exists to the left of the item on the ToolbarControl.
 void setGroupSpacing(int pVal)
          The width of the group separator in pixels if present.
 void setStyle(int pVal)
          The style of the item.
 
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

ToolbarItem

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

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

Throws:
IOException - if there are interop problems ToolbarItem theToolbarItem = (ToolbarItem) 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

getCommand

public ICommand getCommand()
                    throws IOException,
                           AutomationException
The command used by the item.

Description

Returns the ICommand object used by the Command, Tool or ToolControl item. If the item is using a Menu, an IMultiItem object or Palette Nothing is returned.

Product Availability

Available with ArcGIS Engine.

Specified by:
getCommand in interface IToolbarItem
Returns:
A reference to a com.esri.arcgis.systemUI.ICommand
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getUID

public IUID getUID()
            throws IOException,
                   AutomationException
The UID of the command used by the item, which may be empty.

Description

Returns the UID of the Command used by the item. The method will return Nothing if the command has been added to the CommandPool using either the AddCommand or IToolbarControl::AddItem methods without a UID or ProgID supplied.

The UID objects are managed in association with objects implementing ICommand by the IToolbarControl::CommandPool.

Product Availability

Available with ArcGIS Engine.

Specified by:
getUID in interface IToolbarItem
Returns:
A reference to a com.esri.arcgis.system.IUID
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isGroup

public boolean isGroup()
                throws IOException,
                       AutomationException
Indicates if a group separator exists to the left of the item on the ToolbarControl.

Description

Determines whether a separator exists to the left of the item on the ToolbarControl. The separator will appear as verticle line. By default Group is False.

Product Availability

Available with ArcGIS Engine.

Specified by:
isGroup in interface IToolbarItem
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGroup

public void setGroup(boolean pVal)
              throws IOException,
                     AutomationException
Indicates if a group separator exists to the left of the item on the ToolbarControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setGroup in interface IToolbarItem
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getGroupSpacing

public int getGroupSpacing()
                    throws IOException,
                           AutomationException
The width of the group separator in pixels if present.

Description

Determines the width in pixels of a Group separator if it exists to the left the of the item on the ToolbarControl. The separator appears as verticle line and is drawn to the left of the GroupSpacing. A zero value sets the GroupSpacing to its default value (currently 4 pixels).

Product Availability

Available with ArcGIS Engine.

Specified by:
getGroupSpacing in interface IToolbarItem
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGroupSpacing

public void setGroupSpacing(int pVal)
                     throws IOException,
                            AutomationException
The width of the group separator in pixels if present.

Product Availability

Available with ArcGIS Engine.

Specified by:
setGroupSpacing in interface IToolbarItem
Parameters:
pVal - The pVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getStyle

public int getStyle()
             throws IOException,
                    AutomationException
The style of the item. Displays a combination of text caption and bitmap.

Description

Determines the Style of the item on the ToolbarControl, and whether the Caption, or Bitmap or Caption and Bitmap defined within the Command are displayed on the ToolbarControl. By default the Style is esriCommandStyleIconOnly. If the item has a Menu then the Style is fixed to a esriCommandStyleMenuBar Style.

Product Availability

Available with ArcGIS Engine.

Specified by:
getStyle in interface IToolbarItem
Returns:
A com.esri.arcgis.systemUI.esriCommandStyles constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setStyle

public void setStyle(int pVal)
              throws IOException,
                     AutomationException
The style of the item. Displays a combination of text caption and bitmap.

Product Availability

Available with ArcGIS Engine.

Specified by:
setStyle in interface IToolbarItem
Parameters:
pVal - A com.esri.arcgis.systemUI.esriCommandStyles constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCustomProperty

public Object getCustomProperty()
                         throws IOException,
                                AutomationException
A property to associate data with an item.

Description

Use the CustomProperty to associate any useful data with the ToolbarItem. This is similar to a 'Tag' property, and can be use to store strings, numbers and objects.

Product Availability

Available with ArcGIS Engine.

Specified by:
getCustomProperty in interface IToolbarItem
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCustomProperty

public void setCustomProperty(Object pVal)
                       throws IOException,
                              AutomationException
A property to associate data with an item.

Product Availability

Available with ArcGIS Engine.

Specified by:
setCustomProperty in interface IToolbarItem
Parameters:
pVal - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMenu

public IToolbarMenu getMenu()
                     throws IOException,
                            AutomationException
If the item is a menu, this property is a ToolbarMenu object.

Description

Returns the IToolbarMenu used by the item if the item represents a menu. If the item does not use a menu Nothing is returned.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMenu in interface IToolbarItem
Returns:
A reference to a com.esri.arcgis.controls.IToolbarMenu
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPalette

public IToolbarPalette getPalette()
                           throws IOException,
                                  AutomationException
If the item is a palette, this property is a ToolbarPalette object.

Description

Returns the IToolbarPalette used by the item if the item represents a palette. If the item does not use a palette Nothing is returned.

Product Availability

Available with ArcGIS Engine.

Specified by:
getPalette in interface IToolbarItem2
Returns:
A reference to a com.esri.arcgis.controls.IToolbarPalette
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMultiItem

public IMultiItem getMultiItem()
                        throws IOException,
                               AutomationException
If the item is a multi-item, this property is a MultiItem object.

Description

Returns the IMultiItem object used by the item if the item represents a multi-item. If the item does not use a multi-item Nothing is returned.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMultiItem in interface IToolbarItem2
Returns:
A reference to a com.esri.arcgis.systemUI.IMultiItem
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getType

public int getType()
            throws IOException,
                   AutomationException
The type of item

Description

Returns the type of object returned by ItemObject.

Product Availability

Available with ArcGIS Engine.

Specified by:
getType in interface IToolbarItem2
Returns:
A com.esri.arcgis.controls.esriToolbarItemType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItemObject

public Object getItemObject()
                     throws IOException,
                            AutomationException
The Command, Tool, ToolControl, ToolbarMenu, ToolbarPalette or MultiItem used by the item.

Description

Returns the ICommand, ITool, IToolControl, IMultiItem, IToolbarMenu2 or IToolbarPalette object from the ToolbarItem. Use the Type property to determine the type of object to be returned before using the ItemObject property.

Product Availability

Available with ArcGIS Engine.

Specified by:
getItemObject in interface IToolbarItem2
Returns:
A reference to another Object (IUnknown)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

interfaceSupportsErrorInfo

public void interfaceSupportsErrorInfo(GUID riid)
                                throws IOException,
                                       AutomationException
interfaceSupportsErrorInfo

Description

Indicates whether the interface supports IErrorInfo.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
interfaceSupportsErrorInfo in interface ISupportErrorInfo
Parameters:
riid - A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.