You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/04/12 22:44:44 UTC
svn commit: r393605 - in /incubator/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
example/facelets/src/main/java/ example/facelets/src/main/java/org/
example/facelets/src/main/java/org/apache/
example/facelets/src/main/java/org/...
Author: bommel
Date: Wed Apr 12 13:44:41 2006
New Revision: 393605
URL: http://svn.apache.org/viewcvs?rev=393605&view=rev
Log:
more facelets support
Added:
incubator/tobago/trunk/example/facelets/src/main/java/
incubator/tobago/trunk/example/facelets/src/main/java/org/
incubator/tobago/trunk/example/facelets/src/main/java/org/apache/
incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/
incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/
incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/
incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/facelets/
incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/facelets/Counter.java
incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/date.xhtml
incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/textarea.xhtml
Modified:
incubator/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/in.xhtml
incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/tobago-extension.taglib.xml
incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/faces-config.xml
incubator/tobago/trunk/example/facelets/src/main/webapp/helloWorld.xml
incubator/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
Modified: incubator/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java?rev=393605&r1=393604&r2=393605&view=diff
==============================================================================
--- incubator/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java (original)
+++ incubator/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java Wed Apr 12 13:44:41 2006
@@ -30,6 +30,30 @@
public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Command";
+ private boolean defaultCommand;
+
+ public boolean isDefaultCommand() {
+ return defaultCommand;
+ }
+
+ public void setDefaultCommand(boolean defaultCommand) {
+ this.defaultCommand = defaultCommand;
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] saveState = new Object[2];
+ saveState[0] = super.saveState(context);
+ saveState[1] = defaultCommand;
+ return saveState;
+ }
+
+ public void restoreState(FacesContext context, Object savedState) {
+ Object[] values = (Object[]) savedState;
+ super.restoreState(context, values[0]);
+ defaultCommand = (Boolean)values[1];
+ }
+
+
public void processDecodes(FacesContext context) {
if (context == null) {
Added: incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/facelets/Counter.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/facelets/Counter.java?rev=393605&view=auto
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/facelets/Counter.java (added)
+++ incubator/tobago/trunk/example/facelets/src/main/java/org/apache/myfaces/tobago/example/facelets/Counter.java Wed Apr 12 13:44:41 2006
@@ -0,0 +1,30 @@
+package org.apache.myfaces.tobago.example.facelets;
+
+/*
+ * Copyright 2002-2005 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.
+ */
+
+public class Counter {
+ private int count;
+
+ public int getCount() {
+ return ++count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+}
\ No newline at end of file
Added: incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/date.xhtml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/date.xhtml?rev=393605&view=auto
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/date.xhtml (added)
+++ incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/date.xhtml Wed Apr 12 13:44:41 2006
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:tc="http://myfaces.apache.org/tobago/component">
+
+THIS TEXT WILL BE REMOVED
+<ui:composition>
+ <tc:panel>
+ <c:if test="${! empty rendered}">
+ <f:attribute name="rendered" value="${rendered}" />
+ </c:if>
+ <f:facet name="layout">
+ <tc:gridLayout columns="fixed;*"/>
+ </f:facet>
+ <tc:label value="${label}" for="@auto" tip="${tip}"/>
+ <tc:date value="${value}" required="${required}" readonly="${readonly}"
+ converter="${converter}" disabled="${disabled}" >
+ <c:if test="${! empty validator}">
+ <f:attribute name="validator" value="${validator}" />
+ </c:if>
+ <ui:insert/>
+ </tc:date>
+ </tc:panel>
+</ui:composition>
+THIS TEXT WILL BE REMOVED AS WELL
+
+</html>
\ No newline at end of file
Modified: incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/in.xhtml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/in.xhtml?rev=393605&r1=393604&r2=393605&view=diff
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/in.xhtml (original)
+++ incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/in.xhtml Wed Apr 12 13:44:41 2006
@@ -2,42 +2,27 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
- xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:tc="http://myfaces.apache.org/tobago/component">
THIS TEXT WILL BE REMOVED
<ui:composition>
-
- <c:if test="${empty tip}">
- <c:set var="tip" value=""/>
- </c:if>
-
- <c:if test="${empty required}">
- <c:set var="required" value="false"/>
- </c:if>
- <c:if test="${empty rendered}">
- <c:set var="rendered" value="true"/>
- </c:if>
- <c:if test="${empty readonly}">
- <c:set var="readonly" value="false"/>
- </c:if>
- <c:if test="${empty disabled}">
- <c:set var="disabled" value="false"/>
- </c:if>
-
-
- <tc:panel rendered="${rendered}">
+ <tc:panel>
+ <c:if test="${! empty rendered}">
+ <f:attribute name="rendered" value="${rendered}" />
+ </c:if>
<f:facet name="layout">
<tc:gridLayout columns="fixed;*"/>
</f:facet>
<tc:label value="${label}" for="@auto" tip="${tip}"/>
- <tc:in value="${value}" required="${required}">
+ <tc:in value="${value}" required="${required}" readonly="${readonly}"
+ converter="${converter}" disabled="${disabled}" >
+ <c:if test="${! empty validator}">
+ <f:attribute name="validator" value="${validator}" />
+ </c:if>
<ui:insert/>
</tc:in>
-
</tc:panel>
</ui:composition>
THIS TEXT WILL BE REMOVED AS WELL
Added: incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/textarea.xhtml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/textarea.xhtml?rev=393605&view=auto
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/textarea.xhtml (added)
+++ incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/textarea.xhtml Wed Apr 12 13:44:41 2006
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:tc="http://myfaces.apache.org/tobago/component">
+
+THIS TEXT WILL BE REMOVED
+<ui:composition>
+ <tc:panel>
+ <c:if test="${! empty rendered}">
+ <f:attribute name="rendered" value="${rendered}" />
+ </c:if>
+ <f:facet name="layout">
+ <tc:gridLayout columns="fixed;*"/>
+ </f:facet>
+ <tc:label value="${label}" for="@auto" tip="${tip}"/>
+ <tc:textarea value="${value}" required="${required}" readonly="${readonly}"
+ converter="${converter}" disabled="${disabled}" >
+ <c:if test="${! empty validator}">
+ <f:attribute name="validator" value="${validator}" />
+ </c:if>
+ <ui:insert/>
+ </tc:textarea>
+ </tc:panel>
+</ui:composition>
+THIS TEXT WILL BE REMOVED AS WELL
+
+</html>
\ No newline at end of file
Modified: incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/tobago-extension.taglib.xml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/tobago-extension.taglib.xml?rev=393605&r1=393604&r2=393605&view=diff
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/tobago-extension.taglib.xml (original)
+++ incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/facelets/tags/tobago-extension.taglib.xml Wed Apr 12 13:44:41 2006
@@ -8,4 +8,12 @@
<tag-name>in</tag-name>
<source>in.xhtml</source>
</tag>
+ <tag>
+ <tag-name>date</tag-name>
+ <source>date.xhtml</source>
+ </tag>
+ <tag>
+ <tag-name>textarea</tag-name>
+ <source>textarea.xhtml</source>
+ </tag>
</facelet-taglib>
Modified: incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/faces-config.xml?rev=393605&r1=393604&r2=393605&view=diff
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ incubator/tobago/trunk/example/facelets/src/main/webapp/WEB-INF/faces-config.xml Wed Apr 12 13:44:41 2006
@@ -35,4 +35,10 @@
</locale-config>
</application>
+ <managed-bean>
+ <managed-bean-name>counter</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.facelets.Counter</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
</faces-config>
Modified: incubator/tobago/trunk/example/facelets/src/main/webapp/helloWorld.xml
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/example/facelets/src/main/webapp/helloWorld.xml?rev=393605&r1=393604&r2=393605&view=diff
==============================================================================
--- incubator/tobago/trunk/example/facelets/src/main/webapp/helloWorld.xml (original)
+++ incubator/tobago/trunk/example/facelets/src/main/webapp/helloWorld.xml Wed Apr 12 13:44:41 2006
@@ -6,6 +6,7 @@
<tc:gridLayout/>
</f:facet>
<tc:out value="Hello World!"/>
- <tx:in label="foo" value="bar"/>
+ <tx:in label="foo" value="#{counter.count}"/>
+ <tc:button label="Count++" defaultCommand="true" />
</tc:page>
</f:view>
Modified: incubator/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=393605&r1=393604&r2=393605&view=diff
==============================================================================
--- incubator/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ incubator/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Wed Apr 12 13:44:41 2006
@@ -287,7 +287,7 @@
clientId + SUBCOMPONENT_SEP + "form");
writer.writeAttribute("action", formAction, null);
writer.writeIdAttribute(page.getFormId(facesContext));
- writer.writeAttribute("method", null, ATTR_METHOD);
+ writer.writeAttribute("method", getMethod(page), null);
writer.writeAttribute("enctype", null, ATTR_ENCTYPE);
// TODO: enable configuration of 'accept-charset'
writer.writeAttribute("accept-charset", FORM_ACCEPT_CHARSET, null);
@@ -431,11 +431,15 @@
sb.append("]\");");
return sb.toString();
}
-
+ private String getMethod(UIPage page) {
+ String method = (String) page.getAttributes().get(ATTR_METHOD);
+ return method == null?"post":method;
+ }
private String generateDoctype(UIPage page) {
String doctype = (String) page.getAttributes().get(ATTR_DOCTYPE);
String type = null;
- if ("loose".equals(doctype)) {
+ if (doctype == null || "loose".equals(doctype)) {
+ //default
type = LOOSE;
} else if ("strict".equals(doctype)) {
type = STRICT;