You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2012/02/05 23:02:55 UTC

[7/9] git commit: WICKET-4240 moved old tree together into extensions

WICKET-4240 moved old tree together into extensions


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/567a5932
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/567a5932
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/567a5932

Branch: refs/heads/master
Commit: 567a5932b27caa7a343eb4854fb08da331c08f23
Parents: bb687aa
Author: Sven Meier <sv...@apache.org>
Authored: Sun Jan 8 17:56:58 2012 +0100
Committer: Sven Meier <sv...@apache.org>
Committed: Sun Jan 8 18:41:27 2012 +0100

----------------------------------------------------------------------
 .../wicket/markup/html/tree/AbstractTree.java      | 1766 --------------
 .../apache/wicket/markup/html/tree/BaseTree.html   |   23 -
 .../apache/wicket/markup/html/tree/BaseTree.java   |  477 ----
 .../wicket/markup/html/tree/DefaultTreeState.java  |  297 ---
 .../apache/wicket/markup/html/tree/ITreeState.java |  127 -
 .../markup/html/tree/ITreeStateListener.java       |   68 -
 .../wicket/markup/html/tree/LabelIconPanel.html    |   20 -
 .../wicket/markup/html/tree/LabelIconPanel.java    |  188 --
 .../apache/wicket/markup/html/tree/LabelTree.java  |  109 -
 .../wicket/markup/html/tree/LinkIconPanel.html     |   20 -
 .../wicket/markup/html/tree/LinkIconPanel.java     |   89 -
 .../apache/wicket/markup/html/tree/LinkTree.java   |  110 -
 .../apache/wicket/markup/html/tree/LinkType.java   |   62 -
 .../wicket/markup/html/tree/WicketTreeModel.java   |   55 -
 .../apache/wicket/markup/html/tree/package.html    |   27 -
 .../markup/html/tree/res/base-tree-images.png      |  Bin 969 -> 0 bytes
 .../wicket/markup/html/tree/res/base-tree.css      |  131 --
 .../wicket/markup/html/tree/res/folder-closed.gif  |  Bin 372 -> 0 bytes
 .../wicket/markup/html/tree/res/folder-open.gif    |  Bin 376 -> 0 bytes
 .../apache/wicket/markup/html/tree/res/item.gif    |  Bin 582 -> 0 bytes
 .../org/apache/wicket/markup/html/tree/res/tree.js |  179 --
 .../apache/wicket/markup/html/tree/TreeTest.java   |  144 --
 .../wicket/devutils/diskstore/PageWindowModel.java |    2 +-
 .../examples/ajax/builtin/tree/BaseTreePage.java   |    2 +-
 .../ajax/builtin/tree/EditableTreeTablePage.java   |    2 +-
 .../examples/ajax/builtin/tree/SimpleTreePage.java |    6 +-
 .../examples/ajax/builtin/tree/TreeTablePage.java  |    2 +-
 .../org/apache/wicket/examples/nested/Home.java    |    2 +-
 .../extensions/markup/html/tree/AbstractTree.java  | 1767 +++++++++++++++
 .../extensions/markup/html/tree/BaseTree.html      |   23 +
 .../extensions/markup/html/tree/BaseTree.java      |  478 ++++
 .../markup/html/tree/DefaultAbstractTree.java      |    4 +-
 .../markup/html/tree/DefaultTreeState.java         |  297 +++
 .../extensions/markup/html/tree/ITreeState.java    |  128 ++
 .../markup/html/tree/ITreeStateListener.java       |   69 +
 .../markup/html/tree/LabelIconPanel.html           |   20 +
 .../markup/html/tree/LabelIconPanel.java           |  188 ++
 .../extensions/markup/html/tree/LabelTree.java     |  110 +
 .../extensions/markup/html/tree/LinkIconPanel.html |   20 +
 .../extensions/markup/html/tree/LinkIconPanel.java |   89 +
 .../extensions/markup/html/tree/LinkTree.java      |  111 +
 .../extensions/markup/html/tree/LinkType.java      |   62 +
 .../wicket/extensions/markup/html/tree/Tree.java   |    1 +
 .../markup/html/tree/WicketTreeModel.java          |   56 +
 .../extensions/markup/html/tree/package.html       |   27 +
 .../markup/html/tree/res/base-tree-images.png      |  Bin 0 -> 969 bytes
 .../extensions/markup/html/tree/res/base-tree.css  |  131 ++
 .../wicket/extensions/markup/html/tree/res/tree.js |  179 ++
 .../markup/html/tree/table/TreeTable.java          |    9 +-
 .../extensions/markup/html/tree/TreeTest.java      |  146 ++
 50 files changed, 3916 insertions(+), 3907 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
