JBoss Rich Faces SVN: r6177 - in trunk/samples/jira-data: src/test/java/org/richfaces/demo/datagrid/service and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-19 12:08:20 -0500 (Tue, 19 Feb 2008)
New Revision: 6177
Modified:
trunk/samples/jira-data/pom.xml
trunk/samples/jira-data/src/test/java/org/richfaces/demo/datagrid/service/JiraServiceTest.java
Log:
update demo
Modified: trunk/samples/jira-data/pom.xml
===================================================================
--- trunk/samples/jira-data/pom.xml 2008-02-19 17:05:41 UTC (rev 6176)
+++ trunk/samples/jira-data/pom.xml 2008-02-19 17:08:20 UTC (rev 6177)
@@ -15,5 +15,11 @@
<artifactId>commons-digester</artifactId>
<version>1.8</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-test</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/samples/jira-data/src/test/java/org/richfaces/demo/datagrid/service/JiraServiceTest.java
===================================================================
--- trunk/samples/jira-data/src/test/java/org/richfaces/demo/datagrid/service/JiraServiceTest.java 2008-02-19 17:05:41 UTC (rev 6176)
+++ trunk/samples/jira-data/src/test/java/org/richfaces/demo/datagrid/service/JiraServiceTest.java 2008-02-19 17:08:20 UTC (rev 6177)
@@ -1,17 +1,21 @@
package org.richfaces.demo.datagrid.service;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.richfaces.demo.datagrid.model.Channel;
import org.richfaces.demo.datagrid.service.JiraService;
-import junit.framework.TestCase;
+public class JiraServiceTest extends AbstractAjax4JsfTestCase {
-public class JiraServiceTest extends TestCase {
+ public JiraServiceTest(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
}
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
}
18 years, 2 months
JBoss Rich Faces SVN: r6176 - in trunk/ui/dataTable/src/main: java/org/richfaces/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-19 12:05:41 -0500 (Tue, 19 Feb 2008)
New Revision: 6176
Modified:
trunk/ui/dataTable/src/main/config/component/dataTable.xml
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
Log:
RF-1741
Modified: trunk/ui/dataTable/src/main/config/component/dataTable.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-02-19 17:03:45 UTC (rev 6175)
+++ trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-02-19 17:05:41 UTC (rev 6176)
@@ -175,8 +175,15 @@
</property>
<property>
<name>sortPriority</name>
- <classname>java.util.List</classname>
+ <classname>java.util.Collection</classname>
<description></description>
</property>
+ <property>
+ <name>sortMode</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Defines mode of sorting. Possible values are 'single' for sorting of one column and 'multi' for some.
+ </description>
+ </property>
</component>
</components>
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-02-19 17:03:45 UTC (rev 6175)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIColumn.java 2008-02-19 17:05:41 UTC (rev 6176)
@@ -21,6 +21,7 @@
package org.richfaces.component;
+import javax.el.ELContext;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
@@ -75,11 +76,11 @@
return sortField2;
}
- public void toggleSortOrder(){
+ public void toggleSortOrder(ELContext elContext){
if(Ordering.ASCENDING.equals(getSortOrder())) {
- setSortOrder(Ordering.DESCENDING);
+ getValueExpression("sortOrder").setValue(elContext, Ordering.DESCENDING);
} else {
- setSortOrder(Ordering.ASCENDING);
+ getValueExpression("sortOrder").setValue(elContext, Ordering.ASCENDING);
}
}
}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-19 17:03:45 UTC (rev 6175)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-19 17:05:41 UTC (rev 6176)
@@ -21,19 +21,15 @@
package org.richfaces.component;
+import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxSupport;
import org.ajax4jsf.component.SequenceDataAdaptor;
@@ -41,10 +37,8 @@
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.FilterIterator;
import org.apache.commons.collections.iterators.IteratorChain;
-import org.richfaces.model.ExtendedFilterField;
import org.richfaces.model.FilterField;
import org.richfaces.model.ModifiableModel;
-import org.richfaces.model.Ordering;
import org.richfaces.model.SortField2;
@@ -186,7 +180,7 @@
}
List<SortField2> sortFields = new LinkedList<SortField2>();
- List sortPriority = getSortPriority();
+ Collection sortPriority = getSortPriority();
if (sortPriority != null) {
for (Object object : sortPriority) {
if (object instanceof String) {
@@ -206,7 +200,8 @@
return new ModifiableModel(dataModel, getVar(), getFilterFields(), getSortFields());
}
- public abstract List getSortPriority();
- public abstract void setSortPriority(List sortPriority);
-
+ public abstract Collection getSortPriority();
+ public abstract void setSortPriority(Collection sortPriority);
+ public abstract String getSortMode();
+ public abstract void setSortMode(String sortMode);
}
\ No newline at end of file
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-19 17:03:45 UTC (rev 6175)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-19 17:05:41 UTC (rev 6176)
@@ -23,10 +23,12 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import javax.el.ELContext;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -486,26 +488,35 @@
protected void doDecode(FacesContext context, UIComponent component) {
Map<String, String> map = context.getExternalContext().getRequestParameterMap();
if (SORT_FILTER_PARAMETER.equals(map.get(component.getClientId(context)))) {
+ ELContext elContext = context.getELContext();
String clientId = map.get(SORT_FILTER_PARAMETER);
List<UIComponent> list = component.getChildren();
+ UIDataTable table = (UIDataTable) component;
+ boolean isSingleSortMode = !"multi".equals(table.getSortMode());
for (Iterator<UIComponent> iterator = list.iterator(); iterator
.hasNext();) {
UIComponent children = iterator.next();
if (children instanceof org.richfaces.component.UIColumn) {
org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) children;
children.setId(children.getId());
- if(children.getClientId(context).equals(clientId)) {
- String id = children.getId();
- UIDataTable table = (UIDataTable)component;
- List sortPriority = table.getSortPriority();
- if(sortPriority == null){
- sortPriority = new ArrayList();
- table.setSortPriority(sortPriority);
+ if (clientId != null) {
+ if (children.getClientId(context).equals(clientId)) {
+ String id = children.getId();
+ Collection sortPriority = table.getSortPriority();
+ if (sortPriority == null) {
+ sortPriority = new ArrayList();
+ table.getValueExpression("sortPriority").setValue(elContext, sortPriority);
+ }
+ if (isSingleSortMode) {
+ sortPriority.clear();
+ }
+ if(!sortPriority.contains(id)) {
+ sortPriority.add(id);
+ }
+ column.toggleSortOrder(elContext);
+ } else if(isSingleSortMode){
+ column.getValueExpression("sortOrder").setValue(elContext, Ordering.UNSORTED);
}
- if(!sortPriority.contains(id)) {
- sortPriority.add(id);
- }
- column.toggleSortOrder();
}
String filterValue = map.get(children.getClientId(context) + SORT_FILTER_PARAMETER);
if (filterValue != null) {
18 years, 2 months
JBoss Rich Faces SVN: r6175 - in trunk/sandbox/ui/fileUpload/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-19 12:03:45 -0500 (Tue, 19 Feb 2008)
New Revision: 6175
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
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-19 16:34:21 UTC (rev 6174)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-19 17:03:45 UTC (rev 6175)
@@ -19,11 +19,14 @@
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.UIProgressBar;
import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
import org.richfaces.org.jboss.seam.web.MultipartRequest;
import org.richfaces.renderkit.TemplateEncoderRendererBase;
+import com.sun.faces.context.FacesContextImpl;
+
/**
* Class provides base renderer for upload file component
*
@@ -55,10 +58,16 @@
UIFileUpload fileUpload = (UIFileUpload) component;
ServletRequest request = (ServletRequest) context.getExternalContext()
.getRequest();
+
String clientId = component.getClientId(context);
-// Map<String, String[]> params = context.getExternalContext()
-// .getRequestParameterValuesMap();
+ Map<String, String[]> params = context.getExternalContext()
+ .getRequestParameterValuesMap();
+
+ if (params.containsKey("percent")) {
+ AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
+ ajaxContext.setResponseData("safasfas");
+ }
//
// AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
@@ -70,7 +79,7 @@
if (request instanceof MultipartRequest) {
MultipartRequest multipartRequest = (MultipartRequest) request;
- clientId = clientId + ":1";
+ clientId = clientId + ":file";
fileUpload.setLocalInputStream(multipartRequest
.getFileInputStream(clientId));
fileUpload.setLocalContentType(multipartRequest
@@ -79,7 +88,6 @@
fileUpload.setLocalFileSize(multipartRequest.getFileSize(clientId));
onUploadComplete(context, multipartRequest.getFile(clientId),
fileUpload);
-
}
}
@@ -94,7 +102,6 @@
map.isEmpty();
}
}
-
}
private void onUploadComplete(FacesContext context, File file,
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-19 16:34:21 UTC (rev 6174)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-19 17:03:45 UTC (rev 6175)
@@ -25,7 +25,6 @@
<div class="upload_list_width upload_list_decor" id="#{clientId}">
<iframe name="#{clientId}" id="#{clientId}_iframe" style="display: none;"/>
-
<span style="display: none;">
<jsp:scriptlet>
@@ -34,7 +33,6 @@
]]>
</jsp:scriptlet>
</span>
-
<table class="upload_toolbar_decor">
<tr>
<td>
@@ -47,7 +45,7 @@
<input type="file" style="cursor: pointer; z-index: 3; right: -10px; top: -10px; font-size: 10em; position: absolute"
class="hidden"
id="#{clientId}:file"
- name="fileName"
+ name="#{clientId}:file"
onchange="return $('#{clientId}').component.add(this);"/>
</div>
</div>
@@ -98,7 +96,7 @@
</td>
</tr>
</table>
-
+
<div class="upload_list_width upload_list_overflow" id="#{clientId}:fileItems">
</div>
18 years, 2 months
JBoss Rich Faces SVN: r6174 - in trunk/sandbox/ui/inplaceSelect/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-19 11:34:21 -0500 (Tue, 19 Feb 2008)
New Revision: 6174
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
InplaceSelect component
Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-02-19 16:30:49 UTC (rev 6173)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-02-19 16:34:21 UTC (rev 6174)
@@ -1,21 +1,22 @@
if(!window.Richfaces) window.Richfaces = {};
-Richfaces.InplaceSelect = Class.create(Richfaces.Input, {
- inizialize : function($super, listObj, clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams) {
+Richfaces.InplaceSelect = Class.create(Richfaces.InplaceInput, {
+ initialize : function($super, listObj, clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams) {
+ this.comboList = listObj;
$super(clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams);
- this.comboList = listObj;
},
- initHandlers : function() {
+ initHandlers : function($super) {
+ $super();
this.comboList.list.observe("click", function(e){this.listClickHandler(e);}.bindAsEventListener(this));
this.tempValueKeeper.observe("blur", function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
- this.tempValueKeeper.observe("blur", function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
+ this.tempValueKeeper.observe("click", function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
},
tempKeeperClickHandler : function() {
- this.insList.showWithDelay();
+ this.comboList.showWithDelay();
},
- tmpValueBlurHandler : function(event) {
+ tmpValueBlurHandler : function($super, event) {
$super(event);
this.comboList.hideWithDelay();
},
@@ -24,5 +25,16 @@
this.tempValueKeeper.focus();
this.inputProcessing();
this.comboList.hideWithDelay();
+ },
+
+ deleteViewArtifacts : function () {
+ var text = this.inplaceInput.childNodes[6];
+ if (text) {
+ this.inplaceInput.removeChild(text);
+ }
+ },
+
+ getCurrentText : function() {
+ return this.inplaceInput.childNodes[6];
}
});
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 16:30:49 UTC (rev 6173)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 16:34:21 UTC (rev 6174)
@@ -16,21 +16,63 @@
new org.ajax4jsf.javascript.PrototypeScript(),
scripts/comboboxUtils.js,
scripts/combobox.js,
- scripts/inplaceselect.js
+ scripts/inplaceinput.js,
+ scripts/inplaceselect.js,
+ /org/richfaces/renderkit/html/scripts/utils.js
</h:scripts>
<f:clientid var="clientId" />
-
<f:resource var="saveIcon" name="org.richfaces.renderkit.html.images.saveControlIcon"/>
<f:resource var="cancelIcon" name="org.richfaces.renderkit.html.images.CancelControlIcon"/>
+<jsp:scriptlet>
+ <![CDATA[
+ Object value = component.getAttributes().get("value");
+ Object fieldValue = component.getAttributes().get("value");
+ value = getConvertedStringValue(context, component,value);
+ if (value == null) {
+ fieldValue = "";
+ value = component.getAttributes().get("defaultLabel");
+ }
+ if (value.equals("")) {
+ value = component.getAttributes().get("defaultLabel");
+ }
+ variables.setVariable("value", value);
+ variables.setVariable("fieldValue", fieldValue);
+
+ /*String saveIcon = (String)component.getAttributes().get("saveControlIcon");
+ if (saveIcon != null && saveIcon.length() != 0 ) {
+ variables.setVariable("saveIcon", saveIcon);
+ }
+
+ String cancelIcon = (String)component.getAttributes().get("cancelControlIcon");
+ if (cancelIcon != null && cancelIcon.length() != 0 ) {
+ variables.setVariable("cancelIcon", cancelIcon);
+ }
+
+ String controllClass = (String)component.getAttributes().get("controllClass");
+ variables.setVariable("controllClass", controllClass);
+ String controllHoveredClass = (String)component.getAttributes().get("controllHoveredClass");
+ variables.setVariable("controllHoveredClass", controllHoveredClass);
+ String controllPressedClass = (String)component.getAttributes().get("controllPressedClass");
+ variables.setVariable("controllPressedClass", controllPressedClass);*/
+ ]]>
+ </jsp:scriptlet>
<f:resource var="spacer" name="images/spacer.gif"/>
<span id="#{clientId}" class="insel_edit_state">
<input id="#{clientId}tabber" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" />
<img id="#{clientId}inplaceStrut" src="#{spacer}" class="is_strut"/>
- <input id="#{clientId}inplaceTmpValue" readonly="readonly" type="Text" value="New York" class="insel_field"/>
+ <input id="#{clientId}inplaceTmpValue"
+ readonly="readonly"
+ type="Text"
+ style='display:none;'
+ value="#{fieldValue}"
+ autocomplete="off"
+ maxlength='#{component.attributes["inputMaxLength"]}'
+ tabindex='#{component.attributes["tabindex"]}'
+ class="insel_field"/>
<input id='#{clientId}inplaceValue' name='#{clientId}value' type='hidden' value='#{fieldValue}'/>
- <div class="insel_btn_set">
+ <div id="#{clientId}bar" class="insel_btn_set">
<div class="insel_shadow">
<table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
<tr>
@@ -58,7 +100,6 @@
</div>
<div id="listParent#{clientId}" class="cb_width_list" style="position : absolute; height : 100px; left : 0px; top: 13px">
- <iframe class="cb_width_list cb_list_scroll cb_list_position" frameborder="0"></iframe>
<div class="cb_shadow">
<table id="shadow#{clientId}" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
<tr>
@@ -87,6 +128,7 @@
</div>
</div>
</div>
+ #{value}
</span>
<script type="text/javascript">
Richfaces.InplaceSelect.CLASSES = {
@@ -106,8 +148,12 @@
ITEM : {NORMAL : "rich-combobox-item #{itemClass}",
SELECTED : "rich-combobox-item rich-combobox-item-selected #{itemSelectedClass}"
}
+ },
+ COMPONENT : {CHANGED : {NORMAL : 'rich-inplace rich-inplace-changed #{component.attributes["changedClass"]}', HOVERED : '#{component.attributes["changedHoveredClass"]}'},
+ VIEW : {NORMAL : 'rich-inplace rich-inplace-view #{component.attributes["viewClass"]}', HOVERED : '#{component.attributes["viewHoveredClass"]}'},
+ EDITABLE : 'rich-inplace rich-inplace-edit #{component.attributes["editClass"]}'
}
- }
+ };
var richInplaceSelAttributes = {defaultLabel : '#{component.attributes["defaultLabel"]}',
showControls : #{component.attributes["showControls"]},
18 years, 2 months
JBoss Rich Faces SVN: r6173 - in trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp: pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-19 11:30:49 -0500 (Tue, 19 Feb 2008)
New Revision: 6173
Added:
trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.xhtml
Modified:
trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.jsp
Log:
extended sample
Modified: trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-02-19 16:14:48 UTC (rev 6172)
+++ trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-02-19 16:30:49 UTC (rev 6173)
@@ -2,9 +2,25 @@
<!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>
- <managed-bean>
- <managed-bean-name>bean</managed-bean-name>
- <managed-bean-class>org.richfaces.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+ <navigation-rule>
+ <display-name>xhtml</display-name>
+ <navigation-case>
+ <from-outcome>xhtml</from-outcome>
+ <to-view-id>/faces/pages/index.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>jsp</from-outcome>
+ <to-view-id>/faces/pages/index.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.richfaces.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/web.xml 2008-02-19 16:14:48 UTC (rev 6172)
+++ trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/WEB-INF/web.xml 2008-02-19 16:30:49 UTC (rev 6173)
@@ -2,14 +2,31 @@
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Archetype Created Web Application</display-name>
+<!--
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
<context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param> -->
+ <context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+ <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+</context-param>
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
Modified: trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.jsp 2008-02-19 16:14:48 UTC (rev 6172)
+++ trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.jsp 2008-02-19 16:30:49 UTC (rev 6173)
@@ -1,13 +1,26 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/inplaceSelect" prefix="ii"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/inplaceSelect" prefix="is"%>
<html>
- <head>
+ <head>
<title></title>
- </head>
- <body>
- <f:view>
- <ii:inplaceSelect />
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set skin" />
+ <h:outputText value="Current skin: #{skinBean.skin}"/><br />
+ </h:form>
+ <h:form>
+ <is:inplaceSelect>
+ <f:selectItem itemLabel="option 1" itemValue="option 1"/>
+ <f:selectItem itemLabel="option 2" itemValue="option 2"/>
+ <f:selectItem itemLabel="option 3" itemValue="option 3"/>
+ <f:selectItem itemLabel="option 4" itemValue="option 4"/>
+ <f:selectItem itemLabel="option 5" itemValue="option 5"/>
+ </is:inplaceSelect>
+ </h:form>
</f:view>
- </body>
+ </body>
</html>
Added: trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.xhtml (rev 0)
+++ trunk/sandbox/samples/inplaceSelect-sample/src/main/webapp/pages/index.xhtml 2008-02-19 16:30:49 UTC (rev 6173)
@@ -0,0 +1,34 @@
+<!-- <!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//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:is="http://labs.jboss.com/jbossrichfaces/ui/ui/inplaceSelect">
+
+
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set skin" />
+ <h:outputText value="Current skin: #{skinBean.skin}"/><br />
+ </h:form>
+
+ <h:form>
+ <is:inplaceSelect>
+ <f:selectItem itemLabel="option 1" itemValue="option 1"/>
+ <f:selectItem itemLabel="option 2" itemValue="option 2"/>
+ <f:selectItem itemLabel="option 3" itemValue="option 3"/>
+ <f:selectItem itemLabel="option 4" itemValue="option 4"/>
+ <f:selectItem itemLabel="option 5" itemValue="option 5"/>
+ </is:inplaceSelect>
+ </h:form>
+ </f:view>
+ </body>
+
+</html>
+
\ No newline at end of file
18 years, 2 months
JBoss Rich Faces SVN: r6172 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-02-19 11:14:48 -0500 (Tue, 19 Feb 2008)
New Revision: 6172
Modified:
trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/tree.xml
Log:
http://jira.jboss.com/jira/browse/RF-1137
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml 2008-02-19 15:34:30 UTC (rev 6171)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.desc.xml 2008-02-19 16:14:48 UTC (rev 6172)
@@ -52,7 +52,7 @@
</listitem>
<listitem>
- <para>Possibility to define a visual representation by node type</para>
+ <para>Possibility to define a visual representation by a node type</para>
</listitem>
<listitem>
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2008-02-19 15:34:30 UTC (rev 6171)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2008-02-19 16:14:48 UTC (rev 6172)
@@ -44,7 +44,7 @@
<section>
<title>Creating the Component with a Page Tag</title>
- <para>There are two cases for a tree definition: together with <emphasis role="bold">
+ <para>There are two cases for a tree definition: with <emphasis role="bold">
<property><rich:recursiveTreeNodesAdaptor></property>
</emphasis> or <emphasis role="bold">
<property><rich:treeNodesAdaptor></property>
@@ -65,7 +65,7 @@
...]]></programlisting>
<para> In the second case, it's necessary to define it with these attributes as
- it's shown below: </para>
+ it's shown in the example: </para>
<para>
<emphasis role="bold">Example:</emphasis>
@@ -314,7 +314,7 @@
<para>As it has been mentioned <link linkend="tree">above</link> the <emphasis role="bold">
<property><rich:tree></property>
</emphasis> component allows rendering any tree-like data model.</para>
- <para>The component interacts with data model through
+ <para>The component interacts with data model via
<property>"TreeNode"</property> interface (<ulink
url="http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..."
>org.richfaces.model.TreeNode</ulink>) that is used for tree nodes representation. The <emphasis>
@@ -322,7 +322,7 @@
</emphasis> attribute of the <emphasis role="bold">
<property><rich:tree></property>
</emphasis> component contains a nodes structure defined in a bean property. The property
- keeps a structure of objects that implement <property>"TreeNode"</property>
+ keeps a structure of objects that implements <property>"TreeNode"</property>
interface.</para>
<para><property>"TreeNode"</property> has a property
<property>"data"</property> (see <ulink
@@ -349,7 +349,7 @@
<property><rich:tree></property>
</emphasis> component.</para>
<para>It's possible to define a visual representation of a data model node (to define a
- node icon) and its behavior in a compliance with data contained in this node (with a value of
+ node icon) and its behavior in correspondence with data contained in this node (with a value of
the <emphasis>
<property>"var"</property>
</emphasis> attribute). The node behavior is defined by components nested to the <emphasis
@@ -399,14 +399,14 @@
</figure>
<para>In the example when each node of data model is processed, data contained in the property
<property>"data"</property> of
- <property>"TreeNode"</property> interface are placed in a request scope
+ <property>"TreeNode"</property> interface is placed in a request scope
variable, which name is defined with <emphasis>
<property>"var"</property>
</emphasis> attribute. The value of the <emphasis>
<property>"nodeFace"</property>
- </emphasis> attribute is evaluated in compliance with data placed in the <emphasis>
+ </emphasis> attribute is evaluated in correspondence with data placed in the <emphasis>
<property>"var"</property>
- </emphasis> attribute. And for the node representation is used corresponding <emphasis
+ </emphasis> attribute. And for the node representation is used the corresponding <emphasis
role="bold">
<property><rich:treeNode></property>
</emphasis> component (with a value of <emphasis>
@@ -483,7 +483,7 @@
</emphasis> attribute and different values of <emphasis>
<property>"rendered"</property>
</emphasis> attribute. It provides the possibility to define different representation for the
- same nodes type. In the example with artists and their albums (see <link linkend="example"
+ same node types. In the example with artists and their albums (see <link linkend="example"
>above</link>) it's possible to represent albums that are available for sale and
albums that are not available. An example is placed below:</para>
<para>
@@ -523,9 +523,9 @@
<property><rich:treeNode></property>
</emphasis> components has equal values of the <emphasis>
<property>"type"</property>
- </emphasis> attribute. In a compliance with value of the <emphasis>
+ </emphasis> attribute. Depending on value of the <emphasis>
<property>"rendered"</property>
- </emphasis> attribute corresponding <emphasis role="bold">
+ </emphasis> attribute the corresponding <emphasis role="bold">
<property><rich:treeNode></property>
</emphasis> component is selected for node representation. If an album is available for sale
the value of the <emphasis>
@@ -543,10 +543,9 @@
</emphasis> component.</para>
<itemizedlist>
<listitem>Ajax (default value) - Ajax submission is used for switching. Note, that for
- collapse/expand operations it is sent an Ajax request to the server. It could be seen a
- short delay in this case.</listitem>
- <listitem>Server - regular form submission request is used. Note, that all nodes actually
- render up-front and expanding/collapsing do not require server call.</listitem>
+ collapse/expand operations, an Ajax request is sent to the server and it could cause a
+ short delay.</listitem>
+ <listitem>Server - regular form submission request is used.</listitem>
<listitem>Client - switching is done as a whole on a client, no interaction with a server
presents. Full page content is reloaded after every click.</listitem>
</itemizedlist>
@@ -560,7 +559,7 @@
<property>"iconLeaf"</property>
</emphasis> attributes define icons for the component. Also you can define icons using facets
with the same names. If the facets are defined, the corresponding attributes are ignored and
- facets contents are used as icons. By default the width of a rendered facet area is 16px. </para>
+ facets content is used as icons. By default the width of a rendered facet area is 16px. </para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
@@ -628,7 +627,7 @@
</row>
<row>
<entry>dragIndicator</entry>
- <entry>Id of a component that is used as drag pointer during the drag operation</entry>
+ <entry>Id of a component that is used as a drag pointer during the drag operation</entry>
</row>
<row>
<entry>dragType</entry>
@@ -729,7 +728,7 @@
<listitem>ondragexit is a script expression to invoke when an element passing out from a tree zone</listitem>
<listitem>ondragstart is a script expression to invoke when drag starts</listitem>
<listitem>ondragend is a script expression to invoke when drag ends (a drop event)</listitem>
- <listitem>ondragenter is a script expression to invoke when an dragged element appears on a tree</listitem>
+ <listitem>ondragenter is a script expression to invoke when a dragged element appears on a tree</listitem>
</itemizedlist>
<para>They can be used to add some JavaScript effects.</para>
18 years, 2 months
JBoss Rich Faces SVN: r6171 - 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-19 10:34:30 -0500 (Tue, 19 Feb 2008)
New Revision: 6171
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 exception
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-19 15:09:26 UTC (rev 6170)
+++ trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-19 15:34:30 UTC (rev 6171)
@@ -112,21 +112,21 @@
return UIInplaceSelect.class;
}
- public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
- String event = (String) component.getAttributes().get(attributeName);
- ScriptString result = JSReference.NULL;
-
- if (event != null) {
- event = event.trim();
-
- if (event.length() != 0) {
- JSFunctionDefinition function = new JSFunctionDefinition();
- function.addParameter("event");
- function.addToBody(event);
-
- result = function;
- }
- }
- return ScriptUtils.toScript(result);
- }
+// public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
+// String event = (String) component.getAttributes().get(attributeName);
+// ScriptString result = JSReference.NULL;
+//
+// if (event != null) {
+// event = event.trim();
+//
+// if (event.length() != 0) {
+// JSFunctionDefinition function = new JSFunctionDefinition();
+// function.addParameter("event");
+// function.addToBody(event);
+//
+// result = function;
+// }
+// }
+// return ScriptUtils.toScript(result);
+// }
}
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-19 15:09:26 UTC (rev 6170)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-19 15:34:30 UTC (rev 6171)
@@ -10,21 +10,24 @@
body{padding : 30px;}
fieldset{padding : 30px; border : 1px solid #c0c0c0;}
legend{font-weight : bold}
-
.insel_default_state{white-space : nowrap; background-color : #f1f1f1/*editorBackgroundColor*/; border-bottom : 1px dashed #000000/*generalTextColor*/; padding-left : 3px; padding-right : 3px;}
-.insel_changed_state{background-image:url(images/mark_changed.gif); background-position : top left; background-repeat : no-repeat;}
+.insel_changed_state{background-position : top left; background-repeat : no-repeat;}
.insel_edit_state{position : relative; width : 100px;}
-.insel_field{background : #FBFF8E/*editBackgroundColor*/; padding : 0px 0px 0px 0px; border : 0px; margin : 0px; width : 112px; position : absolute; top:0px; left : 0px;background-image:url(images/mark_list.gif); background-position : center right; background-repeat : no-repeat;}
+.insel_field{background : #FBFF8E/*editBackgroundColor*/; padding : 0px 0px 0px 0px; border : 0px; margin : 0px; width : 112px; position : absolute; top:0px; left : 0px; background-position : center right; background-repeat : no-repeat;}
.insel_strut{width : 100px; height : 1px}
.insel_btn{
- background : url(images/bg_btn.png) top repeat-x #C7D7EC; /*gradient - from generalBackgroundColor to tabBackgroundColor, background-color - tabBackgroundColor*/
+ background-position : top;
+ background-repeat: repeat-x;
+ background-color: #C7D7EC; /*gradient - from generalBackgroundColor to tabBackgroundColor, background-color - tabBackgroundColor*/
border : 1px outset #BED6F8; /*panelBorderColor*/
padding : 0px;
margin : 0px;}
.insel_btn_press{
- background : url(images/bg_press.png) top repeat-x #C7D7EC; /*gradient - from tabBackgroundColor to generalBackgroundColor, background-color - tabBackgroundColor*/
+ background-position: top;
+ background-repeat: repeat-x;
+ background-color: #C7D7EC; /*gradient - from tabBackgroundColor to generalBackgroundColor, background-color - tabBackgroundColor*/
border : 1px inset #BED6F8; /*panelBorderColor*/
padding : 0px;
margin : 0px;}
@@ -33,10 +36,6 @@
.insel_btn_set{ position : absolute; top:0px; left : 112px; white-space : nowrap}
.insel_shadow{ top:0; left:0; position : absolute;}
.insel_shadow_size{ width : 34px; height : 16px;}
-.insel_shadow_tl{ background : url(images/bg_shadow.png) repeat-x top left;}
-.insel_shadow_tr{ background : url(images/bg_shadow.png) repeat-x top right;}
-.insel_shadow_bl{ background : url(images/bg_shadow.png) repeat-x bottom left;}
-.insel_shadow_br{ background : url(images/bg_shadow.png) repeat-x bottom right;}
.cb_list_cord{ position : relative; font-size : 0px;d!isplay : none}/*DDL is hidden!!!!!*/
.cb_list_scroll{ overflow : auto; height : 100px;}
.cb_list_position{ position : absolute; top:1px; left:0px;}
@@ -46,11 +45,124 @@
.cb_font{ font-size : 11px/*generalSizeFont*/; font-family : arial/*generalFamilyFont*/; color : #000000/*generalTextColor*/}
.cb_select{ padding : 1px; background-color: #4a75b5; border : 1px dotted #4a75b5; color: white;/*generalTextColor*/}
-.cb_shadow_tl{ background : url(images/bg_shadow.png) repeat-x top left;}
-.cb_shadow_tr{ background : url(images/bg_shadow.png) repeat-x top right;}
-.cb_shadow_bl{ background : url(images/bg_shadow.png) repeat-x bottom left;}
-.cb_shadow_br{ background : url(images/bg_shadow.png) repeat-x bottom right;}
+.insel_shadow_tl{
+ background-repeat: repeat-x;
+ background-position : top left;
+}
+
+.insel_shadow_tr{
+ background-repeat: repeat-x;
+ background-position : top right;
+}
+
+.insel_shadow_bl{
+ background-repeat: repeat-x;
+ background-position : bottom left;
+}
+
+.insel_shadow_br{
+ background-repeat: repeat-x;
+ background-position : bottom right;
+}
+
+.cb_shadow_tl{
+ background-repeat: repeat-x;
+ background-position: top left;
+}
+
+.cb_shadow_tr{
+ background-repeat: repeat-x;
+ background-position: top right;
+}
+.cb_shadow_bl{
+ background-repeat : repeat-x
+ background-position: bottom left;
+}
+
+.cb_shadow_br{
+ background-repeat : repeat-x;
+ background-position : bottom right;
+}
]]>
</f:verbatim>
-
+ <u:selector name=".insel_changed_state">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.EditIcon"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_field">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.SpinnerButtonDown"/>
+ </u:style>
+ </u:selector>
+
+
+ <u:selector name=".insel_shadow_tl">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".cb_shadow_tr">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".cb_shadow_bl">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".cb_shadow_br">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_shadow_tl">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_shadow_tr">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_shadow_bl">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_shadow_br">
+ <u:style name="background-image">
+ <f:resource f:key="/org/richfaces/renderkit/html/images/bg_shadow.png"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_btn">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.SpinnerButtonGradient"/>
+ </u:style>
+ </u:selector>
+
+ <u:selector name=".insel_btn_press">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.ComboBoxButtonPressGradient"/>
+ </u:style>
+ </u:selector>
+
+
+
+
+
+
+
+
</f:template>
\ No newline at end of file
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 15:09:26 UTC (rev 6170)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 15:34:30 UTC (rev 6171)
@@ -21,6 +21,8 @@
<f:clientid var="clientId" />
+<f:resource var="saveIcon" name="org.richfaces.renderkit.html.images.saveControlIcon"/>
+<f:resource var="cancelIcon" name="org.richfaces.renderkit.html.images.CancelControlIcon"/>
<f:resource var="spacer" name="images/spacer.gif"/>
<span id="#{clientId}" class="insel_edit_state">
@@ -50,8 +52,8 @@
</table>
</div>
<div style="position : relative">
- <input type="image" src="images/ico_ok.gif" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
- <input type="image" src="images/ico_cancel.gif" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ <input type="image" src="#{saveIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ <input type="image" src="#{cancelIcon}" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
</div>
</div>
18 years, 2 months
JBoss Rich Faces SVN: r6170 - trunk/docs/faq/en/src/main/docbook/module.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-02-19 10:09:26 -0500 (Tue, 19 Feb 2008)
New Revision: 6170
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-2153 - Section 'How to save the state of simpleTogglePanel or panelMenu?' added
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-02-19 14:43:42 UTC (rev 6169)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-02-19 15:09:26 UTC (rev 6170)
@@ -1455,13 +1455,104 @@
>here</ulink>.</para>
</section> -->
+ <!--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>
+ <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>.
+ </para>
+ <para>
+ In the following example when user submit
+ </para>
+ </section-->
+ <section id="SimpleTogglePanelPanelMenuState">
+ <?dbhtml filename="SimpleTogglePanelPanelMenuState.html"?>
+ <title>How to save the state of simpleTogglePanel or panelMenu?</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.
+ This state is remembered between page views.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+<programlisting role="XML"><![CDATA[...
+<rich:simpleTogglePanel id="stpIncludeID" switchType="ajax" width="600px" opened="#{simpleTogglePanel.state}" >
+ <a4j:support event="onexpand" actionListener="#{simpleTogglePanel.stateTrue}" reRender="repeater" oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
+ <a4j:support event="oncollapse" actionListener="#{simpleTogglePanel.stateFalse}" reRender="repeater" oncomplete="javascript:Richfaces.showModalPanel('panel')"/>
+ <h:panelGrid columns="2" border="0">
+ <h:graphicImage url="/pics/Canon.jpg" alt="" width="100px" height="100px"/>
+ <h:panelGroup>
+ <h:outputText style="font: 18px;font-weight: bold;" value="Canon EOS Digital Rebel XT"/>
+ <f:verbatim>
+ <br />
+ 8.2 Megapixels - SLR / Large Digital Camera - 1.8 in LCD Screen -
+ Storage: Compact Flash, Compact Flash Type II - Built In Flash
+ </f:verbatim>
+ </h:panelGroup>
+ </h:panelGrid>
+</rich:simpleTogglePanel>
+
+<rich:modalPanel id="panel" width="200" height="100">
+ <f:facet name="header">
+ <h:outputText value="States of simpleTogglePanel"/>
+ </f:facet>
+ <f:facet name="controls">
+ <span style="cursor:pointer" onclick="javascript:Richfaces.hideModalPanel('panel')">X</span>
+ </f:facet>
+ <h:outputText value="Expanded: " style="font-weight:bold;"/>
+ <h:outputText value="#{simpleTogglePanel.state}" id="repeater" />
+</rich:modalPanel>
+...]]></programlisting>
+ <para>
+ In order to build this application, you can create a managed bean like this one.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+public class SimpleTogglePanel {
+
+ private boolean state = false;
+
+ public boolean isState() {
+ return state;
+ }
+ public void setState(boolean state) {
+ this.state = state;
+ }
+
+
+ public boolean gState() {
+ return state;
+ }
+
+ public void stateTrue(ActionEvent event) {
+ this.state = true;
+ }
+ public void stateFalse(ActionEvent event) {
+ this.state = false;
+ }
+}
+...]]></programlisting>
+ </section>
+
+
<section id="RowSelectionInDataTable">
<?dbhtml filename="HighlightRowDataTable.html"?>
<title>How to highlight rows in a dataTable when the mouse is over?</title>
- <para>In order to highlight rows in a dataTable when the mouse is over you should use <emphasis><property>"onmouseover"</property></emphasis> and <emphasis><property>"onmouseout"</property></emphasis> attributes. </para>
<para>
+ In order to highlight rows in a dataTable when the mouse is over you should use
+ <emphasis><property>"onmouseover"</property></emphasis> and <emphasis><property>"onmouseout"</property></emphasis> attributes.
+ </para>
+ <para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
18 years, 2 months
JBoss Rich Faces SVN: r6169 - in trunk/sandbox/ui/fileUpload/src/main: java/org/richfaces/org/jboss/seam/ui/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-19 09:43:42 -0500 (Tue, 19 Feb 2008)
New Revision: 6169
Removed:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/FileItem.java
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
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/MultipartRequest.java
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:
file upload refactoring
Deleted: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/FileItem.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/FileItem.java 2008-02-19 14:41:47 UTC (rev 6168)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/FileItem.java 2008-02-19 14:43:42 UTC (rev 6169)
@@ -1,119 +0,0 @@
-/*
- * FileItem.java Date created: 03.01.2008
- * Last modified by: $Author$
- * $Revision$ $Date$
- */
-
-package org.richfaces.org.jboss.seam.ui.component;
-
-import java.io.Serializable;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Class provides an entity for file item in file upload list
- * @author "Andrey Markavtsov"
- *
- */
-public class FileItem implements Serializable{
-
- private static final long serialVersionUID = 42L;
-
- /** Defines list of statuses available */
- public static enum Status {ADDED, MARKED_4_UPLOAD, IN_PROGRESS, UPLOADED, CANCELLED};
-
- /** Pattern to search file name in full file name string */
- private static final Pattern pattern = Pattern.compile
- (".*\\\\+(.*)");
-
- /** Current status */
- private Status status;
-
- /** File name */
- private String fileName;
-
- /** File size */
- private Integer fileSize;
-
-
- /**
- * TODO Description goes here.
- */
- public FileItem() {
- super();
- // TODO Auto-generated constructor stub
- }
-
-
-
- /**
- * TODO Description goes here.
- * @param fileName
- */
- public FileItem(String fileName) {
- super();
- this.fileName = fileName;
- this.status = Status.ADDED;
- }
-
- /**
- * @return the fileName
- */
- public String getFileName() {
- Matcher matcher = pattern.matcher(fileName);
- if (matcher.matches()) {
- return matcher.group(1);
- }
- return fileName;
- }
-
- /**
- * @return the fileName
- */
- public String getFullFileName() {
- return fileName;
- }
-
-
- /**
- * @param fileName the fileName to set
- */
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- /**
- * @return the fileSize
- */
- public Integer getFileSize() {
- return (Integer)fileSize/1000;
- }
-
- /**
- * @param fileSize the fileSize to set
- */
- public void setFileSize(Integer fileSize) {
- this.fileSize = fileSize;
- }
-
-
-
- /**
- * @return the status
- */
- public Status getStatus() {
- return status;
- }
-
-
-
- /**
- * @param status the status to set
- */
- public void setStatus(Status status) {
- this.status = status;
- }
-
-
-
-}
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-19 14:41:47 UTC (rev 6168)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-19 14:43:42 UTC (rev 6169)
@@ -1,35 +1,15 @@
package org.richfaces.org.jboss.seam.ui.component;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import org.richfaces.component.UIProgressBar;
-import org.richfaces.org.jboss.seam.ui.component.FileItem.Status;
-
/**
* JSF component class
*
*/
public abstract class UIFileUpload extends UIInput {
- public static final String READY = "1";
-
- public static final String UNDER_UPLOAD = "2";
-
- public static final String UPLOADING = "3";
-
- private String uploadStatus = READY;
-
private String localContentType;
private String localFileName;
@@ -37,12 +17,9 @@
private Integer localFileSize;
private InputStream localInputStream;
-
- private List<FileItem> fileItems;
- private UIComponent progressBar;
+
-
// @Override
// public void processUpdates(FacesContext context) {
// ValueExpression dataBinding = getValueExpression("data");
@@ -96,103 +73,6 @@
// }
// }
- public boolean isReady () {
- return this.getUploadStatus() == READY;
- }
-
- public boolean isUploading () {
- return (this.getUploadStatus() == UPLOADING || this.getUploadStatus() == UNDER_UPLOAD);
- }
-
- public boolean hasFiles () {
- return this.getFileItems().size() > 0;
- }
-
- public Integer getFilesCount() {
- return fileItems.size();
- }
-
- public boolean isCanCleanAll() {
- boolean result = false;
- for (FileItem item : fileItems) {
- if (item.getStatus() != FileItem.Status.IN_PROGRESS) {
- result = true;
- break;
- }
- }
- return result;
- }
-
-
- public FileItem getFileForClean() {
- for (FileItem item : fileItems) {
- if (item.getStatus() != FileItem.Status.IN_PROGRESS) {
- return item;
- }
- }
- return null;
- }
-
- public Integer getFilesCountByStatus (Status status) {
- Integer counter = 0;
- for (FileItem item : fileItems) {
- if (item.getStatus() == status) {
- counter++;
- }
- }
- return counter;
- }
-
- public boolean isCanAdd () {
- boolean result = true;
- Integer max = (Integer)getAttributes().get("maxFiles");
- if (max != null) {
- if (getFilesCountByStatus(Status.UPLOADED) >= max) {
- result = false;
- }
- }
- return result;
- }
-
- public boolean isCanUploadAll () {
- return (null != getFileByStatus(FileItem.Status.ADDED));
- }
-
- public FileItem getFileInProgress () {
- for (FileItem item : fileItems) {
- if (item.getStatus() == FileItem.Status.IN_PROGRESS) {
- return item;
- }
- }
- return null;
- }
-
- public FileItem getFileByStatus (Status status) {
- for (FileItem item : fileItems) {
- if (item.getStatus() == status) {
- return item;
- }
- }
- return null;
- }
-
- public boolean hasFilesInProgress() {
- for (FileItem item : fileItems) {
- if (item.getStatus() == FileItem.Status.IN_PROGRESS) {
- return true;
- }
- }
- return false;
- }
-
- public void markForUpload() {
- for (FileItem item : fileItems) {
- if (item.getStatus() == FileItem.Status.ADDED) {
- item.setStatus(FileItem.Status.MARKED_4_UPLOAD);
- }
- }
- }
-
public String getLocalContentType() {
return localContentType;
}
@@ -237,86 +117,5 @@
public abstract void setStyle(String style);
- /**
- * @return the fileItems
- */
- public List<FileItem> getFileItems() {
- if (fileItems == null) {
- fileItems = new ArrayList<FileItem>();
- }
- return fileItems;
- }
-
-
-
- /**
- * @return the uploadStatus
- */
- public String getUploadStatus() {
- return uploadStatus;
- }
-
- /**
- * @param uploadStatus the uploadStatus to set
- */
- public void setUploadStatus(String uploadStatus) {
- this.uploadStatus = uploadStatus;
- }
-
- /**
- * @param fileItems
- * the fileItems to set
- */
- public void setFileItems(List<FileItem> fileItems) {
- this.fileItems = fileItems;
- }
-
-
-
- private Object[] values;
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIInput#saveState(javax.faces.context.FacesContext)
- */
- @Override
- public Object saveState(FacesContext context) {
- if (values == null) {
- values = new Object[3];
- }
- values[0] = super.saveState(context);
- values[1] = fileItems;
- values[2] = uploadStatus;
- return values;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIInput#restoreState(javax.faces.context.FacesContext,
- * java.lang.Object)
- */
- @Override
- public void restoreState(FacesContext context, Object state) {
- values = (Object[]) state;
- super.restoreState(context, values[0]);
- fileItems = (List<FileItem>) values[1];
- uploadStatus = (String) values[2];
- }
-
- /**
- * @return the progressBar
- */
- public UIComponent getProgressBar() {
- return progressBar;
- }
-
- /**
- * @param progressBar the progressBar to set
- */
- public void setProgressBar(UIComponent progressBar) {
- this.progressBar = progressBar;
- }
-
+
}
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-19 14:41:47 UTC (rev 6168)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-19 14:43:42 UTC (rev 6169)
@@ -1,11 +1,9 @@
package org.richfaces.org.jboss.seam.ui.renderkit;
+import java.io.File;
import java.io.IOException;
-import java.io.Writer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import javax.el.ValueExpression;
@@ -13,7 +11,6 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpSession;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.context.AjaxContextImpl;
@@ -23,55 +20,35 @@
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.UIProgressBar;
-import org.richfaces.org.jboss.seam.ui.component.FileItem;
-import org.richfaces.org.jboss.seam.ui.component.ProgressData;
import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
import org.richfaces.org.jboss.seam.web.MultipartRequest;
import org.richfaces.renderkit.TemplateEncoderRendererBase;
/**
* Class provides base renderer for upload file component
+ *
* @author "Andrey Markavtsov"
- *
+ *
*/
public abstract class FileUploadRendererBase extends
TemplateEncoderRendererBase {
- /** Add file action name */
- private static final String ACTION_ADD_FILE = "add";
-
- /** Upload all files action name */
- private static final String ACTION_UPLOAD_ALL = "uploadall";
-
- /** Upload file action name */
- private static final String ACTION_NEXT = "next";
-
- /** Clear file action name */
- private static final String ACTION_CLEAR_FILE = "clear";
-
- /** Clear all files action name */
- private static final String ACTION_CLEAR_ALL = "clearall";
-
- /** Stop file uploading action name */
- private static final String ACTION_STOP_FILE = "stop";
-
- private static final String ACTION_STOP_ALL = "stopall";
-
/** 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)
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ private static final String _reRenderAllFlag = "reRenderAll";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
*/
@Override
protected void doDecode(FacesContext context, UIComponent component) {
@@ -80,23 +57,13 @@
.getRequest();
String clientId = component.getClientId(context);
- Map<String, String[]> params = context.getExternalContext()
- .getRequestParameterValuesMap();
-
- AjaxContext ajaxContext = AjaxContextImpl
- .getCurrentInstance(context);
-
- if (!ajaxContext.isAjaxRequest() && !(request instanceof MultipartRequest)) {
- fileUpload.getFileItems().clear();
- fileUpload.setUploadStatus(UIFileUpload.READY);
- }
-
+// Map<String, String[]> params = context.getExternalContext()
+// .getRequestParameterValuesMap();
+//
+// AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
+
new AjaxEvent(component).queue();
-
- if (params.containsKey(getActionParameterName(clientId))) {
- processEvents(context, component, clientId);
- ajaxContext.addComponentToAjaxRender(component);
- }
+
if (!(request instanceof MultipartRequest)) {
request = unwrapMultipartRequest(request);
}
@@ -110,69 +77,36 @@
.getFileContentType(clientId));
fileUpload.setLocalFileName(multipartRequest.getFileName(clientId));
fileUpload.setLocalFileSize(multipartRequest.getFileSize(clientId));
- onUploadComplete(context, multipartRequest.getFileName(clientId),
+ onUploadComplete(context, multipartRequest.getFile(clientId),
fileUpload);
}
}
-
- private void storeData(FacesContext context, UIFileUpload fileUpload) {
+
+ private void storeData(FacesContext context, UIFileUpload fileUpload, File file) {
ValueExpression data = fileUpload.getValueExpression("data");
if (data != null) {
Class clazz = data.getType(context.getELContext());
if (clazz.isAssignableFrom(Map.class)) {
- Map map = (Map)data.getValue(context.getELContext());
- map.put(fileUpload.getLocalFileName(),fileUpload.getLocalInputStream());
+ Map map = (Map) data.getValue(context.getELContext());
+ map.put(fileUpload.getLocalFileName(), file);
map.isEmpty();
}
}
-
- }
-// public void encodeControlsMarkup(FacesContext context, UIComponent component)
-// throws IOException {
-// UIComponent header = component.getFacet("header");
-// if (header != null) {
-// writeScriptBody(context, header, true);
-// }
-// }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#encodeBegin(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- @Override
- public void encodeBegin(FacesContext context, UIComponent component)
- throws IOException {
- AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance();
- ajaxContext.removeRenderedArea(component.getClientId(context));
- ajaxContext.addRenderedArea(component.getClientId(context)
- + ":fileItems");
}
-
- private void onUploadComplete(FacesContext context, String fileName,
+ private void onUploadComplete(FacesContext context, File file,
UIFileUpload fileUpload) {
- Iterator<FileItem> it = fileUpload.getFileItems().iterator();
- while (it.hasNext()) {
- FileItem item = it.next();
- if (FileItem.Status.IN_PROGRESS == item.getStatus()) {
- item.setStatus(FileItem.Status.UPLOADED);
- break;
- }
- }
- fileUpload.setUploadStatus(UIFileUpload.READY);
- storeData(context, fileUpload);
+ storeData(context, fileUpload, file);
try {
- context.responseComplete();
- }catch (Exception e) {
- e.getMessage();
+ context.responseComplete();
+ } catch (Exception e) {
+ e.getMessage();
}
}
-
+
/*
* (non-Javadoc)
*
@@ -184,260 +118,23 @@
return null;
}
- private void processEvents(FacesContext context, UIComponent component,
- String clientId) {
- Map<String, String[]> params = context.getExternalContext()
- .getRequestParameterValuesMap();
- UIFileUpload fileUpload = (UIFileUpload) component;
- String action = params.get(getActionParameterName(clientId))[0];
- if (ACTION_ADD_FILE.equals(action)) {
- processAddFileAction(context, fileUpload, params);
- } else if (ACTION_UPLOAD_ALL.equals(action)) {
- processUploadAllAction(context, fileUpload);
- } else if (ACTION_CLEAR_ALL.equals(action)) {
- processClearAllAction(context, fileUpload);
- } else if (ACTION_CLEAR_FILE.equals(action)) {
- processClearAction(context, fileUpload, params);
- } else if (ACTION_NEXT.equals(action)) {
- processNextAction(context, fileUpload);
- } else if (ACTION_STOP_FILE.equals(action)) {
- processStopFileAction(context, fileUpload, params);
- } else if (ACTION_STOP_ALL.equals(action)) {
- processStopAllAction(context, fileUpload, params);
- }
- }
-
- private void setupSessionAttributes(FacesContext context, UIComponent component) {
- HttpSession session = getSession(context);
- session.setAttribute(_percentBeanName, 0);
- String progressInfo = (String)component.getAttributes().get("progressInfo");
- if (progressInfo != null) {
- session.setAttribute(_progressInfoBeanName, component.getAttributes().get("progressInfo"));
- session.setAttribute(progressInfo, new ProgressData());
- }
- }
-
- private void tearDownSessionAttributes(FacesContext context, UIComponent component) {
- HttpSession session = getSession(context);
- session.removeAttribute(_percentBeanName);
- String progressInfo = (String)component.getAttributes().get("progressInfo");
- if (progressInfo != null) {
- session.removeAttribute(_progressInfoBeanName);
- session.removeAttribute(progressInfo);
- }
- }
-
- private void processClearAction(FacesContext context,
- UIFileUpload fileUpload, Map<String, String[]> params) {
- if (params.containsKey(ACTION_CLEAR_FILE)) {
- String[] fileNames = params.get(ACTION_CLEAR_FILE);
- for (String name : fileNames) {
- removeFileItem(name, fileUpload);
- }
- putResponseData(context, getResponseData(fileUpload, null));
- }
- }
-
- private void processStopFileAction(FacesContext context,
- UIFileUpload fileUpload, Map<String, String[]> params) {
- FileItem item = fileUpload.getFileInProgress();
- if (item != null) {
- item.setStatus(FileItem.Status.CANCELLED);
- }
- processNextAction(context, fileUpload);
- }
-
-
- private void processStopAllAction(FacesContext context,
- UIFileUpload fileUpload, Map<String, String[]> params) {
- FileItem item = fileUpload.getFileByStatus(FileItem.Status.IN_PROGRESS);
- if (item != null) {
- item.setStatus(FileItem.Status.CANCELLED);
- }
- putResponseData(context, getResponseData(fileUpload, null));
- }
-
- private void processClearAllAction(FacesContext context,UIFileUpload fileUpload) {
- FileItem item = null;
- while ((item = fileUpload.getFileForClean()) != null) {
- fileUpload.getFileItems().remove(item);
- }
- putResponseData(context, getResponseData(fileUpload, null));
- }
-
-
- private void removeFileItem(String name, UIFileUpload fileUpload) {
- Iterator<FileItem> it = fileUpload.getFileItems().iterator();
- while (it.hasNext()) {
- FileItem item = it.next();
- if (name.equalsIgnoreCase(item.getFullFileName())) {
- fileUpload.getFileItems().remove(item);
- return;
- }
- }
- }
-
- private void processNextAction(FacesContext context,
- UIFileUpload fileUpload) {
- FileItem item = fileUpload.getFileByStatus(FileItem.Status.MARKED_4_UPLOAD);
- if (item != null) {
- item.setStatus(FileItem.Status.IN_PROGRESS);
- setupSessionAttributes(context, fileUpload);
- putResponseData(context, getResponseData(fileUpload, item.getFullFileName()));
- }else {
- tearDownSessionAttributes(context, fileUpload);
- putResponseData(context, getResponseData(fileUpload, null));
- }
- }
-
- private void processUploadAllAction(FacesContext context,
- UIFileUpload fileUpload) {
- fileUpload.markForUpload();
- FileItem toUpload = fileUpload.getFileByStatus(FileItem.Status.MARKED_4_UPLOAD);
- if (toUpload != null) {
- toUpload.setStatus(FileItem.Status.IN_PROGRESS);
- putResponseData(context, getResponseData(fileUpload, toUpload.getFullFileName()));
- setupSessionAttributes(context, fileUpload);
- }else {
- putResponseData(context, getResponseData(fileUpload, null));
- }
- }
-
- private void processAddFileAction(FacesContext context,
- UIFileUpload fileUpload, Map<String, String[]> params) {
- if (params.containsKey(FILE_NAME_PARAMETER)) {
- String[] fileNames = params.get(FILE_NAME_PARAMETER);
- for (String filename : fileNames) {
- FileItem fileItem = new FileItem(filename);
- fileUpload.getFileItems().add(fileItem);
- }
- putResponseData(context, getResponseData(fileUpload, null));
- }
- }
-
- private void putResponseData(FacesContext context, Object data) {
- AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
- ajaxContext.setResponseData(data);
- }
-
- private Object getResponseData(UIFileUpload fileUpload, String fileName) {
- Map<String, Object> map = new HashMap<String, Object>();
- Map<String, Object> upload = new HashMap<String, Object>();
- map.put("add", !fileUpload.isCanAdd());
- boolean hasFilesInProgress = fileUpload.hasFilesInProgress();
- upload.put("iscancel", hasFilesInProgress);
- upload.put("disabled", (hasFilesInProgress) ? false : !fileUpload.isCanUploadAll());
- map.put("upload",upload);
- map.put("clean", !fileUpload.isCanCleanAll());
- if (fileName != null) {
- map.put("filename", fileName);
- }
- return map;
- }
-
- private String getActionParameterName(String clientId) {
- return clientId + "_action";
- }
-
- private HttpSession getSession(FacesContext context) {
- if (context.getExternalContext() != null) {
- return (HttpSession) context.getExternalContext().getSession(false);
- }
- return null;
- }
-
-// public void encodeDate(FacesContext context, UIComponent component)
-// throws IOException {
-// ResponseWriter writer = context.getResponseWriter();
-// writer.write(new Date().toString());
-// }
-
- public String convertFileName(String name) {
- return name.replaceAll("[\\\\]{1}", "\\\\\\\\");
- }
-
public String getStopScript(FacesContext context, UIComponent component)
- throws IOException {
-
- JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
- ((Map) options.get("parameters")).put("action", "stop");
- ((Map) options.get("parameters")).put("uid", new JSReference("uid"));
- ajaxFunction.addParameter(options);
-
- JSFunctionDefinition function = new JSFunctionDefinition("uid");
- function.addParameter("event");
- function.addToBody(ajaxFunction.toScript());
-
- return function.toScript();
- }
-
- public void encodeInitialScript(FacesContext context, UIComponent component)
throws IOException {
- Writer writer = context.getResponseWriter();
- String clientId = component.getClientId(context);
- StringBuffer script = new StringBuffer("\n");
- script.append("new FileUpload('");
- script.append(clientId);
- script.append("','");
- UIComponent container = (UIComponent) AjaxRendererUtils
- .findAjaxContainer(context, component);
- UIComponent form = (UIComponent) AjaxRendererUtils
- .getNestingForm(component);
- String containerId = container.getId();
- String formId = form.getId();
- String actionUrl = AjaxContextImpl.getCurrentInstance(context)
- .getAjaxActionURL(context);
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
+ component, context);
+ Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ ((Map) options.get("parameters")).put("action", "stop");
+ ((Map) options.get("parameters")).put("uid", new JSReference("uid"));
+ ajaxFunction.addParameter(options);
- script.append(containerId).append("','");
- script.append(formId).append("','");
- script.append(actionUrl).append("','");
- script.append(component.getAttributes().get("addStyle"));
- script.append("','");
- script.append(component.getAttributes().get("addStyleDisabled"));
- script.append("','");
- script.append(component.getAttributes().get("uploadStyle"));
- script.append("','");
- script.append(component.getAttributes().get("uploadStyleDisabled"));
- script.append("','");
- script.append(component.getAttributes().get("cancelStyle"));
- script.append("','");
- script.append(component.getAttributes().get("cancelStyleDisabled"));
- script.append("','");
- script.append(component.getAttributes().get("cleanStyle"));
- script.append("','");
- script.append(component.getAttributes().get("cleanStyleDisabled"));
- script.append("');");
+ JSFunctionDefinition function = new JSFunctionDefinition("uid");
+ function.addParameter("event");
+ function.addToBody(ajaxFunction.toScript());
-
- writer.write(script.toString());
+ return function.toScript();
}
-
- public void encodeUpdateButtonScript(FacesContext context, UIComponent component)
- throws IOException {
-// UIFileUpload fileUpload = (UIFileUpload) component;
-// String cliendId = fileUpload.getClientId(context);
-// Writer writer = context.getResponseWriter();
-//
-// StringBuffer buffer = new StringBuffer();
-// buffer.append(getJSScriptStart(cliendId));
-// boolean hasFileInProgress = fileUpload.hasFilesInProgress();
-// buffer.append(".updateUploadButton(").append(hasFileInProgress)
-// .append(",")
-// .append(hasFileInProgress ? false : !fileUpload.isCanUploadAll())
-// .append(");\n");
-//
-// buffer.append(getJSScriptStart(cliendId)).append(".updateAddButton(")
-// .append(!fileUpload.isCanAdd()).append(");\n");
-//
-// buffer.append(getJSScriptStart(cliendId)).append(".updateCleanButton(")
-// .append(!fileUpload.isCanCleanAll()).append(");\n");
-//
-// writer.write(buffer.toString());
- }
-
/**
* Finds an instance of MultipartRequest wrapped within a request or its
* (recursively) wrapped requests.
@@ -475,38 +172,19 @@
return request;
}
+
- public void renderLabel(FacesContext context, UIComponent component,
- FileItem item) throws IOException {
- UIComponent label = getProgressLabel(component);
- Writer writer = context.getResponseWriter();
- if (item.getStatus() == FileItem.Status.UPLOADED) {
- writer.write("<b>Done</b>");
- } else if (item.getStatus() == FileItem.Status.IN_PROGRESS) {
- if (label != null) {
- renderChild(context, label);
- }else {
- writer.write("<b>In progress</b>");
- }
- } else if (item.getStatus() == FileItem.Status.CANCELLED) {
- writer.write("<b>Cancelled</b>");
- }
+ public String getProgressBarId(FacesContext context, UIComponent component)
+ throws IOException {
+ return getProgressBar(context, component).getClientId(context);
}
- public String getProgressBarId(FacesContext context, UIComponent component) throws IOException {
- return getProgressBar(context, component).getClientId(context);
+ public void renderProgress(FacesContext context, UIComponent component)
+ throws IOException {
+ UIComponent progressBar = getProgressBar(context, component);
+ renderChild(context, progressBar);
}
-
- public void renderProgress(FacesContext context, UIComponent component) throws IOException {
- UIComponent progressBar = getProgressBar(context, component);
- renderChild(context, progressBar);
- }
-
- public boolean isCanClear (FileItem item) {
- return item.getStatus() != FileItem.Status.IN_PROGRESS;
- }
-
-
+
private UIComponent createProgressBar(FacesContext context,
UIComponent fileUpload) {
UIComponent progressBar = fileUpload.getFacet("progress");
@@ -530,6 +208,8 @@
Integer.class);
progressBar.setValueExpression("value", ex);
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");
@@ -537,13 +217,13 @@
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) {
@@ -551,9 +231,8 @@
}
return label;
}
-
-
- /*
+
+ /*
* (non-Javadoc)
*
* @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
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-19 14:41:47 UTC (rev 6168)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2008-02-19 14:43:42 UTC (rev 6169)
@@ -120,10 +120,14 @@
private ByteArrayOutputStream bOut = null;
private FileOutputStream fOut = null;
private File tempFile = null;
-
+
public FileParam(String name) {
super(name);
}
+
+ public File getFile() {
+ return tempFile;
+ }
public String getFilename() {
return filename;
@@ -568,7 +572,14 @@
return (p != null && p instanceof FileParam) ? ((FileParam) p)
.getContentType() : null;
}
+
+ public File getFile(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getFile() : null;
+ }
+
public String getFileName(String name) {
Param p = getParam(name);
return (p != null && p instanceof FileParam) ? ((FileParam) p)
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-19 14:41:47 UTC (rev 6168)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-19 14:43:42 UTC (rev 6169)
@@ -52,7 +52,7 @@
[
new ET(function (context) { return Richfaces.evalMacro("fileName", context)})
]),
- new E('div',{'id':'progress'}),
+ new E('div',{ }),
new E('div',{'className':'upload_name_padding'},
[
new ET(function (context) { return Richfaces.evalMacro("label", context)})
@@ -124,13 +124,24 @@
this.entryElement.component = this;
this.statusLabel = this.entryElement.rows[0].cells[0].lastChild;
this.controlArea = this.entryElement.rows[0].cells[1].firstChild;
+ this.progressArea = this.entryElement.rows[0].cells[0].childNodes[1];
},
upload: function() {
this.setState(FileUploadEntry.UPLOAD_IN_PROGRESS);
+ this.setupProgressBar();
this.uploadObject.submitForm(this);
},
+ setupProgressBar: function () {
+ this.progressArea.appendChild(this.uploadObject._progressBar);
+ this.uploadObject.prepareProgressBar();
+ },
+
+ finishProgressBar: function () {
+ this.uploadObject.finishProgressBar();
+ },
+
stop: function() {
this.uploadObject.stopScript(this.uid);
},
@@ -138,11 +149,18 @@
_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;
},
@@ -150,7 +168,7 @@
this._clearInput();
this._clearEntry();
},
-
+
setState: function(newState) {
var oldState = this.state;
this.state = newState;
@@ -247,10 +265,10 @@
});
-FileUpload1 = {};
-FileUpload1 = Class.create();
+FileUpload = {};
+FileUpload = Class.create();
-Object.extend(FileUpload1.prototype, {
+Object.extend(FileUpload.prototype, {
idCounter: 0,
@@ -271,7 +289,9 @@
initialize: function(id, stopScript, progressBarId, options) {
this.id = id;
this.element = $(this.id);
- this.progressBar = $(progressBarId).component;
+ //this.progressBarId = progressBarId;
+ this._progressBar = $(progressBarId);
+ this.progressBar = this._progressBar.component;
this.element.component = this;
@@ -284,6 +304,17 @@
this.setupAutoUpload();
},
+ prepareProgressBar: function () {
+ this.progressBar.setValue(0);
+ Element.show(this._progressBar);
+ },
+
+ finishProgressBar: function () {
+ this.progressBar.disable();
+ this.progressBar.setValue(100);
+ Element.hide(this._progressBar);
+ },
+
setupAutoUpload: function() {
this.runUpload = this.options.autoUpload;
},
@@ -369,8 +400,9 @@
_endUpload: function() {
this.activeEntry = null;
- this.progressBar.setValue(0);
- this.progressBar.disable();
+ //this.progressBar.setValue(100);
+ //this.progressBar.disable();
+ //Element.hide(this._progressBar);
},
_updateEntriesState: function() {
@@ -488,6 +520,7 @@
if (!parentForm.onsubmit || parentForm.onsubmit()) {
var iframe = this.iframe;
new LoadWatcher(iframe, function(newState) {
+ this.finishProgressBar();
this.setState(newState);
}.bind(entry));
@@ -516,347 +549,3 @@
});
-FileUpload = {};
-FileUpload = Class.create();
-FileUpload.Uploaders = {};
-Object.extend(FileUpload.prototype, {
- initialize: function(id, containerId, formId, actionUrl, addStyle, addStyleDisabled, uploadStyle, uploadStyleDisabled, cancelStyle, cancelStyleDisabled, cleanStyle, cleanStyleDisabled) {
- this.id = id;
- this.containerId = containerId;
- this.formId = formId;
- this.actionUrl = actionUrl;
- this.createForm();
- this.f = $(id + ":files");
- this.fm = $(id + ":f");
- this.fr = $(id + ":fr");
- this.addStyle = addStyle;
- this.addStyleDisabled = addStyleDisabled;
- this.uploadStyle = uploadStyle;
- this.uploadStyleDisabled = uploadStyleDisabled;
- this.cancelStyle = cancelStyle;
- this.cancelStyleDisabled = cancelStyleDisabled;
- this.cleanStyle = cleanStyle;
- this.cleanStyleDisabled = cleanStyleDisabled;
- this.canAddAll = true;
- this.canUploadAll = false;
- this.canCleanAll = false;
- $(this.id).component = this;
- },
- renderControl: function (template, context) {
- if (!template) {
- return;
- }
- var html = template.invoke('getContent', context).join('');
- $(this.id + ":header").innerHTML = html;
- },
- setClassName: function (o , className) {
- o.className = className;
- },
- updateCleanButton: function(disabled) {
- this.canCleanAll = !disabled;
- this.updateButton($(this.id+":clean1"),$(this.id+":clean2"),this.cleanStyle,this.cleanStyleDisabled,"clear",disabled);
- },
- updateAddButton: function(disabled) {
- this.canAddAll = !disabled;
- this.updateButton($(this.id+":add1"),$(this.id+":add2"),this.addStyle,this.addStyleDisabled,"add",disabled);
- },
- updateUploadButton: function (isCancel, disabled) {
- this.canUploadAll = !disabled;
- var d = $(this.id + ":upload1");
- var l = $(this.id + ":upload2");
- if (d && l) {
- var cancelButton = Element.firstDescendant(l);
- var uploadButton = cancelButton.next();
-
- if (isCancel) {
- cancelButton.show();
- uploadButton.hide();
-
- this.updateButton(d,l,this.cancelStyle,this.cancelStyleDisabled,"start",disabled);
- d.onclick = function () { this.stopAll(); }.bind(this);
- }else {
- uploadButton.show();
- cancelButton.hide();
-
- this.updateButton(d,l,this.uploadStyle,this.uploadStyleDisabled,"start",disabled);
- d.onclick = function () { this.uploadAll(); }.bind(this);
- }
-
- }
- },
- updateButton: function (o1,o2, style, styleDis, prefix ,disabled) {
- if (disabled) {
- this.setClassName(o1, "upload_button_dis upload_font "+ styleDis);
- this.setClassName(o2, "upload_button_content upload_font upload_ico upload_ico_"+prefix+"_dis "+styleDis);
- }else {
- this.setClassName(o1, "upload_button upload_font "+ style);
- this.setClassName(o2, "upload_button_content upload_font upload_ico upload_ico_"+prefix+" "+style);
- }
- },
- processResponseData: function (data) {
- if (data) {
- var add = data['add'];
- if (add != null) {
- this.updateAddButton(add);
- }
- var upload = data['upload'];
- this.updateUploadButton(upload['iscancel'],upload['disabled']);
- var clean = data['clean'];
- if (clean != null) {
- this.updateCleanButton(clean);
- }
- }
- },
- sendAjaxRequest: function (params, oncomplete) {
- var options = {};
- options['actionUrl'] = this.actionUrl;
- var p = options['parameters'] = {};
- p[this.id] = this.id;
- if (params) {
- for (var param in params) {
- p[param] = params[param];
- }
- }
- if (oncomplete) {
- options['oncomplete'] = oncomplete;
- }
- A4J.AJAX.Submit(this.containerId,this.formId,null,options);
- },
- add: function () {
- if (!this.canAddAll) return;
- var oncomplete = function(request, event, data) {
- this._add();
- this.processResponseData(data);
- }.bind(this);
- var params = {};
- params[this.id + "_action"] = 'add';
- this.sendAjaxRequest(params, oncomplete);
- return false;
- },
- _add: function (){
- var o = $(this.id + ":file");
- var parent = o.parentNode;
-
- var clon = o.cloneNode(true);
- clon.id = this.id + ":file";
- clon.name = "fileName";
-
- o.id = "add";
- o.name = "add";
- o.disabled = true;
- o.style.display = "none";
-
- this.f.appendChild(o);
-
- parent.appendChild(clon);
- },
- addViewState: function () {
- if (!this.fm['javax.faces.ViewState']) {
- var d = document.createElement("input");
- d.type="hidden";
- d.name = "javax.faces.ViewState";
- d.value = $("javax.faces.ViewState").value;
- this.fm.appendChild(d);
- }
- },
- uploadAll: function () {
- if (!this.canUploadAll) return;
- if (this.getFilesCount() == 0) return;
- var oncomplete = function(request, event, data) {
- this.processResponseData(data);
- if (data['filename']) {
- this._upload(data['filename']);
- }
- }.bind(this);
- var params = {};
- params[this.id + "_action"] = 'uploadall';
- this.sendAjaxRequest(params, oncomplete);
- return false;
- },
- _upload: function (name) {
- var v = this.findFileByName(name);
- this.addViewState();
- this.prepareUpload();
- if (v) {
- v.disabled = false;
- v.name = this.id + ":1";
- v.id = v.name;
- this.fm.submit();
- }
- },
- next: function (ev) {
- var params = {};
- params[this.id + "_action"] = "next";
- var oncomplete = function(request, event, data) {
- this.processResponseData(data);
- if (data['filename']) {
- this._upload(data['filename']);
- }
- }.bind(this);
- this.sendAjaxRequest(params, oncomplete);
- },
- onFileUploaded: function (ev) {
- var d = $(this.id).component;
- if (d.canceled == true) {
- d.canceled = false;
- return;
- }
- var i = $(this.id + ":1");
- if (i) {
- this.finishProgressBar();
- i.disabled = true;
- i.id = "";
- i.name = "";
- this.next(ev);
- }
- },
- finishProgressBar: function () {
- var prBar = $(this.formId + ":progressBar");
- if (prBar) {
- prBar.component.disable();
- prBar.component.setValue(100);
- }
- },
- createForm: function () {
- if ($(this.id + ":fr")) return;
- var fr = document.createElement("iframe");
- fr.id = this.id + ":fr";
- fr.name = fr.id;
- fr.style.display="none";
- fr.src = "about:blank";
- fr.onload = function(request, event, data) {
- this.onFileUploaded(event);
- }.bind(this);
-
-
- document.body.insertBefore(fr, null);
-
- var f = document.createElement("form");
- f.enctype = "multipart/form-data";
- f.action = this.actionUrl;
- f.method = "post";
- f.id = this.id + ":f";
- f.target = this.id + ":fr";
-
- var d = document.createElement("div");
- d.id = this.id + ":files";
- f.appendChild(d);
- //--
- d = document.createElement("input");
- d.type="hidden";
- d.name = this.formId;
- d.value = d.name;
- f.appendChild(d);
-
- document.body.insertBefore(f, null);
- //--
- },
- getFilesCount: function () {
- if (this.f.hasChildNodes()) {
- return this.f.childNodes.length;
- }
- return 0;
- },
- cleanAll: function () {
- if (!this.canCleanAll) return;
- var params = {}
- params[this.id + "_action"] = "clearall";
- var oncomplete = function (request, event, data) {
- this.processResponseData(data);
- this._cleanAll();
- }.bind(this);
- this.sendAjaxRequest(params, oncomplete);
- return false;
- },
- _cleanAll: function() {
- this.removeChilds(this.f);
- },
- stopRequest: function () {
- this.canceled = true;
- this.fr.src = "about:blank";
- },
- stop: function () {
- $(this.formId+":progressBar").component.disable();
- this.stopRequest();
- var f = $(this.id + ":1");
- if (f) {
- f.disabled = true;
- f.id = "add";
- f.name = f.id;
- }
- var params = {}
- params[this.id + "_action"] = "stop";
- var oncomplete = function (request, event, data) {
- this.processResponseData(data);
- if (data['filename']) {
- this._upload(data['filename']);
- }
- }.bind(this);
- this.sendAjaxRequest(params, oncomplete);
- return false;
- },
- stopAll: function () {
- this.stopRequest();
- var params = {}
- params[this.id + "_action"] = "stopall";
- var oncomplete = function (request, event, data) {
- this.processResponseData(data);
- }.bind(this);
- this.sendAjaxRequest(params, oncomplete);
- return false;
- },
- prepareUpload: function () {
- for (var i = 0; i < this.f.childNodes.length; i++) {
- this.f.childNodes[i].disabled = true;
- this.f.childNodes[i].name="";
- this.f.childNodes[i].id="";
- }
- },
- removeChilds: function (f) {
- if (f && f.hasChildNodes && f.removeChild) {
- while (f.hasChildNodes()) {
- f.removeChild(f.firstChild);
- }
- }
- },
- reduce: function (confirmId, id) {
- var confirm = $(confirmId);
- var d = $(id);
- if (confirm)
- Element.hide(confirm);
- if (d)
- Element.show(d);
- return false;
- },
- confirm: function (confirmId, id) {
- Element.show($(confirmId));
- Element.hide($(id));
- window.setTimeout("$('"+this.id+"').component.reduce('"+confirmId+"','"+id+"');", 3000);
- return false;
- },
- findFileByName: function(name) {
- for (var i = 0; i < this.getFilesCount(); i++) {
- var d = this.f.childNodes[i];
- if (d.value == name) { return d; }
- }
- return null;
- },
- clear: function (name) {
- var v = this.findFileByName(name);
- if (!v) return;
- var params = {}
- params[this.id + "_action"] = "clear";
- params["clear"] = name;
- var oncomplete = function (request, event, data) {
- this.processResponseData(data);
- this._clear(v);
- }.bind(this);
- this.sendAjaxRequest(params, oncomplete);
- return false;
- },
- _clear: function (v) {
- if (v) {
- this.f.removeChild(v);
- }
- }
- });
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-19 14:41:47 UTC (rev 6168)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-19 14:43:42 UTC (rev 6169)
@@ -23,19 +23,17 @@
<f:clientId var="clientId" />
<div class="upload_list_width upload_list_decor" id="#{clientId}">
- <iframe name="#{clientId}" id="#{clientId}_iframe" />
-<span style="display: none">
- <script type="text/javascript">
- /*<!-- f:call name="encodeInitialScript" / -->*/
- </script>
-</span>
+<iframe name="#{clientId}" id="#{clientId}_iframe" style="display: none;"/>
+
+<span style="display: none;">
<jsp:scriptlet>
<![CDATA[
renderProgress(context, component);
]]>
</jsp:scriptlet>
+</span>
<table class="upload_toolbar_decor">
<tr>
@@ -103,99 +101,11 @@
<div class="upload_list_width upload_list_overflow" id="#{clientId}:fileItems">
- <!-- jsp:scriptlet>
- <![CDATA[
- Iterator<org.richfaces.org.jboss.seam.ui.component.FileItem> it = component.getFileItems().iterator();
- Integer i = 0;
- while (it.hasNext()) {
- org.richfaces.org.jboss.seam.ui.component.FileItem item = it.next();
- String fullFileName = item.getFullFileName();
- String fileName = item.getFileName();
- variables.setVariable("fileName",fileName);
- variables.setVariable("fullFileName",fullFileName);
- variables.setVariable("fullFileNameJs",convertFileName(fullFileName));
- variables.setVariable("n",i);
- ]]>
- </jsp:scriptlet>
-
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="upload_font upload_name upload_table_td">
- <div class="upload_name_padding">
- #{fileName}
- </div>
-
- <jsp:scriptlet>
- <![CDATA[
- renderProgress(context, component, item);
- ]]>
- </jsp:scriptlet>
-
-
- <div class="upload_name_padding">
- <jsp:scriptlet>
- <![CDATA[
- renderLabel(context, component, item);
- ]]>
- </jsp:scriptlet>
- </div>
-
-
- </td>
- <td class="upload_table_td" style="vertical-align: center;">
- <jsp:scriptlet>
- <![CDATA[
- if (isCanClear(item)) {
- ]]>
- </jsp:scriptlet>
- <div class="upload_font upload_del">
- <a href="#" class="upload_anc" id="#{clientId}:clear#{n}"
- onclick="return $('#{clientId}').component.confirm('#{clientId}:cconfirm#{n}','#{clientId}:clear#{n}');"
- style="text-decoration: none; color:black">Clear</a>
- <span id="#{clientId}:cconfirm#{n}" style="display:none">
- <a href="#" onclick="return $('#{clientId}').component.clear('#{fullFileNameJs}');" style="text-decoration: none; color:black">Yes</a>
- <a href="#" onclick="$('#{clientId}').component.reduce('#{clientId}:cconfirm#{n}','#{clientId}:clear#{n}');" style="text-decoration: none; padding-left: 10px; color:black">No</a>
- </span>
- </div>
- <jsp:scriptlet>
- <![CDATA[
- } else {
- ]]>
- </jsp:scriptlet>
- <div class="upload_font upload_del">
- <a href="#" class="upload_anc" id="#{clientId}:stop#{n}"
- onclick="return $('#{clientId}').component.confirm('#{clientId}:sconfirm#{n}','#{clientId}:stop#{n}');"
- style="text-decoration: none; color:black">Stop</a>
- <span id="#{clientId}:sconfirm#{n}" style="display:none">
- <a href="#" onclick="return $('#{clientId}').component.stop();" style="text-decoration: none; color:black">Yes</a>
- <a href="#" onclick="$('#{clientId}').component.reduce('#{clientId}:sconfirm#{n}','#{clientId}:stop#{n}');" style="text-decoration: none; padding-left: 10px; color:black">No</a>
- </span>
- </div>
-
- <jsp:scriptlet>
- <![CDATA[
- }
- ]]>
- </jsp:scriptlet>
- </td>
- <td class="upload_table_td">
- <div class="upload_font upload_scroll"></div>
- </td>
- </tr>
- </table>
-
- <jsp:scriptlet>
- <![CDATA[
- i++;
- }
- ]]>
- </jsp:scriptlet-->
-
</div>
+
<span>
<script type="text/javascript">
- new FileUpload1('#{clientId}', #{this:getStopScript(context, component)}, '#{this:getProgressBarId(context, component)}');
- /*<!-- f:call name="encodeUpdateButtonScript" / -->*/
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, '#{this:getProgressBarId(context, component)}');
</script>
</span>
18 years, 2 months
JBoss Rich Faces SVN: r6168 - Suite and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2008-02-19 09:41:47 -0500 (Tue, 19 Feb 2008)
New Revision: 6168
Added:
trunk/test-applications/qa/Performance Suite/Performance Test Suite Blank.doc
Removed:
trunk/test-applications/qa/Performance Suite/Performance Test Suite.doc
Log:
Deleted: trunk/test-applications/qa/Performance Suite/Performance Test Suite.doc
===================================================================
(Binary files differ)
Added: trunk/test-applications/qa/Performance Suite/Performance Test Suite Blank.doc
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/qa/Performance Suite/Performance Test Suite Blank.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
18 years, 2 months