Author: tchemit Date: 2008-07-25 17:55:34 +0000 (Fri, 25 Jul 2008) New Revision: 795 Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/AbstractActionFactory.java trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/ActionFactory.java Log: ActionFactory javadoc add methode newAction(String) to ActionFactory Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/AbstractActionFactory.java =================================================================== --- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/AbstractActionFactory.java 2008-07-25 14:00:19 UTC (rev 794) +++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/AbstractActionFactory.java 2008-07-25 17:55:34 UTC (rev 795) @@ -219,6 +219,10 @@ return result; } + public A newAction(String actionKey) { + return newAction(actionKey, null); + } + public String[] getActionNames() { return impls.keySet().toArray(new String[impls.size()]); } Modified: trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/ActionFactory.java =================================================================== --- trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/ActionFactory.java 2008-07-25 14:00:19 UTC (rev 794) +++ trunk/lutinjaxx/jaxx-swing-action/src/main/java/org/codelutin/jaxx/action/factory/ActionFactory.java 2008-07-25 17:55:34 UTC (rev 795) @@ -41,29 +41,92 @@ */ Map<String, Class<? extends MyAbstractAction>> init(); + /** @return the class of the base action of the factory. */ Class<A> getBaseImpl(); + /** clear the cache of instanciated actions. */ void resetCache(); + /** + * @param actionKey the key of an action + * @return the action with this key from cache, or <code>null</code> if this action is not in cache + */ A get(String actionKey); + /** + * For a given ui, load all actions registred in factory. + * <p/> + * The id of the widget in ui is directly mapped to a action key. + * + * @param ui the ui to treate + */ void loadActions(JAXXObject ui); + /** + * Obtain an action instance given his key and widget + * + * @param actionKey the key of action + * @param component the component using the action + * @return the instanciated action (could come from cache if already instanciated {@link #getActionFromCache(String)} + */ A newAction(String actionKey, JComponent component); + /** + * Obtain an action instance given his key (should call {@link #newAction(String, javax.swing.JComponent)} + * <p/> + * This is a convinient method when you want to obtain an action with no attached widget. + * + * @param actionKey the key of action + * @return the instanciated action (could come from cache if already instanciated {@link #getActionFromCache(String)} + */ + A newAction(String actionKey); + + /** @return the array of names of all actions known by the factory */ String[] getActionNames(); + /** @return the set of all the action's classes known by the factory. */ Set<Entry<String, Class<? extends MyAbstractAction>>> implsEntrySet(); + /** @return the set of all actions cached in factory indexed by their name */ Set<Entry<String, A>> cacheEntrySet(); + /** + * Fire an action given his key, his source and tthe widget responsible of action + * + * @param actionKey the action's key + * @param source the object source of action + * @param component the component doing the action + */ void fireAction(String actionKey, Object source, JComponent component); + /** + * Fire an action given his key and his source, no widget are involved here + * + * @param actionKey the action's key + * @param source the object source of action + */ void fireAction(String actionKey, Object source); + /** + * Fire an action given his action's key, his source and the reaal action. + * <p/> + * This is a convinient method when you need to modified action before fire it. + * + * @param actionKey action's key + * @param source source of action + * @param action real action + */ void fireAction0(String actionKey, Object source, A action); + /** + * @param actionKey the action's key + * @return the action in cache or <code>null</code> if action is not in cache + */ MyAbstractAction getActionFromCache(String actionKey); + /** + * dispose all actions in cache using {@link org.codelutin.jaxx.action.MyAbstractAction#disposeUI()} on each + * action, then {@link #resetCache()} + */ void dispose(); }