Return-Path: Delivered-To: apmail-shale-commits-archive@locus.apache.org Received: (qmail 37708 invoked from network); 14 Nov 2006 05:13:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Nov 2006 05:13:54 -0000 Received: (qmail 89043 invoked by uid 500); 14 Nov 2006 05:14:04 -0000 Delivered-To: apmail-shale-commits-archive@shale.apache.org Received: (qmail 89018 invoked by uid 500); 14 Nov 2006 05:14:03 -0000 Mailing-List: contact commits-help@shale.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shale.apache.org Delivered-To: mailing list commits@shale.apache.org Received: (qmail 89008 invoked by uid 99); 14 Nov 2006 05:14:03 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Nov 2006 21:14:03 -0800 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Nov 2006 21:13:51 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 9D4401A9846; Mon, 13 Nov 2006 21:13:21 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r474666 - in /shale/sandbox/shale-clay-trinidad: ./ src/main/java/org/apache/myfaces/trinidad/blank/ src/main/java/org/apache/shale/clay/component/chain/trinidad/ src/main/webapp/WEB-INF/ src/main/webapp/pages/ Date: Tue, 14 Nov 2006 05:13:21 -0000 To: commits@shale.apache.org From: gvanmatre@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061114051321.9D4401A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gvanmatre Date: Mon Nov 13 21:13:20 2006 New Revision: 474666 URL: http://svn.apache.org/viewvc?view=rev&rev=474666 Log: More on the Clay/Trinidad integration. Added support for the rest of the Trinidad custom method action component attributes. Dropped in a partial page rendering test and added a tree component and a few other components. The partial page rendering is amazingly simple to use. Added: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/PropertyListenerCommand.java - copied, changed from r473148, shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/AttributeChangeListenerCommand.java Removed: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/AttributeChangeListenerCommand.java Modified: shale/sandbox/shale-clay-trinidad/pom.xml shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/chain-config.xml shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html Modified: shale/sandbox/shale-clay-trinidad/pom.xml URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/pom.xml?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/pom.xml (original) +++ shale/sandbox/shale-clay-trinidad/pom.xml Mon Nov 13 21:13:20 2006 @@ -15,8 +15,12 @@ ${artifactId} - ${project.build.outputDirectory}/META-INF - ${project.build.outputDirectory}/src/main/resources/META-INF + + ${project.build.outputDirectory}/META-INF + + + ${project.build.outputDirectory}/src/main/resources/META-INF + **/*.xml @@ -162,12 +166,12 @@ + You need to build for the source. + svn co http://svn.apache.org/repos/asf/incubator/adffaces/trunk/trinidad trinidad + cd trinidad + mvn install + ** rock on ** + --> org.apache.myfaces.trinidad trinidad-api @@ -206,13 +210,12 @@ shale-view 1.0.4-SNAPSHOT - + - org.apache.shale - shale-tiger - 1.0.4-SNAPSHOT - - + org.apache.shale + shale-tiger + 1.0.4-SNAPSHOT + org.apache.shale Modified: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java (original) +++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java Mon Nov 13 21:13:20 2006 @@ -1,12 +1,24 @@ +/* + * 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.myfaces.trinidad.blank; import org.apache.shale.tiger.managed.Bean; import org.apache.shale.tiger.managed.Scope; -/** - * @author Gary VanMatre - * - */ @Bean(name = "displayElementTree", scope = Scope.SESSION) public class ComponentTreeModelAdapter extends TreeModelAdapter { private static final long serialVersionUID = -6792244110698122858L; Modified: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java (original) +++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java Mon Nov 13 21:13:20 2006 @@ -1,12 +1,13 @@ /* - * Copyright 2006 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 - * + * 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. Modified: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java (original) +++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java Mon Nov 13 21:13:20 2006 @@ -1,13 +1,43 @@ +/* + * 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.myfaces.trinidad.blank; import java.io.Serializable; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.Iterator; import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.myfaces.trinidad.event.AttributeChangeEvent; +import org.apache.myfaces.trinidad.event.FocusEvent; +import org.apache.myfaces.trinidad.event.RangeChangeEvent; +import org.apache.myfaces.trinidad.event.RowDisclosureEvent; +import org.apache.myfaces.trinidad.event.SelectionEvent; +import org.apache.shale.clay.config.beans.ActionListenerBean; import org.apache.shale.clay.config.beans.ComponentBean; import org.apache.shale.clay.config.beans.ConfigBean; import org.apache.shale.clay.config.beans.ConfigBeanFactory; +import org.apache.shale.clay.config.beans.ConverterBean; +import org.apache.shale.clay.config.beans.ValidatorBean; +import org.apache.shale.clay.config.beans.ValueChangeListenerBean; import org.apache.shale.tiger.managed.Bean; import org.apache.shale.tiger.managed.Scope; import org.apache.shale.tiger.view.Prerender; @@ -17,6 +47,16 @@ @Bean(name="page3", scope=Scope.REQUEST) @View public class ShowDisplayElementBacking extends AbstractFacesBean { + /** + *

