Updated Branches: refs/heads/master 2a17dd012 -> b947aa27c
Cleanup. Fixes in javadoc, log messages. Removal of unused private and package-private methods. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b947aa27 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b947aa27 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b947aa27 Branch: refs/heads/master Commit: b947aa27cd640bb67c6fe8d0450d1056acc9beb4 Parents: 2a17dd0 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Wed Jan 18 08:54:37 2012 +0100 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Wed Jan 18 08:54:37 2012 +0100 ---------------------------------------------------------------------- .../src/main/java/org/apache/wicket/Component.java | 71 +++------------ .../java/org/apache/wicket/MarkupContainer.java | 14 ++-- 2 files changed, 19 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/b947aa27/wicket-core/src/main/java/org/apache/wicket/Component.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java index ef9cc28..7a546d1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java @@ -756,7 +756,7 @@ public abstract class Component { if (log.isDebugEnabled()) { - log.debug("Markup available " + toString()); + log.debug("Markup available {}", toString()); } } @@ -926,13 +926,11 @@ public abstract class Component } /** - * Called on very component after the page is rendered. It will call onAfterRender for it self + * Called on every component after the page is rendered. It will call onAfterRender for it self * and its children. */ public final void afterRender() { - // if the component has been previously attached via attach() - // detach it now try { setFlag(FLAG_AFTER_RENDERING, true); @@ -1154,7 +1152,7 @@ public abstract class Component throw new IllegalStateException(Component.class.getName() + " has not been properly removed from hierachy. Something in the hierarchy of " + getClass().getName() + - " has not called super.onRemovalFromHierarchy() in the override of onRemovalFromHierarchy() method"); + " has not called super.onRemove() in the override of onRemove() method"); } removeChildren(); } @@ -1166,8 +1164,6 @@ public abstract class Component @Override public final void detach() { - // if the component has been previously attached via attach() - // detach it now setFlag(FLAG_DETACHING, true); onDetach(); if (getFlag(FLAG_DETACHING)) @@ -1486,25 +1482,6 @@ public abstract class Component } /** - * Find the Page and get net value from an auto-index - * - * @return autoIndex - */ - private final int nextAutoIndex() - { - Page page = findPage(); - if (page == null) - { - throw new WicketRuntimeException( - "This component is not (yet) coupled to a page. It has to be able " - + "to find the page it is supposed to operate in before you can call " - + "this method (Component#getMarkupId)"); - } - - return page.getAutoIndex(); - } - - /** * Retrieves id by which this component is represented within the markup. This is either the id * attribute set explicitly via a call to {@link #setMarkupId(String)}, id attribute defined in * the markup, or an automatically generated id - in that order. @@ -2371,7 +2348,7 @@ public abstract class Component // Rendering is beginning if (log.isDebugEnabled()) { - log.debug("Begin render " + this); + log.debug("Begin render {}", this); } try @@ -2390,7 +2367,7 @@ public abstract class Component if (log.isDebugEnabled()) { - log.debug("End render " + this); + log.debug("End render {}", this); } } // elem is null when rendering a page @@ -2585,7 +2562,7 @@ public abstract class Component */ private boolean needToRenderTag(final ComponentTag openTag) { - // If a open-close tag has been modified to be open-body-close than a + // If a open-close tag has been modified to be open-body-close then a // synthetic close tag must be rendered. boolean renderTag = (openTag != null && !(openTag instanceof WicketTag)); if (renderTag == false) @@ -2673,7 +2650,7 @@ public abstract class Component { if (log.isDebugEnabled()) { - log.debug("renderHead: " + toString(false)); + log.debug("renderHead: {}", toString(false)); } IHeaderResponse response = container.getHeaderResponse(); @@ -2739,10 +2716,8 @@ public abstract class Component */ public Component replaceWith(Component replacement) { - if (replacement == null) - { - throw new IllegalArgumentException("Argument [[replacement]] cannot be null."); - } + Args.notNull(replacement, "replacement"); + if (!getId().equals(replacement.getId())) { throw new IllegalArgumentException( @@ -3596,7 +3571,7 @@ public abstract class Component } /** - * Prefixes an exception message with useful information about this. component. + * Suffixes an exception message with useful information about this. component. * * @param message * The message @@ -3612,7 +3587,6 @@ public abstract class Component * * @return The markup stream for this component. Since a Component cannot have a markup stream, * we ask this component's parent to search for it. - * @TODO can be removed in 1.5 */ protected final MarkupStream findMarkupStream() { @@ -3802,14 +3776,6 @@ public abstract class Component } /** - * @return Component's markup stream - */ - protected MarkupStream locateMarkupStream() - { - return new MarkupStream(getMarkup()); - } - - /** * Called just after a component is rendered. */ protected void onAfterRender() @@ -3893,8 +3859,6 @@ public abstract class Component * * Overrides of this method MUST call the super implementation, the most logical place to do * this is the last line of the override method. - * - * */ protected void onRemove() { @@ -4149,22 +4113,11 @@ public abstract class Component return this; } throw new IllegalArgumentException( - exceptionMessage("Component is not a container and so does " + "not contain the path " + + exceptionMessage("Component is not a container and so does not contain the path " + path)); } /** - * Checks whether or not this component has a markup id value generated, whether it is automatic - * or user defined - * - * @return true if this component has a markup id value generated - */ - final boolean hasMarkupIdMetaData() - { - return getMarkupId() != null; - } - - /** * @param setRenderingFlag * rendering flag */ @@ -4408,7 +4361,7 @@ public abstract class Component * <p> * Example usecase for overriding: Suppose you are building an component that displays images. * The component generates a callback to itself using {@link IRequestListener} interface and - * uses this callback to stream image data. If such a component is placed inside a disable + * uses this callback to stream image data. If such a component is placed inside a disabled * webmarkupcontainer we still want to allow the invocation of the request listener callback * method so that image data can be streamed. Such a component would override this method and * return {@literal true} if the listener method belongs to {@link IRequestListener}. http://git-wip-us.apache.org/repos/asf/wicket/blob/b947aa27/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java index 08d2ddb..8b79831 100644 --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java @@ -55,8 +55,8 @@ import org.slf4j.LoggerFactory; /** * A MarkupContainer holds a map of child components. * <ul> - * <li><b>Children </b>- 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 + * <li><b>Children </b>- Children can be added by calling the {@link #add(Component...)} method, and they can be looked + * up using a colon separated 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". The number * of children in a MarkupContainer can be determined by calling size(), and the whole hierarchy of * children held by a MarkupContainer can be traversed by calling visitChildren(), passing in an @@ -73,19 +73,19 @@ import org.slf4j.LoggerFactory; * graphic designers may be setting attributes on component tags that affect visual presentation. * <p> * The type of markup held in a given container subclass can be determined by calling - * getMarkupType(). Markup is accessed via a MarkupStream object which allows a component to + * {@link #getMarkupType()}. Markup is accessed via a MarkupStream object which allows a component to * traverse ComponentTag and RawMarkup MarkupElements while rendering a response. Markup in the * stream may be HTML or some other kind of markup, such as VXML, as determined by the specific * container subclass. * <p> * A markup stream may be directly associated with a container via setMarkupStream. However, a * container which does not have a markup stream (its getMarkupStream() returns null) may inherit a - * markup stream from a container above it in the component hierarchy. The findMarkupStream() method + * markup stream from a container above it in the component hierarchy. The {@link #findMarkupStream()} method * will locate the first container at or above this container which has a markup stream. * <p> * All Page containers set a markup stream before rendering by calling the method - * getAssociatedMarkupStream() to load the markup associated with the page. Since Page is at the top - * of the container hierarchy, it is guaranteed that findMarkupStream will always return a valid + * {@link #getAssociatedMarkupStream(boolean)} to load the markup associated with the page. Since Page is at the top + * of the container hierarchy, it is guaranteed that {@link #findMarkupStream()} will always return a valid * markup stream. * * @see MarkupStream @@ -122,7 +122,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp * Adds a child component to this container. * * @param childs - * The child(s) + * The child(ren) to add. * @throws IllegalArgumentException * Thrown if a child with the same id is replaced by the add operation. * @return This
