shale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvanma...@apache.org
Subject svn commit: r473878 - in /shale/sandbox: shale-clay-mailreader/src/main/webapp/WEB-INF/ shale-clay-trinidad/ shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ shale-clay-trinidad/src/main/webapp/WEB-INF/ shale-clay-trinidad/src/main/...
Date Sun, 12 Nov 2006 05:00:36 GMT
Author: gvanmatre
Date: Sat Nov 11 21:00:35 2006
New Revision: 473878

URL: http://svn.apache.org/viewvc?view=rev&rev=473878
Log:
More Trinidad/Clay experimentation.  These Trinidad components are sick.

Added:
    shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java
  (with props)
    shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java
  (with props)
    shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java
  (with props)
    shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html   (with
props)
Modified:
    shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-config.xml
    shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-tiles-config.xml
    shale/sandbox/shale-clay-trinidad/pom.xml
    shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/HelloWorldBacking.java
    shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/clay-tiles-config.xml
    shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/faces-config.xml
    shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/index.html

Modified: shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-config.xml
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-config.xml?view=diff&rev=473878&r1=473877&r2=473878
==============================================================================
--- shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-config.xml (original)
+++ shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-config.xml Sat Nov 11
21:00:35 2006
@@ -178,6 +178,12 @@
 		     <set name="value" value="#{@row.@columnAttribute}" />
 		  </attributes>
        </element>
+       <element renderId="2" jsfid="outputText">
+          <attributes>
+              <set name="value" value="#{rowId}" />
+          </attributes>
+       </element>
+       
     </component>
           
     <component jsfid="columnActionCommand" extends="t:commandButton" id="@action">
@@ -195,6 +201,8 @@
             <set name="var" value="@row"/>
             <set name="sortColumn" value="#{@managed-bean-name.sort}"/>
             <set name="sortAscending" value="#{@managed-bean-name.ascending}"/>
+            <set name="rowId" value="row_#{rowIndex} " />
+            <set name="rowIndexVar" value="rowIndex" />
         </attributes>
         
         <symbols>

Modified: shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-tiles-config.xml
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-tiles-config.xml?view=diff&rev=473878&r1=473877&r2=473878
==============================================================================
--- shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-tiles-config.xml (original)
+++ shale/sandbox/shale-clay-mailreader/src/main/webapp/WEB-INF/clay-tiles-config.xml Sat
Nov 11 21:00:35 2006
@@ -48,8 +48,8 @@
        <symbols>
            <set name="@title" value="registrationTitle"/>
            <set name="@bodycontent" value="/pages/registration_nsjsp.html"/> 
-           <!-- <set name="@subscriptionTable" value="/pages/subscription_table_tap.html"/>
-->
-           <set name="@subscriptionTable" value="/pages/subscription_table_nsjsp.html"/>
+           <set name="@subscriptionTable" value="/pages/subscription_table_tap.html"/>
+           <!--  <set name="@subscriptionTable" value="/pages/subscription_table_nsjsp.html"/>
-->
        </symbols>
     </component>
 

Modified: shale/sandbox/shale-clay-trinidad/pom.xml
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/pom.xml?view=diff&rev=473878&r1=473877&r2=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/pom.xml (original)
+++ shale/sandbox/shale-clay-trinidad/pom.xml Sat Nov 11 21:00:35 2006
@@ -206,6 +206,13 @@
 			<artifactId>shale-view</artifactId>
 			<version>1.0.4-SNAPSHOT</version>
 		</dependency>
+		
+		<dependency>
+            <groupId>org.apache.shale</groupId>
+            <artifactId>shale-tiger</artifactId>
+            <version>1.0.4-SNAPSHOT</version>
+        </dependency>
+		
 
 		<dependency>
 			<groupId>org.apache.shale</groupId>

