Outdated JavaDoc content in MarkupContainer class
-------------------------------------------------
Key: WICKET-1963
URL: https://issues.apache.org/jira/browse/WICKET-1963
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.4
Environment: Windows Environment
Reporter: Valentine Wu
In the JavaDoc of MarkupContainer, the following is not correct:
--------------------------
...Children can be added by calling the add() method, and they can be looked up
using a dotted path. For example, if a container called "a" held a nested
container "b" which held a nested component "c", then a.get("b.c") would return
the Component with id "c". ...
------------------
In the code of MarkupContainer, we use Component.PATH_SEPARATOR, which is ":".
The example in JavaDoc should be updated to
use a.get("b:c") rather than a.get("b.c").
-------------------------------------------------------------
/**
* Get a child component by looking it up with the given path.
*
* @param path
* Path to component
* @return The component at the path
*/
public final Component get(final String path)
{
// Reference to this container
if (path == null || path.trim().equals(""))
{
return this;
}
// Get child's id, if any
final String id = Strings.firstPathComponent(path,
Component.PATH_SEPARATOR);
// Get child by id
Component child = children_get(id);
// If the container is transparent, than ask its parent.
// ParentResolver does something quite similar, but because of
<head>,
// <body>, <wicket:panel> etc. it is quite common to have
transparent
// components. Hence, this is little short cut for a tiny
performance
// optimization.
if ((child == null) && isTransparentResolver() && (getParent()
!= null))
{
child = getParent().get(path);
}
// Found child?
if (child != null)
{
final String path2 =
Strings.afterFirstPathComponent(path, Component.PATH_SEPARATOR);
// Recurse on latter part of path
return child.get(path2);
}
return child;
}
--------------------------------------------------------------
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.