Author: knopp
Date: Wed Jul 9 12:38:53 2008
New Revision: 675321
URL: http://svn.apache.org/viewvc?rev=675321&view=rev
Log:
fix npe
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java?rev=675321&r1=675320&r2=675321&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
Wed Jul 9 12:38:53 2008
@@ -49,7 +49,7 @@
* This class encapsulates the logic for displaying and (partial) updating the
tree. Actual
* presentation is out of scope of this class. User should derive they own
tree (if needed) from
* [EMAIL PROTECTED] BaseTree} (recommended).
- *
+ *
* @author Matej Knopp
*/
public abstract class AbstractTree extends Panel
@@ -60,7 +60,7 @@
{
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
@@ -71,7 +71,7 @@
{
/**
* Visits the tree item.
- *
+ *
* @param item
* the item to visit
*/
@@ -106,7 +106,7 @@
/**
* Construct.
- *
+ *
* @param id
* The component id
* @param node
@@ -167,7 +167,7 @@
/**
* Sets the children.
- *
+ *
* @param children
* The children
*/
@@ -178,7 +178,7 @@
/**
* Whether to render children.
- *
+ *
* @return whether to render children
*/
protected final boolean isRenderChildren()
@@ -348,7 +348,7 @@
/**
* Construct.
- *
+ *
* @param id
* The component id
*/
@@ -374,7 +374,7 @@
/**
* renders the tree items, making sure that items are rendered
in the order they should be
- *
+ *
* @param markupStream
*/
@Override
@@ -470,7 +470,7 @@
/**
* Tree constructor
- *
+ *
* @param id
* The component id
*/
@@ -482,7 +482,7 @@
/**
* Tree constructor
- *
+ *
* @param id
* The component id
* @param model
@@ -508,7 +508,7 @@
/**
* Returns the TreeState of this tree.
- *
+ *
* @return Tree state instance
*/
public ITreeState getTreeState()
@@ -669,7 +669,7 @@
/**
* Determines whether the TreeNode needs to be rebuilt if it is
selected or deselected
- *
+ *
* @return true if the node should be rebuilt after (de)selection,
false otherwise
*/
protected boolean isForceRebuildOnSelectionChange()
@@ -679,7 +679,7 @@
/**
* Sets whether the root of the tree should be visible.
- *
+ *
* @param rootLess
* whether the root should be visible
*/
@@ -734,10 +734,10 @@
/**
* Marks the last but one visible child node of the given item as
dirty, if give child is the
* last item of parent.
- *
+ *
* We need this to refresh the previous visible item in case the
inserted / deleted item was
* last. The reason is that the line shape of previous item changes
from L to |- .
- *
+ *
* @param parent
* @param child
*/
@@ -804,7 +804,7 @@
Object parent = e.getTreePath().getLastPathComponent();
TreeItem parentItem = nodeToItemMap.get(parent);
- if (isNodeVisible(parent) && isNodeExpanded(parent))
+ if (parentItem != null && isNodeVisible(parent) &&
isNodeExpanded(parent))
{
boolean nonEmpty = !parentItem.getChildren().isEmpty();
for (int i = 0; i < e.getChildren().length; ++i)
@@ -878,7 +878,7 @@
/**
* Allows to intercept adding dirty components to AjaxRequestTarget.
- *
+ *
* @param target
* @param component
*/
@@ -993,7 +993,7 @@
* the component on page. Make sure that the tree model has fired the
proper listener functions.
* <p>
* <b>You can only call this method once in a request.</b>
- *
+ *
* @param target
* Ajax request target used to send the update to the page
*/
@@ -1009,7 +1009,7 @@
/**
* Returns whether the given node is expanded.
- *
+ *
* @param node
* The node to inspect
* @return true if the node is expanded, false otherwise
@@ -1028,7 +1028,7 @@
/**
* Creates the TreeState, which is an object where the current state of
tree (which nodes are
* expanded / collapsed, selected, ...) is stored.
- *
+ *
* @return Tree state instance
*/
protected ITreeState newTreeState()
@@ -1050,10 +1050,10 @@
/**
* This method is called after creating every TreeItem. This is the
place for adding components
* on item (junction links, labels, icons...)
- *
+ *
* @param item
* newly created tree item. The node can be obtained as
item.getModelObject()
- *
+ *
* @param level
* how deep the component is in tree hierarchy (0 for root
item)
*/
@@ -1062,7 +1062,7 @@
/**
* Builds the children for given TreeItem. It recursively traverses
children of it's TreeNode
* and creates TreeItem for every visible TreeNode.
- *
+ *
* @param item
* The parent tree item
*/
@@ -1088,7 +1088,7 @@
/**
* Builds (recursively) TreeItems for the given Iterator of TreeNodes.
- *
+ *
* @param parent
* @param nodes
* The nodes to build tree items for
@@ -1160,7 +1160,7 @@
/**
* Returns the javascript used to delete removed elements.
- *
+ *
* @return The javascript
*/
private String getElementsDeleteJavascript()
@@ -1195,7 +1195,7 @@
/**
* returns the short version of item id (just the number part).
- *
+ *
* @param item
* The tree item
* @return The id
@@ -1233,7 +1233,7 @@
/**
* INTERNAL
- *
+ *
* @param node
*/
public final void markNodeDirty(Object node)
@@ -1243,7 +1243,7 @@
/**
* INTERNAL
- *
+ *
* @param node
*/
public final void markNodeChildrenDirty(Object node)
@@ -1264,7 +1264,7 @@
/**
* Invalidates single node (without children). On the next render, this
node will be updated.
* Node will not be rebuilt, unless forceRebuild is true.
- *
+ *
* @param node
* The node to invalidate
* @param forceRebuild
@@ -1330,7 +1330,7 @@
/**
* Invalidates node and it's children. On the next render, the node and
children will be
* updated. Node children will be rebuilt.
- *
+ *
* @param node
* The node to invalidate
*/
@@ -1367,7 +1367,7 @@
/**
* Returns whether the given node is visible, e.g. all it's parents are
expanded.
- *
+ *
* @param node
* The node to inspect
* @return true if the node is visible, false otherwise
@@ -1392,7 +1392,7 @@
/**
* Returns parent node of given node.
- *
+ *
* @param node
* @return
*/
@@ -1412,7 +1412,7 @@
/**
* Creates a tree item for given node.
- *
+ *
* @param parent
* @param node
* The tree node
@@ -1427,7 +1427,7 @@
/**
* Creates a tree item for given node with specified id.
- *
+ *
* @param parent
* @param node
* The tree node
@@ -1444,7 +1444,7 @@
/**
* Return the representation of node children as Iterator interface.
- *
+ *
* @param node
* The tree node
* @return iterable presentation of node children
@@ -1502,7 +1502,7 @@
/**
* Removes the item, appends it's id to deleteIds. This is called when
a items parent is being
* deleted or rebuilt.
- *
+ *
* @param item
* The item to remove
*/
@@ -1544,7 +1544,7 @@
/**
* Call the callback#visitItem method for the given item and all it's
children.
- *
+ *
* @param item
* The tree item
* @param callback
@@ -1558,7 +1558,7 @@
/**
* Call the callback#visitItem method for every child of given item.
- *
+ *
* @param item
* The tree item
* @param callback
@@ -1579,7 +1579,7 @@
/**
* Returns the component associated with given node, or null, if node
is not visible. This is
* useful in situations when you want to touch the node element in html.
- *
+ *
* @param node
* Tree node
* @return Component associated with given node, or null if node is not
visible.