Added: 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=auto&rev=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java
(added)
+++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java
Sat Nov 11 21:00:35 2006
@@ -0,0 +1,24 @@
+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;
+
+    private String jsfid = null;
+
+    public String getJsfid() {
+        return jsfid;
+    }
+
+    public void setJsfid(String jsfid) {
+        this.jsfid = jsfid;
+    }
+
+}

Propchange: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ComponentTreeModelAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=473878&r1=473877&r2=473878
==============================================================================
--- 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
Sat Nov 11 21:00:35 2006
@@ -22,12 +22,15 @@
 import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
 import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
 import org.apache.myfaces.trinidad.util.Service;
+import org.apache.shale.tiger.managed.Bean;
+import org.apache.shale.tiger.managed.Scope;
 
 /**
  * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
  * 
  * @author <a href="mailto:matzew@apache.org">Matthias We├čendorf</a>
  */
+@Bean(name="helloWorldBacking", scope=Scope.REQUEST)
 public class HelloWorldBacking {
 
     /**

Added: 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=auto&rev=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java
(added)
+++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java
Sat Nov 11 21:00:35 2006
@@ -0,0 +1,114 @@
+package org.apache.myfaces.trinidad.blank;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+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.tiger.managed.Bean;
+import org.apache.shale.tiger.managed.Scope;
+import org.apache.shale.tiger.view.Prerender;
+import org.apache.shale.tiger.view.View;
+import org.apache.shale.view.AbstractFacesBean;
+
+@Bean(name="page3", scope=Scope.REQUEST)
+@View public class ShowDisplayElementBacking extends AbstractFacesBean {
+
+    private String showJsfid = null;
+    
+    @Prerender public void load() {
+        
+        if (showJsfid == null) {
+            throw new NullPointerException("The jsfid property can not be null");
+        }
+
+        ComponentTreeModelAdapter adapter = (ComponentTreeModelAdapter) getBean("displayElementTree");

+        if (adapter.getJsfid() == null || !adapter.getJsfid().equals(getShowJsfid())) {
+            
+          List<ComponentWrapper> roots = new ArrayList<ComponentWrapper>();
+          roots.add(new ComponentWrapper(getTopLevelElement()));
+
+          adapter.setInstance(roots);
+          adapter.setChildProperty("children");
+          adapter.setJsfid(getShowJsfid());
+          
+          setBean("displayElementTree", adapter);
+        }
+    }
+
+    public String getShowJsfid() {
+        return showJsfid;
+    }
+
+    public void setShowJsfid(String jsfid) {
+        this.showJsfid = jsfid;
+    }
+
+     /**
+     * @param jsfid parent id of a config bean
+     * @return parent config bean
+     */
+    private ComponentBean getTopLevelElement() {
+
+        ConfigBean config = ConfigBeanFactory.findConfig(getShowJsfid());
+
+        if (config == null) {
+            throw new NullPointerException("Unable to find a clay config bean handler for
" + getShowJsfid());
+        }
+
+        // find the top-level display element associated with the subtree
+        ComponentBean b = config.getElement(getShowJsfid());
+        if (b == null) {
+            throw new NullPointerException("Unable to find top-level config bean using jsfid:
" + getShowJsfid());
+        }
+
+        return b;
+    }
+
+    
+    public static class ComponentWrapper implements Serializable {
+       private ComponentBean bean = null;
+       private List<ComponentWrapper> children = null;
+       
+       public ComponentWrapper(ComponentBean bean) {
+          this.bean = bean;    
+       }
+       
+       public String getJsfid() {
+           if (bean.getJsfid().startsWith("/")) {
+              return bean.getJsfid().substring(1);
+           }
+           return bean.getJsfid();
+       }
+       
+       public String getComponentType() {
+           return bean.getComponentType();
+       }
+       
+       public String getExtends() {
+           return bean.getExtends();
+       }
+
+       public String getId() {
+           return bean.getId();
+       }
+
+       public List<ComponentWrapper> getChildren() {
+           if (bean.getChildren().size() > 0) {
+               children = new ArrayList<ComponentWrapper>();
+               Iterator ci = bean.getChildrenIterator();
+               while (ci.hasNext()) {
+                   ComponentBean c = (ComponentBean) ci.next();
+                   children.add(new ComponentWrapper(c));
+               }
+           }
+                  
+           return children;
+       }
+        
+    };
+    
+}

Propchange: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/ShowDisplayElementBacking.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=auto&rev=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java
(added)
+++ shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java
Sat Nov 11 21:00:35 2006
@@ -0,0 +1,90 @@
+package org.apache.myfaces.trinidad.blank;
+
+import java.beans.IntrospectionException;
+import java.util.List;
+
+import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
+import org.apache.myfaces.trinidad.model.TreeModel;
+
+/**
+ * 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
+ * need to be set: "childProperty" and "instance"
+ */
+
+public class TreeModelAdapter implements java.io.Serializable {
+    private static final long serialVersionUID = 7558320251869517919L;
+
+    public TreeModelAdapter() {
+    }
+
+    private String _propertyName = null;
+
+    private Object _instance = null;
+
+    private transient TreeModel _model = null;
+
+    public TreeModel getModel() throws IntrospectionException {
+        if (_model == null) {
+            _model = new ChildPropertyTreeModel(getInstance(),
+                    getChildProperty());
+        }
+        return _model;
+    }
+
+    public String getChildProperty() {
+        return _propertyName;
+    }
+
+    /**
+     * Sets the property to use to get at child lists
+     * 
+     * @param propertyName
+     */
+    public void setChildProperty(String propertyName) {
+        _propertyName = propertyName;
+        _model = null;
+    }
+
+    public Object getInstance() {
+        return _instance;
+    }
+
+    /**
+     * Sets the root list for this tree.
+     * 
+     * @param instance
+     *            must be something that can be converted into a List
+     */
+    public void setInstance(Object instance) {
+        _instance = instance;
+        _model = null;
+    }
+
+    /**
+     * Sets the root list for this tree. This is needed for passing a List when
+     * using the managed bean list creation facility, which requires the
+     * parameter type is List.
+     * 
+     * @param instance
+     *            the list of root nodes
+     */
+    public void setListInstance(List<Object> instance) {
+        setInstance(instance);
+    }
+
+    /**
+     * This should only be called if setListInstance was called.
+     * 
+     * This method shouldn't be needed according to faces spec 1.1 rev 1, see
+     * 5.3.1.3 However without this we get the following error in websphere:
+     * java.beans.IntrospectionException: No method "getListInstance" with 0
+     * arg(s) of matching types in websphere
+     */
+    @SuppressWarnings("unchecked")
+    public List<Object> getListInstance() {
+        return (List<Object>) getInstance();
+    }
+
+}

Propchange: shale/sandbox/shale-clay-trinidad/src/main/java/org/apache/myfaces/trinidad/blank/TreeModelAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/clay-tiles-config.xml
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/clay-tiles-config.xml?view=diff&rev=473878&r1=473877&r2=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/clay-tiles-config.xml (original)
+++ shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/clay-tiles-config.xml Sat Nov
11 21:00:35 2006
@@ -37,4 +37,10 @@
 		</symbols>
 	</component>
 
+	<component jsfid="/page3.jsf" extends="basePage">
+		<symbols>
+			<set name="@bodycontent" value="/pages/showDisplayElement.html" />
+		</symbols>
+	</component>
+
 </view>

Modified: shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=473878&r1=473877&r2=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ shale/sandbox/shale-clay-trinidad/src/main/webapp/WEB-INF/faces-config.xml Sat Nov 11
21:00:35 2006
@@ -27,6 +27,7 @@
 	</application>
 
 	<!-- Global preferences object that proxies to others -->
+    <!-- 
 	<managed-bean>
 		<managed-bean-name>helloWorldBacking</managed-bean-name>
 		<managed-bean-class>
@@ -34,13 +35,18 @@
 		</managed-bean-class>
 		<managed-bean-scope>request</managed-bean-scope>
 	</managed-bean>
-
+    -->
+    
 	<!-- navigation rules for index.jsf -->
 	<navigation-rule>
 		<from-view-id>/index.jsf</from-view-id>
 		<navigation-case>
 			<from-outcome>success</from-outcome>
 			<to-view-id>/page2.jsf</to-view-id>
+		</navigation-case>
+		<navigation-case>
+			<from-outcome>page3</from-outcome>
+			<to-view-id>/page3.jsf</to-view-id>
 		</navigation-case>
 	</navigation-rule>
 

Modified: shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/index.html
URL: http://svn.apache.org/viewvc/shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/index.html?view=diff&rev=473878&r1=473877&r2=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/index.html (original)
+++ shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/index.html Sat Nov 11 21:00:35
2006
@@ -29,7 +29,13 @@
 				attributeChangeListener="#{helloWorldBacking.attributeChangeListener}" />
 			<tr:commandButton id="button1" text="press me"
 				action="#{helloWorldBacking.send}" />
+				
+		    
+		</tr:panelPage>
+	</tr:form>
+	<tr:form>
+	    <tr:panelPage>		
+		     <tr:commandLink id="button2" text="check it out" action="page3" />
 		</tr:panelPage>
-
 	</tr:form>
 </span>

Added: 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=auto&rev=473878
==============================================================================
--- shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html (added)
+++ shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html Sat Nov
11 21:00:35 2006
@@ -0,0 +1,77 @@
+<!-- ### clay:page charset="UTF-8" /### -->
+<!-- ### clay:remove ### -->
+<!--
+ 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.
+-->
+<!-- ### /clay:remove ### -->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+          xmlns:f="http://java.sun.com/jsf/core"
+          xmlns:h="http://java.sun.com/jsf/html"
+          xmlns:trh="http://myfaces.apache.org/trinidad/html" 
+          xmlns:tr="http://myfaces.apache.org/trinidad" >
+
+  <jsp:directive.page contentType="text/html;charset=utf-8"/>
+    <tr:form id="form">
+       <tr:panelGroupLayout layout="vertical">
+            <f:facet name="separator">
+              <tr:separator />
+            </f:facet>
+            <tr:panelGroupLayout layout="horizontal">   
+               <f:facet name="separator">
+                 <tr:separator />
+               </f:facet>
+
+               <tr:selectOneChoice id="jsfid" required="true" label="Choose a Page:" value="#{@managed-bean-name.showJsfid}">
+                 <f:selectItem itemLabel="Page 1" itemValue="/pages/index.html"/>
+                 <f:selectItem itemLabel="Page 2" itemValue="/pages/page2.html"/>
+                 <f:selectItem itemLabel="Page 3" itemValue="/pages/showDisplayElement.html"/>
+               </tr:selectOneChoice>
+              <tr:commandLink text="Show" />    
+            </tr:panelGroupLayout>
+
+    
+            <tr:treeTable id="tree" var="foo" value="#{displayElementTree.model}" summary="Component
Tree">
+
+              <f:facet name="nodeStamp">
+                <tr:column>
+                  <f:facet name="header">
+                    <tr:outputText value="jsfid"/>
+                  </f:facet>
+                  <tr:outputText value="#{foo.jsfid}"/>
+                </tr:column>
+              </f:facet>
+              <f:facet name="pathStamp">
+                <tr:outputText value="#{foo.jsfid}"/>
+              </f:facet>
+
+              <tr:column>
+                <f:facet name="header">
+                  <h:outputText value="componentType"/>
+                </f:facet>
+                <tr:outputText value="#{foo.componentType}"/>
+              </tr:column>
+
+              <tr:column>
+                <f:facet name="header">
+                  <h:outputText value="id"/>
+                </f:facet>
+                <tr:outputText value="#{foo.id}"/>
+              </tr:column>
+
+            </tr:treeTable>
+        </tr:panelGroupLayout>
+      </tr:form>   
+</jsp:root>
\ No newline at end of file

Propchange: shale/sandbox/shale-clay-trinidad/src/main/webapp/pages/showDisplayElement.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message