You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Valentine Wu (JIRA)" <ji...@apache.org> on 2008/11/28 22:50:44 UTC

[jira] Created: (WICKET-1963) Outdated JavaDoc content in MarkupContainer class

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.


[jira] Resolved: (WICKET-1963) Outdated JavaDoc content in MarkupContainer class

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Juergen Donnerstag resolved WICKET-1963.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-RC2

thanks

> 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
>             Fix For: 1.4-RC2
>
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> 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.