r1785 - trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation
Author: tchemit Date: 2010-03-15 12:20:55 +0100 (Mon, 15 Mar 2010) New Revision: 1785 Log: reformat code Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java 2010-03-13 19:35:08 UTC (rev 1784) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java 2010-03-15 11:20:55 UTC (rev 1785) @@ -20,47 +20,46 @@ */ package jaxx.runtime.swing.navigation; -import java.util.Enumeration; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; import jaxx.runtime.JAXXAction; import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXObject; import jaxx.runtime.context.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import java.util.Enumeration; + /** * Node of the {@link NavigationTreeModel}. - * - * Each node is associated with : - * <ul> - * <li> a {@code bean} coming from a {@link JAXXContext} </li> - * <li> a {@code uiClass} to build the associated ui </li> + * <p/> + * Each node is associated with : <ul> <li> a {@code bean} coming from a {@link + * JAXXContext} </li> <li> a {@code uiClass} to build the associated ui </li> * </ul> * <p/> - * To retrieve the bean from the context, there is a huge logic in the - * method {@link #getBean(JAXXContext)}. - * - * In few words, if the {@link #jaxxContextEntryDef} is defined, it means - * that the object is taken from the {@code context}. + * To retrieve the bean from the context, there is a huge logic in the method + * {@link #getBean(JAXXContext)}. * <p/> + * In few words, if the {@link #jaxxContextEntryDef} is defined, it means that + * the object is taken from the {@code context}. + * <p/> * Otherwise, find the first ancestor with an context entry and retrieve from * here the bean. * <p/> - * Then go down to the initial node by applying the jxpath expressions - * {@link #jaxxContextEntryPath} of each node on road back. + * Then go down to the initial node by applying the jxpath expressions {@link + * #jaxxContextEntryPath} of each node on road back. * <p/> - * - * To identify easly a node, each node has a {@link #path} and a - * {@link #fullPath} (full path from root node). * <p/> - * + * To identify easly a node, each node has a {@link #path} and a {@link + * #fullPath} (full path from root node). + * <p/> + * <p/> * To display the node we use a {@link NavigationTreeNodeRenderer} which is in * fact the {@link #userObject}, the object can be synch with the bean via the * {@link NavigationTreeNodeRenderer#reload(java.lang.Object)} method. - * + * * @author chemit * @see NavigationTreeModel * @see NavigationTreeNodeRenderer @@ -69,32 +68,35 @@ public class NavigationTreeNode extends DefaultMutableTreeNode { private static final long serialVersionUID = 1L; - /** - * Logger - */ + + /** Logger */ static private final Log log = LogFactory.getLog(NavigationTreeNode.class); + /** * The path separator used to build the {@link #fullPath}. - * + * * @see #path * @see #fullPath */ protected final String pathSeparator; + /** * The node path. * <p/> - * Used to build the {@link #fullPath} which gives a unique identifier of the - * node. + * Used to build the {@link #fullPath} which gives a unique identifier of + * the node. + * * @see #pathSeparator * @see #fullPath */ protected String path; + /** * The full path for the node from the rood node. * <p/> - * This path is build by appending nodes {@link #path} from the root node - * to this node, between each path we introduce the {@link #pathSeparator}. - * <p> + * This path is build by appending nodes {@link #path} from the root node to + * this node, between each path we introduce the {@link #pathSeparator}. + * <p/> * Exemple : * <pre> * root @@ -103,48 +105,56 @@ * `-- child2 * </pre> * will given {@code $root/child1/child2}. + * * @see #pathSeparator * @see #path */ protected String fullPath; + /** * The UI class associated with the node. * <p/> - * This class can be {@code null}, in that case, the - * {@link NavigationTreeModelBuilder#defaultUIClass} will be used while - * building the model. + * This class can be {@code null}, in that case, the {@link + * NavigationTreeModelBuilder#defaultUIClass} will be used while building + * the model. */ protected Class<? extends JAXXObject> uIClass; - /** + + /** * The UI handler class associated with the node. * <p/> - * This class can be {@code null}, in that case, the - * {@link NavigationTreeModelBuilder#defaultUIHandlerClass} will be used - * while building the model. + * This class can be {@code null}, in that case, the {@link + * NavigationTreeModelBuilder#defaultUIHandlerClass} will be used while + * building the model. */ protected Class<? extends JAXXAction> uIHandlerClass; + /** * The context entry definition to retrieve the bean. - * + * <p/> * <b>Note:</b> If not set - the {@code bean} will be retrieve on a ancestor * node. */ protected JAXXContextEntryDef<?> jaxxContextEntryDef; - /** + + /** * The jxPath to process to obtain real {@code bean} from the data retrieve * in the context. - * - * <b>Note:</b> If not set -no jxpath will be apply on the bean from context. + * <p/> + * <b>Note:</b> If not set -no jxpath will be apply on the bean from + * context. */ protected String jaxxContextEntryPath; + /** * The bean associated with the node ( the value can be obtain via the - * method {@link #getBean(JAXXContext)} or directly set via method - * {@link #setBean(Object)}. + * method {@link #getBean(JAXXContext)} or directly set via method {@link + * #setBean(Object)}. * <p/> * cache of bean associated with bean to improve performance */ protected transient Object bean; + /** * The type of the related bean associated with the node. * <p/> @@ -177,10 +187,7 @@ this.jaxxContextEntryPath = jaxxContextEntryPath; } - /** - * - * @return the text node renderer (store in {@link #userObject} property. - */ + /** @return the text node renderer (store in {@link #userObject} property. */ public NavigationTreeNodeRenderer getRenderer() { NavigationTreeNodeRenderer render = null; Object o = getUserObject(); @@ -275,7 +282,8 @@ } /** - * @param path the name of the {@link #path} to be matched in the child of this node. + * @param path the name of the {@link #path} to be matched in the child of + * this node. * @return the child of this node with given {@link #path} value. */ public NavigationTreeNode getChild(String path) { @@ -311,7 +319,15 @@ throw new NullPointerException("could not find the renderer for node " + this); } - Object b = getBean(context); + String s = getFullPath(); + Object b = null; + try { + b = getBean(context); + } finally { + if (log.isInfoEnabled()) { + log.info("bean for path [" + s + "] = " + bean); + } + } renderer.reload(b); }
participants (1)
-
tchemit@users.nuiton.org