|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.action.DefaultActionFactory
public class DefaultActionFactory
Is implementation of the ActionFactory
The factory read the class information for the actions from the property file.
Note:Actions aren't Singletons!
ActionFactory
Field Summary | |
---|---|
protected String |
factoryName
Name of this action factory, usually its properties file name. |
protected List<BasicActionFactory> |
linkedActionFactories
List of associated action factories |
Method Summary | |
---|---|
static void |
addActionCreationListener(ActionCreationListener listener)
Adds a action creation listener to receive informations or failure messages of action creation process. |
void |
addLinkedActionFactory(BasicActionFactory actionFactory)
Adds an action factory as linked factory to this factory. |
CommandAction |
getAction(Context context,
String key)
Default constructor using the settings of the actions.properties file. |
CommandAction |
getAction(Context context,
String key,
String name,
String commands,
String shortDescription,
String longDescription,
Icon smallIcon,
Icon largeIcon,
String actionCommandKey,
KeyStroke acceleratorKey,
int mnemonicKey,
HashMap<String,Object> otherParameters)
Settings for the icons, texts etc. |
static ActionCreationListener[] |
getActionCreationListener()
Returns an array of currently registered creation listeners |
String |
getFactoryName()
Returns the name of this factory, usually its properties resource name. |
static DefaultActionFactory |
getInstance(String propertiesFileName)
Provide access to the one and only instance of this factory. |
NamedActionFactory[] |
getLinkedActionFactories()
Returns an array of linked actions factories |
String |
getLinkedFactoryDescription()
Returns a description of linked factories. |
String |
getLookupProperty(String key)
Allows an application to programmatically request lookup properties. |
void |
insertLinkedActionFactory(int index,
BasicActionFactory actionFactory)
Inserts a action factory at index position of linked factories. |
void |
putLookupProperty(String key,
String value)
Deprecated. use setLookupProperty(String, String) instead |
static void |
removeActionCreationListener(ActionCreationListener listener)
Removes a action creation listener. |
void |
removeLinkedActionFactory(BasicActionFactory actionFactory)
Removes an action factory of linked factories. |
void |
reset()
Clears and resets this factory instance. |
void |
setLookupProperty(String key,
String value)
Allows an application to overwrite or set lookup properties programmatically. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String factoryName
protected List<BasicActionFactory> linkedActionFactories
Method Detail |
---|
public static void addActionCreationListener(ActionCreationListener listener)
listener
- the listener instance to addpublic static void removeActionCreationListener(ActionCreationListener listener)
listener
- the listener instance to removepublic static ActionCreationListener[] getActionCreationListener()
public static DefaultActionFactory getInstance(String propertiesFileName)
ActionFactory
but just one instance.
propertiesFileName
-
public String getLinkedFactoryDescription()
public String getFactoryName()
NamedActionFactory
getFactoryName
in interface NamedActionFactory
NamedActionFactory.getFactoryName()
@Deprecated public void putLookupProperty(String key, String value)
setLookupProperty(String, String)
instead
key
- value
- The value of the given key, null
if the key is not mapped to any
value.public void setLookupProperty(String key, String value)
key
- value
- The value of the given key, null
if the key is not mapped to any
value.
NullPointerException
- if the key or value is null
.public String getLookupProperty(String key)
key
- The key to look up (e.g. MyAction.commands or MyAction.ShortDescription)
null
if the key is not mapped to any
value.
NullPointerException
- if the key is null.public CommandAction getAction(Context context, String key)
ActionFactory
To create the commands is the default command factory used.
getAction
in interface ActionFactory
context
- belongs to the contextkey
- key of the commandAction
ActionFactory.getAction(com.levigo.util.swing.action.Context,
java.lang.String)
public CommandAction getAction(Context context, String key, String name, String commands, String shortDescription, String longDescription, Icon smallIcon, Icon largeIcon, String actionCommandKey, KeyStroke acceleratorKey, int mnemonicKey, HashMap<String,Object> otherParameters)
ActionFactory
To create the commands is the default command factory used.
getAction
in interface ActionFactory
context
- belongs to the contextkey
- key of the commandActionname
- value for Action.NAME
commands
- all commands of the commandActionshortDescription
- value for Action.SHORT_DESCRIPTION
longDescription
- value for Action.LONG_DESCRIPTION
smallIcon
- value for Action.SMALL_ICON
largeIcon
- value for Action.LARGE_ICON_KEY
actionCommandKey
- value for Action.ACTION_COMMAND_KEY
acceleratorKey
- value for Action.ACCELERATOR_KEY
mnemonicKey
- value for Action.MNEMONIC_KEY
otherParameters
- other parameters which will be added to the action (can be null)
ActionFactory.getAction(com.levigo.util.swing.action.Context,
java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String,
javax.swing.Icon, javax.swing.Icon, java.lang.String, javax.swing.KeyStroke, int,
java.util.HashMap)
public NamedActionFactory[] getLinkedActionFactories()
NamedActionFactory
[] linked action factories.public void addLinkedActionFactory(BasicActionFactory actionFactory)
actionFactory
- factory to addpublic void removeLinkedActionFactory(BasicActionFactory actionFactory)
actionFactory
- factory to removepublic void insertLinkedActionFactory(int index, BasicActionFactory actionFactory)
index
- index of factoryactionFactory
- factory to insertpublic void reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |