|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.framework.CommandItem
public class CommandItem
Command Item.
A CommandItem class represents any item on a command bar. For example, buttons, tools, and menu items that appear on command bars are all command items. Use the Find method from either ICommandBars or ICommandBar to obtain a reference to a particular CommandItem.
Constructor Summary | |
---|---|
CommandItem(Object obj)
Construct a CommandItem using a reference to such an object returned from ArcGIS Engine or Server. |
Method Summary | |
---|---|
void |
delete()
Removes this object from the commandbar. |
boolean |
equals(Object o)
Compare this object with another |
void |
execute()
Causes the command to execute. |
String |
getAction()
The name of the VBA macro this command should run when pressed. |
String |
getCaption()
The caption of this command item. |
String |
getCategory()
The name of the category with which this command item is associated. |
void |
getClassID(GUID[] pClassID)
getClassID |
ICommand |
getCommand()
A reference to the internal command object. |
Object |
getFaceID()
The bitmap that is used as the icon on this command item. |
int |
getHelpContextID()
The help context ID associated with this command item. |
String |
getHelpFile()
The help file associated with this command item. |
IUID |
getID()
The unique integer ID associated with this command item. |
int |
getIndex()
The positional index of this command item within its menu or toolbar. |
String |
getMessage()
The status bar message for this command item. |
String |
getName()
The name of this command item. |
ICommandBar |
getParent()
The menu or toolbar that this command item currently resides on. |
void |
getSizeMax(_ULARGE_INTEGER[] pcbSize)
getSizeMax |
int |
getStyle()
The display style of this command item. |
String |
getTag()
The tag for this command item. |
String |
getTooltip()
The tooltip for this command item. |
int |
getType()
The type of this command item. |
int |
hashCode()
the hashcode for this object |
void |
interfaceSupportsErrorInfo(GUID riid)
interfaceSupportsErrorInfo |
boolean |
isBuiltIn()
Indicates whether this command item is built-in or if it was implemented through VBA. |
void |
isDirty()
isDirty |
boolean |
isGroup()
Indicates if this command item begins a menu or toolbar group. |
void |
load(IStream pstm)
load |
void |
readExternal(ObjectInput in)
|
void |
refresh()
Causes the command to be redrawn. |
void |
reset()
Restores this command item's properties to that of the original. |
void |
save(IStream pstm,
int fClearDirty)
save |
void |
setAction(String macro)
The name of the VBA macro this command should run when pressed. |
void |
setCaption(String name)
The caption of this command item. |
void |
setFaceID(Object faceID)
The bitmap that is used as the icon on this command item. |
void |
setGroup(boolean group)
Indicates if this command item begins a menu or toolbar group. |
void |
setHelpContextID(int contextID)
The help context ID associated with this command item. |
void |
setHelpFile(String helpFile)
The help file associated with this command item. |
void |
setMessage(String message)
The status bar message for this command item. |
void |
setName(String name)
The name of this command item. |
void |
setStyle(int style)
The display style of this command item. |
void |
setTag(String tag)
The tag for this command item. |
void |
setTooltip(String tooltip)
The tooltip for this command item. |
void |
writeExternal(ObjectOutput out)
|
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 CommandItem(Object obj) throws IOException
obj
to CommandItem
. *
CommandItem o = (CommandItem)obj; // will not work
CommandItem o = new CommandItem(obj); // Use this constructor instead
* @param obj an object returned from ArcGIS Engine or Server
IOException
- if there are interop problems
CommandItem theCommandItem = (CommandItem) obj;
Method Detail |
---|
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String getAction() throws IOException, AutomationException
Action is a string representing the full name of the VBA macro that is to be executed when the command item is clicked. The name of the macro must include the name of the VBA project in which this macro is located.
Here are some examples of the syntax of the value for the Action property.
Macro called MyMacro in ThisDocument in Normal template:
"Normal.ThisDocument.MyMacro"
Macro called MyMacro in Module1 in Normal template:
"Normal.Module1.MyMacro"
Macro called MyMacro in ThisDocument in the current document:
"Project.ThisDocument.MyMacro"
Macro called MyMacro in Module1 in the current document:
"Project.Module1.MyMacro"
Macro called MyMacro in ThisDocument in a base template:
"TemplateProject.ThisDocument.MyMacro"
Macro called MyMacro in Module1 in a base template:
"TemplateProject.Module1.MyMacro"
Note: This property only applies to macro items.
getAction
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setAction(String macro) throws IOException, AutomationException
setAction
in interface ICommandItem
macro
- The macro (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isBuiltIn() throws IOException, AutomationException
Returns True if the command is a COM command that was created by implementing ICommand and compiling into a DLL. Returns False if the command is a UIControl or a VBA macro.
isBuiltIn
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getCategory() throws IOException, AutomationException
Category is a string that represents the category of the command on which this command item is based. The category determines where the command will appear in the Commands panel of the Customize dialog.
getCategory
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public ICommand getCommand() throws IOException, AutomationException
Returns a reference to the command (Button, Tool, ToolControl, or MultiItem) on which this command item is based.
getCommand
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ICommand
public void delete() throws IOException, AutomationException
When you delete a commanditem from a commandbar it is not deleted from the application; it is just removed from the commandbar. You can always add that command back to a commandbar.
delete
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setFaceID(Object faceID) throws IOException, AutomationException
setFaceID
in interface ICommandItem
faceID
- A Variant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getFaceID() throws IOException, AutomationException
The values for FaceID from the built-in icon palette are:
You can also use your own bitmap (.bmp file) with ICommandItem::FaceID. To use your own bitmap, you could create a UserForm in VBA with a Image control on it. Set the Picture property of the Image control to your bitmap.
If you are using your own bitmap, it must be a Bitmap file (.bmp); Icon files (.ico) are not supported. Bitmap files should be 16 X 16 pixels. The color of the upper left pixel of the bitmap is treated as the transparent color. For example, if the upper left pixel of the bitmap is red, then all of the red pixels in the bitmap will be converted to transparent.
getFaceID
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setGroup(boolean group) throws IOException, AutomationException
setGroup
in interface ICommandItem
group
- The group (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isGroup() throws IOException, AutomationException
If Group is set to True, the command item is the first item in a group on a toolbar or menu. There will be a separator bar to the left of the command item. If Group is set to False, the command item does not have a separator bar to the left of it.
isGroup
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getHelpFile() throws IOException, AutomationException
You cannot set HelpFile for built-in commands. It is not implemented for macro items and UIControls.
getHelpFile
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setHelpFile(String helpFile) throws IOException, AutomationException
setHelpFile
in interface ICommandItem
helpFile
- The helpFile (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getHelpContextID() throws IOException, AutomationException
You cannot set HelpContextID for built-in commands. It is not implemented for macro items and UIControls.
getHelpContextID
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setHelpContextID(int contextID) throws IOException, AutomationException
setHelpContextID
in interface ICommandItem
contextID
- The contextID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IUID getID() throws IOException, AutomationException
getID
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IUID
public int getIndex() throws IOException, AutomationException
getIndex
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getName() throws IOException, AutomationException
Returns the programmatic identifying name string for the command on which this command item is based. Note, this is usually different from the Caption property of a the command.
You can modify Name for VBA macro items but not built-in commands and UIControls. Setting this property for a built-in command or UIControls will return "This method cannot be called on built in commands" run-time error.
getName
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setName(String name) throws IOException, AutomationException
Returns the programmatic identifying name string for the command on which this command item is based. Note, this is usually different from the Caption property of a the command.
setName
in interface ICommandItem
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCaption(String name) throws IOException, AutomationException
setCaption
in interface ICommandItem
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getCaption() throws IOException, AutomationException
The Caption property of a command item is a string that appears when the command item is placed on a menu or when the command item's display style property is set to Text Only or Image and Text.
getCaption
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public ICommandBar getParent() throws IOException, AutomationException
Returns a reference to the CommandBar that this command item is on.
getParent
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ICommandBar
public void reset() throws IOException, AutomationException
reset
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getStyle() throws IOException, AutomationException
The Style of a command item determines whether the command item is displayed on a command bar using its caption, image or both. Refer to the esriCommandStyles constants topic for the values for Style.
When a command is put on a toolbar, the command is displayed with the bitmap only by default; the display type is set to Image Only (Style = esriCommandStyleIconOnly).
When a command is put on a menu, the command is displayed with the bitmap and caption by default; the display type is set to Image and Text (Style = esriCommandStyleIconAndText).
However, if the Bitmap property (ICommand::Bitmap) is not set for this command, then the command will be displayed with the caption only by default when it is put on a toolbar or menu; the display type is set to Text Only (Style = esriCommandStyleTextOnly).
getStyle
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.esriCommandStyles
public void setStyle(int style) throws IOException, AutomationException
setStyle
in interface ICommandItem
style
- A com.esri.arcgis.systemUI.esriCommandStyles constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.esriCommandStyles
public String getTag() throws IOException, AutomationException
getTag
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setTag(String tag) throws IOException, AutomationException
setTag
in interface ICommandItem
tag
- The tag (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getTooltip() throws IOException, AutomationException
Tooltip is a string that appears in the screen tip when the mouse hovers over the command item.
You can modify Tooltip for VBA macro items but not built-in commands and UIControls. Setting this property for a built-in command or UIControls will return "This method cannot be called on built in commands" run-time error.
getTooltip
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setTooltip(String tooltip) throws IOException, AutomationException
setTooltip
in interface ICommandItem
tooltip
- The tooltip (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getType() throws IOException, AutomationException
Returns the type of this command item using the esriCommandTypes constants. The command item can be one of the following types:
getType
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.esriCommandTypes
public String getMessage() throws IOException, AutomationException
Message is a string that appears as the message in the statusbar of the application when the mouse passes over the command item.
You can modify Message for VBA macro items but not built-in commands and UIControls. Setting this property for a built-in command or UIControls will return "This method cannot be called on built in commands" run-time error.
getMessage
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setMessage(String message) throws IOException, AutomationException
setMessage
in interface ICommandItem
message
- The message (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void execute() throws IOException, AutomationException
execute
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void refresh() throws IOException, AutomationException
Causes the command item to be redrawn on the CommandBar in order to correctly display any new property changes.
It is generally unnecessary to explicitly call Refresh; CommandItem updates such as setting the caption, image, and style all automatically call Refresh.
refresh
in interface ICommandItem
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getClassID(GUID[] pClassID) throws IOException, AutomationException
IPersist is a Microsoft interface. Please refer to MSDN for information about this interface.
getClassID
in interface IPersist
pClassID
- A Structure: com.esri.arcgis.support.ms.stdole.GUID (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void isDirty() throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
isDirty
in interface IPersistStream
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void load(IStream pstm) throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
load
in interface IPersistStream
pstm
- A reference to a com.esri.arcgis.system.IStream (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void save(IStream pstm, int fClearDirty) throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
save
in interface IPersistStream
pstm
- A reference to a com.esri.arcgis.system.IStream (in)fClearDirty
- The fClearDirty (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getSizeMax(_ULARGE_INTEGER[] pcbSize) throws IOException, AutomationException
IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.
getSizeMax
in interface IPersistStream
pcbSize
- A Structure: com.esri.arcgis.system._ULARGE_INTEGER (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void interfaceSupportsErrorInfo(GUID riid) throws IOException, AutomationException
Indicates whether the interface supports IErrorInfo.
interfaceSupportsErrorInfo
in interface ISupportErrorInfo
riid
- A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |