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

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

public static final class UIManager.IdvActions
extends Object

Represents the set of known UIManager.IdvActions in an idiom that can be easily used by both the IDV and McIDAS-V.


Field Summary
private  Map<String,Set<UIManager.IdvAction>> groupToActions
          Collects UIManager.IdvActions "under" common group values.
private  Map<String,UIManager.IdvAction> idToAction
          Maps "id" values to UIManager.IdvActions.
 
Constructor Summary
UIManager.IdvActions(IntegratedDataViewer idv, IdvResourceManager.XmlIdvResource collectionId)
           
 
Method Summary
 UIManager.IdvAction getAction(String actionId)
          Attempts to return the UIManager.IdvAction associated with the given actionId.
 Set<UIManager.IdvAction> getActionsForGroup(String group)
          Returns the Set of UIManager.IdvActions associated with the given group.
 List<UIManager.IdvAction> getAllActions()
           
 List<String> getAllGroups()
           
 String getAttributeForAction(String actionId, UIManager.ActionAttribute attr)
          Searches for the action associated with actionId and returns the value associated with the given UIManager.ActionAttribute.
 List<String> getAttributes(UIManager.ActionAttribute attr)
           
 Element getElementForAction(String actionId)
          Attempts to return the XML Element that "represents" the action associated with actionId.
 Icon getStyledIconFor(String actionId, UIManager.ToolbarStyle style)
          Attempts to return an Icon for a given UIManager.ActionAttribute.ID and UIManager.ToolbarStyle.
 String toString()
          Returns a summary of the known IDV actions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

idToAction

private final Map<String,UIManager.IdvAction> idToAction
Maps "id" values to UIManager.IdvActions.


groupToActions

private final Map<String,Set<UIManager.IdvAction>> groupToActions
Collects UIManager.IdvActions "under" common group values.

Constructor Detail

UIManager.IdvActions

public UIManager.IdvActions(IntegratedDataViewer idv,
                            IdvResourceManager.XmlIdvResource collectionId)
Parameters:
idv - Reference to the IDV "god" object. Cannot be null.
collectionId - IDV resource collection that contains our actions. Cannot be null.
Throws:
NullPointerException - if idv or collectionId is null.
Method Detail

getAction

public UIManager.IdvAction getAction(String actionId)
Attempts to return the UIManager.IdvAction associated with the given actionId.

Parameters:
actionId - Identifier to use in the search. Cannot be null.
Returns:
Either the IdvAction that matches actionId or null if there was no match.
Throws:
NullPointerException - if actionId is null.

getAttributeForAction

public String getAttributeForAction(String actionId,
                                    UIManager.ActionAttribute attr)
Searches for the action associated with actionId and returns the value associated with the given UIManager.ActionAttribute.

Parameters:
actionId - Identifier to search for. Cannot be null.
attr - Attribute whose value is desired. Cannot be null.
Returns:
Either the desired attribute value of the desired action, or null if actionId has no associated action.
Throws:
NullPointerException - if either actionId or attr is null.

getElementForAction

public Element getElementForAction(String actionId)
Attempts to return the XML Element that "represents" the action associated with actionId.

Parameters:
actionId - Identifier whose XML element is desired. Cannot be null.
Returns:
Either the XML element associated with actionId or null.
Throws:
NullPointerException - if actionId is null.
See Also:
UIManager.IdvAction.originalElement

getStyledIconFor

public Icon getStyledIconFor(String actionId,
                             UIManager.ToolbarStyle style)
Attempts to return an Icon for a given UIManager.ActionAttribute.ID and UIManager.ToolbarStyle.

Parameters:
actionId - ID of the action whose "styled" icon is desired. Cannot be null.
style - Desired Icon style. Cannot be null.
Returns:
Either the Icon associated with actionId and style, or null.
Throws:
NullPointerException - if either actionId or style is null.

getAttributes

public List<String> getAttributes(UIManager.ActionAttribute attr)

getAllActions

public List<UIManager.IdvAction> getAllActions()
Returns:
List of all known IdvActions.

getAllGroups

public List<String> getAllGroups()
Returns:
List of all known action groupings.
See Also:
UIManager.ActionAttribute.GROUP, getActionsForGroup(String)

getActionsForGroup

public Set<UIManager.IdvAction> getActionsForGroup(String group)
Returns the Set of UIManager.IdvActions associated with the given group.

Parameters:
group - Group whose associated actions you want. Cannot be null.
Returns:
Collection of IdvActions associated with group. A blank collection is returned if there are no actions associated with group.
Throws:
NullPointerException - if group is null.
See Also:
UIManager.ActionAttribute.GROUP, getAllGroups()

toString

public String toString()
Returns a summary of the known IDV actions. Please note that this format is subject to change, and is not intended for serialization.

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