edu.wisc.ssec.mcidasv.ui
Class UIManager.IdvAction

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.ui.UIManager.IdvAction
Enclosing class:
UIManager

public static final class UIManager.IdvAction
extends Object

Represents an individual IDV action. Should be fairly adaptable to unforeseen changes from Unidata?


Field Summary
private  Map<UIManager.ActionAttribute,String> attributes
          Mapping of (known) XML attributes to values for this individual action.
private  Map<UIManager.ToolbarStyle,Icon> iconCache
          Simple "cache" for the different icons this action has displayed.
private  Element originalElement
          The XML Element that represents this IDV action.
 
Constructor Summary
UIManager.IdvAction(Element element)
          Creates a representation of an IDV action using a given Element.
 
Method Summary
 String getAttribute(UIManager.ActionAttribute attr)
          Returns the value associated with a given UIManager.ActionAttribute for this action.
 String getCommand()
          Representation of this IdvAction as an "IDV action call".
 Element getElement()
           
 Icon getIconForStyle(UIManager.ToolbarStyle style)
          Returns the Icon associated with this action and the given UIManager.ToolbarStyle.
 String getId()
           
 Icon getMenuIcon()
           
 String getRawIconPath()
           
 String toString()
          Returns a brief description of this action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

originalElement

private final Element originalElement
The XML Element that represents this IDV action.


attributes

private final Map<UIManager.ActionAttribute,String> attributes
Mapping of (known) XML attributes to values for this individual action.


iconCache

private final Map<UIManager.ToolbarStyle,Icon> iconCache
Simple "cache" for the different icons this action has displayed. This is "lazy", so the cache does not contain icons for UIManager.ToolbarStyles that haven't been used.

Constructor Detail

UIManager.IdvAction

public UIManager.IdvAction(Element element)
Creates a representation of an IDV action using a given Element.

Parameters:
element - XML representation of an IDV action. Cannot be null.
Throws:
NullPointerException - if element is null.
IllegalArgumentException - if element is not a valid IDV action.
See Also:
UIManager.isValidIdvAction(Element)
Method Detail

getRawIconPath

public String getRawIconPath()
Returns:
Returns the "raw" path to the icon associated with this action. Remember that this is actually a "format string" and should not be considered a valid path!
See Also:
#getIconForStyle(ToolbarStyle)

getMenuIcon

public Icon getMenuIcon()
Returns:
Returns the Icon associated with UIManager.ToolbarStyle.SMALL.

getIconForStyle

public Icon getIconForStyle(UIManager.ToolbarStyle style)
Returns the Icon associated with this action and the given UIManager.ToolbarStyle.

Parameters:
style - "Style" of the Icon to be returned. Cannot be null.
Returns:
This action's Icon with style "applied."
See Also:
UIManager.ActionAttribute.ICON, iconCache

getId

public String getId()
Returns:
Returns the identifier of this IdvAction.

getCommand

public String getCommand()
Representation of this IdvAction as an "IDV action call".

Returns:
String that is suitable to hand off to the IDV for execution.

getAttribute

public String getAttribute(UIManager.ActionAttribute attr)
Returns the value associated with a given UIManager.ActionAttribute for this action.

Parameters:
attr - ActionAttribute whose value you want. Cannot be null.
Returns:
Value associated with attr.
Throws:
NullPointerException - if attr is null.

getElement

public Element getElement()
Returns:
The XML Element used to create this IdvAction.

toString

public String toString()
Returns a brief description of this action. Please note that the format is subject to change and is not intended for serialization.

Overrides:
toString in class Object
Returns:
String that looks like [IdvAction@HASHCODE: attributes=...].