JBoss Rich Faces SVN: r6338 - 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-26 04:41:32 -0500 (Tue, 26 Feb 2008)
New Revision: 6338
Modified:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
disable functionality refactoring
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-25 19:31:49 UTC (rev 6337)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-26 09:41:32 UTC (rev 6338)
@@ -577,9 +577,9 @@
},
processButtons: function () {
- this.disableAddButton(this.disabled || this.maxFileBatchSize && this.entries.length >= this.maxFileBatchSize);
- this.disableCleanButton(this.disabled || this.cleanAllDisabled());
- this.disableUploadButton(this.disabled || this.uploadAllDisabled());
+ this.disableAddButton();
+ this.disableCleanButton();
+ this.disableUploadButton();
this.switchUploadButton();
},
@@ -625,43 +625,60 @@
}
},
- disableCleanButton: function(disabled) {
- if (disabled)
- Element.hide($(this.id + ":clean1"));
- else
- Element.show($(this.id + ":clean1"));
- if(disabled) {
- $(this.id + ":clean1").onclick = function() {return false;};
+ disableCleanButton: function() {
+ var disabled = this.cleanAllDisabled();
+ var d1 = $(this.id + ":clean1");
+ var d2 = $(this.id + ":clean2");
+ if (disabled) {
+ Element.hide(d1);
+ return;
+ } else {
+ Element.show(d1);
+ }
+
+ if(this.disabled) {
+ d1.onclick = function() {return false;};
} else {
- $(this.id + ":clean1").onclick = function() {return this.clear();}.bind(this);
+ d1.onclick = function() {return this.clear();}.bind(this);
}
- $(this.id+":clean1").className = (disabled? this.classes.CLEAN.DISABLED : this.classes.CLEAN.ENABLED);
- $(this.id+":clean2").className = (disabled? this.classes.CLEAN_CONTENT.DISABLED : this.classes.CLEAN_CONTENT.ENABLED);
+ d1.className = (this.disabled ? this.classes.CLEAN.DISABLED : this.classes.CLEAN.ENABLED);
+ d2.className = (this.disabled ? this.classes.CLEAN_CONTENT.DISABLED : this.classes.CLEAN_CONTENT.ENABLED);
},
- disableAddButton: function(disabled) {
- this.currentInput.disabled = disabled;
- if (disabled)
- Element.hide($(this.id+":add1"));
- else
- Element.show($(this.id+":add1"));
- $(this.id+":add1").className = (disabled? this.classes.ADD.DISABLED : this.classes.ADD.ENABLED);
- $(this.id+":add2").className = (disabled? this.classes.ADD_CONTENT.DISABLED : this.classes.ADD_CONTENT.ENABLED);
+ disableAddButton: function() {
+ var disabled = (this.maxFileBatchSize && this.entries.length >= this.maxFileBatchSize);
+ this.currentInput.disabled = disabled || this.disabled;
+ var d1 = $(this.id+":add1");
+ var d2 = $(this.id+":add2");
+ if (disabled) {
+ Element.hide(d1);
+ return;
+ } else {
+ Element.show(d1);
+ }
+ d1.className = (this.disabled ? this.classes.ADD.DISABLED : this.classes.ADD.ENABLED);
+ d2.className = (this.disabled ? this.classes.ADD_CONTENT.DISABLED : this.classes.ADD_CONTENT.ENABLED);
},
- disableUploadButton: function (disabled) {
+ disableUploadButton: function () {
+ var disabled = this.uploadAllDisabled();
+ var d1 = $(this.id + ":upload1");
+ var d2 = $(this.id + ":upload2");
if(disabled) {
- Element.hide($(this.id + ":upload1"));
- $(this.id + ":upload1").onclick = function() {return false;};
+ Element.hide(d1);
} else {
- Element.show($(this.id + ":upload1"));
- $(this.id + ":upload1").onclick = function() {return this.upload();}.bind(this);
+ Element.show(d1);
}
+ if (this.disabled) {
+ d1.onclick = function() {return false;};
+ }else {
+ d1.onclick = function() {return this.upload();}.bind(this);
+ }
- $(this.id + ":upload1").className = (disabled? this.classes.UPDATE.DISABLED : this.classes.UPDATE.ENABLED);
- $(this.id + ":upload2").className = (disabled? this.classes.UPDATE_CONTENT.DISABLED : this.classes.UPDATE_CONTENT.ENABLED);
+ d1.className = (this.disabled ? this.classes.UPDATE.DISABLED : this.classes.UPDATE.ENABLED);
+ d2.className = (this.disabled ? this.classes.UPDATE_CONTENT.DISABLED : this.classes.UPDATE_CONTENT.ENABLED);
},
disable: function () {
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-25 19:31:49 UTC (rev 6337)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-26 09:41:32 UTC (rev 6338)
@@ -92,7 +92,7 @@
style="display: none">
<a href="#" class="upload_button_selection">
<div class="upload_button_content upload_font upload_ico upload_ico_clear_dis #{component.attributes['cleanButtonClassDisabled']}"
- id="#{clientId}:clean2">Clean All</div>
+ id="#{clientId}:clean2">Clear All</div>
</a>
</div>
</div>
16 years, 10 months
JBoss Rich Faces SVN: r6337 - in trunk/ui/dataTable/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-02-25 14:31:49 -0500 (Mon, 25 Feb 2008)
New Revision: 6337
Modified:
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
Log:
Inplace inputs in headers with filter. HTML mark-up changed.
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-25 19:12:49 UTC (rev 6336)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-25 19:31:49 UTC (rev 6337)
@@ -56,8 +56,6 @@
Collection<Object> sortPriority = new ArrayList<Object>();
- private boolean hasFilterColumns = false;
-
/**
* @author shura
*
@@ -256,12 +254,4 @@
super.restoreState(context, states[0]);
sortPriority = (Collection)states[1];
}
-
- public boolean hasFilterColumns() {
- return hasFilterColumns;
- }
-
- public void setHasFilterColumns(boolean hasFilterColumns) {
- this.hasFilterColumns = hasFilterColumns;
- }
}
\ 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-25 19:12:49 UTC (rev 6336)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-25 19:31:49 UTC (rev 6337)
@@ -112,7 +112,6 @@
}
if (headers.hasNext()&&findFacet(table,"header")) {
- table.setHasFilterColumns(false);
writer.startElement("tr", table);
encodeStyleClass(writer, null,
"dr-table-subheader rich-table-subheader", null,
@@ -122,17 +121,6 @@
headerClass, "header", "th", colCount);
writer.endElement("tr");
-
- if (table.hasFilterColumns()) {
- colums = table.columns();
- writer.startElement("tr", table);
- encodeStyleClass(writer, null,
- "dr-table-subheader rich-table-subheader", null,
- headerClass);
- encodeFilterInputs(context, writer, colums, "dr-table-subheadercell rich-table-subheadercell",
- "th", headerClass, colCount);
- writer.endElement("tr");
- }
}
writer.endElement("thead");
}
@@ -185,6 +173,9 @@
(org.richfaces.component.UIColumn) column;
String clientId = col.getClientId(context) + facetName;
writer.writeAttribute("id", clientId, null);
+
+ writer.startElement(HTML.DIV_ELEM, column);
+
if (column.getValueExpression("comparator") != null
|| column.getValueExpression("sortBy") != null) {
StringBuffer buffer;
@@ -204,6 +195,7 @@
ajaxFunction.appendScript(buffer);
writer.writeAttribute(HTML.onclick_ATTRIBUTE, buffer
.toString(), null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "dr-table-cursor-pointer", null);
}
writer.startElement(HTML.SPAN_ELEM, column);
String spanClass = "";
@@ -234,6 +226,9 @@
}
writer.endElement(HTML.SPAN_ELEM);
}
+
+ writer.endElement(HTML.DIV_ELEM);
+
if (((org.richfaces.component.UIColumn)column).getFilterMethod() == null
&& column.getValueExpression("filterExpression") == null
&& column.getValueExpression("filterBy") != null) {
@@ -247,8 +242,9 @@
StringBuffer buffer = new StringBuffer();
ajaxFunction.appendScript(buffer);
- ((UIDataTable)table).setHasFilterColumns(true);
+ writer.startElement(HTML.DIV_ELEM, column);
addInplaceInput(context, column, buffer);
+ writer.endElement(HTML.DIV_ELEM);
}
}
writer.endElement(element);
@@ -567,41 +563,13 @@
}
filterValueInput.setId(column.getId() + SORT_FILTER_PARAMETER);
filterValueInput.setImmediate(true);
- filterValueInput.getAttributes().put("onclick", "Event.stop(event);");
column.getFacets().put(FILTER_INPUT_FACET_NAME, filterValueInput);
}
filterValueInput.getAttributes().put(event, buffer.toString());
filterValueInput.setValue(column.getAttributes().get("filterValue"));
+
+ getUtils().encodeBeginFormIfNessesary(context, column);
+ renderChild(context, filterValueInput);
+ getUtils().encodeEndFormIfNessesary(context, column);
}
-
- protected void encodeFilterInputs(FacesContext context,
- ResponseWriter writer, Iterator<UIComponent> columns, String cellClass,
- String element, String headerClass, int colCount) throws IOException {
- int t_colCount = 0;
- while (columns.hasNext()) {
- UIComponent column = (UIComponent) columns.next();
- if ((Integer)column.getAttributes().get("colspan") != null ) {
- t_colCount = t_colCount + ((Integer)column.getAttributes().get("colspan")).intValue();
- } else {
- t_colCount++;
- }
- if( t_colCount > colCount) {
- break;
- }
-
- String columnHeaderClass = (String) column.getAttributes().get("headerClass");
- writer.startElement(element, column);
- encodeStyleClass(writer, null, cellClass, headerClass,
- columnHeaderClass);
- writer.writeAttribute("scope", "col", null);
- getUtils().encodeAttribute(context, column, "colspan");
-
- UIInput filterValueInput = (UIInput) column.getFacet(FILTER_INPUT_FACET_NAME);
- if (null != filterValueInput) {
- getUtils().encodeBeginFormIfNessesary(context, column);
- renderChild(context, filterValueInput);
- getUtils().encodeEndFormIfNessesary(context, column);
- }
- }
- }
}
\ No newline at end of file
Modified: trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss
===================================================================
--- trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-02-25 19:12:49 UTC (rev 6336)
+++ trunk/ui/dataTable/src/main/resources/org/richfaces/renderkit/html/css/table.xcss 2008-02-25 19:31:49 UTC (rev 6337)
@@ -105,9 +105,12 @@
.dr-table-sortable-header {
background-position: right;
background-repeat: no-repeat;
- cursor : pointer;
white-space : nowrap;
}
+
+ .dr-table-cursor-pointer {
+ cursor: pointer;
+ }
</f:verbatim>
<u:selector name=".dr-table-header-sort-down" >
16 years, 10 months
JBoss Rich Faces SVN: r6335 - in trunk/ui/dataTable/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-25 13:05:04 -0500 (Mon, 25 Feb 2008)
New Revision: 6335
Modified:
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/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-25 17:59:41 UTC (rev 6334)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-02-25 18:05:04 UTC (rev 6335)
@@ -45,7 +45,6 @@
import org.apache.commons.collections.iterators.IteratorChain;
import org.richfaces.model.FilterField;
import org.richfaces.model.ModifiableModel;
-import org.richfaces.model.Ordering;
import org.richfaces.model.SortField2;
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-25 17:59:41 UTC (rev 6334)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-02-25 18:05:04 UTC (rev 6335)
@@ -524,7 +524,7 @@
org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) children;
children.setId(children.getId());
if (clientId != null) {
- if (children.getClientId(context).equals(clientId)) {
+ if (clientId.equals(children.getClientId(context))) {
String id = children.getId();
Collection<Object> sortPriority = table.getSortPriority();
if (isSingleSortMode) {
16 years, 10 months
JBoss Rich Faces SVN: r6334 - management.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-25 12:59:41 -0500 (Mon, 25 Feb 2008)
New Revision: 6334
Removed:
management/planning/
Log:
Removed planning folder
16 years, 10 months
JBoss Rich Faces SVN: r6333 - trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-25 12:58:15 -0500 (Mon, 25 Feb 2008)
New Revision: 6333
Modified:
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
Log:
back sleep filter
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml 2008-02-25 17:57:31 UTC (rev 6332)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml 2008-02-25 17:58:15 UTC (rev 6333)
@@ -41,7 +41,7 @@
</init-param>
</filter>
- <!--
+
<filter>
<display-name>Sleep Filter</display-name>
<filter-name>sleepFilter</filter-name>
@@ -56,7 +56,7 @@
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
- -->
+
<filter-mapping>
<filter-name>fileUpload</filter-name>
16 years, 10 months
JBoss Rich Faces SVN: r6332 - in trunk/sandbox/ui/fileUpload/src/main: java/org/richfaces/org/jboss/seam/ui/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-02-25 12:57:31 -0500 (Mon, 25 Feb 2008)
New Revision: 6332
Modified:
trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
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/MultipartFilter.java
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
associate progress percent with file entry uid in session scope; implement autoclear functionality; fix bugs
Modified: trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-02-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2008-02-25 17:57:31 UTC (rev 6332)
@@ -204,6 +204,14 @@
<defaultvalue>false</defaultvalue>
</property>
<property>
+ <name>autoclear</name>
+ <classname>boolean</classname>
+ <description>
+ If this attribute is true files will be immediatelly removed from list after upload completed
+ </description>
+ <defaultvalue>false</defaultvalue>
+ </property>
+ <property>
<name>acceptedTypes</name>
<classname>java.lang.String</classname>
<description>
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-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-25 17:57:31 UTC (rev 6332)
@@ -4,6 +4,8 @@
import java.util.Map;
import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -14,6 +16,7 @@
import org.ajax4jsf.context.AjaxContextImpl;
import org.richfaces.event.FileUploadListener;
import org.richfaces.event.UploadEvent;
+import org.richfaces.org.jboss.seam.ui.renderkit.FileUploadRendererBase;
import org.richfaces.org.jboss.seam.web.MultipartFilter;
import org.richfaces.org.jboss.seam.web.MultipartRequest;
@@ -44,7 +47,19 @@
private Integer localFileSize;
private InputStream localInputStream;
+
+ private void setupProgressBarValueExpression(FacesContext context, String uid) {
+ FileUploadRendererBase renderer = (FileUploadRendererBase)this.getRenderer(context);
+ UIComponent progressBar = renderer.getProgressBar(context, this);
+ String exprStr = "#{" + MultipartFilter.PERCENT_BEAN_NAME + "['"+uid+"']}";
+ ValueExpression ex = context.getApplication().getExpressionFactory()
+ .createValueExpression(context.getELContext(), exprStr,
+ Integer.class);
+ progressBar.setValueExpression("value", ex);
+ }
+
+
// @Override
// public void processUpdates(FacesContext context) {
// ValueExpression dataBinding = getValueExpression("data");
@@ -186,6 +201,7 @@
if (sessions != null) {
MultipartRequest multipartRequest = sessions.get(uid);
if (multipartRequest != null) {
+ setupProgressBarValueExpression(facesContext, uid);
ajaxContext.setResponseData(multipartRequest.getSize());
}
}
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-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2008-02-25 17:57:31 UTC (rev 6332)
@@ -344,7 +344,7 @@
* @param component
* @return
*/
- private UIComponent getProgressBar(FacesContext context,
+ public UIComponent getProgressBar(FacesContext context,
UIComponent component) {
UIComponent progressBar = component.getFacet("progress");
if (null == progressBar) {
@@ -352,11 +352,11 @@
}
//We associate progress bar's percent value in session scope with file upload component id
- String exprStr = "#{" + MultipartFilter.PERCENT_BEAN_NAME + "['"+component.getClientId(context)+"']}";
- ValueExpression ex = context.getApplication().getExpressionFactory()
- .createValueExpression(context.getELContext(), exprStr,
- Integer.class);
- progressBar.setValueExpression("value", ex);
+// String exprStr = "#{" + MultipartFilter.PERCENT_BEAN_NAME + "['"+component.getClientId(context)+"']}";
+// ValueExpression ex = context.getApplication().getExpressionFactory()
+// .createValueExpression(context.getELContext(), exprStr,
+// Integer.class);
+ //progressBar.getAttributes().put("value", 0);
progressBar.getAttributes().put("minValue", -1);
progressBar.getAttributes().put("enabled", false);
progressBar.setTransient(false);
Modified: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java 2008-02-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java 2008-02-25 17:57:31 UTC (rev 6332)
@@ -75,10 +75,10 @@
HttpServletRequest httpRequest = (HttpServletRequest) request;
String uid = httpRequest.getParameter("uid");
- String componentId = httpRequest.getParameter("clientId");
+ //String componentId = httpRequest.getParameter("clientId");
if (isMultipartRequest(httpRequest)) {
MultipartRequest multipartRequest = new MultipartRequest(
- httpRequest, createTempFiles, maxRequestSize, componentId);
+ httpRequest, createTempFiles, maxRequestSize, uid);
Map<String, MultipartRequest> sessionsMap = null;
Map<String, Object> percentMap = null;
@@ -100,7 +100,7 @@
}
}
- percentMap.put(componentId, 0); // associate percent value with file upload component ID
+ percentMap.put(uid, 0); // associate percent value with file entry uid
sessionsMap.put(uid, multipartRequest);
if (multipartRequest.parseRequest()) {
@@ -114,7 +114,7 @@
} finally {
if (sessionsMap != null) {
sessionsMap.remove(uid);
- sessionsMap.remove(componentId);
+ percentMap.remove(uid);
}
}
} else {
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-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2008-02-25 17:57:31 UTC (rev 6332)
@@ -37,14 +37,14 @@
private boolean createTempFiles;
- private String clientId;
+ private String uid;
private String encoding = null;
private Integer contentLength = 0;
private int read = 0;
-
+
private Map<String, Param> parameters = null;
private Map<String, Object> percentMap = null;
@@ -246,11 +246,11 @@
private boolean shouldStop = false;
public MultipartRequest(HttpServletRequest request,
- boolean createTempFiles, int maxRequestSize, String clientId) {
+ boolean createTempFiles, int maxRequestSize, String uid) {
super(request);
this.request = request;
this.createTempFiles = createTempFiles;
- this.clientId = clientId;
+ this.uid = uid;
String contentLength = request.getHeader("Content-Length");
this.contentLength = Integer.parseInt(contentLength);
@@ -438,7 +438,8 @@
private void fillProgressInfo () {
Double percent = (Double) (100.0 * this.read / this.contentLength);
- percentMap.put(clientId, percent);
+ percentMap.put(uid, percent);
+ //this.percent = percent;
}
private byte[] getBoundaryMarker(String contentType) {
@@ -529,7 +530,7 @@
return parameters.get(name);
}
-
+
public Integer getSize() {
return contentLength;
}
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-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-02-25 17:57:31 UTC (rev 6332)
@@ -315,12 +315,13 @@
},
onload: function() {
+ //if (this.iframe && this.iframe.src == 'about:blank') return;
var iframeDocument = this.iframe.contentWindow.document;
var elt = iframeDocument.getElementById('_richfaces_file_upload_stopped');
var restr = iframeDocument.getElementById('_richfaces_file_upload_size_restricted');
if (elt) {
this.callback(FileUploadEntry.UPLOAD_CANCELED);
- } if (restr) {
+ } else if (restr) {
this.callback(FileUploadEntry.UPLOAD_SIZE_ERROR);
} else {
//TODO handle server internal errors, etc.
@@ -414,8 +415,11 @@
deleteFrame: function() {
+ if (this.iframe) {
this.iframe.src = "about:blank";
document.body.removeChild(this.iframe);
+ }
+ this.iframe = null;
},
initEvents : function() {
@@ -456,7 +460,7 @@
finishProgressBar: function () {
this.progressBar.disable();
this.progressBar.setValue(100);
- //Element.hide(this._progressBar);
+ Element.hide(this._progressBar);
},
setupAutoUpload: function() {
@@ -558,7 +562,7 @@
var i = 0;
while (i < this.entries.length) {
var entry = this.entries[i];
- if (entry.state != FileUploadEntry.UPLOAD_IN_PROGRESS) {
+ if (entry.state == FileUploadEntry.UPLOAD_SUCCESS) {
this.remove(entry);
} else {
i++;
@@ -580,9 +584,10 @@
},
cleanAllDisabled: function () {
+ if (this.options['autoclear']) return true;
var c = 0;
for (var i = 0; i < this.entries.length; i++) {
- if (this.entries[i].state != FileUploadEntry.UPLOAD_IN_PROGRESS) {
+ if (this.entries[i].state == FileUploadEntry.UPLOAD_SUCCESS) {
c++;
}
}
@@ -621,7 +626,11 @@
},
disableCleanButton: function(disabled) {
- if(disabled) {
+ if (disabled)
+ Element.hide($(this.id + ":clean1"));
+ else
+ Element.show($(this.id + ":clean1"));
+ if(disabled) {
$(this.id + ":clean1").onclick = function() {return false;};
} else {
$(this.id + ":clean1").onclick = function() {return this.clear();}.bind(this);
@@ -629,18 +638,25 @@
$(this.id+":clean1").className = (disabled? this.classes.CLEAN.DISABLED : this.classes.CLEAN.ENABLED);
$(this.id+":clean2").className = (disabled? this.classes.CLEAN_CONTENT.DISABLED : this.classes.CLEAN_CONTENT.ENABLED);
+
},
disableAddButton: function(disabled) {
this.currentInput.disabled = disabled;
+ if (disabled)
+ Element.hide($(this.id+":add1"));
+ else
+ Element.show($(this.id+":add1"));
$(this.id+":add1").className = (disabled? this.classes.ADD.DISABLED : this.classes.ADD.ENABLED);
$(this.id+":add2").className = (disabled? this.classes.ADD_CONTENT.DISABLED : this.classes.ADD_CONTENT.ENABLED);
},
disableUploadButton: function (disabled) {
if(disabled) {
+ Element.hide($(this.id + ":upload1"));
$(this.id + ":upload1").onclick = function() {return false;};
} else {
+ Element.show($(this.id + ":upload1"));
$(this.id + ":upload1").onclick = function() {return this.upload();}.bind(this);
}
@@ -671,6 +687,9 @@
},
_endUpload: function() {
+ if (this.options['autoclear']) {
+ this.clear(this.activeEntry);
+ }
this.activeEntry = null;
this.deleteFrame();
},
@@ -719,7 +738,6 @@
//but this.runUpload can be false if upload
//has been requested to stop by user
this.setupAutoUpload();
- Element.hide(this._progressBar);
if(this.events.onuploadcomplete) {
this.element.fire("rich:onuploadcomplete", {});
}
@@ -778,7 +796,7 @@
parentForm.encoding = "multipart/form-data";
parentForm.enctype = "multipart/form-data";
parentForm.target = this.id;
- parentForm.action = oldAction + (/\?/.test(oldAction) ? '&uid' : '?uid') + '=' + encodeURI(entry.uid) + '&clientId=' + this.id;
+ parentForm.action = oldAction + (/\?/.test(oldAction) ? '&uid' : '?uid') + '=' + encodeURI(entry.uid);
try {
var inputs = parentForm.elements;
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-25 17:55:46 UTC (rev 6331)
+++ trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-02-25 17:57:31 UTC (rev 6332)
@@ -69,6 +69,7 @@
<div class="upload_button upload_font #{component.attributes['uploadButtonClassDisabled']}" onmouseover="this.className='upload_button_light upload_font'" onmousedown="this.className='upload_button_press upload_font'" onmouseup="this.className='upload_button upload_font'"
onmouseout="this.className='upload_button upload_font'"
id="#{clientId}:upload1"
+ style="display: none"
onclick="return $('#{clientId}').component.upload();">
<a href="#" class="upload_button_selection">
<div class="upload_button_content upload_font upload_ico upload_ico_start_dis #{component.attributes['uploadButtonClassDisabled']}"
@@ -87,7 +88,8 @@
<div class="upload_button_dis upload_font #{component.attributes['cleanButtonClassDisabled']}" onmouseover="this.className='upload_button_light upload_font'" onmousedown="this.className='upload_button_press upload_font'" onmouseup="this.className='upload_button upload_font'"
onmouseout="this.className='upload_button upload_font'"
onclick="return $('#{clientId}').component.clear();"
- id="#{clientId}:clean1">
+ id="#{clientId}:clean1"
+ style="display: none">
<a href="#" class="upload_button_selection">
<div class="upload_button_content upload_font upload_ico upload_ico_clear_dis #{component.attributes['cleanButtonClassDisabled']}"
id="#{clientId}:clean2">Clean All</div>
@@ -158,7 +160,7 @@
onerror : #{this:getAsEventHandler(context, component, "onerror")}
};
- new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, '#{component.attributes["maxFilesQuantity"]}', events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)});
+ new FileUpload('#{clientId}', #{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, '#{component.attributes["maxFilesQuantity"]}', events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]}});
</script>
</span>
16 years, 10 months
JBoss Rich Faces SVN: r6331 - management/design/standardComponent.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-25 12:55:46 -0500 (Mon, 25 Feb 2008)
New Revision: 6331
Added:
management/design/standardComponent/Standard controls vision.doc
Log:
Standard controls vision.doc committed
Added: management/design/standardComponent/Standard controls vision.doc
===================================================================
(Binary files differ)
Property changes on: management/design/standardComponent/Standard controls vision.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 10 months
JBoss Rich Faces SVN: r6330 - trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-25 12:42:21 -0500 (Mon, 25 Feb 2008)
New Revision: 6330
Modified:
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
Log:
update demo
Modified: trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-02-25 17:41:02 UTC (rev 6329)
+++ trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-02-25 17:42:21 UTC (rev 6330)
@@ -9,7 +9,7 @@
<body>
<f:view>
<h:form>
- <dt:dataTable value="#{jiraService.channel.issues}" var="issue">
+ <dt:dataTable value="#{jiraService.channel.issues}" var="issue" rows="10">
<dt:column filterBy="#{issue.key.value}">
<f:facet name="header">
<h:outputText value="Key"></h:outputText>
16 years, 10 months
JBoss Rich Faces SVN: r6329 - trunk/framework/impl/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-02-25 12:41:02 -0500 (Mon, 25 Feb 2008)
New Revision: 6329
Added:
trunk/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java
Modified:
trunk/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java
Log:
RF-1741
Added: trunk/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/ListSequenceDataModel.java 2008-02-25 17:41:02 UTC (rev 6329)
@@ -0,0 +1,145 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class ListSequenceDataModel extends ExtendedDataModel {
+
+ private List<?> list;
+ private int index;
+
+ public ListSequenceDataModel(List<?> list) {
+ this.list = list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ @Override
+ public Object getRowKey() {
+ if(index<0){
+ return null;
+ }
+ return new Integer(index);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ @Override
+ public void setRowKey(Object key) {
+ if(null == key){
+ index = -1;
+ } else {
+ setRowIndex(((Integer) key).intValue());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+ final SequenceRange seqRange = (SequenceRange) range;
+ int rows = seqRange.getRows();
+ int rowCount = list !=null ? list.size() : -1;
+ int currentRow = seqRange.getFirstRow();
+ if(rows > 0){
+ rows += currentRow;
+ rows = Math.min(rows, rowCount);
+ } else {
+ rows = rowCount;
+ }
+ for (; currentRow < rows; currentRow++) {
+ setRowIndex(currentRow);
+ visitor.process(context, new Integer(currentRow), argument);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ @Override
+ public int getRowCount() {
+ if (list == null) {
+ return (-1);
+ }
+ return list.size();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ @Override
+ public Object getRowData() {
+ if (!isRowAvailable()) {
+ throw new IllegalArgumentException();
+ } else {
+ return list.get(index);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ @Override
+ public int getRowIndex() {
+ return index;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ @Override
+ public Object getWrappedData() {
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ @Override
+ public boolean isRowAvailable() {
+ return list != null && 0 <= index && index < list.size();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ @Override
+ public void setRowIndex(int rowIndex) {
+ if (rowIndex < -1) {
+ throw new IllegalArgumentException();
+ }
+ index = rowIndex;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ @Override
+ public void setWrappedData(Object data) {
+ if (data == null) {
+ list = null;
+ setRowIndex(-1);
+ } else {
+ list = (List<?>) data;
+ setRowIndex(0);
+ }
+ }
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java 2008-02-25 17:40:47 UTC (rev 6328)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/ModifiableModel.java 2008-02-25 17:41:02 UTC (rev 6329)
@@ -108,8 +108,7 @@
if (shouldSort() || shouldFilter()) {
if (modifiedModel == null) {
- modifiedModel = new SequenceDataModel();
- modifiedModel.setWrappedData(prepareCollection());
+ modifiedModel = new ListSequenceDataModel(prepareCollection());
}
delegate = modifiedModel;
} else {
16 years, 10 months
JBoss Rich Faces SVN: r6328 - trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-25 12:40:47 -0500 (Mon, 25 Feb 2008)
New Revision: 6328
Added:
trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java
Removed:
trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
file upload component's tests
Copied: trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java (from rev 6316, trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java 2008-02-25 17:40:47 UTC (rev 6328)
@@ -0,0 +1,125 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * Unit test for file upload component.
+ */
+public class FileUploadComponentTest extends AbstractAjax4JsfTestCase {
+
+ private final static String FILE_UPLOAD_LABEL_TEMPLATE = "{_KB}KB from {KB}KB uploaded --- {mm}:{ss}";
+
+ private HtmlForm form;
+ private UIFileUpload fileUpload;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public FileUploadComponentTest(String testName) {
+ super(testName);
+ }
+
+ /**
+ * @see AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+ fileUpload = (UIFileUpload) application.createComponent(UIFileUpload.COMPONENT_TYPE);
+ fileUpload.setAccept("application/zip,image/jpeg,video/mpeg");
+ Map<String, UIComponent> facets = fileUpload.getFacets();
+ UIProgressBar progressBar = (UIProgressBar) application.createComponent(UIProgressBar.COMPONENT_TYPE);
+ facets.put("progress", progressBar);
+ UIOutput label = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ label.setValue(FILE_UPLOAD_LABEL_TEMPLATE);
+ facets.put("label", label);
+ form.getChildren().add(fileUpload);
+ }
+
+ public void testRenderer() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ }
+
+ public void testFileUploadStyles() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ assertEquals(2, links.size());
+ String hrefs = "";
+ for (Object link : links) {
+ hrefs += ((HtmlElement) link).getAttributeValue("href");
+ }
+ assertTrue(hrefs.contains("css/fileUpload.xcss"));
+ assertTrue(hrefs.contains("css/progressBar.xcss"));
+ }
+
+ public void testFileUploadScrits() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+ if (item.getFirstChild() != null) {
+ String scriptBodyString = item.getFirstChild().toString();
+ if (scriptBodyString.contains("new FileUpload")) {
+// assertTrue(scriptBodyString.contains("application/zip"));
+// assertTrue(scriptBodyString.contains("image/jpeg"));
+// assertTrue(scriptBodyString.contains("video/mpeg"));
+// assertFalse(scriptBodyString.contains("image/png"));
+ assertTrue(scriptBodyString.contains("FileUpload.CLASSES"));
+ }
+ }
+ }
+ }
+
+ /**
+ * @see AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ form = null;
+ fileUpload = null;
+ }
+}
Deleted: trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/JSFComponentTest.java 2008-02-25 17:37:41 UTC (rev 6327)
+++ trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/JSFComponentTest.java 2008-02-25 17:40:47 UTC (rev 6328)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
16 years, 10 months