JBoss Rich Faces SVN: r12713 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-02-23 10:07:20 -0500 (Mon, 23 Feb 2009)
New Revision: 12713
Modified:
trunk/docs/userguide/en/src/main/docbook/included/modalPanel.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml
Log:
domElementAttachment
Modified: trunk/docs/userguide/en/src/main/docbook/included/modalPanel.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/modalPanel.desc.xml 2009-02-23 13:25:26 UTC (rev 12712)
+++ trunk/docs/userguide/en/src/main/docbook/included/modalPanel.desc.xml 2009-02-23 15:07:20 UTC (rev 12713)
@@ -14,7 +14,8 @@
code.</para>
<figure>
- <title><emphasis role="bold"><property><rich:modalPanel></property></emphasis> component</title>
+ <title>The <emphasis role="bold"><property><rich:modalPanel></property></emphasis> component opens in closest to observer layer.
+ All other layers are dimmed by blocking <code><div></code> element (gray on the picture).</title>
<mediaobject>
<imageobject>
Modified: trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml 2009-02-23 13:25:26 UTC (rev 12712)
+++ trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml 2009-02-23 15:07:20 UTC (rev 12713)
@@ -155,20 +155,20 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[...
- <rich:modalPanel id="panel" width="400" height="300">
- <f:facet name="header">
- <h:outputText value="Modal Panel"/>
- </f:facet>
- <h:graphicImage value="/pages/california_large.png"/>
- <a href="javascript:Richfaces.hideModalPanel('form:panel')">Close</a>
- </rich:modalPanel>
- <a href="javascript:Richfaces.showModalPanel('form:panel');">Open</a>
-...]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a onclick="Richfaces.showModalPanel('pnl');" href="#">Show ModalPanel</a>
+<a4j:form>
+ <rich:modalPanel id="pnl">
+ <f:facet name="header">
+ <h:outputText value="This is a panel header" />
+ </f:facet>
+ <p>The <rich:modalPanel> accepts different types of information:
+ from simple text to iterative components such as <rich:dataTable>, etc.
+ </p>
+ <a onclick="Richfaces.hideModalPanel('pnl');" href="#">Hide</a>
+ </rich:modalPanel>
+</a4j:form>]]></programlisting>
- <para>This defines a window with a particular size and ID. It includes one
- "Open" link. Clicking on this link makes the modal window content
- appear.</para>
+ <para>Here is what happening on the page:</para>
<figure>
<title><emphasis role="bold">
@@ -191,24 +191,26 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[...
-<rich:modalPanel id="mp">
- <f:facet name="header">
- <h:outputText value="Modal Panel"/>
- </f:facet>
- <f:facet name="controls">
- <h:graphicImage value="/pages/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('mp')" />
- </f:facet>
- <h:graphicImage value="/pages/california_large.png"/>
-</rich:modalPanel>
-...]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a onclick="Richfaces.showModalPanel('pnl');" href="#">Show ModalPanel</a>
+<a4j:form>
+ <rich:modalPanel id="pnl">
+ <f:facet name="header">
+ <h:outputText value="This is a panel header" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:graphicImage value="/pages/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('pnl')" />
+ </f:facet>
+ <p>The <rich:modalPanel> accepts different types of information:
+ from simple text to iterative components such as <rich:dataTable>, etc.
+ </p>
+ </rich:modalPanel>
+</a4j:form>]]></programlisting>
- <para>The result is displayed here:</para>
+ <para>The result:</para>
<figure>
- <title><emphasis role="bold">
- <property><rich:modalPanel></property>
- </emphasis> with control element</title>
+ <title><emphasis role="bold"><property><rich:modalPanel></property></emphasis>
+ with 'Close' control</title>
<mediaobject>
<imageobject>
@@ -217,11 +219,25 @@
</mediaobject>
</figure>
- <para>To manage the placement of inserted windows, use the <emphasis>
- <property>"zindex"</property>
- </emphasis> attribute that is similar to the standard HTML attribute
- and can specify window placement relative to the content.</para>
-
+ <para>To understand the sence of "<emphasis><property>domElementAttachment</property></emphasis>" attribute
+ you should understand the <emphasis>stacking context</emphasis> in the division element (<code><div></code>) HTML makeup.
+ Since each positioned or z-indexed element (in CSS <code>position: absolute</code> or <code>relative</code> or <code>z-index: [any integer value different from 0]</code>)
+ form their own stacking context the <emphasis role="bold"><property><rich:modalPanel></property></emphasis> nested into such element
+ may be overlapped with another elements, which appear later in HTML heirarchy and assimilated with basic stacking context (HTML <body>).
+ To make the panel rendered in closest to the observer layer and avoid such overlapping, the component was designed in way when
+ it is always being automatically assimilated with <code><body></code> and with a very high rendering layer (<code>z-index</code>).
+ Due to some side effects the <emphasis role="bold"><property><rich:modalPanel></property></emphasis> should not always be
+ assimilated with <code><body></code> stacking context. The "<emphasis><property>domElementAttachment</property></emphasis>"
+ attribute helps to reassign the panel to it '<emphasis>parent</emphasis>' or '<emphasis>form</emphasis>' element.
+ If '<emphasis>form</emphasis>' is used and no parent form is available the panel is functioning as if it is assimilated with <code><body></code>.
+ </para>
+
+ <note>
+ <title>Note:</title>
+ <para>If "<emphasis><property>domElementAttachment</property></emphasis>" value is not '<emphasis>body</emphasis>' then some overlapping may occur.
+ </para>
+ </note>
+
<para>To manage window placement relative to the component, there are <emphasis>
<property>"left"</property>
</emphasis> and <emphasis>
@@ -297,9 +313,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[...
-<a href="javascript:Richfaces.showModalPanel('_panel', {top:'10px', left:'10px', height:'400'});">Show</a>
-...]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a href="javascript:Richfaces.showModalPanel('pnl', {top:'10px', left:'10px', height:'400'});">Show</a>]]></programlisting>
<para> Here, if you open modal dialog window using current link and after
submits data then modalPanel destination and height on new loaded page
@@ -322,23 +336,18 @@
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[...
-<rich:modalPanel>
- <f:facet name="header">
- <h:outputText value="Test" />
- </f:facet>
- <f:facet name="controls">
- <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('mp')" />
- </f:facet>
- <h:form>
- <h:commandButton value="Test" action="#{TESTCONTROLLER.test}" />
- </h:form>
-</rich:modalPanel>
-...
-<h:form>
- <!--Some other Page content-->
-</h:form>
-...]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a4j:form>
+ <rich:modalPanel>
+ <f:facet name="header">
+ <h:outputText value="Test" />
+ </f:facet>
+ <f:facet name="controls">
+ <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('mp')" />
+ </f:facet>
+ <h:form>
+ <h:commandButton value="Test" action="#{TESTCONTROLLER.test}" />
+ </h:form>
+ </rich:modalPanel>]]></programlisting>
@@ -622,14 +631,14 @@
<entry>Defines styles for a wrapper
<div> element of
- a modalpanel</entry>
+ a modalPanel</entry>
</row>
<row>
<entry>rich-mpnl_panel</entry>
<entry>Defines styles for a
- modalpanel</entry>
+ modalPanel</entry>
</row>
<row>
@@ -651,14 +660,14 @@
<row>
<entry>rich-mpnl-shadow</entry>
- <entry>Defines styles for a modalpanel
+ <entry>Defines styles for a modalPanel
shadow</entry>
</row>
<row>
<entry>rich-mpnl-header</entry>
- <entry>Defines styles for a modalpanel
+ <entry>Defines styles for a modalPanel
header</entry>
</row>
@@ -681,7 +690,7 @@
<entry>rich-mpnl-body</entry>
<entry>Defines styles for a content
- inside a modalpanel</entry>
+ inside a modalPanel</entry>
</row>
<row>
@@ -689,7 +698,7 @@
<entry>Defines styles for a wrapper
<div> element of
- a modalpanel control</entry>
+ a modalPanel control</entry>
</row>
</tbody>
</tgroup>
15 years, 2 months
JBoss Rich Faces SVN: r12712 - trunk/ui/dataTable/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2009-02-23 08:25:26 -0500 (Mon, 23 Feb 2009)
New Revision: 12712
Modified:
trunk/ui/dataTable/src/main/config/component/columnAttributes.ent
Log:
RF-6005 - Descriptions of the sortBy and sortExpression (for all necessary components) have been updated.
Modified: trunk/ui/dataTable/src/main/config/component/columnAttributes.ent
===================================================================
--- trunk/ui/dataTable/src/main/config/component/columnAttributes.ent 2009-02-23 12:59:52 UTC (rev 12711)
+++ trunk/ui/dataTable/src/main/config/component/columnAttributes.ent 2009-02-23 13:25:26 UTC (rev 12712)
@@ -52,12 +52,12 @@
<property>
<name>sortExpression</name>
<classname>java.lang.String</classname>
- <description>Attribute defines a bean property which is used for sorting of a column</description>
+ <description>Defines a bean property which is used for sorting of a column and used only with <rich:scrollableDataTable>.</description>
</property>
<property>
<name>sortBy</name>
<classname>java.lang.Object</classname>
- <description>Attribute defines a bean property which is used for sorting of a column</description>
+ <description>Defines a bean property which is used for sorting of a column. This attribute used with <rich:dataTable></description>
</property>
<property>
<name>sortOrder</name>
15 years, 2 months
JBoss Rich Faces SVN: r12711 - in trunk/test-applications/qa/Test Reports: 3.3.1 and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-02-23 07:59:52 -0500 (Mon, 23 Feb 2009)
New Revision: 12711
Added:
trunk/test-applications/qa/Test Reports/3.3.1/
trunk/test-applications/qa/Test Reports/3.3.1/ComponentsAssignment3.3.1.xls
Log:
Added: trunk/test-applications/qa/Test Reports/3.3.1/ComponentsAssignment3.3.1.xls
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/qa/Test Reports/3.3.1/ComponentsAssignment3.3.1.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 2 months
JBoss Rich Faces SVN: r12710 - in trunk/framework/impl/src/main: java/org/ajax4jsf/webapp and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-02-20 17:54:18 -0500 (Fri, 20 Feb 2009)
New Revision: 12710
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js
Log:
https://jira.jboss.org/jira/browse/RF-4187
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2009-02-20 22:52:53 UTC (rev 12709)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2009-02-20 22:54:18 UTC (rev 12710)
@@ -38,9 +38,12 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
@@ -70,12 +73,16 @@
private Integer contentLength = 0;
+ private int bytesRead = 0;
+
private int read = 0;
private Map<String, Param> parameters = null;
private Map<String, Object> percentMap = null;
+ private Map<String, MultipartRequest> requestsMap = null;
+
private List<String> keys = new ArrayList<String>();
private enum ReadState {
@@ -354,184 +361,302 @@
}
}
- public boolean parseRequest() {
- byte[] boundaryMarker = getBoundaryMarker(super.getContentType());
- if (boundaryMarker == null) {
- throw new FileUploadException("The request was rejected because "
- + "no multipart boundary was found");
- }
+ private byte[] boundaryMarker;
+
+ private byte[] buffer;
+
+ private ReadState readState;
+
+ private InputStream input;
+
+ private int pos = 0;
- encoding = getCharacterEncoding();
+ private int zeroReadAttempts = 20; // 20 attempts to read not-readable data
+
+ private void fillBuffer() throws IOException {
+ if (!shouldStop) {
+ if (pos < read) {
+ // move the bytes that weren't read to the start of
+ // the
+ // buffer
+ int bytesNotRead = read - pos;
+
+ if (bytesNotRead != buffer.length) {
+ System.arraycopy(buffer, pos, buffer, 0,
+ bytesNotRead);
+ read = input.read(buffer, bytesNotRead,
+ buffer.length - bytesNotRead);
+
+ if (read != 0 || --zeroReadAttempts != 0) {
+ if (read > 0) {
+ bytesRead += read;
+ }
- parameters = new HashMap<String, Param>();
+ read += bytesNotRead;
+ } else {
+ //read is already zero
+ //read = 0;
+ }
+ } else {
+ read = bytesNotRead;
+ }
+ } else {
+ read = input.read(buffer);
- int loopCounter = 20; // 20 attempts to read not-readable data
+ if (read > 0) {
+ bytesRead += read;
+ }
+ }
+
+ fillProgressInfo();
+ pos = 0;
+ } else {
+ cancel();
+ read = -1;
+ }
+ }
+
+ private void readNext() throws IOException {
+ Param p = readHeader();
+ readData(p);
+ }
- this.percentMap = getProgressData();
+ private void readData(Param p) throws IOException {
+ int localRead = this.read;
+
+ while (localRead > 0) {
+ for (int i = this.pos; i < localRead; i++) {
+ // If we've encountered another boundary...
+ if (checkSequence(buffer, i - boundaryMarker.length
+ - CR_LF.length, CR_LF)
+ && checkSequence(buffer, i, boundaryMarker)) {
+ // Write any data before the boundary (that
+ // hasn't
+ // already been written) to the param
+ if (pos < i - boundaryMarker.length
+ - CR_LF.length - 1) {
+ p.appendData(buffer, pos, i - pos
+ - boundaryMarker.length
+ - CR_LF.length - 1);
+ }
- try {
- byte[] buffer = new byte[BUFFER_SIZE];
- Map<String, String> headers = new HashMap<String, String>();
+ if (p instanceof ValueParam)
+ ((ValueParam) p).complete();
- ReadState readState = ReadState.BOUNDARY;
+ if (checkSequence(buffer, i + CR_LF.length,
+ CR_LF)) {
+ i += CR_LF.length;
+ pos = i + 1;
+ } else {
+ pos = i;
+ }
- InputStream input = getInputStream();
- if (!shouldStop) {
+ readState = ReadState.HEADERS;
+ break;
+ }
+ // Otherwise write whatever data we have to the
+ // param
+ else if (i > (pos + boundaryMarker.length
+ + CHUNK_SIZE + CR_LF.length)) {
+ p.appendData(buffer, pos, CHUNK_SIZE);
+ pos += CHUNK_SIZE;
- int read = input.read(buffer);
- int pos = 0;
+ }
+ }
+
+ if (ReadState.DATA.equals(readState)) {
+ fillBuffer();
+ localRead = this.read;
+ } else {
+ break;
+ }
+ }
+ }
- Param p = null;
+ private Param readHeader() throws IOException {
+ Param p = null;
- while (read > 0 && loopCounter > 0) {
- for (int i = 0; i < read; i++) {
- switch (readState) {
- case BOUNDARY: {
- if (checkSequence(buffer, i, boundaryMarker)
- && checkSequence(buffer, i + 2, CR_LF)) {
- readState = ReadState.HEADERS;
- i += 2;
- pos = i + 1;
+ Map<String, String> headers = new HashMap<String, String>();
- }
- break;
- }
- case HEADERS: {
- if (checkSequence(buffer, i, CR_LF)) {
- String param = (encoding == null) ? new String(
- buffer, pos, i - pos - 1) : new String(
- buffer, pos, i - pos - 1, encoding);
- parseParams(param, "; ", headers);
+ int localRead = this.read;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
+
+ while (localRead > 0) {
+ for (int i = this.pos; i < localRead; i++) {
+ if (checkSequence(buffer, i, CR_LF)) {
+ baos.write(buffer, pos, i - pos - 1);
- if (checkSequence(buffer, i + CR_LF.length,
- CR_LF)) {
- readState = ReadState.DATA;
- i += CR_LF.length;
- pos = i + 1;
+ String param = (encoding == null) ?
+ new String(baos.toByteArray()) :
+ new String(baos.toByteArray(), encoding);
- String paramName = headers.get(PARAM_NAME);
- if (paramName != null) {
- if (headers.containsKey(PARAM_FILENAME)) {
- FileParam fp = new FileParam(
- paramName);
- if (createTempFiles)
- fp.createTempFile();
- fp.setContentType(headers
- .get(PARAM_CONTENT_TYPE));
- fp
- .setFilename(decodeFileName(headers
- .get(PARAM_FILENAME)));
- p = fp;
- } else {
- if (parameters
- .containsKey(paramName)) {
- p = parameters.get(paramName);
- } else {
- p = new ValueParam(paramName);
- }
- }
+ parseParams(param, "; ", headers);
- if (!parameters.containsKey(paramName)) {
- parameters.put(paramName, p);
- }
- }
+ if (checkSequence(buffer, i + CR_LF.length,
+ CR_LF)) {
+ readState = ReadState.DATA;
+ i += CR_LF.length;
+ pos = i + 1;
- headers.clear();
+ String paramName = headers.get(PARAM_NAME);
+ if (paramName != null) {
+ if (headers.containsKey(PARAM_FILENAME)) {
+ FileParam fp = new FileParam(
+ paramName);
+ if (createTempFiles)
+ fp.createTempFile();
+ fp.setContentType(headers
+ .get(PARAM_CONTENT_TYPE));
+ fp
+ .setFilename(decodeFileName(headers
+ .get(PARAM_FILENAME)));
+ p = fp;
+ } else {
+ if (parameters
+ .containsKey(paramName)) {
+ p = parameters.get(paramName);
} else {
- pos = i + 1;
+ p = new ValueParam(paramName);
}
}
- break;
+
+ if (!parameters.containsKey(paramName)) {
+ parameters.put(paramName, p);
+ }
}
- case DATA: {
- // If we've encountered another boundary...
- if (checkSequence(buffer, i - boundaryMarker.length
- - CR_LF.length, CR_LF)
- && checkSequence(buffer, i, boundaryMarker)) {
- // Write any data before the boundary (that
- // hasn't
- // already been written) to the param
- if (pos < i - boundaryMarker.length
- - CR_LF.length - 1) {
- p.appendData(buffer, pos, i - pos
- - boundaryMarker.length
- - CR_LF.length - 1);
- }
- if (p instanceof ValueParam)
- ((ValueParam) p).complete();
+ headers.clear();
+ baos.reset();
+
+ break;
+ } else {
+ pos = i + 1;
+ baos.reset();
+ }
+ }
+ }
+
+ if (ReadState.HEADERS.equals(readState)) {
+ baos.write(buffer, pos, read - pos);
+ pos = read;
+ fillBuffer();
+ localRead = this.read;
+ } else {
+ break;
+ }
+ }
+ return p;
+ }
- if (checkSequence(buffer, i + CR_LF.length,
- CR_LF)) {
- i += CR_LF.length;
- pos = i + 1;
- } else {
- pos = i;
- }
+ boolean initialized = false;
+
+ private void initialize() throws IOException {
+ if (!initialized) {
+ initialized = true;
- readState = ReadState.HEADERS;
- }
- // Otherwise write whatever data we have to the
- // param
- else if (i > (pos + boundaryMarker.length
- + CHUNK_SIZE + CR_LF.length)) {
- p.appendData(buffer, pos, CHUNK_SIZE);
- pos += CHUNK_SIZE;
+ this.boundaryMarker = getBoundaryMarker(super.getContentType());
+ if (this.boundaryMarker == null) {
+ throw new FileUploadException("The request was rejected because "
+ + "no multipart boundary was found");
+ }
- }
- break;
- }
- }
+ this.encoding = getCharacterEncoding();
+
+ this.parameters = new HashMap<String, Param>();
+
+ this.buffer = new byte[BUFFER_SIZE];
+
+ this.readState = ReadState.BOUNDARY;
+
+ this.input = getInputStream();
+
+ setupProgressData();
+
+ fillBuffer();
+ int localRead = this.read;
+
+ while (localRead > 0) {
+ for (int i = 0; i < localRead; i++) {
+ if (checkSequence(buffer, i, boundaryMarker)
+ && checkSequence(buffer, i + 2, CR_LF)) {
+ readState = ReadState.HEADERS;
+ i += 2;
+ pos = i + 1;
+
+ break;
}
+ }
+
+ if (ReadState.BOUNDARY.equals(readState)) {
+ pos = read - (boundaryMarker.length + CR_LF.length) + 1;
+ fillBuffer();
+ localRead = this.read;
+ } else {
+ break;
+ }
+ }
+
+ }
+ }
+
+ public void parseRequest() {
+ try {
+ initialize();
+
+ while (read >= 0) {
+ readNext();
+ }
+
+ } catch (IOException e) {
+ throw new FileUploadException("IO Error parsing multipart request", e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void setupProgressData() {
+ if (percentMap == null || requestsMap == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (facesContext != null) {
+ ExternalContext externalContext = facesContext.getExternalContext();
+ if (externalContext != null) {
+ Map<String, Object> sessionMap = externalContext.getSessionMap();
+ if (sessionMap != null) {
+ String uploadId = getUploadId();
- if (!shouldStop) {
- if (pos < read) {
- // move the bytes that weren't read to the start of
- // the
- // buffer
- int bytesNotRead = read - pos;
- System.arraycopy(buffer, pos, buffer, 0,
- bytesNotRead);
- read = input.read(buffer, bytesNotRead,
- buffer.length - bytesNotRead);
- if (read <= 0) {
- loopCounter--;
+ synchronized (sessionMap) {
+ if (percentMap == null) {
+ percentMap = (Map<String, Object>) sessionMap.get(FileUploadConstants.PERCENT_BEAN_NAME);
+ if (percentMap == null) {
+ percentMap = new ConcurrentHashMap<String, Object>();
+ sessionMap.put(FileUploadConstants.PERCENT_BEAN_NAME, percentMap);
+ }
+ percentMap.put(uploadId, Double.valueOf(0));
}
- read += bytesNotRead;
- } else {
- read = input.read(buffer);
+
+ if (requestsMap == null) {
+ requestsMap = (Map<String, MultipartRequest>) sessionMap.get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
+ if (requestsMap == null) {
+ requestsMap = new ConcurrentHashMap<String, MultipartRequest>();
+ sessionMap.put(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME, requestsMap);
+ }
+ requestsMap.put(uploadId, this);
+ }
}
- this.read += pos;
- pos = 0;
- fillProgressInfo();
- } else {
- cancel();
- return false;
}
}
-
- return true;
- } else {
- cancel();
- return false;
}
- } catch (IOException ex) {
- throw new FileUploadException("IO Error parsing multipart request",
- ex);
}
}
- @SuppressWarnings("unchecked")
- private Map<String, Object> getProgressData() {
- percentMap = (Map<String, Object>) getSession().getAttribute(
- FileUploadConstants.PERCENT_BEAN_NAME);
- return percentMap;
- }
-
private void fillProgressInfo() {
- Double percent = (Double) (100.0 * this.read / this.contentLength);
- percentMap.put(uid, percent);
- // this.percent = percent;
+ setupProgressData();
+
+ if (percentMap != null) {
+ Double percent = (Double) (100.0 * this.bytesRead / this.contentLength);
+ percentMap.put(uid, percent);
+ // this.percent = percent;
+ }
}
private byte[] getBoundaryMarker(String contentType) {
@@ -618,9 +743,25 @@
}
private Param getParam(String name) {
- if (parameters == null)
- parseRequest();
- return parameters.get(name);
+ Param param = null;
+ if (parameters != null) {
+ param = parameters.get(name);
+ }
+
+ if (param == null) {
+ try {
+ initialize();
+
+ while (param == null && read > 0) {
+ readNext();
+ param = parameters.get(name);
+ }
+ } catch (IOException e) {
+ throw new FileUploadException("IO Error parsing multipart request", e);
+ }
+ }
+
+ return param;
}
public Integer getSize() {
@@ -689,6 +830,8 @@
@Override
public String[] getParameterValues(String name) {
+ parseRequest();
+
Param p = getParam(name);
if (p != null && p instanceof ValueParam) {
ValueParam vp = (ValueParam) p;
@@ -753,8 +896,28 @@
shouldStop = true;
}
+ public boolean isStopped() {
+ return shouldStop;
+ }
+
@Override
public String getContentType() {
return "application/x-www-form-urlencoded";
}
+
+ protected String getUploadId() {
+ return uid;
+ }
+
+ public void clearRequestData() {
+ String uploadId = getUploadId();
+
+ if (percentMap != null) {
+ percentMap.remove(uploadId);
+ }
+
+ if (requestsMap != null) {
+ requestsMap.remove(uploadId);
+ }
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2009-02-20 22:52:53 UTC (rev 12709)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2009-02-20 22:54:18 UTC (rev 12710)
@@ -324,8 +324,6 @@
if (isMultipartRequest(httpRequest)) {
MultipartRequest multipartRequest = new MultipartRequest(httpRequest, createTempFiles, maxRequestSize, uid);
- Map<String, MultipartRequest> sessionsMap = null;
- Map<String, Object> percentMap = null;
try {
if (isFileSizeRestricted(request, maxRequestSize)) {
@@ -343,45 +341,21 @@
printResponse(response, "<html id=\"_richfaces_file_upload_forbidden\"></html>");
} else {
- HttpSession session = httpRequest.getSession();
- synchronized (session) {
- sessionsMap = (Map<String, MultipartRequest>) session.getAttribute(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
- percentMap = (Map<String, Object>) session.getAttribute(FileUploadConstants.PERCENT_BEAN_NAME);
- if (sessionsMap == null) {
- sessionsMap = Collections.synchronizedMap(new HashMap<String, MultipartRequest>());
- session.setAttribute(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME, sessionsMap);
+ handleRequest(multipartRequest, multipartRequest.isFormUpload() ? response :
+ new HttpServletResponseWrapper((HttpServletResponse) response){
+ @Override
+ public void setContentType(String type) {
+ super.setContentType(BaseXMLFilter.TEXT_HTML + ";charset=UTF-8");
}
- if (percentMap == null) {
- percentMap = new HashMap<String, Object>();
- session.setAttribute(FileUploadConstants.PERCENT_BEAN_NAME, percentMap);
- }
- }
+ }, chain);
- /* associate percent value with file entry uid */
- percentMap.put(uid, 0);
- sessionsMap.put(uid, multipartRequest);
-
- if (multipartRequest.parseRequest()) {
- handleRequest(multipartRequest, multipartRequest.isFormUpload() ? response :
- new HttpServletResponseWrapper(response){
- @Override
- public void setContentType(String type) {
- super.setContentType(BaseXMLFilter.TEXT_HTML + ";charset=UTF-8");
- }
- }, chain);
- } else {
+ if (multipartRequest.isStopped()) {
printResponse(response, "<html id=\"_richfaces_file_upload_stopped\"></html>");
}
-
}
} finally {
-
- if (sessionsMap != null) {
- sessionsMap.remove(uid);
- percentMap.remove(uid);
- }
-
+ multipartRequest.clearRequestData();
}
} else {
handleRequest(request, response, chain);
Modified: trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js 2009-02-20 22:52:53 UTC (rev 12709)
+++ trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js 2009-02-20 22:54:18 UTC (rev 12710)
@@ -34,7 +34,14 @@
input.id=param;
input.name=param;
input.value=parameters[param];
- form.appendChild(input);
+
+ if (param === "javax.faces.portletbridge.STATE_ID" /* fix for fileUpload in portlets */
+ && form.firstChild) {
+
+ form.insertBefore(input, form.firstChild);
+ } else {
+ form.appendChild(input);
+ }
}
}
}
15 years, 2 months
JBoss Rich Faces SVN: r12709 - in trunk/ui/fileUpload/src/main: config/faces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-02-20 17:52:53 -0500 (Fri, 20 Feb 2009)
New Revision: 12709
Added:
trunk/ui/fileUpload/src/main/config/faces/
trunk/ui/fileUpload/src/main/config/faces/phase-listener.inc
trunk/ui/fileUpload/src/main/java/org/richfaces/component/FileUploadPhaselistener.java
Log:
https://jira.jboss.org/jira/browse/RF-4187
Added: trunk/ui/fileUpload/src/main/config/faces/phase-listener.inc
===================================================================
--- trunk/ui/fileUpload/src/main/config/faces/phase-listener.inc (rev 0)
+++ trunk/ui/fileUpload/src/main/config/faces/phase-listener.inc 2009-02-20 22:52:53 UTC (rev 12709)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <lifecycle>
+ <phase-listener>org.richfaces.component.FileUploadPhaselistener</phase-listener>
+ </lifecycle>
+</faces-config>
+
Added: trunk/ui/fileUpload/src/main/java/org/richfaces/component/FileUploadPhaselistener.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/FileUploadPhaselistener.java (rev 0)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/FileUploadPhaselistener.java 2009-02-20 22:52:53 UTC (rev 12709)
@@ -0,0 +1,73 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.richfaces.component;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.ajax4jsf.request.MultipartRequest;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.1
+ */
+public class FileUploadPhaselistener implements PhaseListener {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3243506714022741982L;
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
+ */
+ public void afterPhase(PhaseEvent event) {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent)
+ */
+ public void beforePhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Object request = externalContext.getRequest();
+ if (request instanceof MultipartRequest) {
+ MultipartRequest multipartRequest = (MultipartRequest) request;
+ multipartRequest.parseRequest();
+ if (multipartRequest.isStopped()) {
+ facesContext.responseComplete();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.PhaseListener#getPhaseId()
+ */
+ public PhaseId getPhaseId() {
+ return PhaseId.RESTORE_VIEW;
+ }
+
+}
15 years, 2 months
JBoss Rich Faces SVN: r12708 - in management/design: realWorldDemo and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-02-20 15:35:54 -0500 (Fri, 20 Feb 2009)
New Revision: 12708
Added:
management/design/realWorldDemo/
management/design/realWorldDemo/001_my-tree-collaps-shelfs.png
management/design/realWorldDemo/002_my-tree-expand+shelfs.png
management/design/realWorldDemo/003_my-shelf-selected.png
management/design/realWorldDemo/004_my-tree-all-albums-expand.png
management/design/realWorldDemo/005_my-tree-all-photos-expand.png
management/design/realWorldDemo/006_1_album-preview_delete.png
management/design/realWorldDemo/006_album-preview.png
management/design/realWorldDemo/007_album-edit.png
management/design/realWorldDemo/008_1_photo-preview-delete.png
management/design/realWorldDemo/008_photo-preview.png
management/design/realWorldDemo/009_photo-edit.png
management/design/realWorldDemo/010_search-panel.png
management/design/realWorldDemo/011_1_search-results-true.png
management/design/realWorldDemo/011_search-results.png
management/design/realWorldDemo/012_user-preferences.png
management/design/realWorldDemo/013_slideshow.png
Log:
Real-world demo screens check-in
Added: management/design/realWorldDemo/001_my-tree-collaps-shelfs.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/001_my-tree-collaps-shelfs.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/002_my-tree-expand+shelfs.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/002_my-tree-expand+shelfs.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/003_my-shelf-selected.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/003_my-shelf-selected.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/004_my-tree-all-albums-expand.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/004_my-tree-all-albums-expand.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/005_my-tree-all-photos-expand.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/005_my-tree-all-photos-expand.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/006_1_album-preview_delete.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/006_1_album-preview_delete.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/006_album-preview.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/006_album-preview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/007_album-edit.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/007_album-edit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/008_1_photo-preview-delete.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/008_1_photo-preview-delete.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/008_photo-preview.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/008_photo-preview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/009_photo-edit.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/009_photo-edit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/010_search-panel.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/010_search-panel.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/011_1_search-results-true.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/011_1_search-results-true.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/011_search-results.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/011_search-results.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/012_user-preferences.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/012_user-preferences.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: management/design/realWorldDemo/013_slideshow.png
===================================================================
(Binary files differ)
Property changes on: management/design/realWorldDemo/013_slideshow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 2 months
JBoss Rich Faces SVN: r12707 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2009-02-20 12:55:57 -0500 (Fri, 20 Feb 2009)
New Revision: 12707
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedList.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedListAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractDataListTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataOrderedListTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataListTest.java
Log:
RF-5694
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedList.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedList.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedList.xhtml 2009-02-20 17:55:57 UTC (rev 12707)
@@ -0,0 +1,50 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="attrForm">
+ <h:outputText value="rows" />
+ <h:inputText id="rows" value="#{dataList.rows}">
+ <a4j:support event="onchange" reRender="panelGroup"/>
+ </h:inputText>
+ </h:form>
+ <h:form id="mainForm">
+ <h:panelGroup id="panelGroup">
+ <rich:dataOrderedList id="dataList" value="#{dataList.model}" var="rows"
+ rows="#{dataList.rows}" ajaxKeys="#{dataList.ajaxKeys}"
+ stateVar="stateVar" rowKeyVar="rowKeyVar"
+ componentState="#{componentState}"
+ rowKeyConverter="#{dataList.rowKeyConverter}">
+ <h:outputText id="rowKeyVar" value="#{rowKeyVar} "></h:outputText>
+ <h:outputText id="first" value="#{stateVar.range.firstRow} "></h:outputText>
+ <h:outputText id="rows" value="#{stateVar.range.rows} "></h:outputText>
+ <h:outputText id="firstState" value="#{componentState.range.firstRow} "></h:outputText>
+ <h:outputText id="rowsState" value="#{componentState.range.rows} "></h:outputText>
+ <h:outputText value="#{rows.cell1}"></h:outputText>
+ <h:inputText id="inputText" value="#{rows.cell2}" validator="#{dataList.validate}"></h:inputText>
+ <h:outputText value="#{rows.cell3}"></h:outputText>
+ <h:commandButton id="submit" value="submit" actionListener="#{dataList.submit}"></h:commandButton>
+ <a4j:commandButton id="ajaxSubmit" value="ajaxSubmit" actionListener="#{dataList.submit}"></a4j:commandButton>
+ <a4j:commandButton id="ajaxSingleSubmit" value="ajaxSingleSubmit" actionListener="#{dataList.submit}" ajaxSingle="true"></a4j:commandButton>
+ </rich:dataOrderedList>
+ <a4j:commandButton id="reRender" value="reRender" reRender="inputText" actionListener="#{dataList.reRender}"></a4j:commandButton>
+ </h:panelGroup>
+ </h:form>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:outputText id="outputText" value="#{dataList.trace}"></h:outputText>
+ <h:dataTable id="dataTable" value="#{dataList.model}" var="row" rows="#{dataList.rows}">
+ <h:column>
+ <h:outputText value="#{row.cell2}"></h:outputText>
+ </h:column>
+ </h:dataTable>
+ </a4j:outputPanel>
+ <rich:messages></rich:messages>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedListAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedListAutoTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataList/dataOrderedListAutoTest.xhtml 2009-02-20 17:55:57 UTC (rev 12707)
@@ -0,0 +1,31 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:dataOrderedList id="componentId" value="#{dataGrid.model}" var="row"
+ rendered="#{autoTestBean.rendered}"
+ style="width: 100%; color: yellow"
+ styleClass="noname"
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ >
+ <h:panelGroup>
+ <h:inputText id="inputText" value="#{row.cell2}"></h:inputText>
+ </h:panelGroup>
+ </rich:dataOrderedList>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractDataListTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractDataListTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractDataListTest.java 2009-02-20 17:55:57 UTC (rev 12707)
@@ -0,0 +1,154 @@
+package org.richfaces.testng;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public abstract class AbstractDataListTest extends SeleniumTestBase {
+
+ private String rows;
+
+ private String dataList;
+
+ private String reRender;
+
+ private String outputText;
+
+ private String dataTable;
+
+ private void init(Template template) {
+ renderPage(null, template, "#{dataList.init}");
+ String attrForm = getParentId() + "attrForm";
+ rows = attrForm + ":rows";
+ String mainForm = getParentId() + "mainForm";
+ dataList = mainForm + ":dataList";
+ reRender = mainForm + ":reRender";
+ outputText = getParentId() + "outputText";
+ dataTable = getParentId() + "dataTable";
+ }
+
+ /**
+ * items from collection defined as value attribute are output to the client;
+ * number of items is limited using elements attribute and not
+ */
+ @Test
+ public void testStructure(Template template) {
+ init(template);
+ chekStructure();
+ selenium.type(rows, "3");
+ waitForAjaxCompletion();
+ Assert.assertEquals(selenium.getXpathCount("id('"+ dataList + "')/li"), 3);
+ chekStructure();
+ }
+
+ /**
+ * nested input and command components work correctly
+ * for the cases of validation failure or not
+ */
+ @Test
+ public void testComponentsProcessingWithValidation(Template template) {
+ init(template);
+ String liLocator = "xpath=id('"+ dataList + "')/li[";
+ String inputLocator = liLocator + "6]/input[";
+ Assert.assertEquals(selenium.getText(outputText), "");
+ selenium.click(inputLocator + "2]");
+ waitForPageToLoad();
+ Assert.assertTrue(selenium.getText(outputText).endsWith("5:submit"));
+ selenium.click(inputLocator + "3]");
+ waitForAjaxCompletion();
+ Assert.assertTrue(selenium.getText(outputText).endsWith("5:ajaxSubmit"));
+ selenium.click(inputLocator + "4]");
+ waitForAjaxCompletion();
+ Assert.assertTrue(selenium.getText(outputText).endsWith("5:ajaxSingleSubmit"));
+ selenium.type(inputLocator + "1]", "abc5");
+ selenium.click(inputLocator + "3]");
+ waitForAjaxCompletion();
+ chekStructure();
+ selenium.type(inputLocator + "1]", "fail");
+ selenium.type(liLocator + "3]/input[1]", "fail");
+ selenium.click(inputLocator + "3]");
+ waitForAjaxCompletion();
+ chekStructure(3, 6);
+ }
+
+ /**
+ * rows defined by ajaxKeys attribute are re-rendered correctly
+ */
+ @Test
+ public void testAjaxKeys(Template template) {
+ init(template);
+ chekStructure();
+ clickAjaxCommandAndWait(reRender);
+ chekStructure(3, 7);
+ }
+
+ /**
+ * components using rowKeyVar and stateVar variables are correctly output to the client
+ */
+ @Test
+ public void testVars(Template template) {
+ init(template);
+ Assert.assertEquals(selenium.getText(dataList + ":c_2:first"), "0", "Attribute 'stateVar' works wrong.");
+ Assert.assertEquals(selenium.getText(dataList + ":c_2:rows"), "0", "Attribute 'stateVar' works wrong.");
+ int rows = selenium.getXpathCount("id('"+ dataList + "')/tbody/tr").intValue();
+ for (int i = 0; i < rows; i++) {
+ Assert.assertEquals(selenium.getText(dataList + ":c_" + i + ":rowKeyVar"), Integer.toString(i));
+ }
+ }
+
+ /**
+ * componentState attribute stores nested components state across requests
+ */
+ @Test
+ public void testComponentState(Template template) {
+ init(template);
+ Assert.assertEquals(selenium.getText(dataList + ":c_2:firstState"), "0", "Attribute 'componentState' works wrong.");
+ Assert.assertEquals(selenium.getText(dataList + ":c_2:rowsState"), "0", "Attribute 'componentState' works wrong.");
+ }
+
+ /**
+ * component with rendered = false is not present on the page,
+ * style and classes, standard HTML attributes are output to client
+ */
+ @Test
+ public void testStandardAttributes(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, "#{dataGrid.init}");
+ autoTester.testRendered();
+ Map<String, String> styleAttributes = new HashMap<String, String>();
+ styleAttributes.put("width", "100%");
+ styleAttributes.put("color", "yellow");
+ autoTester.testStyleAndClasses(new String[]{"noname"}, styleAttributes);
+ autoTester.testHTMLEvents();
+ }
+
+ /**
+ * rowKeyConverter outputs correct client ids
+ */
+ @Test
+ public void testRowKeyConverter(Template template) {
+ init(template);
+ Assert.assertTrue(selenium.getAttribute("xpath=id('"+ dataList + "')/li[3]@id").endsWith(":c_2"), "Attribute 'rowKeyConverter' works wrong.");
+ }
+
+ private void chekStructure(int ... notEqualRows) {
+ String dataTableRowLocator = "id('"+ dataTable + "')/li";
+ int count = selenium.getXpathCount(dataTableRowLocator).intValue();
+ for (int i = 1; i <= count; i++) {
+ if (Arrays.binarySearch(notEqualRows, i) < 0) {
+ Assert.assertEquals(selenium.getValue("xpath=id('"+ dataList + "')/li[" + i + "]/input"),
+ selenium.getText("xpath=" + dataTableRowLocator + "[" + i + "]"));
+ } else {
+ Assert.assertFalse(selenium.
+ getValue("xpath=id('"+ dataList + "')/li[" + i + "]/input").
+ equals(selenium.getText("xpath=" + dataTableRowLocator + "[" + i + "]")));
+ }
+ }
+ }
+}
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataListTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataListTest.java 2009-02-20 16:23:04 UTC (rev 12706)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataListTest.java 2009-02-20 17:55:57 UTC (rev 12707)
@@ -1,157 +1,7 @@
package org.richfaces.testng;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import org.ajax4jsf.template.Template;
-import org.richfaces.AutoTester;
-import org.richfaces.SeleniumTestBase;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class DataListTest extends SeleniumTestBase {
-
- private String rows;
-
- private String dataList;
-
- private String reRender;
-
- private String outputText;
-
- private String dataTable;
-
- private void init(Template template) {
- renderPage(null, template, "#{dataList.init}");
- String attrForm = getParentId() + "attrForm";
- rows = attrForm + ":rows";
- String mainForm = getParentId() + "mainForm";
- dataList = mainForm + ":dataList";
- reRender = mainForm + ":reRender";
- outputText = getParentId() + "outputText";
- dataTable = getParentId() + "dataTable";
- }
-
- /**
- * items from collection defined as value attribute are output to the client;
- * number of items is limited using elements attribute and not
- */
- @Test
- public void testStructure(Template template) {
- init(template);
- chekStructure();
- selenium.type(rows, "3");
- waitForAjaxCompletion();
- Assert.assertEquals(selenium.getXpathCount("id('"+ dataList + "')/li"), 3);
- chekStructure();
- }
-
- /**
- * nested input and command components work correctly
- * for the cases of validation failure or not
- */
- @Test
- public void testComponentsProcessingWithValidation(Template template) {
- init(template);
- String liLocator = "xpath=id('"+ dataList + "')/li[";
- String inputLocator = liLocator + "6]/input[";
- Assert.assertEquals(selenium.getText(outputText), "");
- selenium.click(inputLocator + "2]");
- waitForPageToLoad();
- Assert.assertTrue(selenium.getText(outputText).endsWith("5:submit"));
- selenium.click(inputLocator + "3]");
- waitForAjaxCompletion();
- Assert.assertTrue(selenium.getText(outputText).endsWith("5:ajaxSubmit"));
- selenium.click(inputLocator + "4]");
- waitForAjaxCompletion();
- Assert.assertTrue(selenium.getText(outputText).endsWith("5:ajaxSingleSubmit"));
- selenium.type(inputLocator + "1]", "abc5");
- selenium.click(inputLocator + "3]");
- waitForAjaxCompletion();
- chekStructure();
- selenium.type(inputLocator + "1]", "fail");
- selenium.type(liLocator + "3]/input[1]", "fail");
- selenium.click(inputLocator + "3]");
- waitForAjaxCompletion();
- chekStructure(3, 6);
- }
-
- /**
- * rows defined by ajaxKeys attribute are re-rendered correctly
- */
- @Test
- public void testAjaxKeys(Template template) {
- init(template);
- chekStructure();
- clickAjaxCommandAndWait(reRender);
- chekStructure(3, 7);
- }
-
- /**
- * components using rowKeyVar and stateVar variables are correctly output to the client
- */
- @Test
- public void testVars(Template template) {
- init(template);
- Assert.assertEquals(selenium.getText(dataList + ":c_2:first"), "0", "Attribute 'stateVar' works wrong.");
- Assert.assertEquals(selenium.getText(dataList + ":c_2:rows"), "0", "Attribute 'stateVar' works wrong.");
- int rows = selenium.getXpathCount("id('"+ dataList + "')/tbody/tr").intValue();
- for (int i = 0; i < rows; i++) {
- Assert.assertEquals(selenium.getText(dataList + ":c_" + i + ":rowKeyVar"), Integer.toString(i));
- }
- }
-
- /**
- * componentState attribute stores nested components state across requests
- */
- @Test
- public void testComponentState(Template template) {
- init(template);
- Assert.assertEquals(selenium.getText(dataList + ":c_2:firstState"), "0", "Attribute 'componentState' works wrong.");
- Assert.assertEquals(selenium.getText(dataList + ":c_2:rowsState"), "0", "Attribute 'componentState' works wrong.");
- }
-
- /**
- * component with rendered = false is not present on the page,
- * style and classes, standard HTML attributes are output to client
- */
- @Test
- public void testStandardAttributes(Template template) {
- AutoTester autoTester = getAutoTester(this);
- autoTester.renderPage(template, "#{dataGrid.init}");
- autoTester.testRendered();
- Map<String, String> styleAttributes = new HashMap<String, String>();
- styleAttributes.put("width", "100%");
- styleAttributes.put("color", "yellow");
- autoTester.testStyleAndClasses(new String[]{"noname"}, styleAttributes);
- autoTester.testHTMLEvents();
- }
-
- /**
- * rowKeyConverter outputs correct client ids
- */
- @Test
- public void testRowKeyConverter(Template template) {
- init(template);
- Assert.assertTrue(selenium.getAttribute("xpath=id('"+ dataList + "')/li[3]@id").endsWith(":c_2"), "Attribute 'rowKeyConverter' works wrong.");
- }
-
- private void chekStructure(int ... notEqualRows) {
- String dataTableRowLocator = "id('"+ dataTable + "')/li";
- int count = selenium.getXpathCount(dataTableRowLocator).intValue();
- for (int i = 1; i <= count; i++) {
- if (Arrays.binarySearch(notEqualRows, i) < 0) {
- Assert.assertEquals(selenium.getValue("xpath=id('"+ dataList + "')/li[" + i + "]/input"),
- selenium.getText("xpath=" + dataTableRowLocator + "[" + i + "]"));
- } else {
- Assert.assertFalse(selenium.
- getValue("xpath=id('"+ dataList + "')/li[" + i + "]/input").
- equals(selenium.getText("xpath=" + dataTableRowLocator + "[" + i + "]")));
- }
- }
- }
-
+public class DataListTest extends AbstractDataListTest {
@Override
public String getTestUrl() {
return "pages/dataList/dataList.xhtml";
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataOrderedListTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataOrderedListTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataOrderedListTest.java 2009-02-20 17:55:57 UTC (rev 12707)
@@ -0,0 +1,14 @@
+package org.richfaces.testng;
+
+
+public class DataOrderedListTest extends AbstractDataListTest {
+ @Override
+ public String getTestUrl() {
+ return "pages/dataList/dataOrderedList.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/dataList/dataOrderedListAutoTest.xhtml";
+ }
+}
15 years, 2 months
JBoss Rich Faces SVN: r12706 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-20 11:23:04 -0500 (Fri, 20 Feb 2009)
New Revision: 12706
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5989
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java 2009-02-20 15:40:14 UTC (rev 12705)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataFilterSliderTest.java 2009-02-20 16:23:04 UTC (rev 12706)
@@ -212,6 +212,15 @@
}
@Test
+ public void testClientErrorMessageAttribute(Template template) {
+ renderPage(template, null);
+
+ writeStatus("Check 'clientErrorMessage' attributes");
+
+ Assert.fail("Bug https://jira.jboss.org/jira/browse/RF-6273");
+ }
+
+ @Test
public void testRenderedAttribute(Template template) {
AutoTester tester = getAutoTester(this);
tester.renderPage(template, RESET_METHOD);
15 years, 2 months
JBoss Rich Faces SVN: r12705 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-02-20 10:40:14 -0500 (Fri, 20 Feb 2009)
New Revision: 12705
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
Log:
fixed legacy test
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxHTMLCommandLink/ajaxHTMLLinkTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-20 15:23:41 UTC (rev 12704)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxHTMLCommandLinkTest.java 2009-02-20 15:40:14 UTC (rev 12705)
@@ -76,12 +76,12 @@
assertActionInvoked(true);
assertListenerInvoked(true);
- // linkId = parentId + "l1";
- // writeStatus("Click link 1");
- // clickCommandAndWait(linkId);
- // assertValueSubmitted(true);
- // assertActionInvoked(true);
- // assertListenerInvoked(true);
+ linkId = parentId + "l1";
+ writeStatus("Click link 1");
+ clickCommandAndWait(linkId);
+ assertValueSubmitted(true);
+ assertActionInvoked(true);
+ assertListenerInvoked(true);
}
@Test
15 years, 2 months
JBoss Rich Faces SVN: r12704 - trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-02-20 10:23:41 -0500 (Fri, 20 Feb 2009)
New Revision: 12704
Modified:
trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js
Log:
find form fix
Modified: trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js
===================================================================
--- trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js 2009-02-20 15:23:08 UTC (rev 12703)
+++ trunk/ui/togglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/togglePanel.js 2009-02-20 15:23:41 UTC (rev 12704)
@@ -40,7 +40,8 @@
}
TogglePanelManager.toggleOnServer = function (formId,clientId,stateId) {
- var parentForm = document.forms[formId];
+ var parentForm = document.getElementById(formId);
+ //document.forms[formId];
if(parentForm == null) return;
var params = {};
15 years, 2 months