public class DefaultActionFactory extends Object implements NamedActionFactory
ActionFactory
The factory read the class information for the actions from the property file.
Note:Actions aren't Singletons!
ActionFactory
Modifier and Type | Field and Description |
---|---|
protected String |
factoryName
Name of this action factory, usually its properties file name.
|
protected List<BasicActionFactory> |
linkedActionFactories
List of associated action factories
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected String factoryName
protected List<BasicActionFactory> linkedActionFactories
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)
insteadkey
- 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 commandActionActionFactory.getAction(org.jadice.util.swing.action.context.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(org.jadice.util.swing.action.context.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()
Copyright © 2024 levigo holding gmbh. All rights reserved.