|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.action.BasicCommandFactory
public class BasicCommandFactory
BasicCommandFactory provides base functionality for command factories.
CommandFactory
,
DefaultCommandFactory
Field Summary | |
---|---|
protected Properties |
commandLookupProperties
Set of provided command properties. |
protected static List<String> |
EMPTY_STRING_LIST
|
protected String |
factoryName
Name of this command factory, usually its properties file name. |
Constructor Summary | |
---|---|
protected |
BasicCommandFactory()
Constructor |
protected |
BasicCommandFactory(InputStream propertyInputStream,
String factoryName)
Constructor, reads a property list (key and element pairs) from the given input stream and fills up the contained commandLookupProperties . |
protected |
BasicCommandFactory(String propertiesFileName)
Constructor, invokes the loading of the property file name resource and fills up the contained commandLookupProperties . |
Method Summary | |
---|---|
void |
clearLookupProperties()
Clears the lookup properties. |
protected Command |
createCommand(String key)
|
Command |
getCommand(String key)
Default constructor using the settings of the commands.properties file. |
protected String |
getCommandClassname(String key)
Returns the command class name for given key, provided by embedded commandLookupProperties , or an empty string if no command entry was found. |
String |
getFactoryName()
Returns the name of this factory, usually its properties file name. |
String |
getLookupProperty(String key)
Allows an application to request lookup properties programmatically. |
protected void |
loadProperties(InputStream is)
Reads a property list (key and element pairs) from the input stream and fills the embedded commandLookupProperties . |
protected void |
loadProperties(String propertiesFileName)
Reads a property list (key and element pairs) from the input file name and fills the embedded commandLookupProperties . |
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 final List<String> EMPTY_STRING_LIST
protected Properties commandLookupProperties
protected String factoryName
Constructor Detail |
---|
protected BasicCommandFactory(String propertiesFileName) throws Exception
commandLookupProperties
.
propertiesFileName
- for which should be factory created
Exception
Properties
protected BasicCommandFactory()
protected BasicCommandFactory(InputStream propertyInputStream, String factoryName) throws Exception
commandLookupProperties
.
propertyInputStream
- the inputstream to read the command propertiesfactoryName
- name of this factory
Exception
Properties
Method Detail |
---|
public Command getCommand(String key)
CommandFactory
Algorithm of the command creating:
first:
lookup, if the command is already in the cache
second:
create command, if not already in the cache otherwise next point.
third:
return the created command.
getCommand
in interface CommandFactory
key
- of the command (ID)
CommandFactory.getCommand(String)
protected Command createCommand(String key)
protected String getCommandClassname(String key)
commandLookupProperties
, or an empty string if no command entry was found.
key
-
protected void loadProperties(String propertiesFileName) throws IOException
commandLookupProperties
.
propertiesFileName
- from which should be the informations read
IOException
protected void loadProperties(InputStream is) throws IOException
commandLookupProperties
.
IOException
public String getFactoryName()
getFactoryName
in interface NamedCommandFactory
protected void setFactoryName(String factoryName)
factoryName
- the new factory name@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.
NullPointerException
- if the key or value is null
.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
- a key to look up
null
if the key is not mapped to any
value.
NullPointerException
- if the key is null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |