Chart FX for Java 6.5

SoftwareFX.ChartFX
Class Command

java.lang.Object
  extended by SoftwareFX.ChartFX.Command

public final class Command
extends java.lang.Object

Provides access to the Command object.

Sometimes, customizing a tool becomes imperative as you don't want end users to access a particular feature in it or you want to extend the original functionality provided by it, or you simply want to change the tooltips the Toolbar buttons display.

In Chart FX, there numerous ways to access the available commands. For example, to change the chart type, the end user may select the Gallery button in the Toolbar, MenuBar or right-clicking the marker and changing the gallery type, as depicted in the following figure:

For this reason Chart FX introduces the Commands object, which contains all commands available in Chart FX that all tools use to create and display the user interface in Chart FX.


Constructor Summary
Command()
           
 
Method Summary
 int findSubCommandID(int nID)
          Gets the SubCommandID for the selected sub command index in a command list.
 int getID()
          Used to retrieve the unique identifier of the command item.
 int getPicture()
          Gets the Picture.
 int getStyle()
          Gets the Style.
 CommandList getSubCommandID()
          Used to get or set the ID of a subcommand used in a menu or selector.
 int getSubCommandID(int n)
          Deprecated. You should use getSubCommandID() instead.
 java.lang.String getText()
          Gets the Text.
 void insertSubCommands(int count, int index)
          Allows you to insert a subcommand to a command list.
 boolean isChecked()
          Gets the Checked.
 boolean isEnabled()
          Gets the Enabled.
 void removeAllSubCommands()
          Allows you to remove all subcommands from the subcommands list associated with a particular command.
 void removeSubCommand(int index)
          Allows you to remove a particular subcommand from the subcommands list.
 void setChecked(boolean value)
          Used to check or uncheck a command in the commands list.
 void setEnabled(boolean value)
          Allows you to enable or disable a command from the commands list.
 void setPicture(int value)
          Gets or sets the picture (icon) associated with a command.
 void setStyle(int value)
          Allows you to set the style for a command item.
 void setSubCommandID(int n, int value)
          Deprecated. You should use getSubCommandID() instead.
 void setText(java.lang.String value)
          Gets or sets the text associated with the command.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

findSubCommandID

public int findSubCommandID(int nID)

Gets the SubCommandID for the selected sub command index in a command list.

