[Japi-cvs] SF.net SVN: japi: [318] libs/swing-action/trunk/src/net/sf/japi/swing/ ActionFactory.jav
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2007-01-20 22:40:13
|
Revision: 318
http://svn.sourceforge.net/japi/?rev=318&view=rev
Author: christianhujer
Date: 2007-01-20 14:40:12 -0800 (Sat, 20 Jan 2007)
Log Message:
-----------
Added constructor that creates a new ActionFactory for a key (bundle).
This might be useful for developing SDI applications or per-document actions in MDI applications.
Modified Paths:
--------------
libs/swing-action/trunk/src/net/sf/japi/swing/ActionFactory.java
Modified: libs/swing-action/trunk/src/net/sf/japi/swing/ActionFactory.java
===================================================================
--- libs/swing-action/trunk/src/net/sf/japi/swing/ActionFactory.java 2007-01-20 14:49:57 UTC (rev 317)
+++ libs/swing-action/trunk/src/net/sf/japi/swing/ActionFactory.java 2007-01-20 22:40:12 UTC (rev 318)
@@ -206,14 +206,8 @@
@NotNull public static ActionFactory getFactory(@Nullable final String key) {
ActionFactory factory = FACTORIES.get(key);
if (factory == null) {
- factory = new ActionFactory();
+ factory = new ActionFactory(key);
FACTORIES.put(key, factory);
- try {
- factory.addBundle(key + ".action");
- } catch (final MissingResourceException e) {
- /* ignore */
- }
- // eventually initialize factory here
}
return factory;
}
@@ -307,6 +301,21 @@
public ActionFactory() {
}
+ /**
+ * Create an ActionFactory.
+ * Usually you wouldn't create an ActionFactory yourself but use {@link #getFactory(String)} for recycling ActionFactories and profit of easy
+ * access to the same ActionFactory from within the whole application without passing around ActionFactory references.
+ * Use this constructor if you explicitely need a new ActionFactory that doesn't share information (especially the action cache) with other ActionFactory instances.
+ * @param key name of ActionFactory.
+ */
+ public ActionFactory(final String key) {
+ try {
+ addBundle(key + ".action");
+ } catch (final MissingResourceException e) {
+ /* ignore */
+ }
+ }
+
/** Get the ActionMap.
* @return ActionMap
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|