JBoss Rich Faces SVN: r6237 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-02-21 08:20:34 -0500 (Thu, 21 Feb 2008)
New Revision: 6237
Added:
trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml
Log:
Mistakes in code sample were corrrected.
http://jira.jboss.com/jira/browse/RF-1690
Added: trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml (rev 0)
+++ trunk/docs/userguide/en/src/main/docbook/included/progressBar.xml 2008-02-21 13:20:34 UTC (rev 6237)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>rich:</keyword>
+ <keyword></keyword>
+ </keywordset>
+ </sectioninfo>
+ <table>
+ <title>Component identification parameters</title>
+
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.richfaces.ProgressBar</entry>
+ </row>
+ <!--row>
+ <entry>component-class</entry>
+ <entry></entry>
+ </row-->
+ <row>
+ <entry>component-family</entry>
+ <entry>org.richfaces.ProgressBar</entry>
+ </row>
+ <row>
+ <entry>renderer-type</entry>
+ <entry>org.richfaces.renderkit.ProgressBarRenderer</entry>
+ </row>
+ <row>
+ <entry>tag-class</entry>
+ <entry>org.richfaces.taglib.ProgressBarTag</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <section>
+ <title>Creating the Component with a Page Tag</title>
+ <para>Here is a simple example of how the component can be used on a page: </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+ <rich:progressBar value="#{bean.incValue}" enabled="#{bean.enabled}" id="progrs" action="#{bean.action}" >
+ <f:facet name="initial">
+ <h:outputText value="Process not started"></h:outputText>
+ </f:facet>
+ <f:facet name="complete">
+ <h:outputText value="Process completed"></h:outputText>
+ </f:facet>
+ <h:outputText value="{value}%" ></h:outputText>
+ </rich:progressBar>
+...]]></programlisting>
+ </section>
+ <section>
+ <title>Creating the Component Dynamically Using Java</title>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.progressBar;
+...
+HtmlColumns myColumns = new progressBar();
+...]]>
+ </programlisting>
+ </section>
+
+
+ <!-- Start Details of Usage-->
+
+ <section>
+ <title>Details of Usage</title>
+ <para>
+ Some processes running with in an application might take some time to complete, therefore in
+ order to indicate for a user the status of the process we recommend you to use <emphasis role="bold"><property><rich:progressBar></property> </emphasis>
+component.
+ </para>
+ <para>
+
+ The component employs the following facets to display the "initial" and "complete" states of the process:
+ </para>
+
+ <programlisting role="XML"><![CDATA[...
+ <f:facet name="initial">
+ <h:outputText value="Process not started"></h:outputText>
+ </f:facet>
+
+...]]></programlisting>
+ <para>
+ and
+ </para>
+
+ <programlisting role="XML">
+ <![CDATA[...
+ <f:facet name="complete">
+ <h:outputText value="Process completed"></h:outputText>
+ </f:facet>
+
+ ...]]>
+
+ </programlisting>
+ <para> However, the usage of these facets is optional. If you omit them nothing will be displayed. </para>
+
+ <para> The progress bar starts and finishes rendering its state relying on <emphasis><property>"minValue"</property></emphasis> (default value – "0")
+ and <emphasis><property>"maxValue"</property></emphasis> (default value is "100") parameters relatively. See the following example: </para>
+
+
+ <programlisting role="XML">
+ <![CDATA[...
+ <rich:progressBar value="#{bean.incValue}" enabled="#{bean.enabled}" id="progrs"
+ minValue="50"
+ maxValue="400">
+ <h:outputText value="{value}%" ></h:outputText>
+ </rich:progressBar>
+
+
+ ...]]>
+
+ </programlisting>
+
+ <para> In order do display textual and numerical information on the progress bar you need to use this code </para>
+
+ <programlisting role="XML">
+ <![CDATA[...
+<h:outputText value="{value}%" ></h:outputText>
+ ...]]>
+ </programlisting>
+
+
+
+ <para> The interval <emphasis><property>"interval"</property></emphasis>attribute defines the frequency of status polling. Polling is active while the component is operational. </para>
+ <programlisting role="XML">
+ <![CDATA[...
+<rich:progressBar value="#{bean.incValue}" enabled="#{bean.enabled}" id="progrs"
+ interval="900" >
+ . . .
+ </rich:progressBar>
+ ...]]>
+ </programlisting>
+
+
+
+ </section>
+ <!-- End. Details of Usage-->
+
+
+
+
+
+
+
+
+ </section>
\ No newline at end of file
18 years, 2 months
JBoss Rich Faces SVN: r6236 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-02-21 08:18:25 -0500 (Thu, 21 Feb 2008)
New Revision: 6236
Modified:
trunk/docs/userguide/en/src/main/docbook/included/progressBar.desc.xml
Log:
Description and key features were corrected.
http://jira.jboss.com/jira/browse/RF-1690
Modified: trunk/docs/userguide/en/src/main/docbook/included/progressBar.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/progressBar.desc.xml 2008-02-21 13:10:40 UTC (rev 6235)
+++ trunk/docs/userguide/en/src/main/docbook/included/progressBar.desc.xml 2008-02-21 13:18:25 UTC (rev 6236)
@@ -9,7 +9,7 @@
<title>Description</title>
<para>The <emphasis role="bold">
<property><rich:progressBar></property>
- </emphasis> component is designed for displaying a progress bar which shows the current status of the process. The component has an option to display some numeric data, like percentage (above, in or below the progress bar) along side with graphical presentation. </para>
+ </emphasis> component is designed for displaying a progress bar which shows the current status of the process. </para>
<!--figure>
<title><emphasis role="bold"><property><rich:column></property></emphasis> component</title>
@@ -26,6 +26,7 @@
<listitem>Customization of informational part of the component</listitem>
<listitem>Status polling frequency adjustment</listitem>
<listitem>Ajax or Client modes</listitem>
+ <listitem>Option to display some numeric data along side with graphical presentation.</listitem>
</itemizedlist>
</section>
</section>
\ No newline at end of file
18 years, 2 months
JBoss Rich Faces SVN: r6235 - trunk/docs/faq/en/src/main/docbook/module.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-02-21 08:10:40 -0500 (Thu, 21 Feb 2008)
New Revision: 6235
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-2276 - Section 'How to select several rows in a scrollableDataTable and Drag-and-Drop them on dataTable?' added to FAQ
http://jira.jboss.com/jira/browse/RF-2153 - edit section 'How to save the state of simpleTogglePanel or panelMenu?'
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-02-21 12:55:32 UTC (rev 6234)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-02-21 13:10:40 UTC (rev 6235)
@@ -1455,29 +1455,129 @@
>here</ulink>.</para>
</section> -->
- <!--section id="ScrollableDataTableDragAndDrop">
+ <section id="ScrollableDataTableDragAndDrop">
<?dbhtml filename="ScrollableDataTableDragAndDrop.html"?>
- <title>How to select several rows in a scrollableDataTable and perform Drag-and-Drop of several rows on dataTable?</title>
+ <title>How to select several rows in a scrollableDataTable and Drag-and-Drop them on dataTable?</title>
<para>
How to get row selection in scrollableDataTable using <property>one and multi-selection rows mode</property>
- you could see section <ulink url="RFCfaq.html#ScrollableDataTableDragAndDrop">above</ulink>.
+ you could see the section <link linkend="RowSelectionInScrollableDataTable">above</link>.
</para>
<para>
- In the following example when user submit
+ In order to perform Drag-and-Drop of selected columns on a dataTable you could use
+ <emphasis role="bold"><property><rich:dragSupport></property></emphasis> and <emphasis role="bold"><property><rich:dropSupport></property></emphasis>
+ components as it is shown in the example below.
</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="400px" width="700px" id="carList" rows="40" columnClasses="col"
+ value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single" selection="#{dataTableScrollerBean.selection}">
+ <rich:column id="make">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Make" />
+ </f:facet>
+ <a4j:outputPanel>
+ <rich:dragSupport dragType="selectionDrag" dragIndicator=":indicator"/>
+ <h:outputText value="#{category.make}" />
+ </a4j:outputPanel>
+ </rich:column>
+ <rich:column id="model">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Model" />
+ </f:facet>
+ <h:outputText value="#{category.model}" />
+ </rich:column>
+ <rich:column id="price">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Price" />
+ </f:facet>
+ <h:outputText value="#{category.price}" />
+ </rich:column>
+ <rich:column id="mileage">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Mileage" />
+ </f:facet>
+ <h:outputText value="#{category.mileage}" />
+ </rich:column>
+ <rich:column width="200px" id="vin">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="VIN" />
+ </f:facet>
+ <h:outputText value="#{category.vin}" />
+ </rich:column>
+ <rich:column id="stock">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Stock" />
+ </f:facet>
+ <h:outputText value="#{category.stock}" />
+ </rich:column>
+</rich:scrollableDataTable>
+<rich:spacer height="20px"/>
+<rich:panel style="width:300px; height:300px">
+ <f:facet name="header">
+ <h:outputText value="Drop Here"/>
+ </f:facet>
+ <rich:dropSupport acceptedTypes="selectionDrag" dropListener="#{dataTableScrollerBean.dropListener}" reRender="table"/>
+ <rich:dataTable value="#{dataTableScrollerBean.droppedCars}" var="sel" id="table">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Make" />
+ </f:facet>
+ <h:outputText value="#{sel.make}" />
+ </rich:column>
+ <rich:column id="model">
+ <f:facet name="header">
+ <h:outputText value="Model" />
+ </f:facet>
+ <h:outputText value="#{sel.model}" />
+ </rich:column>
+ <rich:column id="price">
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{sel.price}" />
+ </rich:column>
+ <rich:column id="mileage">
+ <f:facet name="header">
+ <h:outputText value="Mileage" />
+ </f:facet>
+ <h:outputText value="#{sel.mileage}" />
+ </rich:column>
+ <rich:column id="stock">
+ <f:facet name="header">
+ <h:outputText value="Stock" />
+ </f:facet>
+ <h:outputText value="#{sel.stock}" />
+ </rich:column>
+ </rich:dataTable>
+</rich:panel>
+...]]></programlisting>
+ <para>This is the page from <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/scrollableDataTable.jsf">RichFaces LiveDemo</ulink> site and also uses beans from RichFaces LiveDemo site.
+ Only one method is added where the dropped selection is stored:</para>
+ <programlisting role="JAVA"><![CDATA[...
+public void dropListener(DropEvent event) {
+ System.out.println("Drop Listener Fired");
+ getDroppedCars().clear();
+ Iterator<SimpleRowKey> item = getSelection().getKeys();
+ while (item.hasNext()){
+ SimpleRowKey key = item.next();
+ getDroppedCars().add(getAllCars().get(key.intValue()));
+ }
+}
+...]]></programlisting>
+ </section>
- </section-->
-
<section id="SimpleTogglePanelPanelMenuState">
<?dbhtml filename="SimpleTogglePanelPanelMenuState.html"?>
- <title>How to save the state of simpleTogglePanel or panelMenu?</title>
+ <title>How to save the state of simpleTogglePanel?</title>
<para>
In order to save the state (exapnd/collapse) of the <emphasis role="bold"><property><rich:simpleTogglePanel></property></emphasis> component
you could use <emphasis><property>"opened"</property></emphasis> attribute responsible for keeping a panel state
and <emphasis role="bold"><property><a4j:support></property></emphasis> binded to <property>onexpand</property> and <property>oncollapse</property> events.
</para>
<para>
- In the following example when you click on the toggle icon simpleTogglePanel arrears and current state displays on modal panel.
+ In the following example when you click on the toggle icon simpleTogglePanel appears and current state displays on modal panel.
This state is remembered between page views.
</para>
<para>
18 years, 2 months
JBoss Rich Faces SVN: r6234 - trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-21 07:55:32 -0500 (Thu, 21 Feb 2008)
New Revision: 6234
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
Log:
comment unnecessary styles
Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-21 12:43:53 UTC (rev 6233)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-21 12:55:32 UTC (rev 6234)
@@ -37,7 +37,7 @@
padding : 0px 0px 0px 0px;
border : 0px;
margin : 0px;
- width : 112px;
+ /*width : 112px;*/
position : absolute;
top:0px;
left : 0px;
@@ -50,8 +50,7 @@
height : 1px
}
.rich-inplace-select-btn-set{
- position : absolute;
- top:0px; left : 112px;
+ /*position : absolute; top:0px; left : 112px;*/
white-space : nowrap
}
@@ -94,7 +93,7 @@
.rich-inplace-select-list-scroll{
overflow : auto;
- height : 100px;
+ /*height : 100px;*/
}
.rich-inplace-select-list-position{
@@ -110,7 +109,7 @@
.rich-inplace-select-width-list{
- width : 250px;
+ /*width : 250px;*/
}
.rich-inplace-select-item{
18 years, 2 months
JBoss Rich Faces SVN: r6233 - in trunk/sandbox/ui/inplaceSelect/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-21 07:43:53 -0500 (Thu, 21 Feb 2008)
New Revision: 6233
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
fix shadow and items css classes
Modified: trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-21 11:37:38 UTC (rev 6232)
+++ trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-21 12:43:53 UTC (rev 6233)
@@ -28,7 +28,7 @@
public class InplaceSelectBaseRenderer extends ComboBoxBaseRenderer{
private static Log logger = LogFactory.getLog(InplaceSelectBaseRenderer.class);
- private static final String RICH_INPLACE_SELECT_CLASSES = "rich-iselect-item rich-iselect-item-normal";
+ private static final String RICH_INPLACE_SELECT_CLASSES = "rich-inplace-select-item rich-inplace-select-font";
@Override
protected void doDecode(FacesContext context, UIComponent component) {
Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-21 11:37:38 UTC (rev 6232)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-21 12:43:53 UTC (rev 6233)
@@ -79,7 +79,10 @@
position : absolute;
}
-.rich-inplace-select-size{
+.rich-inplace-select-list-shadow{
+}
+
+.rich-inplace-select-shadow-size{
width : 34px;
height : 16px;
}
@@ -110,7 +113,7 @@
width : 250px;
}
-.rich-inplace-select-option{
+.rich-inplace-select-item{
padding : 2px;
white-space : nowrap;
}
@@ -120,7 +123,7 @@
font-family : arial/*generalFamilyFont*/;
color : #000000/*generalTextColor*/
}
-.rich-inplace-select-select-item{
+.rich-inplace-select-selected-item{
padding : 1px;
background-color: #4a75b5;
border : 1px dotted #4a75b5;
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-21 11:37:38 UTC (rev 6232)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-21 12:43:53 UTC (rev 6233)
@@ -75,7 +75,7 @@
<input id='#{clientId}inplaceValue' name='#{clientId}value' type='hidden' value='#{fieldValue}'/>
<div id="#{clientId}bar" class="rich-inplace-select-btn-set" style="display:none;">
<div class="rich-inplace-select-shadow">
- <table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
+ <table cellpadding="0" cellspacing="0" border="0" class="rich-inplace-select-shadow-size">
<tr>
<td class="rich-inplace-select-shadow-tl">
<img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
@@ -101,21 +101,21 @@
</div>
<div id="listParent#{clientId}" class="rich-inplace-select-width-list" style="position : absolute; height : 100px; left : 0px; top: 13px">
- <div class="rich-inplace-select-shadow">
+ <div class="rich-inplace-select-list-shadow">
<table id="shadow#{clientId}" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
<tr>
- <td class=".rich-inplace-select-shadow-tl">
+ <td class="rich-inplace-select-shadow-tl">
<img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
</td>
- <td class=".rich-inplace-select-shadow-tr">
+ <td class="rich-inplace-select-shadow-tr">
<img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
</tr>
<tr>
- <td class=".rich-inplace-select-shadow-bl">
+ <td class="rich-inplace-select-shadow-bl">
<img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
- <td class=".rich-inplace-select-shadow-br">
+ <td class="rich-inplace-select-shadow-br">
<img src="#{spacer}" width="10" height="10" alt="" border="0"/><br/>
</td>
</tr>
18 years, 2 months
JBoss Rich Faces SVN: r6232 - in trunk/sandbox/ui/fileUpload/src/main: java/org/richfaces/org/jboss/seam/web and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-21 06:37:38 -0500 (Thu, 21 Feb 2008)
New Revision: 6232
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
Fix code review notes
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-21 10:21:54 UTC (rev 6231)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-21 11:37:38 UTC (rev 6232)
@@ -15,7 +15,6 @@
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpSession;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.context.AjaxContextImpl;
@@ -25,11 +24,11 @@
import org.ajax4jsf.javascript.JSLiteral;
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.resource.CountingOutputWriter;
import org.richfaces.component.UIProgressBar;
import org.richfaces.event.UploadEvent;
import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
+import org.richfaces.org.jboss.seam.web.MultipartFilter;
import org.richfaces.org.jboss.seam.web.MultipartRequest;
import org.richfaces.renderkit.TemplateEncoderRendererBase;
@@ -42,17 +41,6 @@
public abstract class FileUploadRendererBase extends
TemplateEncoderRendererBase {
- /** File name parameter name */
- private static final String FILE_NAME_PARAMETER = "fileName";
-
- /** Session bean name to store the percent value of uploading process */
- public static final String _percentBeanName = "__percentValue$";
-
- /** Session bean name to store the percent value of uploading process */
- public static final String _progressInfoBeanName = "__ProgressInfo$";
-
- private static final String _reRenderAllFlag = "reRenderAll";
-
/*
* (non-Javadoc)
*
@@ -71,29 +59,21 @@
.getRequestParameterValuesMap();
if ("progress".equals(request.getParameter("action"))) {
- AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
+ AjaxContext ajaxContext = AjaxContextImpl
+ .getCurrentInstance(context);
String uid = request.getParameter("uid");
- /*
- *
- * FIXME: Maksim --> Andrei
- * Why not use standard JSF constructs?
- *
+
ExternalContext externalContext = context.getExternalContext();
- Map <String, Object> sessionMap = externalContext.getSessionMap();
-
- */
+ Map<String, Object> sessionMap = externalContext.getSessionMap();
- HttpSession session = (HttpSession)context.getExternalContext().getSession(false);
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
- .getAttribute("_richfaces_upload_sessions");
-
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- ajaxContext.setResponseData(multipartRequest.getSize());
- }
+ Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) sessionMap
+ .get(MultipartFilter.REQUESTS_SESSIONS_BEAN_NAME);
+ if (sessions != null) {
+ MultipartRequest multipartRequest = sessions.get(uid);
+ if (multipartRequest != null) {
+ ajaxContext.setResponseData(multipartRequest.getSize());
}
-
+ }
} else {
new AjaxEvent(component).queue();
}
@@ -117,6 +97,12 @@
}
+ /**
+ * Put uploaded file into data attribute defined
+ * @param context
+ * @param fileUpload
+ * @param file
+ */
private void storeData(FacesContext context, UIFileUpload fileUpload, File file) {
ValueExpression data = fileUpload.getValueExpression("data");
if (data != null) {
@@ -124,13 +110,16 @@
if (clazz.isAssignableFrom(Map.class)) {
Map map = (Map) data.getValue(context.getELContext());
map.put(fileUpload.getLocalFileName(), file);
- //FIXME: Maksim --> Andrei
- // What does Map.empty mean?
- map.isEmpty();
}
}
}
+ /**
+ * Call with method after uploading completed
+ * @param context
+ * @param file
+ * @param fileUpload
+ */
private void onUploadComplete(FacesContext context, File file,
UIFileUpload fileUpload) {
storeData(context, fileUpload, file);
@@ -146,27 +135,28 @@
*
* @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
*/
- //FIXME: Maksim --> Andrei
- //Better use UIFileUpload here. Otherwise you can get NPE here
@Override
protected Class<? extends UIComponent> getComponentClass() {
- // TODO Auto-generated method stub
- return null;
+ return UIFileUpload.class;
}
+ /**
+ * Generates common JS script by action value
+ * @param context
+ * @param component
+ * @param action
+ * @param oncomplete
+ * @return
+ * @throws IOException
+ */
private String getActionScript(FacesContext context, UIComponent component,
String action, Object oncomplete) throws IOException {
JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
component, context);
-
- //FIXME: Maksim --> Andrei
- //Why multiple map.get? In eclipse, use Ctrl+2 then L to introduce local variable
- //
-
Map options = AjaxRendererUtils.buildEventOptions(context, component);
-
- ((Map) options.get("parameters")).put("action", action);
- ((Map) options.get("parameters")).put("uid", new JSReference("uid"));
+ Map parameters = (Map) options.get("parameters");
+ parameters.put("action", action);
+ parameters.put("uid", new JSReference("uid"));
if (oncomplete != null) {
options.put("onbeforedomupdate", oncomplete);
}
@@ -179,13 +169,26 @@
return function.toScript();
}
+ /**
+ * Generates JS script for stopping uploading process
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
public String getStopScript(FacesContext context, UIComponent component)
throws IOException {
return getActionScript(context, component, "stop", null);
}
- // TODO : complete this one
+ /**
+ * Generates JS script for getting file size from server
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
public String getFileSizeScript(FacesContext context, UIComponent component)
throws IOException {
JSFunctionDefinition oncomplete = new JSFunctionDefinition();
@@ -200,9 +203,13 @@
}
- //FIXME: Maksim --> Andrei
- //Method not used anywhere
- //WHY?
+ /**
+ * Generates progress label markup
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
public Object getLabelMarkup(FacesContext context, UIComponent component)
throws IOException {
CountingOutputWriter customWriter = new CountingOutputWriter();
@@ -226,7 +233,6 @@
ResponseWriter responseWriter = renderKit.createResponseWriter(
customWriter, null, "UTF-8");
context.setResponseWriter(responseWriter);
- //renderChild(context, label);
writeScriptBody(context, label, false);
if (writer != null) {
context.setResponseWriter(writer);
@@ -279,17 +285,36 @@
}
+ /**
+ * Gets progress bar Id
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
public String getProgressBarId(FacesContext context, UIComponent component)
throws IOException {
return getProgressBar(context, component).getClientId(context);
}
+ /**
+ * Renders progress bar
+ * @param context
+ * @param component
+ * @throws IOException
+ */
public void renderProgress(FacesContext context, UIComponent component)
throws IOException {
UIComponent progressBar = getProgressBar(context, component);
renderChild(context, progressBar);
}
+ /**
+ * Creates progress bar component
+ * @param context
+ * @param fileUpload
+ * @return
+ */
private UIComponent createProgressBar(FacesContext context,
UIComponent fileUpload) {
UIComponent progressBar = fileUpload.getFacet("progress");
@@ -301,6 +326,12 @@
return progressBar;
}
+ /**
+ * Returns progress bar
+ * @param context
+ * @param component
+ * @return
+ */
private UIComponent getProgressBar(FacesContext context,
UIComponent component) {
UIComponent progressBar = component.getFacet("progress");
@@ -308,45 +339,18 @@
progressBar = createProgressBar(context, component);
}
- //FIXME: Maksim --> Andrei
- //What happens if we have two fileuploads on the page?
- //Two progress bars with identical value?
- String exprStr = "#{" + _percentBeanName + "}";
+ //We associate progress bar's percent value in session scope with file upload component id
+ String exprStr = "#{" + MultipartFilter.PERCENT_BEAN_NAME + "['"+component.getClientId(context)+"']}";
ValueExpression ex = context.getApplication().getExpressionFactory()
.createValueExpression(context.getELContext(), exprStr,
Integer.class);
progressBar.setValueExpression("value", ex);
-
-
- //FIXME: Maksim --> Andrei
- //Why set id for user-defined component
- progressBar.setId("progressBar");
progressBar.getAttributes().put("minValue", -1);
progressBar.getAttributes().put("enabled", false);
progressBar.setTransient(false);
- if (getProgressLabel(component) != null) {
- progressBar.getAttributes().put("reRender", "progressLabel");
- }
-
return progressBar;
}
- private StringBuffer getJSScriptStart(String clientId) {
- StringBuffer buffer = new StringBuffer("$('");
- buffer.append(clientId).append("').component");
- return buffer;
- }
-
- private UIComponent getProgressLabel(UIComponent component) {
- UIComponent label = component.getFacet("progressLabel");
- if (label != null) {
- //FIXME: Maksim --> Andrei
- //Why set id for user-defined component
- label.setId("progressLabel");
- }
- return label;
- }
-
/*
* (non-Javadoc)
*
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java 2008-02-21 10:21:54 UTC (rev 6231)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java 2008-02-21 11:37:38 UTC (rev 6232)
@@ -16,8 +16,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.richfaces.org.jboss.seam.ui.renderkit.FileUploadRendererBase;
-
/**
* A filter for decoding multipart requests, for
* use with the file upload control.
@@ -34,6 +32,10 @@
{
public static final String MULTIPART = "multipart/";
+ public static final String REQUESTS_SESSIONS_BEAN_NAME = "_richfaces_upload_sessions";
+
+ public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
+
/**
* Flag indicating whether a temporary file should be used to cache the uploaded file
*/
@@ -73,34 +75,36 @@
HttpServletRequest httpRequest = (HttpServletRequest) request;
String uid = httpRequest.getParameter("uid");
+ String componentId = httpRequest.getParameter("clientId");
if (isMultipartRequest(httpRequest)) {
MultipartRequest multipartRequest = new MultipartRequest(
- httpRequest, createTempFiles, maxRequestSize);
+ httpRequest, createTempFiles, maxRequestSize, componentId);
Map<String, MultipartRequest> sessionsMap = null;
+ Map<String, Object> percentMap = null;
try {
HttpSession session = httpRequest.getSession();
synchronized (session) {
sessionsMap = (Map<String, MultipartRequest>) session
- .getAttribute("_richfaces_upload_sessions");
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+ percentMap = (Map<String, Object>) session.getAttribute(PERCENT_BEAN_NAME);
if (sessionsMap == null) {
sessionsMap = Collections.synchronizedMap(new HashMap<String, MultipartRequest>());
session.setAttribute(
- "_richfaces_upload_sessions", sessionsMap);
+ REQUESTS_SESSIONS_BEAN_NAME, sessionsMap);
}
+ if (percentMap == null) {
+ percentMap = new HashMap<String, Object>();
+ session.setAttribute(PERCENT_BEAN_NAME, percentMap);
+ }
}
- //FIXME: Maksim --> Andrei
- //Can we make _percentBeanName uid-dependent?
-
- session.setAttribute(FileUploadRendererBase._percentBeanName, 0);
+ percentMap.put(componentId, 0); // associate percent value with file upload component ID
+ sessionsMap.put(uid, multipartRequest);
- sessionsMap.put(uid, multipartRequest);
-
if (multipartRequest.parseRequest()) {
chain.doFilter(multipartRequest, response);
} else {
- // TODO
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setStatus(HttpServletResponse.SC_OK);
httpResponse.setContentType("text/html");
@@ -119,7 +123,7 @@
if ("stop".equals(httpRequest.getParameter("action"))) {
HttpSession session = httpRequest.getSession();
Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
- .getAttribute("_richfaces_upload_sessions");
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
if (sessions != null) {
MultipartRequest multipartRequest = sessions.get(uid);
@@ -159,7 +163,6 @@
}
public void destroy() {
- // TODO Auto-generated method stub
}
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2008-02-21 10:21:54 UTC (rev 6231)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2008-02-21 11:37:38 UTC (rev 6232)
@@ -12,7 +12,6 @@
import java.rmi.server.UID;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
@@ -23,9 +22,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
-import org.richfaces.org.jboss.seam.ui.component.ProgressData;
-import org.richfaces.org.jboss.seam.ui.renderkit.FileUploadRendererBase;
-
/**
* Request wrapper for supporting multipart requests, used for file uploading.
*
@@ -40,6 +36,8 @@
private static final int CHUNK_SIZE = 512;
private boolean createTempFiles;
+
+ private String clientId;
private String encoding = null;
@@ -47,9 +45,9 @@
private int read = 0;
- private String beanName;
-
private Map<String, Param> parameters = null;
+
+ private Map<String, Object> percentMap = null;
private enum ReadState {
BOUNDARY, HEADERS, DATA
@@ -248,14 +246,14 @@
private boolean shouldStop = false;
public MultipartRequest(HttpServletRequest request,
- boolean createTempFiles, int maxRequestSize) {
+ boolean createTempFiles, int maxRequestSize, String clientId) {
super(request);
this.request = request;
this.createTempFiles = createTempFiles;
+ this.clientId = clientId;
String contentLength = request.getHeader("Content-Length");
this.contentLength = Integer.parseInt(contentLength);
- //initProgressInfo(this.contentLength);
if (contentLength != null && maxRequestSize > 0
&& this.contentLength > maxRequestSize) {
throw new FileUploadException(
@@ -292,6 +290,7 @@
encoding = request.getCharacterEncoding();
parameters = new HashMap<String, Param>();
+ this.percentMap = getProgressData();
try {
byte[] buffer = new byte[BUFFER_SIZE];
@@ -430,36 +429,17 @@
}
}
- private ProgressData getProgressData () {
- ProgressData progressData = null;
- String beanName = (String)getSession().getAttribute(FileUploadRendererBase._progressInfoBeanName);
- if (beanName != null) {
- progressData = (ProgressData)getSession().getAttribute(beanName);
- }
- return progressData;
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getProgressData () {
+ percentMap = (Map<String, Object>)getSession().getAttribute(MultipartFilter.PERCENT_BEAN_NAME);
+ return percentMap;
}
private void fillProgressInfo () {
Double percent = (Double) (100.0 * this.read / this.contentLength);
- getSession().setAttribute(FileUploadRendererBase._percentBeanName,percent);
- /*if (this.progressData != null) {
- progressData.setPercent(percent);
- progressData.setUploaded((long)this.read);
- progressData.setTime((new Date().getTime() / 1000)- this.time);
- }*/
+ percentMap.put(clientId, percent);
}
-
- /* private void initProgressInfo(int size) {
- time = new Date().getTime()/1000;
- progressData = getProgressData();
- if (progressData != null) {
- progressData.setSize((long)size);
- progressData.setTime(0L);
- }
- }
- */
-
private byte[] getBoundaryMarker(String contentType) {
Map<String, Object> params = parseParams(contentType, ";");
String boundaryStr = (String) params.get("boundary");
Modified: trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-21 10:21:54 UTC (rev 6231)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-21 11:37:38 UTC (rev 6232)
@@ -139,6 +139,7 @@
},
setupLabelUpdate: function () {
+ this.updateLabel();
this.labelUpdateInterval = setInterval(function () { this.updateLabel(); }.bind(this), this.uploadObject.progressBar.options['pollinterval']);
},
@@ -164,20 +165,12 @@
},
_clearInput: function() {
- //remove input type="file" element
Richfaces.removeNode(this.fileInput);
- /*var inputs = $(this.uploadObject.id + ":add1")
- try{
- inputs.removeChild(this.fileInput);
- }catch(e) {}*/
this.fileInput = null;
},
_clearEntry: function() {
Richfaces.removeNode(this.entryElement);
- /*try{
- this.uploadObject.items.removeChild(this.entryElement);
- }catch(e) {}*/
this.entryElement = null;
},
@@ -365,7 +358,6 @@
initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label, maxFiles, options) {
this.id = id;
this.element = $(this.id);
- //this.progressBarId = progressBarId;
this._progressBar = $(progressBarId);
this.progressBar = this._progressBar.component;
@@ -402,6 +394,7 @@
prepareProgressBar: function () {
this.progressBar.setValue(0);
Element.show(this._progressBar);
+ this.progressBar.enable();
},
finishProgressBar: function () {
@@ -439,7 +432,6 @@
entry.clear();
this.entries = this.entries.without(entry);
- //this.disableAddButton(this.maxFileBatchSize && this.entries.length >= this.maxFileBatchSize);
},
_selectEntryForUpload: function() {
@@ -576,9 +568,6 @@
_endUpload: function() {
this.activeEntry = null;
- //this.progressBar.setValue(100);
- //this.progressBar.disable();
- //Element.hide(this._progressBar);
},
_updateEntriesState: function() {
@@ -628,7 +617,6 @@
}
this._updateEntriesState();
- //this.disableUploadButton(false);
} else if (newState == FileUploadEntry.UPLOAD_CANCELED ||
newState == FileUploadEntry.UPLOAD_TRANSFER_ERROR ||
@@ -641,17 +629,12 @@
this._updateEntriesState();
- //this.disableUploadButton(false);
-
} else if (newState == FileUploadEntry.UPLOAD_IN_PROGRESS) {
this.activeEntry = entry;
- this.progressBar.setValue(0);
- this.progressBar.enable();
this._updateEntriesState();
- //this.disableUploadButton(true);
}
this.processButtons();
},
@@ -676,7 +659,7 @@
parentForm.encoding = "multipart/form-data";
parentForm.enctype = "multipart/form-data";
parentForm.target = this.id;
- parentForm.action = oldAction + (/\?/.test(oldAction) ? '&uid' : '?uid') + '=' + encodeURI(entry.uid);
+ parentForm.action = oldAction + (/\?/.test(oldAction) ? '&uid' : '?uid') + '=' + encodeURI(entry.uid) + '&clientId=' + this.id;
try {
var inputs = parentForm.elements;
18 years, 2 months
JBoss Rich Faces SVN: r6231 - in trunk/sandbox/ui: inplaceInput/src/main/java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-02-21 05:21:54 -0500 (Thu, 21 Feb 2008)
New Revision: 6231
Modified:
trunk/sandbox/ui/inplaceInput/
trunk/sandbox/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
trunk/sandbox/ui/inplaceSelect/
Log:
review of component and renderer code?
Property changes on: trunk/sandbox/ui/inplaceInput
___________________________________________________________________
Name: svn:ignore
- target
+ target
.settings
.classpath
.project
Modified: trunk/sandbox/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2008-02-21 09:25:44 UTC (rev 6230)
+++ trunk/sandbox/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2008-02-21 10:21:54 UTC (rev 6231)
@@ -41,6 +41,10 @@
inplaceInput = (UIInplaceInput) component;
} else {
if (logger.isDebugEnabled()) {
+
+ //FIXME: from Maksim
+ //That's no ComboBox but Inplace input!
+
logger.debug("No decoding necessary since the component "
+ component.getId() +
" is not an instance or a sub class of UIComboBox");
@@ -75,6 +79,7 @@
}
}
+ //FIXME: from Maksim --> I think this method should check if facet is rendered as well
public boolean isControlsFacetExists(FacesContext context, UIComponent component) {
UIComponent facet = component.getFacet(CONTROLS_FACET);
if (facet != null) {
Modified: trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-02-21 09:25:44 UTC (rev 6230)
+++ trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-02-21 10:21:54 UTC (rev 6231)
@@ -24,6 +24,8 @@
<f:clientid var="clientId" />
<jsp:scriptlet>
<![CDATA[
+ //FIXME: from Maksim --> why get same attribute twice?
+ //This is UIInput, so better call getValue() directly. It's 10x faster
Object value = component.getAttributes().get("value");
Object fieldValue = component.getAttributes().get("value");
value = getConvertedStringValue(context, component,value);
@@ -47,6 +49,7 @@
variables.setVariable("cancelIcon", cancelIcon);
}
+ //FIXME: from Maksim --> Check spelling, in English control is with single L
String controllClass = (String)component.getAttributes().get("controllClass");
variables.setVariable("controllClass", controllClass);
String controllHoveredClass = (String)component.getAttributes().get("controllHoverClass");
@@ -123,6 +126,9 @@
#{value}
</span>
<script type="text/javascript">
+ //TODO: from Maksim --> I suggest you to change this code to use JavaScriptOption class
+ //Constructor can be created from java code
+
var attributes = {defaultLabel : '#{component.attributes["defaultLabel"]}',
showControls : #{component.attributes["showControls"]},
applyFromControlsOnly : #{component.attributes["applyFromControlsOnly"]},
@@ -134,12 +140,12 @@
inputMinWidth : '#{component.attributes["minInputWidth"]}',
inputMaxWidth : '#{component.attributes["maxInputWidth"]}'
};
-
var events = {oneditactivation : #{this:getAsEventHandler(context, component, "oneditactivation")},
onviewactivation : #{this:getAsEventHandler(context, component, "onviewactivation")},
oneditactivated : #{this:getAsEventHandler(context, component, "oneditactivated")},
onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
-
+
+ //Global variable? HMMM...
Richfaces.InplaceInput.CLASSES = {
COMPONENT : {CHANGED : {NORMAL : 'rich-inplace rich-inplace-changed #{component.attributes["changedClass"]}', HOVERED : 'rich-inplace-input-change-hover #{component.attributes["changedHoverClass"]}'},
VIEW : {NORMAL : 'rich-inplace rich-inplace-view #{component.attributes["viewClass"]}', HOVERED : 'rich-inplace-input-view-hover #{component.attributes["viewHoverClass"]}'},
Property changes on: trunk/sandbox/ui/inplaceSelect
___________________________________________________________________
Name: svn:ignore
- target
+ target
.settings
.classpath
.project
18 years, 2 months
JBoss Rich Faces SVN: r6230 - in trunk/sandbox/ui/fileUpload/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-21 04:25:44 -0500 (Thu, 21 Feb 2008)
New Revision: 6230
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
maxFiles attribute is taken into consideration
Modified: trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-21 09:25:35 UTC (rev 6229)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-21 09:25:44 UTC (rev 6230)
@@ -360,9 +360,9 @@
classes: null,
- maxFileBatchSize: 5,
+ maxFileBatchSize: null,
- initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label, options) {
+ initialize: function(id, stopScript, getFileSizeScript, progressBarId, classes, label, maxFiles, options) {
this.id = id;
this.element = $(this.id);
//this.progressBarId = progressBarId;
@@ -379,6 +379,7 @@
this.iframe = $(this.id + "_iframe");
this.items = $(this.id + ":fileItems");
this.classes = classes;
+ this.maxFileBatchSize = maxFiles;
this.currentInput = $(this.id + ":file");
this.options = options || {};
@@ -438,7 +439,7 @@
entry.clear();
this.entries = this.entries.without(entry);
- //this.disableAddButton(this.entries.length > this.maxFileBatchSize);
+ //this.disableAddButton(this.maxFileBatchSize && this.entries.length >= this.maxFileBatchSize);
},
_selectEntryForUpload: function() {
@@ -496,14 +497,14 @@
}
this.processButtons();
},
-
+
processButtons: function () {
- this.disableAddButton(this.entries.length > this.maxFileBatchSize);
+ this.disableAddButton(this.maxFileBatchSize && this.entries.length >= this.maxFileBatchSize);
this.disableCleanButton(this.cleanAllDisabled());
this.disableUploadButton(this.uploadAllDisabled());
this.switchUploadButton();
},
-
+
cleanAllDisabled: function () {
var c = 0;
for (var i = 0; i < this.entries.length; i++) {
Modified: trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-21 09:25:35 UTC (rev 6229)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-21 09:25:44 UTC (rev 6230)
@@ -123,7 +123,7 @@
}
};
- new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)});
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, '#{component.attributes["maxFiles"]}');
</script>
</span>
18 years, 2 months
JBoss Rich Faces SVN: r6229 - trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-21 04:25:35 -0500 (Thu, 21 Feb 2008)
New Revision: 6229
Modified:
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
maxFiles attribute is taken into consideration
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2008-02-21 01:12:11 UTC (rev 6228)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2008-02-21 09:25:35 UTC (rev 6229)
@@ -20,7 +20,7 @@
<h:messages />
-<fu:fileUpload data="#{bean.data}" fileUploadListener="#{bean.listener}">
+<fu:fileUpload data="#{bean.data}" fileUploadListener="#{bean.listener}" maxFiles="5">
<f:facet name="progress">
<progressBar:progressBar style="height: 10px; width: 300px;">
</progressBar:progressBar>
18 years, 2 months
JBoss Rich Faces SVN: r6228 - management/design/standardComponent.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-20 20:12:11 -0500 (Wed, 20 Feb 2008)
New Revision: 6228
Modified:
management/design/standardComponent/default_example.html
Log:
changed DTD for default_example.html
Modified: management/design/standardComponent/default_example.html
===================================================================
--- management/design/standardComponent/default_example.html 2008-02-21 01:11:00 UTC (rev 6227)
+++ management/design/standardComponent/default_example.html 2008-02-21 01:12:11 UTC (rev 6228)
@@ -1,4 +1,5 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
18 years, 2 months