Remarks:
  • The ID is an integer that you will use to identify the command when the user press or interacts with it. This is a unique ID that will be associated to the custom command and no other custom command may have the same ID. Chart FX defines its pre-defined IDs between CommandID.First (29440) and CommandID.Last (29951), so please make sure you don't use a number in this range as it will cause unpredictable results.

  • This method may be used to find the ID of a subcommand. By doing this, you can trap events and add custom actions to pre-existing commands.

  • Parameters:
    nID - An integer specifying the index of the subcommand you want to find the ID. (zero based)
    See Also:
    getSubCommandID(int), getID(), insertSubCommands(int, int), removeAllSubCommands(), removeSubCommand(int)

    getID

    public int getID()

    Used to retrieve the unique identifier of the command item.

    (Read only)

    Remarks:
  • Each command has a unique identifier and you can not change it. Please refer to the Commands List available in Chart FX.

  • Please refer to the Programmer's Guide for a step-by-step guide on how to customize the Chart FX commands list.

  • See Also:
    setEnabled(boolean), setPicture(int), setChecked(boolean), setStyle(int), setText(java.lang.String), CommandBar.getItem(int)

    getPicture

    public int getPicture()

    Gets the Picture. For more detail see setPicture(int).


    getStyle

    public int getStyle()

    Gets the Style. For more detail see setStyle(int).


    getSubCommandID

    public int getSubCommandID(int n)
    Deprecated. You should use getSubCommandID() instead.


    getSubCommandID

    public CommandList getSubCommandID()

    Used to get or set the ID of a subcommand used in a menu or selector.

    Remarks:
  • Sometimes, a button in the toolbar does not perform a specific action, but instead it displays a menu or a list of options (selector) the user can access. As depicted in the following figure:

  • There are many commands in Chart FX that have a series of sub-commands. For example the Gallery combo in the Toolbar is actually a selector with a series of subcommands. When the user right-clicks a series or another element in the chart, a command containing a list of subcommands is actually displayed. You may access, add, delete or change the subcommands with this property and the help of the removeSubCommand(int) method.

  • If you are adding subcommands to a specific command you must make sure to keep the indexes in order as non-consecutive indexes may cause unpredictable results.

  • See Also:
    setEnabled(boolean), setPicture(int), setChecked(boolean), setStyle(int), setText(java.lang.String), removeSubCommand(int), removeAllSubCommands()

    getText

    public java.lang.String getText()

    Gets the Text. For more detail see setText(java.lang.String).


    insertSubCommands

    public void insertSubCommands(int count,
                                  int index)

    Allows you to insert a subcommand to a command list.

    Remarks:
  • This method allows you to insert custom subcommands or predefined subcommands. The below sample inserts below inserts a 'Save' command into the Personalized Options command list.

  • Parameters:
    count - An integer specifying number of items to insert.
    index - An integer specifying the index of the subcommand you want to insert. (zero based)
    See Also:
    getSubCommandID(int), getID(), findSubCommandID(int), removeAllSubCommands(), removeSubCommand(int)

    isChecked

    public boolean isChecked()

    Gets the Checked. For more detail see setChecked(boolean).


    isEnabled

    public boolean isEnabled()

    Gets the Enabled. For more detail see setEnabled(boolean).


    removeAllSubCommands

    public void removeAllSubCommands()

    Allows you to remove all subcommands from the subcommands list associated with a particular command.

    Remarks:
  • RemoveAllSubCommands should be followed by one or more calls to SubCommandID since an empty list is not supported (Unpredictable results may occur).

  • See Also:
    getSubCommandID(int), setEnabled(boolean), setPicture(int), setChecked(boolean), setStyle(int), setText(java.lang.String), removeSubCommand(int)

    removeSubCommand

    public void removeSubCommand(int index)

    Allows you to remove a particular subcommand from the subcommands list.

    Remarks:
  • Please note that when you remove a particular sub-command from the subcommand list, the indexes will be shifted to the actual number of subcommands available in the command. Please refer to the SubCommandID property for more information about subcommand lists.

  • You can remove all subcommands associated with a command with the removeAllSubCommands() method.

  • Parameters:
    index - An integer specifying the index of the subcommand you want to remove. (zero based)
    See Also:
    getSubCommandID(int), setEnabled(boolean), setPicture(int), setChecked(boolean), setStyle(int), setText(java.lang.String), removeAllSubCommands()

    setChecked

    public void setChecked(boolean value)

    Used to check or uncheck a command in the commands list.

    Remarks:
  • The result from setting this property depends on the setStyle(int) of the command (Style Property). If it represents a two-state button in the toolbar, setting this property to TRUE will cause the button appear checked. If the two-state button belongs to a group and you set this property to True, any other button that may be checked will be unchecked.

  • If its a menu item, setting this property to True will check the option in the menu.

  • Please refer to the Programmer's Guide for a step-by-step guide on how to customize the Chart FX commands list.

  • Many ChartFX commands should not be checked/unchecked since they show the current status of the chart.

  • See Also:
    getID(), setPicture(int), setEnabled(boolean), setStyle(int), setText(java.lang.String), CommandBar.getItem(int)

    setEnabled

    public void setEnabled(boolean value)

    Allows you to enable or disable a command from the commands list.

    Remarks:
  • The result from setting this property depends on the style of the command (setStyle(int) Property). If its represented as a toolbar button, setting this property to FALSE will gray out the button. If its a menu item, setting this property to FALSE will gray out the option in the menu.

  • Many ChartFX commands should not be checked/unchecked since they show the current status of the chart. e.g. Cluster will be disabled if the user changes to a 2d chart regardless of whether the programmer just enabled that command.

  • Please refer to the Programmer's Guide for a step-by-step guide on how to customize the Chart FX commands list.

  • See Also:
    getID(), setPicture(int), setChecked(boolean), setStyle(int), setText(java.lang.String), CommandBar.getItem(int)

    setPicture

    public void setPicture(int value)

    Gets or sets the picture (icon) associated with a command.

    Remarks:
  • The Commands object provides a picture image with many 16x15 icons that you can use to set existing commands or new commands you have added to the commands list. If you want to change or add new icons to this image, please refer to ChangePicture or AddPicture methods.

  • Please refer to the Programmer's Guide for a step-by-step guide on how to customize the Chart FX commands list.

  • See Also:
    getID(), setEnabled(boolean), setChecked(boolean), setStyle(int), setText(java.lang.String), CommandBar.getItem(int)

    setStyle

    public void setStyle(int value)

    Allows you to set the style for a command item.

    Values:
    CommandStyle : Define the command styles
    ValueDescription
    CommandStyle.TWO_STATEThe command is two-state, that can be checked or unchecked according to certain condition in the chart (e.g. The Chart FX 3D button is a two state that indicates whethe if the chart is in 2D or 3D mode).
    CommandStyle.GROUPThe command belongs to a group that starts with the GroupHead flag.
    CommandStyle.GROUP_HEADThe command belongs to a group and this command points to the beginning of the group.
    CommandStyle.SELECTORIndicates the command is a selector that shows the actual selection. For example, the gallery button in the Chart FX Toolbar is a selector, where a drop-down list appears with the chart types available and when it is closed, the actual selection, chart type is displayed.
    CommandStyle.PREFER_IMAGEWhenever possible, shows the image and not the text associated with the command.
    CommandStyle.OWNER_DRAWFor internal use.
    CommandStyle.CHILD_IMAGESpecifies that when a subcommand is selected, the command image will be replaced by the subcommand image. (such as the ChartFX Gallery Command)
    CommandStyle.VIRTUAL_LISTfor internal use.
    CommandStyle.SMART_LISTSpecifies that only one item in a collection of subcommands must be selected. (such as the ChartFX Gallery Command)
    CommandStyle.SHOW_TEXT_ONLYOnly text will be shown for the command icon, no image will be used.
    CommandStyle.SELECTOR_CHILDSpecifies that the command will be one of the subcommands of a selector.
    CommandStyle.TRANSPOSEDIndicates to transpose the items in a command selector.
    CommandStyle.HEADMay be combined with the Group enumeration to create the GroupHead equivalent. Should never be used alone.

    Remarks:
  • IMPORTANT NOTE:

    Please note that you can only assign or change styles to custom commands you have added to the Chart FX commands list (using the AddCommand method). If you attempt to change the style for an existent Chart FX command you will receive an error message.

  • If you want to create a group of commands, you must include the GroupHead to the first item in the group and the Group for every subsequent command in the group.

    For example, if you have added 3 commands (using the AddCommand method), which IDs are 4,5 and 6 respectively and you want them to be two-state buttons that function as a group you must assign the style as follows:

  • Please refer to the Programmer's Guide for a step-by-step guide on how to customize the Chart FX commands list.

  • TwoState in a group makes the group to be "possible empty" (You can uncheck the current selection)

  • See Also:
    getID(), setPicture(int), setEnabled(boolean), setChecked(boolean), setText(java.lang.String), CommandBar.getItem(int)

    setSubCommandID

    public void setSubCommandID(int n,
                                int value)
    Deprecated. You should use getSubCommandID() instead.


    setText

    public void setText(java.lang.String value)

    Gets or sets the text associated with the command.

    Remarks:
  • As mentioned in the syntax tab. The text associated with a command will be used to display a tooltip when the command is displayed in the toolbar, or the text that will be shown in the menu bar.

  • You can also change the icon associated with a command with the Picture property.

  • Please refer to the Programmer's Guide for a step-by-step guide on how to customize the Chart FX commands list.

  • See Also:
    getID(), setEnabled(boolean), setChecked(boolean), setStyle(int), setPicture(int), CommandBar.getItem(int), findSubCommandID(int), ToolBar

    http://www.softwarefx.com

    2007 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
    All other names are trademarks or registered trademarks of their respective owners.