I've committed *most of* TAP5-1528. Still to come is some work to copy resource files over to output directory, and some cleanups of existing components. Also, find a way to make it a little prettier.
Due to limitations of the JavaDoc tool, it will be necessary to add @tapestrydoc to components to get their documentation generated. I feel we are closing in on an alpha release. I would like to remove tapestry-component-report (as it is Maven only, while the new tapestry-javadoc is universal). I still want to support the Maven archetype, but will be looking for a way to have a Gradle script generate it. This may not make it into the first alpha release. What's on other's hit lists for the first alpha release, and on 5.3 in general? ---------- Forwarded message ---------- From: <hls...@apache.org> Date: Sun, May 22, 2011 at 12:09 PM Subject: svn commit: r1126178 - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ To: comm...@tapestry.apache.org Author: hlship Date: Sun May 22 19:09:39 2011 New Revision: 1126178 URL: http://svn.apache.org/viewvc?rev=1126178&view=rev Log: TAP5-1528: Resolve published parameters from embedded components Added: tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescriptionSource.java Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescription.java tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java?rev=1126178&r1=1126177&r2=1126178&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java (original) +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.java Sun May 22 19:09:39 2011 @@ -1,4 +1,4 @@ -// Copyright 2007, 2008, 2009, 2010 The Apache Software Foundation +// Copyright 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,14 +16,23 @@ package org.apache.tapestry5.corelib.com import java.io.IOException; -import org.apache.tapestry5.*; -import org.apache.tapestry5.annotations.*; +import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.ClientElement; +import org.apache.tapestry5.ComponentResources; +import org.apache.tapestry5.EventConstants; +import org.apache.tapestry5.Field; +import org.apache.tapestry5.FormValidationControl; +import org.apache.tapestry5.TrackableComponentEventCallback; +import org.apache.tapestry5.annotations.Component; +import org.apache.tapestry5.annotations.Environmental; +import org.apache.tapestry5.annotations.Events; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.annotations.SupportsInformalParameters; import org.apache.tapestry5.beaneditor.BeanModel; import org.apache.tapestry5.internal.beaneditor.BeanModelUtils; -import org.apache.tapestry5.internal.services.ComponentResultProcessorWrapper; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.services.BeanModelSource; -import org.apache.tapestry5.services.ComponentEventResultProcessor; /** * A component that creates an entire form editing the properties of a particular bean. Inspired by <a @@ -45,6 +54,7 @@ import org.apache.tapestry5.services.Com * @see org.apache.tapestry5.services.BeanModelSource * @see org.apache.tapestry5.corelib.components.PropertyEditor * @see org.apache.tapestry5.beaneditor.DataType + * @tapestrydoc */ @SupportsInformalParameters @Events(EventConstants.PREPARE) Modified: tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescription.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescription.java?rev=1126178&r1=1126177&r2=1126178&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescription.java (original) +++ tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescription.java Sun May 22 19:09:39 2011 @@ -17,9 +17,11 @@ package org.apache.tapestry5.javadoc; import java.util.Map; import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.annotations.Component; import org.apache.tapestry5.annotations.Events; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.ioc.internal.util.CollectionFactory; +import org.apache.tapestry5.ioc.internal.util.InternalUtils; import com.sun.javadoc.AnnotationDesc; import com.sun.javadoc.AnnotationDesc.ElementValuePair; @@ -37,22 +39,16 @@ public class ClassDescription public final Map<String, ParameterDescription> parameters = CollectionFactory.newCaseInsensitiveMap(); /** - * Case insensitive map, keyed on parameter name, value is class name of component from which the parameter is - * published. - */ - public final Map<String, String> publishedParameters = CollectionFactory.newCaseInsensitiveMap(); - - /** * Case insensitive map, keyed on event name, value is optional description (often blank). */ public final Map<String, String> events = CollectionFactory.newCaseInsensitiveMap(); - public ClassDescription(ClassDoc classDoc) + public ClassDescription(ClassDoc classDoc, ClassDescriptionSource source) { this.classDoc = classDoc; loadEvents(); - loadParameters(); + loadParameters(source); } private void loadEvents() @@ -82,7 +78,7 @@ public class ClassDescription } } - private void loadParameters() + private void loadParameters(ClassDescriptionSource source) { for (FieldDoc fd : classDoc.fields(false)) { @@ -111,6 +107,38 @@ public class ClassDescription continue; } + values = getAnnotationValues(fd, Component.class); + + if (values != null) + { + String names = get(values, "publishParameters", ""); + + if (InternalUtils.isBlank(names)) + continue; + + for (String name : names.split("\\s*,\\s*")) + { + ParameterDescription pd = getPublishedParameterDescription(source, fd, name); + parameters.put(name, pd); + } + + } + + } + } + + private ParameterDescription getPublishedParameterDescription(ClassDescriptionSource source, FieldDoc fd, + String name) + { + String currentClassName = fd.type().qualifiedTypeName(); + + while (true) + { + ClassDescription componentCD = source.getDescription(currentClassName); + + if (componentCD.parameters.containsKey(name)) { return componentCD.parameters.get(name); } + + currentClassName = componentCD.classDoc.superclass().typeName(); } } Added: tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescriptionSource.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescriptionSource.java?rev=1126178&view=auto ============================================================================== --- tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescriptionSource.java (added) +++ tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/ClassDescriptionSource.java Sun May 22 19:09:39 2011 @@ -0,0 +1,20 @@ +// Copyright 2011 The Apache Software Foundation +// +// Licensed 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.tapestry5.javadoc; + +public interface ClassDescriptionSource +{ + ClassDescription getDescription(String className); +} Modified: tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java?rev=1126178&r1=1126177&r2=1126178&view=diff ============================================================================== --- tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java (original) +++ tapestry/tapestry5/trunk/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java Sun May 22 19:09:39 2011 @@ -31,7 +31,7 @@ import com.sun.tools.doclets.Taglet; /** * An inline tag allowed inside a type; it produces Tapestry component reference and other information. */ -public class TapestryDocTaglet implements Taglet +public class TapestryDocTaglet implements Taglet, ClassDescriptionSource { /** * Map from class name to class description. @@ -95,7 +95,7 @@ public class TapestryDocTaglet implement if (result == null) { ClassDoc cd = firstSeen.findClass(className); - result = new ClassDescription(cd); + result = new ClassDescription(cd, this); classDescriptions.put(className, result); } -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org