public abstract class IlvChartAction extends AbstractAction
IlvChartAction
class is the abstract superclass of all menu,
toolbar, and registered keyboard actions in the Charts module. The standard
Swing AbstractAction
class encapsulates an action with a name
and an optional icon. The IlvChartAction
class extends this by
additionally encapsulating the action with a keyboard accelerator and long
and short description strings.changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
IlvChartAction(String name)
Creates an
IlvChartAction object with the specified name. |
IlvChartAction(String name,
Icon icon)
Creates an
IlvChartAction object with the specified name and the
specified icon. |
IlvChartAction(String name,
Icon icon,
KeyStroke accelerator)
Creates an
IlvChartAction object with the specified name, icon,
and keystroke accelerator. |
IlvChartAction(String name,
Icon icon,
KeyStroke accelerator,
String shortDescription,
String longDescription)
Creates an
IlvChartAction object with the specified name, icon,
description strings. |
Modifier and Type | Method and Description |
---|---|
protected void |
attach()
Called when the action has been attached to a new chart.
|
protected void |
computeEnabled()
Called to refresh the enabled property when a change occurs on the axis
or when a new chart has been set.
|
protected void |
detach()
Called when the action is about to be detached from its associated chart.
|
KeyStroke |
getAccelerator()
Returns the key combination that will invoke the action.
|
String |
getAcceleratorText()
Returns the text representation of this action accelerator.
|
IlvChart |
getChart()
Returns the chart on which the action will be performed.
|
IlvCoordinateSystem |
getCoordinateSystem()
Returns the
IlvCoordinateSystem owning the
associated y-axis or null if no chart has been attached. |
Icon |
getIcon()
Returns the icon that represents this action visually, or
null
if the action has no icon. |
String |
getLongDescription()
Returns the long description text that will typically be used for
display in the status bar, or
null if the action has no long
description. |
String |
getShortDescription()
Returns the short description text that will typically be used for
tooltips, or
null if the action has no short description. |
IlvAxis |
getXAxis()
Returns the x-axis of the attached chart or
null if no
chart has been attached. |
IlvAxis |
getYAxis()
Returns the associated y-axis or
null if no chart has
been attached. |
int |
getYAxisIndex()
Returns the index of the associated y-axis.
|
void |
setAccelerator(KeyStroke keyStroke)
Sets the key combination that will invoke the action.
|
void |
setChart(IlvChart chart)
Sets the chart on which the action will be performed.
|
void |
setIcon(Class baseClass,
String file)
Sets the icon that will be used to represent this action visually.
|
void |
setIcon(Icon icon)
Sets the icon that will be used to represent this action visually.
|
void |
setLongDescription(String text)
Sets the long description text that will typically be used for
display in the status bar.
|
void |
setShortDescription(String text)
Sets the short description text that will typically be used for
tooltips.
|
void |
setYAxisIndex(int index)
Sets the index of the associated y-axis.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
actionPerformed
public IlvChartAction(String name)
IlvChartAction
object with the specified name.name
- The name of the action. If the action is added to a JMenu
,
the name will be used as the menu item text. If the action is added to a
JToolBar
, the name will be used as the button text.public IlvChartAction(String name, Icon icon)
IlvChartAction
object with the specified name and the
specified icon.name
- The name of the action. If the action is added to a JMenu
,
the name will be used as the menu item text. If the action is added to a
JToolBar
, the name will be used as the button text.icon
- The action optional icon.public IlvChartAction(String name, Icon icon, KeyStroke accelerator)
IlvChartAction
object with the specified name, icon,
and keystroke accelerator.name
- The name of the action. If the action is added to a JMenu
,
the name will be used as the menu item text. If the action is added to a
JToolBar
, the name will be used as the button text.icon
- The action optional icon.accelerator
- The action optional keyboard accelerator.public IlvChartAction(String name, Icon icon, KeyStroke accelerator, String shortDescription, String longDescription)
IlvChartAction
object with the specified name, icon,
description strings.name
- The name of the action. If the action is added to a JMenu
,
the name will be used as the menu item text. If the action is added to a
JToolBar
, the name will be used as the button text.icon
- The action optional icon.accelerator
- The action optional keyboard accelerator.shortDescription
- The action optional short description.
If not null
, this text will be typically used for tooltips.longDescription
- The action optional long description.
If not null
, this text will be typically used for display in a status bar.public final IlvChart getChart()
public void setChart(IlvChart chart)
detach()
method is called before setting the new chart.
Then, if the parameter is not null
, the
attach()
method is called.protected void detach()
protected void attach()
protected void computeEnabled()
setChart(ilog.views.chart.IlvChart)
public int getYAxisIndex()
public void setYAxisIndex(int index)
public final IlvCoordinateSystem getCoordinateSystem()
IlvCoordinateSystem
owning the
associated y-axis or null
if no chart has been attached.public final IlvAxis getYAxis()
null
if no chart has
been attached.public final IlvAxis getXAxis()
null
if no
chart has been attached.public Icon getIcon()
null
if the action has no icon.public void setIcon(Icon icon)
icon
- The action icon or null
if the action has no icon.public void setIcon(Class baseClass, String file)
baseClass
- The Class
object on which the method
getResourceAsStream
is called to read the icon image file.file
- The location of the file that contains the icon image to be
read. The location must be specified relative to the location of the
baseClass
class.public KeyStroke getAccelerator()
null
if
the action has no accelerator.public String getAcceleratorText()
null
.public void setAccelerator(KeyStroke keyStroke)
public String getShortDescription()
null
if the action has no short description.public void setShortDescription(String text)
text
- The action short description or null
if the
action has no short description.public String getLongDescription()
null
if the action has no long
description.public void setLongDescription(String text)
text
- The action long description or null
if the
action has no long description.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.