+ * Common logger utility class. + *

+ */ + private static Log log; + static { + log = LogFactory.getLog(ShowDisplayElementBacking.class); + } + private String showJsfid = null; @Prerender public void load() { @@ -70,6 +110,7 @@ public static class ComponentWrapper implements Serializable { + private ComponentBean bean = null; private List children = null; @@ -78,9 +119,6 @@ } public String getJsfid() { - if (bean.getJsfid().startsWith("/")) { - return bean.getJsfid().substring(1); - } return bean.getJsfid(); } @@ -95,20 +133,91 @@ public String getId() { return bean.getId(); } - - public List getChildren() { - if (bean.getChildren().size() > 0) { - children = new ArrayList(); - Iterator ci = bean.getChildrenIterator(); - while (ci.hasNext()) { - ComponentBean c = (ComponentBean) ci.next(); - children.add(new ComponentWrapper(c)); - } + + public String getType() { + if (bean instanceof ValidatorBean) { + return "Validator"; + } else if (bean instanceof ConverterBean) { + return "Converter"; + } else if (bean instanceof ActionListenerBean) { + return "ActionListener"; + } else if (bean instanceof ValueChangeListenerBean) { + return "ValueChangeListener"; } - - return children; + + return "Component"; } - + + public List getChildren() { + List tmpList = new ArrayList(); + Iterator ci = bean.getChildrenIterator(); + while (ci.hasNext()) { + ComponentBean c = (ComponentBean) ci.next(); + tmpList.add(new ComponentWrapper(c)); + } + + if (bean.getConverter() != null) { + tmpList.add(new ComponentWrapper(bean.getConverter())); + } + + ci = bean.getActionListenerIterator(); + while (ci.hasNext()) { + ComponentBean c = (ComponentBean) ci.next(); + tmpList.add(new ComponentWrapper(c)); + } + + ci = bean.getValidatorIterator(); + while (ci.hasNext()) { + ComponentBean c = (ComponentBean) ci.next(); + tmpList.add(new ComponentWrapper(c)); + } + + ci = bean.getValueChangeListenerIterator(); + while (ci.hasNext()) { + ComponentBean c = (ComponentBean) ci.next(); + tmpList.add(new ComponentWrapper(c)); + } + + + if (tmpList.size() > 0) { + children = new ArrayList(); + children.addAll(tmpList); + } + + return children; + } + }; + public void rowDisclosureListener(RowDisclosureEvent event) { + log.info("fire --> rowDisclosureListener: " + event.toString()); + + } + + public void attributeChangeListener(AttributeChangeEvent event) { + log.info("fire --> attributeChangeListener: " + event.toString()); + + } + + public void selectionListener(SelectionEvent event) { + log.info("fire --> selectionListener: " + event.toString()); + + } + + + public void focusListener(FocusEvent event) { + log.info("fire --> focusListener: " + event.toString()); + + } + + public void rangeChangeListener(RangeChangeEvent event) { + log.info("fire --> rangeChangeListener: " + event.toString()); + + } + + + public Date getCurrentTime() { + return Calendar.getInstance().getTime(); + } + } Modified: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java (original) +++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java Mon Nov 13 21:13:20 2006 @@ -1,3 +1,20 @@ +/* + * 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.myfaces.trinidad.blank; import java.beans.IntrospectionException; @@ -7,6 +24,8 @@ import org.apache.myfaces.trinidad.model.TreeModel; /** + * Note: Copied from the Trinidad Demo + * * This class facilitates the construction of a ChildPropertyTreeModel instance * via managed-beans. ChildPropertyTreeModel does not have a no-arg constructor. * This class does, and so can be instantiated as a managed-bean. Two properties Copied: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/PropertyListenerCommand.java (from r473148, shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/AttributeChangeListenerCommand.java) URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/PropertyListenerCommand.java?view=diff&rev=474666&p1=shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/AttributeChangeListenerCommand.java&r1=473148&p2=shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/PropertyListenerCommand.java&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/AttributeChangeListenerCommand.java (original) +++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/shale/clay/component/chain/trinidad/PropertyListenerCommand.java Mon Nov 13 21:13:20 2006 @@ -1,21 +1,42 @@ package org.apache.shale.clay.component.chain.trinidad; +import java.util.HashMap; +import java.util.Map; + import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.el.MethodBinding; +import javax.faces.event.ActionEvent; import org.apache.commons.chain.Context; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.myfaces.trinidad.component.UIXComponent; import org.apache.myfaces.trinidad.event.AttributeChangeEvent; +import org.apache.myfaces.trinidad.event.ChartDrillDownEvent; +import org.apache.myfaces.trinidad.event.DisclosureEvent; +import org.apache.myfaces.trinidad.event.FocusEvent; +import org.apache.myfaces.trinidad.event.LaunchEvent; +import org.apache.myfaces.trinidad.event.PollEvent; +import org.apache.myfaces.trinidad.event.RangeChangeEvent; +import org.apache.myfaces.trinidad.event.ReturnEvent; +import org.apache.myfaces.trinidad.event.RowDisclosureEvent; +import org.apache.myfaces.trinidad.event.SelectionEvent; +import org.apache.myfaces.trinidad.event.SortEvent; import org.apache.shale.clay.component.chain.AbstractCommand; import org.apache.shale.clay.component.chain.AssignPropertiesCommand; import org.apache.shale.clay.component.chain.ClayContext; import org.apache.shale.clay.config.beans.AttributeBean; import org.apache.shale.clay.config.beans.ComponentBean; +import org.apache.shale.util.PropertyHelper; + +public class PropertyListenerCommand extends AbstractCommand { + + /** + *

Holds a cross-reference of attribute name to formal parameter.

+ */ + private static Map methodBindAttrs = new HashMap(); -public class AttributeChangeListenerCommand extends AbstractCommand { /** *

* Common logger utility class. @@ -23,17 +44,32 @@ */ private static Log log; static { - log = LogFactory.getLog(AttributeChangeListenerCommand.class); - } + log = LogFactory.getLog(PropertyListenerCommand.class); + + methodBindAttrs.put("attributeChangeListener", new Class[] {AttributeChangeEvent.class}); + methodBindAttrs.put("focusListener", new Class[] {FocusEvent.class}); + methodBindAttrs.put("rowDisclosureListener", new Class[] {RowDisclosureEvent.class}); + methodBindAttrs.put("selectionListener", new Class[] {SelectionEvent.class}); + methodBindAttrs.put("rangeChangeListener", new Class[] {RangeChangeEvent.class}); + methodBindAttrs.put("sortListener", new Class[] {SortEvent.class}); + methodBindAttrs.put("chartDrillDownListener", new Class[] {ChartDrillDownEvent.class}); + methodBindAttrs.put("returnListener", new Class[] {ReturnEvent.class}); + methodBindAttrs.put("launchListener", new Class[] {LaunchEvent.class}); + methodBindAttrs.put("pollListener", new Class[] {PollEvent.class}); + methodBindAttrs.put("disclosureListener", new Class[] {DisclosureEvent.class}); + methodBindAttrs.put("previousActionListener", new Class[] {ActionEvent.class}); + methodBindAttrs.put("nextActionListener", new Class[] {ActionEvent.class}); + methodBindAttrs.put("nextAction", new Class[0]); + methodBindAttrs.put("previousAction", new Class[0]); + }; /** *

- * Looks to see if the {@link AttributeBean} on the {@link ClayContext} is a - * AttributeChangeListener attribute. If it is, create a + * Looks to see if the {@link AttributeBean} on the {@link ClayContext} is one + * of the custom Trinidad method binding event attributes. If it is, create a * MethodBinding and assign it to the component returning a * true value. Otherwise, return a false - * value. This Command is invoked from the - * {@link AssignPropertiesCommand} chain. + * value. *

* * @param context common chains @@ -61,7 +97,8 @@ throw new NullPointerException(getMessages().getMessage("clay.null.facesContext")); } - if (attributeBean.getName().equals("attributeChangeListener") && attributeBean.getValue() != null) { + Class[] formalParameter = (Class[]) methodBindAttrs.get(attributeBean.getName()); + if (formalParameter != null && attributeBean.getValue() != null) { isFinal = true; UIComponent child = (UIComponent) clayContext.getChild(); @@ -74,12 +111,14 @@ String expr = replaceMnemonic(clayContext); MethodBinding mb = facesContext.getApplication() - .createMethodBinding(expr, new Class[]{AttributeChangeEvent.class}); - ((UIXComponent) child).setAttributeChangeListener(mb); + .createMethodBinding(expr, formalParameter); + PropertyHelper propertyHelper = new PropertyHelper(); + + propertyHelper.setValue(child, attributeBean.getName(), mb); } else { - log.error("Cannot bind attributeChangeListener expression to a" + log.error("Cannot bind " + attributeBean.getName() + " expression to a" + " component not extending UIXComponent: " + attributeBean.toString()); } } Modified: shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/chain-config.xml URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/chain-config.xml?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/chain-config.xml (original) +++ shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/chain-config.xml Mon Nov 13 21:13:20 2006 @@ -52,10 +52,65 @@ className="org.apache.shale.clay.parser.builder.chain.JsfDefaultBuilderRule" prefix="trh" /> - + className="org.apache.shale.clay.component.chain.trinidad.PropertyListenerCommand" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html?view=diff&rev=474666&r1=474665&r2=474666 ============================================================================== --- shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html (original) +++ shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html Mon Nov 13 21:13:20 2006 @@ -24,26 +24,43 @@ xmlns:tr="http://myfaces.apache.org/trinidad" > + + - - - - + + - + + + + + + + + + + + - + - - + @@ -59,6 +76,13 @@ + + + + + + + @@ -72,6 +96,33 @@ + + + + + + + + + + + + + + + + + + + - + + +