|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.action.BasicActionFactory
public class BasicActionFactory
BasicActionFactory provides base functionality for action factories
ActionFactory
,
DefaultActionFactory
Field Summary | |
---|---|
protected com.levigo.util.preferences.PropertiesPreferenceStore |
actionLookupProperties
Instance of the property file. |
protected static String |
COMMANDS
Key word for the property: commands for the action |
protected static List<String> |
EMPTY_STRING_LIST
|
protected String |
factoryName
Name of this action factory, usually the properties file name. |
protected static Field[] |
fields
All key event identifiers used to generate keystrokes. |
static String |
INPUT_MAP
The key used for storing the keystrokes for the action in an InputMap (referenced by an ActionMap) used for a menu or button. |
protected static String |
VISIBLE
Key word for the property if the action is visible |
Constructor Summary | |
---|---|
protected |
BasicActionFactory()
Default constructor |
protected |
BasicActionFactory(InputStream propertyInputStream,
String factoryName)
Constructor, reads a property list (key and element pairs) from the given input stream and fills up the contained actionLookupProperties . |
protected |
BasicActionFactory(String propertiesFileName)
Constructor invokes a loading of the property file and creates the icon manager. |
Method Summary | |
---|---|
void |
clearLookupProperties()
Clears the lookup properties. |
CommandAction |
getAction(Context context,
String key)
Default constructor using the settings of the actions.properties file. |
protected CommandAction |
getAction(Context context,
String key,
boolean ignoreEmptyCommands)
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. |
protected 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,
boolean ignoreEmptyCommands)
Settings for the icons, texts etc. |
protected CommandFactory |
getCommandFactory(String key)
|
String |
getFactoryName()
Returns the name of this factory, usually its properties file name. |
protected IconManager |
getIconManager(String key)
Finds the IconManager to use for the specified key. |
protected static int |
getKeyEventIdentifier(NamedActionFactory caller,
String keyAsString)
Find the key stroke or key mask identifier (defined in either KeyEvent or InputEvent) for the given name and returns it. |
protected KeyStroke |
getKeyStroke(String keyString)
Creates a Keystroke by the given key information, e.g. |
String |
getLookupProperty(String key)
Allows an application to request lookup properties programmatically. |
protected HashMap<String,Object> |
getMoreParameters(String key)
Method returns the Map of the keys and values which are not recognized in AbstractAction. |
protected Collection<String> |
getParameters(String key)
Method returns all parameters for the key. |
protected void |
loadProperties(InputStream is)
Reads a property list (key and element pairs) from the input stream and fills the embedded actionLookupProperties . |
protected void |
loadProperties(String propertyFileName)
The method loads the property file. |
void |
putLookupProperty(String key,
String value)
Deprecated. use setLookupProperty(String, String) instead |
void |
removeLookupProperty(String key)
Removes the value for given key. |
protected void |
setFactoryName(String factoryName)
Changes the name of this factory. |
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 static Field[] fields
public static final String INPUT_MAP
protected static final String VISIBLE
protected static final String COMMANDS
protected static final List<String> EMPTY_STRING_LIST
protected com.levigo.util.preferences.PropertiesPreferenceStore actionLookupProperties
protected String factoryName
Constructor Detail |
---|
protected BasicActionFactory(String propertiesFileName) throws Exception
propertiesFileName
- for which should be factory created
Exception
Object.Object()
protected BasicActionFactory(InputStream propertyInputStream, String factoryName) throws Exception
actionLookupProperties
.
propertyInputStream
- the input stream to read the action propertiesfactoryName
- name of this factory
Exception
Properties
protected BasicActionFactory()
Method Detail |
---|
protected IconManager getIconManager(String key)
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)
Default command factory is DefaultCommandFactory
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)
protected 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, boolean ignoreEmptyCommands)
Default command factory is DefaultCommandFactory
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)
protected Collection<String> getParameters(String key)
key
- to read the parameters
protected HashMap<String,Object> getMoreParameters(String key)
key
- for the parameters
protected void loadProperties(String propertyFileName) throws IOException
propertyFileName
- The name of the file from which should be the informations read
IOException
protected void loadProperties(InputStream is) throws IOException
actionLookupProperties
.
IOException
protected final KeyStroke getKeyStroke(String keyString)
The "virtual key" constants defined in java.awt.event.KeyEvent can be used to specify the key. For example:
VK_A + CTRL_MASK
or
VK_B
or
VK_C + ALT_MASK or
VK_D + ALT_MASK + SHIFT_MASK
Hint:
A KeyStroke consist always of only one key and any combination of modifiers. If more than one
key are defined in the given keyString, only the first key will be accepted.
Fully rewrited 03-12-19, Carolin Köhler.
keyString
- key information to be translated into a keystroke
null
if
keyinformation contains no valid descriptionprotected static int getKeyEventIdentifier(NamedActionFactory caller, String keyAsString)
keyAsString
- The name of the identifier as a String
public CommandAction getAction(Context context, String key)
Default command factory is DefaultCommandFactory
getAction
in interface ActionFactory
context
- belongs to the contextkey
- key of the commandAction
ActionFactory.getAction(Context, String)
protected CommandAction getAction(Context context, String key, boolean ignoreEmptyCommands)
Default command factory is DefaultCommandFactory
ActionFactory.getAction(Context, String)
protected CommandFactory getCommandFactory(String key)
@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.public void removeLookupProperty(String key)
key
- public void clearLookupProperties()
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 String getFactoryName()
getFactoryName
in interface NamedActionFactory
protected void setFactoryName(String factoryName)
factoryName
- the new factory name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |