JBoss Rich Faces SVN: r9793 - trunk/ui/dataTable/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2008-07-28 03:05:25 -0400 (Mon, 28 Jul 2008)
New Revision: 9793
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
Log:
removed unused getColumnLabel method
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-07-25 23:06:19 UTC (rev 9792)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-07-28 07:05:25 UTC (rev 9793)
@@ -75,31 +75,6 @@
}
//
- //Extended data table supports label attribute also
- /**
- * Get label for column. If label attribute is set returns attribute value,
- * otherwise try to get label from column header content.
- * @return label for column
- */
- //TODO what about extra "label" facet?
- public String getColumnLabel(){
- String label = (String)getAttributes().get("label");
- if ((label == null) || (label.length() == 0)){
- //try get header name
- UIComponent hFacet = getHeader();
- if ((hFacet != null) && (hFacet.isRendered())
- /* added check for rendered attribute */ && (hFacet instanceof UIOutput)) {
- UIOutput output = (UIOutput)hFacet;
-
- //TODO add conversion support here
- label = (String)output.getValue();
- }
- }
- return label;
- }//getColumnLabel
-
- //
-
public FilterField getFilterField(){
FilterField filterField = null;
MethodExpression filterMethod = getFilterMethod();
16 years, 5 months
JBoss Rich Faces SVN: r9792 - trunk/framework/impl/src/main/java/org/ajax4jsf/application.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-07-25 19:06:19 -0400 (Fri, 25 Jul 2008)
New Revision: 9792
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
Log:
Capture writed view-state param into request-scope variable.
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-07-25 15:50:52 UTC (rev 9791)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-07-25 23:06:19 UTC (rev 9792)
@@ -22,12 +22,15 @@
package org.ajax4jsf.application;
import java.io.IOException;
+import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
@@ -37,6 +40,7 @@
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.faces.render.ResponseStateManager;
@@ -53,6 +57,8 @@
public class AjaxStateManager extends StateManager {
+ public static final String CAPTURED_VIEW_STATE = "org.ajax4jsf.captured_view_state";
+
private final class SeamStateManagerWrapper extends StateManager {
protected Object getComponentStateToSave(FacesContext arg0) {
// do nothing
@@ -217,7 +223,7 @@
// Myfaces https://issues.apache.org/jira/browse/MYFACES-1753 hack.
stateArray=new Object[]{getLogicalViewId(context),null};
}
- responseStateManager.writeState(context, stateArray);
+ writeState(context, responseStateManager, stateArray);
if (_log.isDebugEnabled()) {
_log.debug("Write view state to the response");
}
@@ -245,6 +251,51 @@
}
}
+ private void writeState(FacesContext context,
+ ResponseStateManager responseStateManager, Object[] stateArray)
+ throws IOException {
+ // Capture writed state into string.
+ ResponseWriter originalWriter = context.getResponseWriter();
+ StringWriter buff = new StringWriter(128);
+ try {
+ ResponseWriter stateResponseWriter = originalWriter
+ .cloneWithWriter(buff);
+ context.setResponseWriter(stateResponseWriter);
+ responseStateManager.writeState(context, stateArray);
+ stateResponseWriter.flush();
+ String stateString = buff.toString();
+ originalWriter.write(stateString);
+ String stateValue = getStateValue(stateString);
+ context.getExternalContext().getRequestMap().put(CAPTURED_VIEW_STATE, stateValue);
+ if (null != stateValue) {
+ } else {
+ }
+ } finally {
+ context.setResponseWriter(originalWriter);
+ }
+ }
+
+ private static final Pattern PATTERN = Pattern.compile(".*<input.*(?:\\svalue=[\"\'](.*)[\"\']\\s).*name=[\"']"+ResponseStateManager.VIEW_STATE_PARAM+"[\"'].*>");
+
+ private static final Pattern PATTERN2 = Pattern.compile(".*<input .*name=[\"']"+ResponseStateManager.VIEW_STATE_PARAM+"[\"'].*(?:\\svalue=[\"\'](.*)[\"\']\\s).*>");
+
+
+ /**
+ * Parse content of the writed viewState hidden input field for a state value.
+ * @param input
+ * @return
+ */
+ private String getStateValue(String input) {
+ Matcher matcher = PATTERN.matcher(input);
+ if(!matcher.matches()){
+ matcher = PATTERN2.matcher(input);
+ if(!matcher.matches()){
+ return null;
+ }
+ }
+ return matcher.group(1);
+}
+
/*
* (non-Javadoc)
*
@@ -265,7 +316,7 @@
stateArray = new Object[] {
state.getStructure(),state.getState() };
}
- responseStateManager.writeState(context, stateArray);
+ writeState(context, responseStateManager, stateArray);
if (_log.isDebugEnabled()) {
_log.debug("Write view state to the response");
}
16 years, 5 months
JBoss Rich Faces SVN: r9791 - trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-07-25 11:50:52 -0400 (Fri, 25 Jul 2008)
New Revision: 9791
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
https://jira.jboss.org/jira/browse/RF-3987
Modified: trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-07-25 14:36:59 UTC (rev 9790)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-07-25 15:50:52 UTC (rev 9791)
@@ -31,6 +31,7 @@
this.comboList = new Richfaces.ComboBoxList(listId, parentListId, selectFirstOnUpdate, filterNewValue, classes.COMBO_LIST, listWidth,
listHeight, itemsText, onlistcall, fieldId, shadowId, showDelay, hideDelay);
this.defaultMessage = defaultMessage;
+ this.classes = classes;
if (value) {
var item = this.comboList.findItemBySubstr(value);
if (item) {
@@ -45,7 +46,6 @@
}
this.onselected = onselected;
this.isSelection = true;
- this.classes = classes;
this.isDisabled = isDisabled;
if (this.onselected) {
this.combobox.observe("rich:onselect", this.onselected);
16 years, 5 months
JBoss Rich Faces SVN: r9790 - in trunk/samples/dataTableDemo/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-07-25 10:36:59 -0400 (Fri, 25 Jul 2008)
New Revision: 9790
Added:
trunk/samples/dataTableDemo/src/main/java/org/richfaces/TestBean.java
trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-4002.jsp
Modified:
trunk/samples/dataTableDemo/src/main/webapp/WEB-INF/faces-config.xml
Log:
files for the RF-4002 issue
Added: trunk/samples/dataTableDemo/src/main/java/org/richfaces/TestBean.java
===================================================================
--- trunk/samples/dataTableDemo/src/main/java/org/richfaces/TestBean.java (rev 0)
+++ trunk/samples/dataTableDemo/src/main/java/org/richfaces/TestBean.java 2008-07-25 14:36:59 UTC (rev 9790)
@@ -0,0 +1,15 @@
+package org.richfaces;
+
+public class TestBean {
+
+ private String text;
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+}
Modified: trunk/samples/dataTableDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/dataTableDemo/src/main/webapp/WEB-INF/faces-config.xml 2008-07-25 14:10:45 UTC (rev 9789)
+++ trunk/samples/dataTableDemo/src/main/webapp/WEB-INF/faces-config.xml 2008-07-25 14:36:59 UTC (rev 9790)
@@ -7,6 +7,13 @@
<managed-bean-class>org.richfaces.Bean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>testBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.TestBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<managed-bean>
<managed-bean-name>data</managed-bean-name>
<managed-bean-class>org.richfaces.Data</managed-bean-class>
Added: trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-4002.jsp
===================================================================
--- trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-4002.jsp (rev 0)
+++ trunk/samples/dataTableDemo/src/main/webapp/pages/page_RF-4002.jsp 2008-07-25 14:36:59 UTC (rev 9790)
@@ -0,0 +1,23 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+
+<html>
+ <head>
+ <title>RF-4002</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="_form">
+ <rich:dataTable value="1" id="dataTable">
+ <rich:column>
+ <h:inputText value="#{testBean.text}"></h:inputText>
+ <a4j:commandLink id="lnk" value="Submit" reRender="out"></a4j:commandLink>
+ <h:outputText id="out" value="#{testBean.text}"/>
+ </rich:column>
+ </rich:dataTable>
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
16 years, 5 months
JBoss Rich Faces SVN: r9788 - trunk/docs/cdkguide/en/src/main/resources/jspx.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-07-25 10:08:22 -0400 (Fri, 25 Jul 2008)
New Revision: 9788
Removed:
trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx
Log:
https://jira.jboss.org/jira/browse/RF-3692 - jspx folder was deleted
Deleted: trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx 2008-07-25 14:06:00 UTC (rev 9787)
+++ trunk/docs/cdkguide/en/src/main/resources/jspx/htmlInputDate.jspx 2008-07-25 14:08:22 UTC (rev 9788)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:h=" http://ajax4jsf.org/cdk/h"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:jsp=" http://ajax4jsf.org/cdk/jsp"
- class="org.mycompany.renderkit.html.InputDateRenderer"
- baseclass="org.mycompany.renderkit.InputDateRendererBase"
- component="org.mycompany.component.UIInputDate"
- >
- <f:clientid var="clientId"/>
- <h:styles>/org/mycompany/renderkit/html/css/inputDate.xcss</h:styles>
- <f:resource name="/org/mycompany/renderkit/html/images/inputDate.png" var="icon" />
- <c:object var="caption" type="javax.faces.component.UIComponent" />
- <jsp:scriptlet>
- <![CDATA[
- caption = component.getFacet("caption");
- if(caption !=null && caption.isRendered()) {]]>
- </jsp:scriptlet>
- <div id="#{clientId}_caption" class="my-inputDate-caption #{component.attributes['captionClass']}">
- <f:insertComponent value="#{caption}" />
- </div>
- <jsp:scriptlet>
- <![CDATA[}]]>
- </jsp:scriptlet>
- <div id="#{clientId}" title="#{value}" x:passThruWithExclusions="value,name,type,id">
- <input id="#{clientId}"
- name="#{clientId}"
- type="text"
- value="#{this:getValueAsString(context, component)}"
- class="my-inputDate-input #{component.attributes['inputClass']}"
- style="#{component.attributes['inputStyle']}"/>
-
- <jsp:scriptlet>
- <![CDATA[if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {]]>
- </jsp:scriptlet>
- <u:insertFacet name="icon" />
- <jsp:scriptlet>
- <![CDATA[
- }else{
- ]]>
- </jsp:scriptlet>
- <img src="#{icon}" class="my-inputDate-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}"/>
- <jsp:scriptlet>
- <![CDATA[
- }
- ]]>
- </jsp:scriptlet>
- </div>
-</f:root>
\ No newline at end of file
16 years, 5 months
JBoss Rich Faces SVN: r9787 - in trunk/docs/cdkguide/en/src/main: resources and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-07-25 10:06:00 -0400 (Fri, 25 Jul 2008)
New Revision: 9787
Added:
trunk/docs/cdkguide/en/src/main/resources/examples/
trunk/docs/cdkguide/en/src/main/resources/examples/InputDateRendererBase.java
trunk/docs/cdkguide/en/src/main/resources/examples/htmlInputDate.jspx
Modified:
trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml
trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml
Log:
https://jira.jboss.org/jira/browse/RF-3692 - 'Creating a Renderer Base class', 'Creating Converter' section creation
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml 2008-07-25 13:39:54 UTC (rev 9786)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/rendererbase.xml 2008-07-25 14:06:00 UTC (rev 9787)
@@ -10,5 +10,159 @@
</keywordset>
</sectioninfo>
<title>Creating a Renderer Base class</title>
- <para> How to create a base class </para>
+ <para>
+ After the component tree is restored on the <property>Restore View Phase </property>,
+ each component in the tree extracts its new value from the request parameters
+ by using its <code>decode()</code> method. Then the value is stored locally on the component.
+ </para>
+ <para>
+ The <code>InputDateRendererBase</code> class extends a <code>HeaderResourcesRendererBase</code>
+ class. In the <code>HeaderResourcesRendererBase</code> class all the <code>encode()</code> methods for
+ the right resources encoding
+ are already realized, so in the <code>InputDateRendererBase</code> class you need to override
+ the <code>decode()</code> method only:
+ </para>
+<programlisting role="JAVA"><![CDATA[ public void decode(FacesContext context, UIComponent component){
+ ExternalContext external = context.getExternalContext();
+ Map requestParams = external.getRequestParameterMap();
+ UIInputDate inputDate = (UIInputDate)component;
+ String clientId = inputDate.getClientId(context);
+ String submittedValue = (String)requestParams.get(clientId);
+ if (submittedValue != null) {
+ inputDate.setSubmittedValue(submittedValue);
+ }
+}
+]]></programlisting>
+<para>
+ As you see in the example above the <code>decode()</code> method reads values from request parameters,
+ grabs the <code>clientId</code> from the component to identify the request parameter to be looked up.
+ The <code>clientId</code> is calculated as the fully qualified name of the component given its container path:
+ <property>nameOfForm:nameOfComponent</property> (for example <property>myForm:inputDate</property>).
+ The last step of the <code>decode()</code> method is to store the submitted value locally on the component.
+</para>
+<note>
+ <title>Note:</title>
+ <para>
+ By default, the base Renderer implementation returns the <code>submittedValue</code> directly without any conversion!
+ If you want to convert submitted value to a strongly typed object you should implement <property>Converter</property>
+ and the <code>getConvertedValue()</code> method in your Renderer class (in our case in the <code>InputDateRendererBase</code> class).
+ </para>
+</note>
+<section id="converter" xreflabel="converter">
+ <?dbhtml filename="converter.html"?>
+ <sectioninfo>
+ <keywordset>
+ <keyword>converter</keyword>
+ <keyword>UI</keyword>
+ <keyword>CDK</keyword>
+ <keyword>Guide</keyword>
+ </keywordset>
+ </sectioninfo>
+ <title>Creating a Converter</title>
+<para>
+ As it was mentioned before the <emphasis role="bold"><property><inputDate></property></emphasis>
+ component at the <property>Apply Request Values</property> phase takes a value and pushes it
+ to the model as a strongly typed <property>Date</property> object.
+ Therefore you need to implement a <property>Converter</property> in the Renderer Base class and also check
+ whether a <property>Converter</property> has been already attached by the application developer.
+ If the conversion of the value fails, an error message associated with the component is generated
+ and queued on <property>FacesContext</property>.
+</para>
+<para>
+ The <code>getConverter()</code> method of the <code>InputDateRendererBase</code> class controls
+ the conversion of entered values, as shown in the following example:
+</para>
+<programlisting role="JAVA"><![CDATA[private Converter getConverter(FacesContext context, UIInputDate inputDate){
+ Converter converter = inputDate.getConverter();
+ if (converter == null){
+ // default the converter
+ DateTimeConverter datetime = new DateTimeConverter();
+ datetime.setLocale(context.getViewRoot().getLocale());
+ datetime.setTimeZone(TimeZone.getDefault());
+ datetime.setType("date");
+ datetime.setDateStyle("medium");
+ datetime.setPattern("d/m/y");
+ converter = datetime;
+ }
+ return converter;
+}
+]]></programlisting>
+<para>
+ At first you should check whether the application developer has attached a <property>Converter</property> to the
+ <emphasis role="bold"><property><inputDate></property></emphasis> component
+ (for example, <emphasis role="bold"><property><f:convertDateTime></property></emphasis>) .
+ If not you should follow the next steps:
+</para>
+<itemizedlist>
+ <listitem>
+ <para>
+ create a new <property>DateTimeConverter</property>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ get the locale for the client from the context with the help of the <code>getLocale()</code> method
+ and set it on the new <property>Converter</property> by means of the <code>setLocale()</code> method
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ set the time zone, date type, date style, and date pattern on the new converter with the help of
+ <code>setTimeZone</code>, <code>setType</code>, <code>setDateStyle</code>, and
+ <code>setPattern</code> methods respectively
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ return the <property>Converter</property>
+ </para>
+ </listitem>
+</itemizedlist>
+<para>
+ After the <property>Apply Request Values</property> phase the application enters the
+ <property>Process Validation</property> phase during which the <code>validate()</code> method
+ calls the <code>getConvertedValue()</code> method on every submitted value and passes
+ the newly submitted value from the decode process.
+</para>
+<para>
+ The <code>getConvertedValue()</code> method converts the submitted value to a strongly typed
+ object (in our case <property>Date</property>) using the <code>getAsObject()</code> method.
+ Then the new strongly typed object is validated and if there are no errors
+ <property>Process Validation</property> phase ends. Otherwise the <code>getConvertedValue()</code> method
+ throws a <property>ConverterException</property>.
+</para>
+<para>
+ Here is the snippet:
+</para>
+<programlisting role="JAVA"><![CDATA[public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException{
+ UIInputDate inputDate = (UIInputDate)component;
+ Converter converter = getConverter(context, inputDate);
+ String valueString = (String)submittedValue;
+ return converter.getAsObject(context, component, valueString);
+}]]></programlisting>
+ <para>
+ Finally on the the <property>Renderer Response</property> phase the value of the component is rendered back to the view.
+ The converter is responsible for transforming the object data back in to a string representation, so you need to
+ implement <code>getValueAsString</code>.
+ JSF calls the <code>getAsString</code> method of your <property>Converter</property> which converts an Object into a String.
+ </para>
+ <para>
+ Here is the example:
+ </para>
+ <programlisting role="JAVA"><![CDATA[protected String getValueAsString(FacesContext context, UIComponent component) throws IOException {
+ UIInputDate inputDate = (UIInputDate) component;
+ String valueString = (String) inputDate.getSubmittedValue();
+ if (valueString == null) {
+ Object value = inputDate.getValue();
+ if (value != null) {
+ Converter converter = getConverter(context, inputDate);
+ valueString = converter.getAsString(context, component, value);
+ }
+ }
+ return valueString;
+}]]></programlisting>
+ </section>
+ <para>
+ You could find the whole example of the <code>InputDateRendererBase</code> class <ulink url="examples/InputDateRendererBase.java">here</ulink>.
+ </para>
</section>
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml 2008-07-25 13:39:54 UTC (rev 9786)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/template.xml 2008-07-25 14:06:00 UTC (rev 9787)
@@ -104,7 +104,7 @@
the <emphasis role="bold">
<property><inputDate></property>
</emphasis> component:
- <ulink url="jspx/htmlInputDate.jspx">htmlInputDate.jspx</ulink>.
+ <ulink url="examples/htmlInputDate.jspx">htmlInputDate.jspx</ulink>.
</para>
<note>
<title>Note:</title>
Added: trunk/docs/cdkguide/en/src/main/resources/examples/InputDateRendererBase.java
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/examples/InputDateRendererBase.java (rev 0)
+++ trunk/docs/cdkguide/en/src/main/resources/examples/InputDateRendererBase.java 2008-07-25 14:06:00 UTC (rev 9787)
@@ -0,0 +1,72 @@
+package org.mycompany.renderkit;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.TimeZone;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.DateTimeConverter;
+
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.mycompany.component.UIInputDate;
+
+
+public abstract class InputDateRendererBase extends HeaderResourcesRendererBase{
+
+ public void decode(FacesContext context, UIComponent component){
+ ExternalContext external = context.getExternalContext();
+ Map requestParams = external.getRequestParameterMap();
+ UIInputDate inputDate = (UIInputDate)component;
+ String clientId = inputDate.getClientId(context);
+ String submittedValue = (String)requestParams.get(clientId);
+
+ if (submittedValue != null) {
+ inputDate.setSubmittedValue(submittedValue);
+ }
+ }
+
+ protected String getValueAsString(FacesContext context,
+ UIComponent component) throws IOException {
+
+ UIInputDate inputDate = (UIInputDate) component;
+ String valueString = (String) inputDate.getSubmittedValue();
+
+ if (valueString == null) {
+ Object value = inputDate.getValue();
+ if (value != null) {
+ Converter converter = getConverter(context, inputDate);
+ valueString = converter.getAsString(context, component, value);
+ }
+ }
+ return valueString;
+ }
+
+
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException
+ {
+ UIInputDate inputDate = (UIInputDate)component;
+ Converter converter = getConverter(context, inputDate);
+ String valueString = (String)submittedValue;
+ return converter.getAsObject(context, component, valueString);
+ }
+
+ private Converter getConverter(FacesContext context, UIInputDate inputDate)
+ {
+ Converter converter = inputDate.getConverter();
+ if (converter == null)
+ {
+ DateTimeConverter datetime = new DateTimeConverter();
+ datetime.setLocale(context.getViewRoot().getLocale());
+ datetime.setTimeZone(TimeZone.getDefault());
+ datetime.setType("date");
+ datetime.setDateStyle("medium");
+ datetime.setPattern("d/m/y");
+ converter = datetime;
+ }
+ return converter;
+ }
+}
Property changes on: trunk/docs/cdkguide/en/src/main/resources/examples/InputDateRendererBase.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/docs/cdkguide/en/src/main/resources/examples/htmlInputDate.jspx
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/examples/htmlInputDate.jspx (rev 0)
+++ trunk/docs/cdkguide/en/src/main/resources/examples/htmlInputDate.jspx 2008-07-25 14:06:00 UTC (rev 9787)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:h=" http://ajax4jsf.org/cdk/h"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:jsp=" http://ajax4jsf.org/cdk/jsp"
+ class="org.mycompany.renderkit.html.InputDateRenderer"
+ baseclass="org.mycompany.renderkit.InputDateRendererBase"
+ component="org.mycompany.component.UIInputDate"
+ >
+ <f:clientid var="clientId"/>
+ <h:styles>/org/mycompany/renderkit/html/css/inputDate.xcss</h:styles>
+ <f:resource name="/org/mycompany/renderkit/html/images/inputDate.png" var="icon" />
+ <c:object var="caption" type="javax.faces.component.UIComponent" />
+ <jsp:scriptlet>
+ <![CDATA[
+ caption = component.getFacet("caption");
+ if(caption !=null && caption.isRendered()) {]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}_caption" class="my-inputDate-caption #{component.attributes['captionClass']}">
+ <f:insertComponent value="#{caption}" />
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}" title="#{value}" x:passThruWithExclusions="value,name,type,id">
+ <input id="#{clientId}"
+ name="#{clientId}"
+ type="text"
+ value="#{this:getValueAsString(context, component)}"
+ class="my-inputDate-input #{component.attributes['inputClass']}"
+ style="#{component.attributes['inputStyle']}"/>
+
+ <jsp:scriptlet>
+ <![CDATA[if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {]]>
+ </jsp:scriptlet>
+ <u:insertFacet name="icon" />
+ <jsp:scriptlet>
+ <![CDATA[
+ }else{
+ ]]>
+ </jsp:scriptlet>
+ <img src="#{icon}" class="my-inputDate-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}"/>
+ <jsp:scriptlet>
+ <![CDATA[
+ }
+ ]]>
+ </jsp:scriptlet>
+ </div>
+</f:root>
\ No newline at end of file
Property changes on: trunk/docs/cdkguide/en/src/main/resources/examples/htmlInputDate.jspx
___________________________________________________________________
Name: svn:executable
+ *
16 years, 5 months
JBoss Rich Faces SVN: r9786 - in trunk: ui/dataTable/src/main/java/org/richfaces/renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-07-25 09:39:54 -0400 (Fri, 25 Jul 2008)
New Revision: 9786
Modified:
trunk/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
RF-3593
Modified: trunk/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-07-25 12:54:53 UTC (rev 9785)
+++ trunk/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-07-25 13:39:54 UTC (rev 9786)
@@ -5,6 +5,11 @@
<html>
<head>
<title></title>
+ <style type="">
+ .rich-sort-icon {
+ border: 1px solid;
+ }
+ </style>
</head>
<body>
<f:view>
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-07-25 12:54:53 UTC (rev 9785)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-07-25 13:39:54 UTC (rev 9786)
@@ -692,7 +692,7 @@
.writeAttribute(HTML.height_ATTRIBUTE, "15",
null);
writer.writeAttribute(HTML.class_ATTRIBUTE,
- "dr-table-header-sort-img", null);
+ "dr-table-header-sort-img rich-sort-icon", null);
writer.endElement(HTML.IMG_ELEMENT);
}
writer.endElement(HTML.SPAN_ELEM);
16 years, 5 months
JBoss Rich Faces SVN: r9785 - trunk/docs/cdkguide/en/src/main/docbook/includes.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-07-25 08:54:53 -0400 (Fri, 25 Jul 2008)
New Revision: 9785
Modified:
trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml
Log:
RF-3692 - Creating project for component was edited
Modified: trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml 2008-07-25 12:54:26 UTC (rev 9784)
+++ trunk/docs/cdkguide/en/src/main/docbook/includes/pcreate.xml 2008-07-25 12:54:53 UTC (rev 9785)
@@ -76,6 +76,71 @@
</tbody>
</tgroup>
</table>
+ <para>
+ It is necessary to extend predefined structure with the following directories:
+ </para>
+ <table>
+ <title>The project structure</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Directory</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ src/main/config/resources
+ </entry>
+ <entry>
+ Contains the <property>resource-config.xml</property> file for the resources registration
+ </entry>
+ </row>
+ <row>
+ <entry>
+ src/main/java/org/mycompany/renderkit
+ </entry>
+ <entry>
+ Contains Renderer Base class
+ </entry>
+ </row>
+ <row>
+ <entry>
+ src/main/resources/org/mycompany/renderkit/html/css
+ </entry>
+ <entry>
+ Used to store CSS files
+ </entry>
+ </row>
+ <row>
+ <entry>
+ src/main/resources/org/mycompany/renderkit/html/images
+ </entry>
+ <entry>
+ Used to store images
+ </entry>
+ </row>
+ <row>
+ <entry>
+ src/main/resources/org/mycompany/renderkit/html/scripts
+ </entry>
+ <entry>
+ Used to store JavaScript files
+ </entry>
+ </row>
+ <row>
+ <entry>
+ src/main/templates/org/mycompany
+ </entry>
+ <entry>
+ Used to contain the JSP-like template
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
<para> Now you should add <property>maven-compiler-plugin</property>
to the <property>plugins</property> section in the <property>inputDate/pom.xml</property> file: </para>
<programlisting role="XML"><![CDATA[...
16 years, 5 months
JBoss Rich Faces SVN: r9784 - in trunk/docs/cdkguide/en/src/main: resources/xslt/org/jboss/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-07-25 08:54:26 -0400 (Fri, 25 Jul 2008)
New Revision: 9784
Modified:
trunk/docs/cdkguide/en/src/main/docbook/master.xml
trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml.xsl
Log:
RF-3189 - chunked version of the 'CDK Development Guide' was fixed [ Show ?\194?\187 ] Gleb Galkin - 25/Jul/08 08:27 AM chunked version of the 'CDK Development Guide' was fixed
Modified: trunk/docs/cdkguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-07-25 12:12:43 UTC (rev 9783)
+++ trunk/docs/cdkguide/en/src/main/docbook/master.xml 2008-07-25 12:54:26 UTC (rev 9784)
@@ -67,7 +67,12 @@
<property><inputDate></property>
</emphasis> component allows to attach a converter in order to set the desired date
format such as <property>mm/dd/yyyy</property>. So the component could convert and
- validate the date entered by user. </para> &pcreate; &ccreate; &protoui;
+ validate the date entered by user. </para>
+ <?forseChanks?>
+ &pcreate;
+ &ccreate;
+ &protoui;
+
<section id="crenderer" xreflabel="crenderer">
<?dbhtml filename="crenderer.html"?>
<sectioninfo>
@@ -119,9 +124,17 @@
</para>
- &template; &rendererbase; &skin; </section> ®ister; &ui;
- &taghandler; </chapter> &test; &overview; <chapter id="button"
- xreflabel="button">
+ &template;
+ &rendererbase;
+ &skin;
+ </section>
+ ®ister;
+ &ui;
+ &taghandler;
+</chapter>
+ &test;
+ &overview;
+<chapter id="button" xreflabel="button">
<?dbhtml filename="button.html"?>
<chapterinfo>
<keywordset>
Modified: trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml.xsl
===================================================================
--- trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml.xsl 2008-07-25 12:12:43 UTC (rev 9783)
+++ trunk/docs/cdkguide/en/src/main/resources/xslt/org/jboss/richfaces/xhtml.xsl 2008-07-25 12:54:26 UTC (rev 9784)
@@ -10,7 +10,7 @@
<xsl:import href="classpath:/xslt/org/jboss/xhtml.xsl"/>
<xsl:import href="xhtml-common.xsl"/>
-
+
<xsl:param name="chunk.fast" select="1"/>
<xsl:template name="chunk">
@@ -18,7 +18,7 @@
<xsl:choose>
<xsl:when test="not($node/parent::*)">1</xsl:when>
- <xsl:when test="$node/parent::node()/processing-instruction('forseChanks') and local-name($node)!='title' and local-name($node)!='para'">1</xsl:when>
+ <xsl:when test="$node/parent::node()/processing-instruction('forseChanks') and local-name($node)!='title' and local-name($node)!='para' and local-name($node)='section'" >1</xsl:when>
<xsl:when test="local-name($node) = 'sect1'
and $chunk.section.depth >= 1
and ($chunk.first.sections != 0
16 years, 5 months