Author: konstantin.mishin
Date: 2007-11-30 14:14:53 -0500 (Fri, 30 Nov 2007)
New Revision: 4396
Added:
trunk/sandbox/ui/fileUpload/src/main/resources/org/
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/css/
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/css/fileUpload.xcss
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/bg_button.png
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/bg_uploaded.png
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/ico_delete.gif
trunk/sandbox/ui/fileUpload/src/main/templates/org/
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Modified:
trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java
Log:
RF-1209
Modified: trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2007-11-30
17:47:13 UTC (rev 4395)
+++ trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2007-11-30
19:14:53 UTC (rev 4396)
@@ -35,17 +35,24 @@
<property name="maxRequestSize">1000000</property>
</component>]]>
</description>
- <renderer generate="false" override="false">
- <name>org.richfaces.renderkit.html.FileUploadRenderer</name>
- <classname>org.richfaces.org.jboss.seam.ui.renderkit.FileUploadRendererBase</classname>
- <!--<template>org/jboss/seam/ui/htmlFileUpload.jspx</template>-->
- </renderer>
+ <test>
+ <classname>org.richfaces.component.html.HtmlFileUploadComponentTestCase</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.renderkit.html.FileUploadRenderer</name>
+ <template>org/richfaces/fileUpload.jspx</template>
+ </renderer>
<tag>
<name>fileUpload</name>
<classname>org.richfaces.taglib.FileUploadTag</classname>
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
+ <test>
+ <classname>org.richfaces.taglib.HtmlFileUploadTagTestCase</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
</tag>
&ui_component_attributes;
&ui_input_attributes;
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 2007-11-30
17:47:13 UTC (rev 4395)
+++
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2007-11-30
19:14:53 UTC (rev 4396)
@@ -1,61 +1,20 @@
package org.richfaces.org.jboss.seam.ui.renderkit;
-import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
import javax.servlet.ServletRequest;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
import org.richfaces.org.jboss.seam.web.MultipartRequest;
-public class FileUploadRendererBase extends RendererBase
+public abstract class FileUploadRendererBase extends HeaderResourcesRendererBase
{
-
@Override
- protected Class getComponentClass()
- {
- return UIFileUpload.class;
- }
-
- @Override
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException
- {
- UIFileUpload fileUpload = (UIFileUpload) component;
-
- writer.startElement(HTML.INPUT_ELEM, fileUpload);
- writer.writeAttribute(HTML.TYPE_ATTR, "file", null);
-
- String clientId = fileUpload.getClientId(context);
- writer.writeAttribute(HTML.id_ATTRIBUTE, clientId, null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, clientId, null);
-
-
- /*if (fileUpload.getAccept() != null)
- {
- writer.writeAttribute(HTML.ACCEPT_ATTR, fileUpload.getAccept(),
"accept");
- }
-
- if (fileUpload.getStyleClass() != null)
- {
- writer.writeAttribute(HTML.CLASS_ATTR, fileUpload.getStyleClass(),
JSF.STYLE_CLASS_ATTR);
- }
-
- if (fileUpload.getStyle() != null)
- {
- writer.writeAttribute(HTML.STYLE_ATTR, fileUpload.getStyle(),
"style");
- }*/
- getUtils().encodePassThruWithExclusions(context, component, HTML.DISABLED_ATTR);
- writer.endElement(HTML.INPUT_ELEM);
- }
-
- @Override
protected void doDecode(FacesContext context, UIComponent component)
{
UIFileUpload fileUpload = (UIFileUpload) component;
@@ -70,7 +29,7 @@
{
MultipartRequest multipartRequest = (MultipartRequest) request;
- String clientId = component.getClientId(context);
+ String clientId = component.getClientId(context) + ":1";
fileUpload.setLocalInputStream(multipartRequest.getFileInputStream(clientId));
fileUpload.setLocalContentType(multipartRequest.getFileContentType(clientId));
fileUpload.setLocalFileName(multipartRequest.getFileName(clientId));
Added:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/css/fileUpload.xcss
===================================================================
---
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/css/fileUpload.xcss
(rev 0)
+++
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/css/fileUpload.xcss 2007-11-30
19:14:53 UTC (rev 4396)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template
+
xmlns:f="http://jsf.exadel.com/template"
+
xmlns:u="http://jsf.exadel.com/template/util"
+
xmlns="http://www.w3.org/1999/xhtml">
+ <f:verbatim>
+ *{
+ font-family: verdana;
+ font-size: 11px;
+ }
+ .file_item{
+ white-space: nowrap;
+ }
+ .file_delete_button{
+ border: 1px solid #CCCCCC;
+ padding: 1px;
+ width: 12px;
+ cursor: pointer;
+ float: left;
+ margin: 1px 2px 1px 7px;
+ }
+ .file_field{
+ float: left;
+ width: 200px;
+ height: 18px;
+ margin-bottom: 5px;
+ }
+ .file_bar_height{
+ height: 16px;
+ }
+ .file_bar_width{
+ width: 200px;
+ }
+ .file_bar_uploaded{
+ width: 99px;
+ overflow: hidden;
+ position: absolute;
+ border: 1px solid #cccccc;
+ }
+ .file_bar_shell{
+ position: relative;
+ margin-bottom: 2px;
+ float: left;
+ }
+ .file_bar_track{
+ background: #F1F1F1;
+ text-align: center;
+ border: 1px solid #cccccc;
+ color: #000000;
+ font-weight: bold;
+ position: absolute;
+ }
+ .file_bar_ststusline{
+ background: #FF9409;
+ text-align: center;
+ color: #FFFFFF;
+ font-weight: bold;
+ background-repeat: repeat-x;
+ position : absolute;
+ }
+ .file_stop_button{
+ border: 1px solid #CCCCCC;
+ padding: 0px 5px 0px 5px;
+ cursor: pointer;
+ float: left;
+ margin: 0px 0px 0px 2px;
+ }
+ </f:verbatim>
+ <u:selector name=".file_bar_ststusline">
+ <u:style name="background-image">
+ <f:resource
f:key="/org/richfaces/renderkit/html/images/bg_uploaded.png"/>
+ </u:style>
+ </u:selector>
+ <u:selector name=".file_stop_button">
+ <u:style name="background-image">
+ <f:resource
f:key="/org/richfaces/renderkit/html/images/bg_button.png"/>
+ </u:style>
+ </u:selector>
+</f:template>
Added:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/bg_button.png
===================================================================
(Binary files differ)
Property changes on:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/bg_button.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/bg_uploaded.png
===================================================================
(Binary files differ)
Property changes on:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/bg_uploaded.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/ico_delete.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/sandbox/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/images/ico_delete.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
(rev 0)
+++
trunk/sandbox/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2007-11-30
19:14:53 UTC (rev 4396)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:h="
http://ajax4jsf.org/cdk/headers"
+ class="org.richfaces.renderkit.html.FileUploadRenderer"
+ baseclass="org.richfaces.org.jboss.seam.ui.renderkit.FileUploadRendererBase"
+ component="org.richfaces.org.jboss.seam.ui.component.UIFileUpload"
+ >
+ <h:styles>
+ /org/richfaces/renderkit/html/css/fileUpload.xcss
+ </h:styles>
+ <h:scripts>
+ </h:scripts>
+ <f:clientId var="clientId" />
+ <div id="#{clientId}">
+ <div>
+ <div class="file_item">
+ <input id="#{clientId}:1" name="#{clientId}:1"
type="file" class="file_field">
+ <f:call name="utils.encodePassThruWithExclusions">
+ <f:parameter value="disabled" />
+ </f:call>
+ </input>
+ <f:resource name="/org/richfaces/renderkit/html/images/ico_delete.gif"
var="ico_delete"/>
+ <div class="file_delete_button"><img src="#{ico_delete}"
width="12" height="12" alt="" border="0"
/></div>
+ </div>
+ </div>
+ <div class="file_stop_button file_bar_height">Upload</div>
+ <!-- div class="file_item">
+ <div class="file_bar_height file_bar_width file_bar_shell">
+ <div class="file_bar_height file_bar_width file_bar_track">
+ 50%
+ </div>
+ <div class="file_bar_height file_bar_uploaded">
+ <div class="file_bar_height file_bar_width file_bar_ststusline">
+ 50%
+ </div>
+ </div>
+ </div>
+ <div class="file_stop_button file_bar_height">Stop</div>
+ </div>
+ Uploaded 200Kb from 500Kb -->
+ </div>
+</f:root>
+
+
+
\ No newline at end of file