Package adams.gui.sendto
Class SendToActionUtils
- java.lang.Object
-
- adams.gui.sendto.SendToActionUtils
-
public class SendToActionUtils extends Object
Helper class for SendTo actions.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected static Hashtable<Class,ArrayList<Class>>
m_AcceptedCache
the cache for sendto actions (accepted class - available actions).static String
MENUITEM_SENDTO
the default menu item text.
-
Constructor Summary
Constructors Constructor Description SendToActionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
addSendToSubmenu(SendToActionSupporter owner, JMenu menu)
Adds all the available sendto actions for the specified class to thestatic boolean
addSendToSubmenu(SendToActionSupporter owner, JPopupMenu menu)
Adds all the available sendto actions for the specified class to theprotected static boolean
addSubmenu(SendToActionSupporter owner, JMenu submenu)
Attaches a listener to the top-level menu that triggers the generation of the send-to submenu.protected static boolean
createSubmenu(SendToActionSupporter owner, JMenu submenu)
Adds all the available sendto actions for the specified class to the submenu.protected static Hashtable<Class,ArrayList<Class>>
getAcceptedCache()
Returns the cache of what sendto actions can accept what classes.static AbstractSendToAction[]
getActions(SendToActionSupporter owner)
Returns all the actions that can handle the specified class.static boolean
isAvailable(Class[] needles, Class[] haystack)
Checks whether at least one class (of the needles) is among a list of classes (haystack).static boolean
isAvailable(Class needle, Class[] haystack)
Checks whether a class (needle) is among a list of classes (haystack).static PlaceholderFile
nextTmpFile(String prefix, String extension)
Generates a new temporary file, which will get deleted when the JVM exits.
-
-
-
Method Detail
-
getAcceptedCache
protected static Hashtable<Class,ArrayList<Class>> getAcceptedCache()
Returns the cache of what sendto actions can accept what classes.- Returns:
- the cache
-
getActions
public static AbstractSendToAction[] getActions(SendToActionSupporter owner)
Returns all the actions that can handle the specified class.- Parameters:
owner
- the owner- Returns:
- the available actions
-
createSubmenu
protected static boolean createSubmenu(SendToActionSupporter owner, JMenu submenu)
Adds all the available sendto actions for the specified class to the submenu.- Parameters:
owner
- the owner to get the item to send fromsubmenu
- the menu to add the "Send to" submenu to if available- Returns:
- true if submenu was added
-
addSubmenu
protected static boolean addSubmenu(SendToActionSupporter owner, JMenu submenu)
Attaches a listener to the top-level menu that triggers the generation of the send-to submenu.- Parameters:
owner
- the owner to get the item to send fromsubmenu
- the menu to add the "Send to" submenu to if available- Returns:
- true if submenu was added
-
addSendToSubmenu
public static boolean addSendToSubmenu(SendToActionSupporter owner, JPopupMenu menu)
Adds all the available sendto actions for the specified class to the- Parameters:
owner
- the owner to get the item to send frommenu
- the menu to add the "Send to" submenu to if available- Returns:
- true if submenu was added
-
addSendToSubmenu
public static boolean addSendToSubmenu(SendToActionSupporter owner, JMenu menu)
Adds all the available sendto actions for the specified class to the- Parameters:
owner
- the owner to get the item to send frommenu
- the menu to add the "Send to" submenu to if available- Returns:
- true if submenu was added
-
nextTmpFile
public static PlaceholderFile nextTmpFile(String prefix, String extension)
Generates a new temporary file, which will get deleted when the JVM exits.- Parameters:
prefix
- the prefix for the filename (within the TMP directory)extension
- the file extension to use (without dot!)- Returns:
- the generated file
-
isAvailable
public static boolean isAvailable(Class needle, Class[] haystack)
Checks whether a class (needle) is among a list of classes (haystack).- Parameters:
needle
- the class to look forhaystack
- the available classes
-
-