deleted file mode 100644
index 2129404..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/AbstractTree.java
+++ /dev/null
@@ -1,1766 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreeNode;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.IMarkupFragment;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
-import org.apache.wicket.markup.html.list.AbstractItem;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IDetachable;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.Response;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.string.AppendingStringBuffer;
-import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
-
-
-/**
- * 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
- * {@link BaseTree} (recommended).
- * 
- * @author Matej Knopp
- */
-public abstract class AbstractTree extends Panel
-	implements
-		ITreeStateListener,
-		TreeModelListener,
-		AjaxRequestTarget.ITargetRespondListener
-{
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * Interface for visiting individual tree items.
-	 */
-	private static interface IItemCallback
-	{
-		/**
-		 * Visits the tree item.
-		 * 
-		 * @param item
-		 *            the item to visit
-		 */
-		void visitItem(TreeItem item);
-	}
-
-	/**
-	 * This class represents one row in rendered tree (TreeNode). Only TreeNodes that are visible
-	 * (all their parent are expanded) have TreeItem created for them.
-	 */
-	private final class TreeItem extends AbstractItem
-	{
-		/**
-		 * whether this tree item should also render it's children to response. this is set if we
-		 * need the whole subtree rendered as one component in ajax response, so that we can replace
-		 * it in one step (replacing individual rows is very slow in javascript, therefore we
-		 * replace the whole subtree)
-		 */
-		private final static int FLAG_RENDER_CHILDREN = FLAG_RESERVED8;
-
-		private static final long serialVersionUID = 1L;
-
-		/**
-		 * tree item children - we need this to traverse items in correct order when rendering
-		 */
-		private List<TreeItem> children = null;
-
-		/** tree item level - how deep is this item in tree */
-		private final int level;
-
-		private final TreeItem parent;
-
-		/**
-		 * Construct.
-		 * 
-		 * @param id
-		 *            The component id
-		 * @param node
-		 *            tree node
-		 * @param level
-		 *            current level
-		 * @param parent
-		 */
-		public TreeItem(TreeItem parent, String id, final Object node, int level)
-		{
-			super(id, new Model<Serializable>((Serializable)node));
-
-			this.parent = parent;
-
-			nodeToItemMap.put(node, this);
-			this.level = level;
-			setOutputMarkupId(true);
-
-			// if this isn't a root item in rootless mode
-			if (level != -1)
-			{
-				populateTreeItem(this, level);
-			}
-		}
-
-		public TreeItem getParentItem()
-		{
-			return parent;
-		}
-
-		/**
-		 * @return The children
-		 */
-		public List<TreeItem> getChildren()
-		{
-			return children;
-		}
-
-		/**
-		 * @return The current level
-		 */
-		public int getLevel()
-		{
-			return level;
-		}
-
-		/**
-		 * @see org.apache.wicket.Component#getMarkupId()
-		 */
-		@Override
-		public String getMarkupId()
-		{
-			// this is overridden to produce id that begins with id of tree
-			// if the tree has set (shorter) id in markup, we can use it to
-			// shorten the id of individual TreeItems
-			return AbstractTree.this.getMarkupId() + "_" + getId();
-		}
-
-		/**
-		 * Sets the children.
-		 * 
-		 * @param children
-		 *            The children
-		 */
-		public void setChildren(List<TreeItem> children)
-		{
-			this.children = children;
-		}
-
-		/**
-		 * Whether to render children.
-		 * 
-		 * @return whether to render children
-		 */
-		protected final boolean isRenderChildren()
-		{
-			return getFlag(FLAG_RENDER_CHILDREN);
-		}
-
-		/**
-		 * Whether the TreeItem has any child TreeItems
-		 * 
-		 * @return true if there are one or more child TreeItems; false otherwise
-		 */
-		public boolean hasChildTreeItems()
-		{
-			return children != null && !children.isEmpty();
-		}
-
-		/**
-		 * @see org.apache.wicket.MarkupContainer#onRender()
-		 */
-		@Override
-		protected void onRender()
-		{
-			// is this root and tree is in rootless mode?
-			if (this == rootItem && isRootLess() == true)
-			{
-				// yes, write empty div with id
-				// this is necessary for createElement js to work correctly
-				String tagName = ((ComponentTag)getMarkup().get(0)).getName();
-				Response response = getResponse();
-				response.write("<" + tagName + " style=\"display:none\" id=\"" + getMarkupId() +
-					"\">");
-				if ("table".equals(tagName))
-				{
-					response.write("<tbody><tr><td></td></tr></tbody>");
-				}
-				response.write("</" + tagName + ">");
-			}
-			else
-			{
-				// render the item
-				super.onRender();
-
-				// should we also render children (ajax response)
-				if (isRenderChildren())
-				{
-					// visit every child
-					visitItemChildren(this, new IItemCallback()
-					{
-						@Override
-						public void visitItem(TreeItem item)
-						{
-							// render child
-							item.onRender();
-
-							// go through the behaviors and invoke IBehavior.afterRender
-							List<? extends Behavior> behaviors = item.getBehaviors();
-							for (Behavior behavior : behaviors)
-							{
-								behavior.afterRender(item);
-							}
-						}
-					});
-				}
-			}
-		}
-
-		/**
-		 * 
-		 * @return model object
-		 */
-		public Object getModelObject()
-		{
-			return getDefaultModelObject();
-		}
-
-		@Override
-		public void renderHead(final HtmlHeaderContainer container)
-		{
-			super.renderHead(container);
-
-			if (isRenderChildren())
-			{
-				// visit every child
-				visitItemChildren(this, new IItemCallback()
-				{
-					@Override
-					public void visitItem(TreeItem item)
-					{
-						// write header contributions from the children of item
-						item.visitChildren(new IVisitor<Component, Void>()
-						{
-							@Override
-							public void component(final Component component,
-								final IVisit<Void> visit)
-							{
-								if (component.isVisible())
-								{
-									component.renderHead(container);
-								}
-								else
-								{
-									visit.dontGoDeeper();
-								}
-							}
-						});
-					}
-				});
-			}
-		}
-
-		protected final void setRenderChildren(boolean value)
-		{
-			setFlag(FLAG_RENDER_CHILDREN, value);
-		}
-
-		@Override
-		protected void onDetach()
-		{
-			super.onDetach();
-			Object object = getModelObject();
-			if (object instanceof IDetachable)
-			{
-				((IDetachable)object).detach();
-			}
-
-			if (isRenderChildren())
-			{
-				// visit every child
-				visitItemChildren(this, new IItemCallback()
-				{
-					@Override
-					public void visitItem(TreeItem item)
-					{
-						item.detach();
-					}
-				});
-			}
-
-			// children are rendered, clear the flag
-			setRenderChildren(false);
-		}
-
-		@Override
-		protected void onBeforeRender()
-		{
-			onBeforeRenderInternal();
-			super.onBeforeRender();
-
-			if (isRenderChildren())
-			{
-				// visit every child
-				visitItemChildren(this, new IItemCallback()
-				{
-					@Override
-					public void visitItem(TreeItem item)
-					{
-						item.prepareForRender();
-					}
-				});
-			}
-		}
-
-		@Override
-		protected void onAfterRender()
-		{
-			super.onAfterRender();
-			if (isRenderChildren())
-			{
-				// visit every child
-				visitItemChildren(this, new IItemCallback()
-				{
-					@Override
-					public void visitItem(TreeItem item)
-					{
-						item.afterRender();
-					}
-				});
-			}
-		}
-
-		private boolean hasParentWithChildrenMarkedToRecreation()
-		{
-			return getParentItem() != null &&
-				(getParentItem().getChildren() == null || getParentItem().hasParentWithChildrenMarkedToRecreation());
-		}
-	}
-
-	/**
-	 * Components that holds tree items. This is similar to ListView, but it renders tree items in
-	 * the right order.
-	 */
-	private class TreeItemContainer extends WebMarkupContainer
-	{
-		private static final long serialVersionUID = 1L;
-
-		/**
-		 * Construct.
-		 * 
-		 * @param id
-		 *            The component id
-		 */
-		public TreeItemContainer(String id)
-		{
-			super(id);
-		}
-
-		/**
-		 * @see org.apache.wicket.MarkupContainer#remove(org.apache.wicket.Component)
-		 */
-		@Override
-		public TreeItemContainer remove(Component component)
-		{
-			// when a treeItem is removed, remove reference to it from
-			// nodeToItemMAp
-			if (component instanceof TreeItem)
-			{
-				nodeToItemMap.remove(((TreeItem)component).getModelObject());
-			}
-			super.remove(component);
-			return this;
-		}
-
-		/**
-		 * @see org.apache.wicket.MarkupContainer#onRender()
-		 */
-		@Override
-		protected void onRender()
-		{
-			// is there a root item? (non-empty tree)
-			if (rootItem != null)
-			{
-				IItemCallback callback = new IItemCallback()
-				{
-					@Override
-					public void visitItem(TreeItem item)
-					{
-						// render component
-						item.render();
-					}
-				};
-
-				// visit item and it's children
-				visitItemAndChildren(rootItem, callback);
-			}
-		}
-
-		@Override
-		public IMarkupFragment getMarkup(final Component child)
-		{
-			// The childs markup is always equal to the parents markup.
-			return getMarkup();
-		}
-	}
-
-	private boolean attached = false;
-
-	/** comma separated list of ids of elements to be deleted. */
-	private final AppendingStringBuffer deleteIds = new AppendingStringBuffer();
-
-	/**
-	 * whether the whole tree is dirty (so the whole tree needs to be refreshed).
-	 */
-	private boolean dirtyAll = false;
-
-	/**
-	 * list of dirty items. if children property of these items is null, the children will be
-	 * rebuild.
-	 */
-	private final Set<TreeItem> dirtyItems = new HashSet<TreeItem>();
-
-	/**
-	 * list of dirty items which need the DOM structure to be created for them (added items)
-	 */
-	private final Set<TreeItem> dirtyItemsCreateDOM = new HashSet<TreeItem>();
-
-	/** counter for generating unique ids of every tree item. */
-	private int idCounter = 0;
-
-	/** Component whose children are tree items. */
-	private TreeItemContainer itemContainer;
-
-	/**
-	 * map that maps TreeNode to TreeItem. TreeItems only exists for TreeNodes, that are visible
-	 * (their parents are not collapsed).
-	 */
-	// TODO this field is not serializable but nested inside an serializable component
-	private final Map<Object, TreeItem> nodeToItemMap = new HashMap<Object, TreeItem>();
-
-	/**
-	 * we need to track previous model. if the model changes, we unregister the tree from listeners
-	 * of old model and register the tree as listener of new model.
-	 */
-
-	// TODO this field is not serializable but nested inside an serializable component
-	private TreeModel previousModel = null;
-
-	/** root item of the tree. */
-	private TreeItem rootItem = null;
-
-	/** whether the tree root is shown. */
-	private boolean rootLess = false;
-
-	/** stores reference to tree state. */
-	private ITreeState state;
-
-	/**
-	 * Tree constructor
-	 * 
-	 * @param id
-	 *            The component id
-	 */
-	public AbstractTree(String id)
-	{
-		super(id);
-		init();
-	}
-
-	/**
-	 * Tree constructor
-	 * 
-	 * @param id
-	 *            The component id
-	 * @param model
-	 *            The tree model
-	 */
-	public AbstractTree(String id, IModel<? extends TreeModel> model)
-	{
-		super(id, model);
-		init();
-	}
-
-	/** called when all nodes are collapsed. */
-	@Override
-	public final void allNodesCollapsed()
-	{
-		invalidateAll();
-	}
-
-	/** called when all nodes are expanded. */
-	@Override
-	public final void allNodesExpanded()
-	{
-		invalidateAll();
-	}
-
-	/**
-	 * 
-	 * @return model
-	 */
-	@SuppressWarnings("unchecked")
-	public IModel<? extends TreeModel> getModel()
-	{
-		return (IModel<? extends TreeModel>)getDefaultModel();
-	}
-
-	/**
-	 * @return treemodel
-	 */
-	public TreeModel getModelObject()
-	{
-		return (TreeModel)getDefaultModelObject();
-	}
-
-	/**
-	 * 
-	 * @param model
-	 * @return this
-	 */
-	public MarkupContainer setModel(IModel<? extends TreeModel> model)
-	{
-		setDefaultModel(model);
-		return this;
-	}
-
-	/**
-	 * 
-	 * @param model
-	 * @return this
-	 */
-	public MarkupContainer setModelObject(TreeModel model)
-	{
-		setDefaultModelObject(model);
-		return this;
-	}
-
-	/**
-	 * Returns the TreeState of this tree.
-	 * 
-	 * @return Tree state instance
-	 */
-	public ITreeState getTreeState()
-	{
-		if (state == null)
-		{
-			state = newTreeState();
-
-			// add this object as listener of the state
-			state.addTreeStateListener(this);
-			// FIXME: Where should we remove the listener?
-		}
-		return state;
-	}
-
-	/**
-	 * This method is called before the onAttach is called. Code here gets executed before the items
-	 * have been populated.
-	 */
-	protected void onBeforeAttach()
-	{
-	}
-
-	// This is necessary because MarkupContainer.onBeforeRender involves calling
-	// beforeRender on children, which results in stack overflow when called from TreeItem
-	private void onBeforeRenderInternal()
-	{
-		if (attached == false)
-		{
-			onBeforeAttach();
-
-			checkModel();
-
-			// Do we have to rebuild the whole tree?
-			if (dirtyAll && rootItem != null)
-			{
-				clearAllItem();
-			}
-			else
-			{
-				// rebuild children of dirty nodes that need it
-				rebuildDirty();
-			}
-
-			// is root item created? (root item is null if the items have not
-			// been created yet, or the whole tree was dirty and clearAllITem
-			// has been called
-			if (rootItem == null)
-			{
-				Object rootNode = getModelObject().getRoot();
-				if (rootNode != null)
-				{
-					if (isRootLess())
-					{
-						rootItem = newTreeItem(null, rootNode, -1);
-					}
-					else
-					{
-						rootItem = newTreeItem(null, rootNode, 0);
-					}
-					itemContainer.add(rootItem);
-					buildItemChildren(rootItem);
-				}
-			}
-
-			attached = true;
-		}
-	}
-
-	/**
-	 * Called at the beginning of the request (not ajax request, unless we are rendering the entire
-	 * component)
-	 */
-	@Override
-	public void onBeforeRender()
-	{
-		onBeforeRenderInternal();
-		super.onBeforeRender();
-	}
-
-	/**
-	 * @see org.apache.wicket.MarkupContainer#onDetach()
-	 */
-	@Override
-	public void onDetach()
-	{
-		attached = false;
-		super.onDetach();
-		if (getTreeState() instanceof IDetachable)
-		{
-			((IDetachable)getTreeState()).detach();
-		}
-	}
-
-	/**
-	 * Call to refresh the whole tree. This should only be called when the roodNode has been
-	 * replaced or the entiry tree model changed.
-	 */
-	public final void invalidateAll()
-	{
-		updated();
-		dirtyAll = true;
-	}
-
-	/**
-	 * @return whether the tree root is shown
-	 */
-	public final boolean isRootLess()
-	{
-		return rootLess;
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeStateListener#nodeCollapsed(Object)
-	 */
-	@Override
-	public final void nodeCollapsed(Object node)
-	{
-		if (isNodeVisible(node) == true)
-		{
-			invalidateNodeWithChildren(node);
-		}
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeStateListener#nodeExpanded(Object)
-	 */
-	@Override
-	public final void nodeExpanded(Object node)
-	{
-		if (isNodeVisible(node) == true)
-		{
-			invalidateNodeWithChildren(node);
-		}
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeStateListener#nodeSelected(Object)
-	 */
-	@Override
-	public final void nodeSelected(Object node)
-	{
-		if (isNodeVisible(node))
-		{
-			invalidateNode(node, isForceRebuildOnSelectionChange());
-		}
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeStateListener#nodeUnselected(Object)
-	 */
-	@Override
-	public final void nodeUnselected(Object node)
-	{
-		if (isNodeVisible(node))
-		{
-			invalidateNode(node, isForceRebuildOnSelectionChange());
-		}
-	}
-
-	/**
-	 * 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()
-	{
-		return true;
-	}
-
-	/**
-	 * Sets whether the root of the tree should be visible.
-	 * 
-	 * @param rootLess
-	 *            whether the root should be visible
-	 */
-	public void setRootLess(boolean rootLess)
-	{
-		if (this.rootLess != rootLess)
-		{
-			this.rootLess = rootLess;
-			invalidateAll();
-
-			// if the tree is in rootless mode, make sure the root node is
-			// expanded
-			if (rootLess == true && getModelObject() != null)
-			{
-				getTreeState().expandNode(getModelObject().getRoot());
-			}
-		}
-	}
-
-	/**
-	 * @see javax.swing.event.TreeModelListener#treeNodesChanged(javax.swing.event.TreeModelEvent)
-	 */
-	@Override
-	public final void treeNodesChanged(TreeModelEvent e)
-	{
-		if (dirtyAll)
-		{
-			return;
-		}
-		// has root node changed?
-		if (e.getChildren() == null)
-		{
-			if (rootItem != null)
-			{
-				invalidateNode(rootItem.getModelObject(), true);
-			}
-		}
-		else
-		{
-			// go through all changed nodes
-			Object[] children = e.getChildren();
-			if (children != null)
-			{
-				for (Object node : children)
-				{
-					if (isNodeVisible(node))
-					{
-						// if the nodes is visible invalidate it
-						invalidateNode(node, true);
-					}
-				}
-			}
-		}
-	}
-
-	/**
-	 * 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
-	 */
-	private void markTheLastButOneChildDirty(TreeItem parent, TreeItem child)
-	{
-		if (parent.getChildren().indexOf(child) == parent.getChildren().size() - 1)
-		{
-			// go through the children backwards, start at the last but one
-			// item
-			for (int i = parent.getChildren().size() - 2; i >= 0; --i)
-			{
-				TreeItem item = parent.getChildren().get(i);
-
-				// invalidate the node and it's children, so that they are
-				// redrawn
-				invalidateNodeWithChildren(item.getModelObject());
-
-			}
-		}
-	}
-
-	/**
-	 * @see javax.swing.event.TreeModelListener#treeNodesInserted(javax.swing.event.TreeModelEvent)
-	 */
-	@Override
-	public final void treeNodesInserted(TreeModelEvent e)
-	{
-		if (dirtyAll)
-		{
-			return;
-		}
-
-		// get the parent node of inserted nodes
-		Object parentNode = e.getTreePath().getLastPathComponent();
-		TreeItem parentItem = nodeToItemMap.get(parentNode);
-
-
-		if (parentItem != null && isNodeVisible(parentNode))
-		{
-			List<?> eventChildren = Arrays.asList(e.getChildren());
-
-			// parentNode was a leaf before this insertion event only if every one of
-			// its current children is in the event's list of children
-			boolean wasLeaf = true;
-			int nodeChildCount = getChildCount(parentNode);
-			for (int i = 0; wasLeaf && i < nodeChildCount; i++)
-			{
-				wasLeaf = eventChildren.contains(getChildAt(parentNode, i));
-			}
-
-			boolean addingToHiddedRoot = parentItem.getParentItem() == null && isRootLess();
-			// if parent was a presented leaf
-			if (wasLeaf && !addingToHiddedRoot)
-			{
-				// parentNode now has children for the first time, so we may need to invalidate
-				// grandparent so that parentNode's junctionLink gets rebuilt with a plus/minus link
-				Object grandparentNode = getParentNode(parentNode);
-				boolean addingToHiddedRootSon = grandparentNode != null &&
-					getParentNode(grandparentNode) == null && isRootLess();
-				// if visible, invalidate the grandparent
-				if (grandparentNode != null && !addingToHiddedRootSon)
-				{
-					invalidateNodeWithChildren(grandparentNode);
-				}
-				else
-				{
-					// if not, simply invalidating the parent node
-					// OBS.: forcing rebuild since unlike the grandparent, the old
-					// leaf parent needs to rebuild with plus/minus link
-					invalidateNode(parentNode, true);
-				}
-				getTreeState().expandNode(parentNode);
-			}
-			else
-			{
-				if (isNodeExpanded(parentNode))
-				{
-					List<TreeItem> itemChildren = parentItem.getChildren();
-					int childLevel = parentItem.getLevel() + 1;
-					final int[] childIndices = e.getChildIndices();
-					for (int i = 0; i < eventChildren.size(); ++i)
-					{
-						TreeItem item = newTreeItem(parentItem, eventChildren.get(i), childLevel);
-						itemContainer.add(item);
-
-						if (itemChildren != null)
-						{
-							itemChildren.add(childIndices[i], item);
-							markTheLastButOneChildDirty(parentItem, item);
-						}
-
-						if (!dirtyItems.contains(item))
-						{
-							dirtyItems.add(item);
-						}
-
-						if (!dirtyItemsCreateDOM.contains(item) &&
-							!item.hasParentWithChildrenMarkedToRecreation())
-						{
-							dirtyItemsCreateDOM.add(item);
-						}
-					}
-				}
-			}
-		}
-	}
-
-	/**
-	 * @see javax.swing.event.TreeModelListener#treeNodesRemoved(javax.swing.event.TreeModelEvent)
-	 */
-	@Override
-	public final void treeNodesRemoved(TreeModelEvent removalEvent)
-	{
-		if (dirtyAll)
-		{
-			return;
-		}
-
-		// get the parent node of deleted nodes
-		Object parentNode = removalEvent.getTreePath().getLastPathComponent();
-		TreeItem parentItem = nodeToItemMap.get(parentNode);
-
-		// unselect all removed items
-		List<Object> selection = new ArrayList<Object>(getTreeState().getSelectedNodes());
-		List<Object> removed = Arrays.asList(removalEvent.getChildren());
-		for (Object selectedNode : selection)
-		{
-			Object cursor = selectedNode;
-			while (cursor != null)
-			{
-				if (removed.contains(cursor))
-				{
-					getTreeState().selectNode(selectedNode, false);
-				}
-				if (cursor instanceof TreeNode)
-				{
-					cursor = ((TreeNode)cursor).getParent();
-				}
-				else
-				{
-					cursor = null;
-				}
-			}
-		}
-
-		if (parentItem != null && isNodeVisible(parentNode))
-		{
-			if (isNodeExpanded(parentNode))
-			{
-				// deleted nodes were visible; we need to delete their TreeItems
-				for (Object deletedNode : removalEvent.getChildren())
-				{
-					TreeItem itemToDelete = nodeToItemMap.get(deletedNode);
-					if (itemToDelete != null)
-					{
-						markTheLastButOneChildDirty(parentItem, itemToDelete);
-
-						// remove all the deleted item's children
-						visitItemChildren(itemToDelete, new IItemCallback()
-						{
-							@Override
-							public void visitItem(TreeItem item)
-							{
-								removeItem(item);
-							}
-						});
-
-						parentItem.getChildren().remove(itemToDelete);
-						removeItem(itemToDelete);
-					}
-				}
-			}
-
-			if (!parentItem.hasChildTreeItems())
-			{
-				// rebuild parent's icon to show it no longer has children
-				invalidateNode(parentNode, true);
-			}
-		}
-	}
-
-	/**
-	 * @see javax.swing.event.TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent)
-	 */
-	@Override
-	public final void treeStructureChanged(TreeModelEvent e)
-	{
-		if (dirtyAll)
-		{
-			return;
-		}
-
-		// get the parent node of changed nodes
-		Object node = e.getTreePath() != null ? e.getTreePath().getLastPathComponent() : null;
-
-		// has the tree root changed?
-		if (node == null || e.getTreePath().getPathCount() == 1)
-		{
-			invalidateAll();
-		}
-		else
-		{
-			invalidateNodeWithChildren(node);
-		}
-	}
-
-	/**
-	 * Allows to intercept adding dirty components to AjaxRequestTarget.
-	 * 
-	 * @param target
-	 * @param component
-	 */
-	protected void addComponent(AjaxRequestTarget target, Component component)
-	{
-		target.add(component);
-	}
-
-	@Override
-	public void onTargetRespond(AjaxRequestTarget target)
-	{
-		// check whether the model hasn't changed
-		checkModel();
-
-		// is the whole tree dirty
-		if (dirtyAll)
-		{
-			// render entire tree component
-			addComponent(target, this);
-		}
-		else
-		{
-			// remove DOM elements that need to be removed
-			if (deleteIds.length() != 0)
-			{
-				String js = getElementsDeleteJavaScript();
-
-				// add the javascript to target
-				target.prependJavaScript(js);
-			}
-
-			// We have to repeat this as long as there are any dirty items to be
-			// created.
-			// The reason why we can't do this in one pass is that some of the
-			// items
-			// may need to be inserted after items that has not been inserted
-			// yet, so we have
-			// to detect those and wait until the items they depend on are
-			// inserted.
-			while (dirtyItemsCreateDOM.isEmpty() == false)
-			{
-				for (Iterator<TreeItem> i = dirtyItemsCreateDOM.iterator(); i.hasNext();)
-				{
-					TreeItem item = i.next();
-					TreeItem parent = item.getParentItem();
-					int index = parent.getChildren().indexOf(item);
-					TreeItem previous;
-					// we need item before this (in dom structure)
-
-					if (index == 0)
-					{
-						previous = parent;
-					}
-					else
-					{
-						previous = parent.getChildren().get(index - 1);
-						// get the last item of previous item subtree
-						while (previous.getChildren() != null && previous.getChildren().size() > 0)
-						{
-							previous = previous.getChildren()
-								.get(previous.getChildren().size() - 1);
-						}
-					}
-					// check if the previous item isn't waiting to be inserted
-					if (dirtyItemsCreateDOM.contains(previous) == false)
-					{
-						// it's already in dom, so we can use it as point of
-						// insertion
-						target.prependJavaScript("Wicket.Tree.createElement(\"" +
-							item.getMarkupId() + "\"," + "\"" + previous.getMarkupId() + "\")");
-
-						// remove the item so we don't process it again
-						i.remove();
-					}
-					else
-					{
-						// we don't do anything here, inserting this item will
-						// have to wait
-						// until the previous item gets inserted
-					}
-				}
-			}
-
-			// iterate through dirty items
-			for (TreeItem item : dirtyItems)
-			{
-				// does the item need to rebuild children?
-				if (item.getChildren() == null)
-				{
-					// rebuild the children
-					buildItemChildren(item);
-
-					// set flag on item so that it renders itself together with
-					// it's children
-					item.setRenderChildren(true);
-				}
-
-				// add the component to target
-				addComponent(target, item);
-			}
-
-			// clear dirty flags
-			updated();
-		}
-	}
-
-	/**
-	 * Convenience method that updates changed portions on tree. You can call this method during
-	 * Ajax response, where calling {@link #updateTree(AjaxRequestTarget)} would be appropriate, but
-	 * you don't have the AjaxRequestTarget instance. However, it is also safe to call this method
-	 * outside Ajax response.
-	 */
-	public final void updateTree()
-	{
-		AjaxRequestTarget handler = AjaxRequestTarget.get();
-		if (handler == null)
-		{
-			throw new WicketRuntimeException(
-				"No AjaxRequestTarget available to execute updateTree(ART target)");
-		}
-
-		updateTree(handler);
-	}
-
-	/**
-	 * Updates the changed portions of the tree using given AjaxRequestTarget. Call this method if
-	 * you modified the tree model during an ajax request target and you want to partially update
-	 * 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
-	 */
-	public final void updateTree(final AjaxRequestTarget target)
-	{
-		Args.notNull(target, "target");
-		target.registerRespondListener(this);
-	}
-
-	/**
-	 * Returns whether the given node is expanded.
-	 * 
-	 * @param node
-	 *            The node to inspect
-	 * @return true if the node is expanded, false otherwise
-	 */
-	protected final boolean isNodeExpanded(Object node)
-	{
-		// In root less mode the root node is always expanded
-		if (isRootLess() && rootItem != null && rootItem.getModelObject().equals(node))
-		{
-			return true;
-		}
-
-		return getTreeState().isNodeExpanded(node);
-	}
-
-	/**
-	 * 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()
-	{
-		return new DefaultTreeState();
-	}
-
-	/**
-	 * Called after the rendering of tree is complete. Here we clear the dirty flags.
-	 */
-	@Override
-	protected void onAfterRender()
-	{
-		super.onAfterRender();
-		// rendering is complete, clear all dirty flags and items
-		updated();
-	}
-
-	/**
-	 * 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)
-	 */
-	protected abstract void populateTreeItem(WebMarkupContainer item, int level);
-
-	/**
-	 * 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
-	 */
-	private void buildItemChildren(TreeItem item)
-	{
-		List<TreeItem> items;
-
-		// if the node is expanded
-		if (isNodeExpanded(item.getModelObject()))
-		{
-			// build the items for children of the items' treenode.
-			items = buildTreeItems(item, nodeChildren(item.getModelObject()), item.getLevel() + 1);
-		}
-		else
-		{
-			// it's not expanded, just set children to an empty list
-			items = new ArrayList<TreeItem>(0);
-		}
-
-		item.setChildren(items);
-	}
-
-	/**
-	 * Builds (recursively) TreeItems for the given Iterator of TreeNodes.
-	 * 
-	 * @param parent
-	 * @param nodes
-	 *            The nodes to build tree items for
-	 * @param level
-	 *            The current level
-	 * @return List with new tree items
-	 */
-	private List<TreeItem> buildTreeItems(TreeItem parent, Iterator<Object> nodes, int level)
-	{
-		List<TreeItem> result = new ArrayList<TreeItem>();
-
-		// for each node
-		while (nodes.hasNext())
-		{
-			Object node = nodes.next();
-			// create tree item
-			TreeItem item = newTreeItem(parent, node, level);
-			itemContainer.add(item);
-
-			// builds it children (recursively)
-			buildItemChildren(item);
-
-			// add item to result
-			result.add(item);
-		}
-
-		return result;
-	}
-
-	/**
-	 * Checks whether the model has been changed, and if so unregister and register listeners.
-	 */
-	private void checkModel()
-	{
-		// find out whether the model object (the TreeModel) has been changed
-		TreeModel model = getModelObject();
-		if (model != previousModel)
-		{
-			if (previousModel != null)
-			{
-				previousModel.removeTreeModelListener(this);
-			}
-
-			previousModel = model;
-
-			if (model != null)
-			{
-				model.addTreeModelListener(this);
-			}
-			// model has been changed, redraw whole tree
-			invalidateAll();
-		}
-	}
-
-	/**
-	 * Removes all TreeItem components.
-	 */
-	private void clearAllItem()
-	{
-		visitItemAndChildren(rootItem, new IItemCallback()
-		{
-			@Override
-			public void visitItem(TreeItem item)
-			{
-				item.remove();
-			}
-		});
-		rootItem = null;
-	}
-
-	/**
-	 * Returns the javascript used to delete removed elements.
-	 * 
-	 * @return The javascript
-	 */
-	private String getElementsDeleteJavaScript()
-	{
-		// build the javascript call
-		final AppendingStringBuffer buffer = new AppendingStringBuffer(100);
-
-		buffer.append("Wicket.Tree.removeNodes(\"");
-
-		// first parameter is the markup id of tree (will be used as prefix to
-		// build ids of child items
-		buffer.append(getMarkupId() + "_\",[");
-
-		// append the ids of elements to be deleted
-		buffer.append(deleteIds);
-
-		// does the buffer end if ','?
-		if (buffer.endsWith(","))
-		{
-			// it does, trim it
-			buffer.setLength(buffer.length() - 1);
-		}
-
-		buffer.append("]);");
-
-		return buffer.toString();
-	}
-
-	//
-	// State and Model callbacks
-	//
-
-	/**
-	 * returns the short version of item id (just the number part).
-	 * 
-	 * @param item
-	 *            The tree item
-	 * @return The id
-	 */
-	private String getShortItemId(TreeItem item)
-	{
-		// show much of component id can we skip? (to minimize the length of
-		// javascript being sent)
-		final int skip = getMarkupId().length() + 1; // the length of id of
-		// tree and '_'.
-		return item.getMarkupId().substring(skip);
-	}
-
-	private final static ResourceReference JAVASCRIPT = new JavaScriptResourceReference(
-		AbstractTree.class, "res/tree.js");
-
-	/**
-	 * Initialize the component.
-	 */
-	private void init()
-	{
-		setVersioned(false);
-
-		// we need id when we are replacing the whole tree
-		setOutputMarkupId(true);
-
-		// create container for tree items
-		itemContainer = new TreeItemContainer("i");
-		add(itemContainer);
-
-		checkModel();
-	}
-
-	/**
-	 * INTERNAL
-	 * 
-	 * @param node
-	 */
-	public final void markNodeDirty(Object node)
-	{
-		invalidateNode(node, false);
-	}
-
-	/**
-	 * INTERNAL
-	 * 
-	 * @param node
-	 */
-	public final void markNodeChildrenDirty(Object node)
-	{
-		TreeItem item = nodeToItemMap.get(node);
-		if (item != null)
-		{
-			visitItemChildren(item, new IItemCallback()
-			{
-				@Override
-				public void visitItem(TreeItem item)
-				{
-					invalidateNode(item.getModelObject(), false);
-				}
-			});
-		}
-	}
-
-	/**
-	 * 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
-	 */
-	private void invalidateNode(Object node, boolean forceRebuild)
-	{
-		if (dirtyAll == false)
-		{
-			// get item for this node
-			TreeItem item = nodeToItemMap.get(node);
-
-			if (item != null)
-			{
-				boolean createDOM = false;
-
-				if (forceRebuild)
-				{
-					// recreate the item
-					int level = item.getLevel();
-					List<TreeItem> children = item.getChildren();
-					String id = item.getId();
-
-					// store the parent of old item
-					TreeItem parent = item.getParentItem();
-
-					// if the old item has a parent, store it's index
-					int index = parent != null ? parent.getChildren().indexOf(item) : -1;
-
-					createDOM = dirtyItemsCreateDOM.contains(item);
-
-					dirtyItems.remove(item);
-					dirtyItemsCreateDOM.remove(item);
-
-					item.remove();
-
-					item = newTreeItem(parent, node, level, id);
-					itemContainer.add(item);
-
-					item.setChildren(children);
-
-					// was the item an root item?
-					if (parent == null)
-					{
-						rootItem = item;
-					}
-					else
-					{
-						parent.getChildren().set(index, item);
-					}
-				}
-
-				if (!dirtyItems.contains(item))
-				{
-					dirtyItems.add(item);
-				}
-
-				if (createDOM && !dirtyItemsCreateDOM.contains(item))
-				{
-					dirtyItemsCreateDOM.add(item);
-				}
-			}
-		}
-	}
-
-	/**
-	 * 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
-	 */
-	private void invalidateNodeWithChildren(Object node)
-	{
-		if (dirtyAll == false)
-		{
-			// get item for this node
-			TreeItem item = nodeToItemMap.get(node);
-
-			// is the item visible?
-			if (item != null)
-			{
-				// go though item children and remove every one of them
-				visitItemChildren(item, new IItemCallback()
-				{
-					@Override
-					public void visitItem(TreeItem item)
-					{
-						removeItem(item);
-					}
-				});
-
-				// set children to null so that they get rebuild
-				item.setChildren(null);
-
-				if (!dirtyItems.contains(item))
-				{
-					// add item to dirty items
-					dirtyItems.add(item);
-				}
-			}
-		}
-	}
-
-	/**
-	 * 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
-	 */
-	private boolean isNodeVisible(Object node)
-	{
-		if (node == null)
-		{
-			return false;
-		}
-		Object parent = getParentNode(node);
-		while (parent != null)
-		{
-			if (isNodeExpanded(parent) == false)
-			{
-				return false;
-			}
-			parent = getParentNode(parent);
-		}
-		return true;
-	}
-
-	/**
-	 * Returns parent node of given node.
-	 * 
-	 * @param node
-	 * @return parent node
-	 */
-	public Object getParentNode(Object node)
-	{
-		TreeItem item = nodeToItemMap.get(node);
-		if (item == null)
-		{
-			return null;
-		}
-		else
-		{
-			TreeItem parent = item.getParentItem();
-			return parent == null ? null : parent.getModelObject();
-		}
-	}
-
-	/**
-	 * Creates a tree item for given node.
-	 * 
-	 * @param parent
-	 * @param node
-	 *            The tree node
-	 * @param level
-	 *            The level *
-	 * @return The new tree item
-	 */
-	private TreeItem newTreeItem(TreeItem parent, Object node, int level)
-	{
-		return new TreeItem(parent, "" + idCounter++, node, level);
-	}
-
-	/**
-	 * Creates a tree item for given node with specified id.
-	 * 
-	 * @param parent
-	 * @param node
-	 *            The tree node
-	 * @param level
-	 *            The level
-	 * @param id
-	 *            the component id
-	 * @return The new tree item
-	 */
-	private TreeItem newTreeItem(TreeItem parent, Object node, int level, String id)
-	{
-		return new TreeItem(parent, id, node, level);
-	}
-
-	/**
-	 * Return the representation of node children as Iterator interface.
-	 * 
-	 * @param node
-	 *            The tree node
-	 * @return iterable presentation of node children
-	 */
-	public final Iterator<Object> nodeChildren(Object node)
-	{
-		TreeModel model = getTreeModel();
-		int count = model.getChildCount(node);
-		List<Object> nodes = new ArrayList<Object>(count);
-		for (int i = 0; i < count; ++i)
-		{
-			nodes.add(model.getChild(node, i));
-		}
-		return nodes.iterator();
-	}
-
-	/**
-	 * @param parent
-	 * @param index
-	 * @return child
-	 */
-	public final Object getChildAt(Object parent, int index)
-	{
-		return getTreeModel().getChild(parent, index);
-	}
-
-	/**
-	 * 
-	 * @param node
-	 * @return boolean
-	 */
-	public final boolean isLeaf(Object node)
-	{
-		return getTreeModel().isLeaf(node);
-	}
-
-	/**
-	 * @param parent
-	 * @return child count
-	 */
-	public final int getChildCount(Object parent)
-	{
-		return getTreeModel().getChildCount(parent);
-	}
-
-	private TreeModel getTreeModel()
-	{
-		return getModelObject();
-	}
-
-	/**
-	 * Rebuilds children of every item in dirtyItems that needs it. This method is called for
-	 * non-partial update.
-	 */
-	private void rebuildDirty()
-	{
-		// go through dirty items
-		for (TreeItem item : dirtyItems)
-		{
-			// item children need to be rebuilt
-			if (item.getChildren() == null)
-			{
-				buildItemChildren(item);
-			}
-		}
-	}
-
-	/**
-	 * 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
-	 */
-	private void removeItem(TreeItem item)
-	{
-		// even if the item is dirty it's no longer necessary to update id
-		dirtyItems.remove(item);
-
-		// if the item was about to be created
-		if (dirtyItemsCreateDOM.contains(item))
-		{
-			// we needed to create DOM element, we no longer do
-			dirtyItemsCreateDOM.remove(item);
-		}
-		else
-		{
-			// add items id (it's short version) to ids of DOM elements that
-			// will be
-			// removed
-			deleteIds.append(getShortItemId(item));
-			deleteIds.append(",");
-		}
-
-		if (item.getParent() != null)
-		{
-			// remove the id
-			// note that this doesn't update item's parent's children list
-			item.remove();
-		}
-	}
-
-	/**
-	 * Calls after the tree has been rendered. Clears all dirty flags.
-	 */
-	private void updated()
-	{
-		dirtyAll = false;
-		dirtyItems.clear();
-		dirtyItemsCreateDOM.clear();
-		deleteIds.clear(); // FIXME: Recreate it to save some space?
-	}
-
-	/**
-	 * Call the callback#visitItem method for the given item and all it's children.
-	 * 
-	 * @param item
-	 *            The tree item
-	 * @param callback
-	 *            item call back
-	 */
-	private void visitItemAndChildren(TreeItem item, IItemCallback callback)
-	{
-		callback.visitItem(item);
-		visitItemChildren(item, callback);
-	}
-
-	/**
-	 * Call the callback#visitItem method for every child of given item.
-	 * 
-	 * @param item
-	 *            The tree item
-	 * @param callback
-	 *            The callback
-	 */
-	private void visitItemChildren(TreeItem item, IItemCallback callback)
-	{
-		if (item.getChildren() != null)
-		{
-			for (TreeItem child : item.getChildren())
-			{
-				visitItemAndChildren(child, callback);
-			}
-		}
-	}
-
-	/**
-	 * 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.
-	 */
-	public Component getNodeComponent(Object node)
-	{
-		return nodeToItemMap.get(node);
-	}
-
-	@Override
-	public void renderHead(IHeaderResponse response)
-	{
-		response.render(JavaScriptHeaderItem.forReference(JAVASCRIPT));
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.html b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.html
deleted file mode 100644
index a123a26..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<wicket:panel xmlns:wicket="http://wicket.apache.org">
-<table wicket:id="i" class="wicket-tree-content"><tr>
-<a wicket:id="junctionLink"></a>
-<td wicket:id="nodeComponent"></td>
-</tr></table>
-</wicket:panel>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.java
deleted file mode 100644
index ba2f3fa..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/BaseTree.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import javax.swing.tree.TreeModel;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.IClusterable;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.IAjaxLink;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.Response;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-import org.apache.wicket.markup.head.CssHeaderItem;
-import org.apache.wicket.util.string.Strings;
-
-/**
- * An abstract Tree component that should serve as a base for custom Tree Components.
- * 
- * It has one abstract method - {@link #newNodeComponent(String, IModel)} that needs to be
- * overridden.
- * 
- * @author Matej Knopp
- */
-public abstract class BaseTree extends AbstractTree
-{
-	/**
-	 * Construct.
-	 * 
-	 * @param id
-	 */
-	public BaseTree(String id)
-	{
-		this(id, null);
-	}
-
-	/**
-	 * Construct.
-	 * 
-	 * @param id
-	 * @param model
-	 */
-	public BaseTree(String id, IModel<? extends TreeModel> model)
-	{
-		super(id, model);
-	}
-
-	// default stylesheet resource
-	private static final ResourceReference CSS = new PackageResourceReference(BaseTree.class,
-		"res/base-tree.css");
-
-	/**
-	 * Returns the stylesheet reference
-	 * 
-	 * @return stylesheet reference
-	 */
-	protected ResourceReference getCSS()
-	{
-		return CSS;
-	}
-
-	private static final long serialVersionUID = 1L;
-
-	private static final String JUNCTION_LINK_ID = "junctionLink";
-	private static final String NODE_COMPONENT_ID = "nodeComponent";
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.AbstractTree#populateTreeItem(org.apache.wicket.markup.html.WebMarkupContainer,
-	 *      int)
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	protected void populateTreeItem(WebMarkupContainer item, int level)
-	{
-		// add junction link
-		Object node = item.getDefaultModelObject();
-		Component junctionLink = newJunctionLink(item, JUNCTION_LINK_ID, node);
-		junctionLink.add(new JunctionBorder(node, level));
-		item.add(junctionLink);
-
-		// add node component
-		Component nodeComponent = newNodeComponent(NODE_COMPONENT_ID,
-			(IModel<Object>)item.getDefaultModel());
-		item.add(nodeComponent);
-
-		// add behavior that conditionally adds the "selected" CSS class name
-		item.add(new Behavior()
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onComponentTag(Component component, ComponentTag tag)
-			{
-				Object node = component.getDefaultModelObject();
-				String klass = getItemClass(node);
-				if (!Strings.isEmpty(klass))
-				{
-					CharSequence oldClass = tag.getAttribute("class");
-					if (Strings.isEmpty(oldClass))
-					{
-						tag.put("class", klass);
-					}
-					else
-					{
-						tag.put("class", oldClass + " " + klass);
-					}
-				}
-			}
-		});
-	}
-
-	protected String getItemClass(Object node)
-	{
-		if (getTreeState().isNodeSelected(node))
-		{
-			return getSelectedClass();
-		}
-		else
-		{
-			return null;
-		}
-	}
-
-	/**
-	 * Returns the class name that will be added to row's CSS class for selected rows
-	 * 
-	 * @return CSS class name
-	 */
-	protected String getSelectedClass()
-	{
-		return "selected";
-	}
-
-	/**
-	 * Creates a new component for the given TreeNode.
-	 * 
-	 * @param id
-	 *            component ID
-	 * @param model
-	 *            model that returns the node
-	 * @return component for node
-	 */
-	protected abstract Component newNodeComponent(String id, IModel<Object> model);
-
-	/**
-	 * Returns whether the provided node is last child of it's parent.
-	 * 
-	 * @param node
-	 *            The node
-	 * @return whether the provided node is the last child
-	 */
-	private boolean isNodeLast(Object node)
-	{
-		Object parent = getParentNode(node);
-		if (parent == null)
-		{
-			return true;
-		}
-		else
-		{
-			return getChildAt(parent, getChildCount(parent) - 1).equals(node);
-		}
-	}
-
-	/**
-	 * Class that wraps a link (or span) with a junction table cells.
-	 * 
-	 * @author Matej Knopp
-	 */
-	private class JunctionBorder extends Behavior
-	{
-		private static final long serialVersionUID = 1L;
-
-		// TODO this field is not serializable but nested inside an serializable component
-		private final Object node;
-		private final int level;
-
-		/**
-		 * Construct.
-		 * 
-		 * @param node
-		 * @param level
-		 */
-		public JunctionBorder(Object node, int level)
-		{
-			this.node = node;
-			this.level = level;
-		}
-
-		/**
-		 * @see org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component)
-		 */
-		@Override
-		public void afterRender(final Component component)
-		{
-			component.getResponse().write("</td>");
-		}
-
-		/**
-		 * @see org.apache.wicket.behavior.Behavior#beforeRender(org.apache.wicket.Component)
-		 */
-		@Override
-		public void beforeRender(final Component component)
-		{
-			Response response = component.getResponse();
-			Object parent = getParentNode(node);
-
-			CharSequence classes[] = new CharSequence[level];
-			for (int i = 0; i < level; ++i)
-			{
-				if (parent == null || isNodeLast(parent))
-				{
-					classes[i] = "spacer";
-				}
-				else
-				{
-					classes[i] = "line";
-				}
-
-				parent = getParentNode(parent);
-			}
-
-			for (int i = level - 1; i >= 0; --i)
-			{
-				response.write("<td class=\"" + classes[i] + "\"><span></span></td>");
-			}
-
-			if (isNodeLast(node))
-			{
-				response.write("<td class=\"half-line\">");
-			}
-			else
-			{
-				response.write("<td class=\"line\">");
-			}
-		}
-	}
-
-	/**
-	 * Creates the junction link for given node. Also (optionally) creates the junction image. If
-	 * the node is a leaf (it has no children), the created junction link is non-functional.
-	 * 
-	 * @param parent
-	 *            parent component of the link
-	 * @param id
-	 *            wicket:id of the component
-	 * @param node
-	 *            tree node for which the link should be created.
-	 * @return The link component
-	 */
-	protected Component newJunctionLink(MarkupContainer parent, final String id, final Object node)
-	{
-		final MarkupContainer junctionLink;
-
-		if (isLeaf(node) == false)
-		{
-			junctionLink = newLink(id, new ILinkCallback()
-			{
-				private static final long serialVersionUID = 1L;
-
-				@Override
-				public void onClick(AjaxRequestTarget target)
-				{
-					if (isNodeExpanded(node))
-					{
-						getTreeState().collapseNode(node);
-					}
-					else
-					{
-						getTreeState().expandNode(node);
-					}
-					onJunctionLinkClicked(target, node);
-
-					if (target != null)
-					{
-						updateTree(target);
-					}
-				}
-			});
-			junctionLink.add(new Behavior()
-			{
-				private static final long serialVersionUID = 1L;
-
-				@Override
-				public void onComponentTag(Component component, ComponentTag tag)
-				{
-					if (isNodeExpanded(node))
-					{
-						tag.put("class", "junction-open");
-					}
-					else
-					{
-						tag.put("class", "junction-closed");
-					}
-				}
-			});
-		}
-		else
-		{
-			junctionLink = new WebMarkupContainer(id)
-			{
-				private static final long serialVersionUID = 1L;
-
-				/**
-				 * @see org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
-				 */
-				@Override
-				protected void onComponentTag(ComponentTag tag)
-				{
-					super.onComponentTag(tag);
-					tag.setName("span");
-					tag.put("class", "junction-corner");
-				}
-			};
-
-		}
-
-		return junctionLink;
-	}
-
-	/**
-	 * Callback function called after user clicked on an junction link. The node has already been
-	 * expanded/collapsed (depending on previous status).
-	 * 
-	 * @param target
-	 *            Request target - may be null on non-ajax call
-	 * 
-	 * @param node
-	 *            Node for which this callback is relevant
-	 */
-	protected void onJunctionLinkClicked(AjaxRequestTarget target, Object node)
-	{
-	}
-
-	/**
-	 * Helper class for calling an action from a link.
-	 * 
-	 * @author Matej Knopp
-	 */
-	public interface ILinkCallback extends IAjaxLink, IClusterable
-	{
-	}
-
-	/**
-	 * Creates a link of type specified by current linkType. When the links is clicked it calls the
-	 * specified callback.
-	 * 
-	 * @param id
-	 *            The component id
-	 * @param callback
-	 *            The link call back. {@code null} is passed for its onClick(AjaxRequestTarget) for
-	 *            {@link LinkType#REGULAR} and eventually for {@link LinkType#AJAX_FALLBACK}.
-	 * @return The link component
-	 */
-	public MarkupContainer newLink(String id, final ILinkCallback callback)
-	{
-		if (getLinkType() == LinkType.REGULAR)
-		{
-			return new Link<Void>(id)
-			{
-				private static final long serialVersionUID = 1L;
-
-				/**
-				 * @see org.apache.wicket.markup.html.link.Link#onClick()
-				 */
-				@Override
-				public void onClick()
-				{
-					callback.onClick(null);
-				}
-			};
-		}
-		else if (getLinkType() == LinkType.AJAX)
-		{
-			return new AjaxLink<Void>(id)
-			{
-				private static final long serialVersionUID = 1L;
-
-				/**
-				 * @see org.apache.wicket.ajax.markup.html.AjaxLink#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
-				 */
-				@Override
-				public void onClick(AjaxRequestTarget target)
-				{
-					callback.onClick(target);
-				}
-			};
-		}
-		else
-		{
-			return new AjaxFallbackLink<Void>(id)
-			{
-				private static final long serialVersionUID = 1L;
-
-				/**
-				 * @see org.apache.wicket.ajax.markup.html.AjaxFallbackLink#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
-				 */
-				@Override
-				public void onClick(AjaxRequestTarget target)
-				{
-					callback.onClick(target);
-				}
-			};
-		}
-	}
-
-	/**
-	 * Returns the current type of links on tree items.
-	 * 
-	 * @return The link type
-	 */
-	public LinkType getLinkType()
-	{
-		return linkType;
-	}
-
-	/**
-	 * Sets the type of links on tree items. After the link type is changed, the whole tree must be
-	 * rebuilt (call invalidateAll).
-	 * 
-	 * @param linkType
-	 *            type of links
-	 */
-	public void setLinkType(LinkType linkType)
-	{
-		if (this.linkType != linkType)
-		{
-			this.linkType = linkType;
-		}
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.AbstractTree#isForceRebuildOnSelectionChange()
-	 */
-	@Override
-	protected boolean isForceRebuildOnSelectionChange()
-	{
-		return false;
-	}
-
-	@Override
-	public void renderHead(IHeaderResponse response)
-	{
-		super.renderHead(response);
-		ResourceReference css = getCSS();
-		if (css != null)
-		{
-			response.render(CssHeaderItem.forReference(css));
-		}
-
-	}
-
-	private LinkType linkType = LinkType.AJAX;
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/DefaultTreeState.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/DefaultTreeState.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/DefaultTreeState.java
deleted file mode 100644
index 17ef6d7..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/DefaultTreeState.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.wicket.IClusterable;
-import org.apache.wicket.model.IDetachable;
-
-/**
- * Default implementation of TreeState.
- * <p>
- * This implementation tries to be as lightweight as possible. By default all nodes are collapsed.
- * 
- * @author Matej Knopp
- */
-public class DefaultTreeState implements ITreeState, IClusterable, IDetachable
-{
-	private static final long serialVersionUID = 1L;
-
-	/** Whether multiple selections can be done. */
-	private boolean allowSelectMultiple = false;
-
-	/** Tree state listeners. */
-	private final List<ITreeStateListener> listeners = new ArrayList<ITreeStateListener>(1);
-
-	/**
-	 * set of nodes which are collapsed or expanded (depends on nodesCollapsed variable).
-	 */
-	private final Set<Object> nodes = new HashSet<Object>();
-
-	/** Whether the nodes set should be treated as set of collapsed or expanded nodes. */
-	private boolean nodesCollapsed = false; // by default treat the node set as expanded nodes
-
-	/** Set selected nodes. */
-	private final Set<Object> selectedNodes = new HashSet<Object>();
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#addTreeStateListener(org.apache.wicket.markup.html.tree.ITreeStateListener)
-	 */
-	@Override
-	public void addTreeStateListener(ITreeStateListener l)
-	{
-		if (listeners.contains(l) == false)
-		{
-			listeners.add(l);
-		}
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#collapseAll()
-	 */
-	@Override
-	public void collapseAll()
-	{
-		if (nodes.isEmpty() && nodesCollapsed == false)
-		{
-			// all nodes are already collapsed, do nothing
-		}
-		else
-		{
-			// clear all nodes from the set and sets the nodes as expanded
-			nodes.clear();
-			nodesCollapsed = false;
-
-			for (ITreeStateListener listener : listeners)
-				listener.allNodesCollapsed();
-		}
-	}
-
-	@Override
-	public void collapseNode(Object node)
-	{
-		if (nodesCollapsed == true)
-		{
-			nodes.add(node);
-		}
-		else
-		{
-			nodes.remove(node);
-		}
-
-		for (ITreeStateListener listener : listeners)
-			listener.nodeCollapsed(node);
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#expandAll()
-	 */
-	@Override
-	public void expandAll()
-	{
-		if (nodes.isEmpty() && nodesCollapsed == true)
-		{
-			// all nodes are already expanded, do nothing
-		}
-		else
-		{
-			// clear node set and set nodes policy as collapsed
-			nodes.clear();
-			nodesCollapsed = true;
-
-			for (ITreeStateListener listener : listeners)
-				listener.allNodesExpanded();
-		}
-	}
-
-	@Override
-	public void expandNode(Object node)
-	{
-		if (nodesCollapsed == false)
-		{
-			nodes.add(node);
-		}
-		else
-		{
-			nodes.remove(node);
-		}
-
-		for (ITreeStateListener listener : listeners)
-			listener.nodeExpanded(node);
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#getSelectedNodes()
-	 */
-	@Override
-	public Collection<Object> getSelectedNodes()
-	{
-		return Collections.unmodifiableList(new ArrayList<Object>(selectedNodes));
-	}
-
-	protected void removeSelectedNodeSilent(Object node)
-	{
-		selectedNodes.remove(node);
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#isAllowSelectMultiple()
-	 */
-	@Override
-	public boolean isAllowSelectMultiple()
-	{
-		return allowSelectMultiple;
-	}
-
-	@Override
-	public boolean isNodeExpanded(Object node)
-	{
-		if (nodesCollapsed == false)
-		{
-			return nodes.contains(node);
-		}
-		else
-		{
-			return nodes.contains(node) == false;
-		}
-	}
-
-	@Override
-	public boolean isNodeSelected(Object node)
-	{
-		return selectedNodes.contains(node);
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#removeTreeStateListener(org.apache.wicket.markup.html.tree.ITreeStateListener)
-	 */
-	@Override
-	public void removeTreeStateListener(ITreeStateListener l)
-	{
-		listeners.remove(l);
-	}
-
-
-	/**
-	 * If <code>node</code> is currently selected, it will be deselected and the
-	 * <code>nodeUnselected</code> method will be called on all registered
-	 * <code>ITreeStateListeners</code>.
-	 * 
-	 * @param node
-	 *            the node to be deselected
-	 */
-	private void deselectNode(Object node)
-	{
-		if (selectedNodes.remove(node))
-		{
-			for (ITreeStateListener listener : listeners.toArray(new ITreeStateListener[listeners.size()]))
-			{
-				listener.nodeUnselected(node);
-			}
-		}
-	}
-
-	/**
-	 * Selects <code>node</code> and calls the <code>nodeSelected</code> method on all registered
-	 * <code>ITreeStateListeners</code>. If <code>isAllowSelectMultiple</code> is <code>false</code>
-	 * , any currently selected nodes are deselected.
-	 * 
-	 * @param node
-	 *            the node to be selected
-	 */
-	private void selectNode(Object node)
-	{
-		// if multiple selections are not allowed, deselect current selections
-		if (selectedNodes.size() > 0 && !isAllowSelectMultiple())
-		{
-			for (Object currentlySelectedNode : selectedNodes.toArray())
-			{
-				if (!currentlySelectedNode.equals(node))
-				{
-					deselectNode(currentlySelectedNode);
-				}
-			}
-		}
-
-		if (!selectedNodes.contains(node))
-		{
-			selectedNodes.add(node);
-			for (ITreeStateListener listener : listeners.toArray(new ITreeStateListener[listeners.size()]))
-			{
-				listener.nodeSelected(node);
-			}
-		}
-	}
-
-	/**
-	 * Selects or deselects <code>node</code> and calls the corresponding method on all registered
-	 * <code>ITreeStateListeners</code>. If <code>isAllowSelectMultiple</code> is <code>false</code>
-	 * , any currently selected nodes are deselected.
-	 * 
-	 * @param node
-	 *            the node to be selected
-	 * @param selected
-	 *            true if node is to be selected, false if node is to be deselected
-	 */
-	@Override
-	public void selectNode(Object node, boolean selected)
-	{
-		if (selected)
-		{
-			selectNode(node);
-		}
-		else
-		{
-			deselectNode(node);
-		}
-	}
-
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.ITreeState#setAllowSelectMultiple(boolean)
-	 */
-	@Override
-	public void setAllowSelectMultiple(boolean value)
-	{
-		allowSelectMultiple = value;
-	}
-
-	@Override
-	public void detach()
-	{
-		for (Object node : nodes)
-		{
-			if (node instanceof IDetachable)
-			{
-				((IDetachable)node).detach();
-			}
-		}
-		for (Object node : selectedNodes)
-		{
-			if (node instanceof IDetachable)
-			{
-				((IDetachable)node).detach();
-			}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeState.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeState.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeState.java
deleted file mode 100644
index df3b557..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeState.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-/**
- * Tree state holds information about a tree such as which nodes are expanded / collapsed and which
- * nodes are selected, It can also fire callbacks on listener in case any of the information
- * changed.
- * 
- * @author Matej Knopp
- */
-public interface ITreeState extends Serializable
-{
-	/**
-	 * Adds a tree state listener. On state change events on the listener are fired.
-	 * 
-	 * @param l
-	 *            Listener to add
-	 */
-	void addTreeStateListener(ITreeStateListener l);
-
-	/**
-	 * Collapses all nodes of the tree.
-	 */
-	void collapseAll();
-
-	/**
-	 * Collapses the given node.
-	 * 
-	 * @param node
-	 *            Node to collapse
-	 */
-	void collapseNode(Object node);
-
-	/**
-	 * Expands all nodes of the tree.
-	 */
-	void expandAll();
-
-	/**
-	 * Expands the given node.
-	 * 
-	 * @param node
-	 *            Node to expand
-	 */
-	void expandNode(Object node);
-
-	/**
-	 * Returns the collection of all selected nodes.
-	 * 
-	 * @return The collection of selected nodes
-	 */
-	Collection<Object> getSelectedNodes();
-
-	/**
-	 * Returns whether multiple nodes can be selected.
-	 * 
-	 * @return True if multiple nodes can be selected
-	 */
-	boolean isAllowSelectMultiple();
-
-	/**
-	 * Returns true if the given node is expanded.
-	 * 
-	 * @param node
-	 *            The node to inspect
-	 * @return True if the node is expanded
-	 */
-	boolean isNodeExpanded(Object node);
-
-	/**
-	 * Returns true if the given node is selected, false otherwise.
-	 * 
-	 * @param node
-	 *            The node to inspect
-	 * @return True if the node is selected
-	 */
-	boolean isNodeSelected(Object node);
-
-	/**
-	 * Removes a tree state listener.
-	 * 
-	 * @param l
-	 *            The listener to remove
-	 */
-	void removeTreeStateListener(ITreeStateListener l);
-
-
-	/**
-	 * Marks given node as selected (or unselected) according to the selected value.
-	 * <p>
-	 * If tree is in single selection mode and a new node is selected, old node is automatically
-	 * unselected (and the event is fired on listeners).
-	 * 
-	 * @param node
-	 *            The node to select or deselect
-	 * @param selected
-	 *            If true, the node will be selected, otherwise, the node will be unselected
-	 */
-	void selectNode(Object node, boolean selected);
-
-	/**
-	 * Sets whether multiple nodes can be selected.
-	 * 
-	 * @param value
-	 *            If true, multiple nodes can be selected. If false, only one node at a time can be
-	 *            selected
-	 */
-	void setAllowSelectMultiple(boolean value);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeStateListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeStateListener.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeStateListener.java
deleted file mode 100644
index 061a166..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/ITreeStateListener.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import java.io.Serializable;
-
-/**
- * Methods this interface are called when tree state is changing.
- * 
- * @author Matej Knopp
- */
-public interface ITreeStateListener extends Serializable
-{
-	/**
-	 * Fired when all nodes are collapsed.
-	 */
-	void allNodesCollapsed();
-
-	/**
-	 * Fired when all nodes are expanded.
-	 */
-	void allNodesExpanded();
-
-	/**
-	 * Fired when given node is collapsed.
-	 * 
-	 * @param node
-	 *            The node that was collapsed
-	 */
-	void nodeCollapsed(Object node);
-
-	/**
-	 * Fired when given node is expanded.
-	 * 
-	 * @param node
-	 */
-	void nodeExpanded(Object node);
-
-	/**
-	 * Fired when given node gets selected.
-	 * 
-	 * @param node
-	 *            The node that was selected
-	 */
-	void nodeSelected(Object node);
-
-	/**
-	 * Fired when given node gets unselected.
-	 * 
-	 * @param node
-	 *            The node that was unselected
-	 */
-	void nodeUnselected(Object node);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.html b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.html
deleted file mode 100644
index 2c10b30..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<wicket:panel xmlns:wicket="http://wicket.apache.org">
-<table class="icon-panel"><tr><td><img wicket:id="icon" /></td><td wicket:id="content" class="content"></td></tr></table>
-</wicket:panel>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.java
deleted file mode 100644
index 166d26a..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelIconPanel.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import javax.swing.tree.TreeModel;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.image.Image;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-
-/**
- * Simple panel that contains an icon next to a label.
- * 
- * @author Matej Knopp
- */
-public class LabelIconPanel extends Panel
-{
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * Constructs the panel.
-	 * 
-	 * @param id
-	 *            component id
-	 * @param model
-	 *            model that is used to access the TreeNode
-	 * @param tree
-	 */
-	public LabelIconPanel(String id, IModel<Object> model, BaseTree tree)
-	{
-		super(id, model);
-
-		addComponents(model, tree);
-	}
-
-	/**
-	 * Adds the icon and content components to the panel. You can override this method if you want
-	 * custom components to be added
-	 * 
-	 * @param model
-	 *            model that can be used to retrieve the TreeNode
-	 * 
-	 * @param tree
-	 */
-	protected void addComponents(IModel<Object> model, BaseTree tree)
-	{
-		add(newImageComponent("icon", tree, model));
-		add(newContentComponent("content", tree, model));
-	}
-
-	/**
-	 * Creates the icon component for the node
-	 * 
-	 * @param componentId
-	 * @param tree
-	 * @param model
-	 * @return icon image component
-	 */
-	protected Component newImageComponent(String componentId, final BaseTree tree,
-		final IModel<Object> model)
-	{
-		return new Image(componentId)
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			protected ResourceReference getImageResourceReference()
-			{
-				return LabelIconPanel.this.getImageResourceReference(tree, model.getObject());
-			}
-
-			@Override
-			protected boolean shouldAddAntiCacheParameter()
-			{
-				return false;
-			}
-		};
-	}
-
-	/**
-	 * Creates the content component (label in this case) for the node
-	 * 
-	 * @param componentId
-	 * @param tree
-	 * @param model
-	 * @return content component
-	 */
-	protected Component newContentComponent(String componentId, BaseTree tree, IModel<?> model)
-	{
-		return new Label(componentId, model);
-	}
-
-	/**
-	 * Returns the image resource reference based on the give tree node type.
-	 * 
-	 * @param tree
-	 * @param node
-	 * @return image resource reference
-	 */
-	protected ResourceReference getImageResourceReference(BaseTree tree, Object node)
-	{
-		TreeModel model = (TreeModel)tree.getDefaultModelObject();
-		if (model.isLeaf(node))
-		{
-			return getResourceItemLeaf(node);
-		}
-		else
-		{
-			if (tree.getTreeState().isNodeExpanded(node))
-			{
-				return getResourceFolderOpen(node);
-			}
-			else
-			{
-				return getResourceFolderClosed(node);
-			}
-		}
-	}
-
-	/**
-	 * Optional method for wrapping (creating an intermediate model) for the tree node model
-	 * 
-	 * @param nodeModel
-	 * @return wrapped model
-	 */
-	protected IModel<Object> wrapNodeModel(IModel<Object> nodeModel)
-	{
-		return nodeModel;
-	}
-
-	/**
-	 * Returns resource reference for closed folder icon.
-	 * 
-	 * @param node
-	 * @return resource reference
-	 */
-	protected ResourceReference getResourceFolderClosed(Object node)
-	{
-		return RESOURCE_FOLDER_CLOSED;
-	}
-
-	/**
-	 * Returns resource reference for open folder icon.
-	 * 
-	 * @param node
-	 * @return resource reference
-	 */
-	protected ResourceReference getResourceFolderOpen(Object node)
-	{
-		return RESOURCE_FOLDER_OPEN;
-	}
-
-	/**
-	 * Returns resource reference for a leaf icon.
-	 * 
-	 * @param node
-	 * @return resource reference
-	 */
-	protected ResourceReference getResourceItemLeaf(Object node)
-	{
-		return RESOURCE_ITEM;
-	}
-
-	private static final ResourceReference RESOURCE_FOLDER_OPEN = new PackageResourceReference(
-		LabelIconPanel.class, "res/folder-open.gif");
-	private static final ResourceReference RESOURCE_FOLDER_CLOSED = new PackageResourceReference(
-		LabelIconPanel.class, "res/folder-closed.gif");
-	private static final ResourceReference RESOURCE_ITEM = new PackageResourceReference(
-		LabelIconPanel.class, "res/item.gif");
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelTree.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelTree.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelTree.java
deleted file mode 100644
index 2bf87b4..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LabelTree.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.markup.html.tree;
-
-import javax.swing.tree.TreeModel;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-/**
- * Simple tree component that uses label to render tree node.
- * 
- * @author Matej Knopp
- */
-public class LabelTree extends BaseTree
-{
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * Construct.
-	 * 
-	 * @param id
-	 */
-	public LabelTree(String id)
-	{
-		super(id);
-	}
-
-	/**
-	 * Construct.
-	 * 
-	 * @param id
-	 * @param model
-	 *            model that provides the {@link TreeModel}
-	 */
-	public LabelTree(String id, IModel<? extends TreeModel> model)
-	{
-		super(id, model);
-	}
-
-	/**
-	 * Construct.
-	 * 
-	 * @param id
-	 * @param model
-	 *            Tree model
-	 */
-	public LabelTree(String id, TreeModel model)
-	{
-		super(id, new WicketTreeModel());
-		setModelObject(model);
-	}
-
-	/**
-	 * @see org.apache.wicket.markup.html.tree.BaseTree#newNodeComponent(java.lang.String,
-	 *      org.apache.wicket.model.IModel)
-	 */
-	@Override
-	protected Component newNodeComponent(String id, IModel<Object> model)
-	{
-		return new LabelIconPanel(id, model, this)
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			protected Component newContentComponent(String componentId, BaseTree tree,
-				IModel<?> model)
-			{
-				return super.newContentComponent(componentId, tree, getNodeTextModel(model));
-			}
-		};
-	}
-
-	/**
-	 * Provides the model that will be used to feed the node text.
-	 * 
-	 * Example implementation: <code>return new PropertyModel(nodeModel, "object.name");</code>
-	 * which will translate to <code>YourTreeNodeSubclass.getObject().getName();</code>
-	 * 
-	 * NOTE: remember that the nodeModel represents the TreeNode object, not the model object inside
-	 * it
-	 * 
-	 * NOTE: this method is called from the default implementation of
-	 * {@link #newNodeComponent(String, IModel)}, so if it is subclassed this method may no longer
-	 * be called unless the subclassing code maintains the callback explicitly
-	 * 
-	 * @param nodeModel
-	 *            model representing the current tree node
-	 * @return model used for text
-	 */
-	protected IModel<?> getNodeTextModel(IModel<?> nodeModel)
-	{
-		return nodeModel;
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/567a5932/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LinkIconPanel.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LinkIconPanel.html b/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LinkIconPanel.html
deleted file mode 100644
index a18bbec..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/tree/LinkIconPanel.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<wicket:panel xmlns:wicket="http://wicket.apache.org">
-<table class="icon-panel"><tr><td wicket:id="iconLink"><img wicket:id="icon" class="icon"/></td><td class="content"><a wicket:id="contentLink"><span wicket:id="content" class="content"></span></a></td></tr></table>
-</wicket:panel>
\ No newline at end of file