Author: konstantin.mishin
Date: 2010-11-23 20:33:02 -0500 (Tue, 23 Nov 2010)
New Revision: 20154
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
Log:
RF-9497
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java
===================================================================
---
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java 2010-11-23
19:55:10 UTC (rev 20153)
+++
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/component/AbstractFileUpload.java 2010-11-24
01:33:02 UTC (rev 20154)
@@ -32,6 +32,7 @@
import javax.faces.event.ListenerFor;
import javax.faces.event.PostAddToViewEvent;
+import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
@@ -48,6 +49,9 @@
@ListenerFor(systemEventClass = PostAddToViewEvent.class)
public abstract class AbstractFileUpload extends UIComponentBase implements
ComponentSystemEventListener {
+ @Attribute(defaultValue = "true")
+ public abstract boolean isEnabled();
+
@Override
public void decode(FacesContext context) {
super.decode(context);
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss
===================================================================
---
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss 2010-11-23
19:55:10 UTC (rev 20153)
+++
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.ecss 2010-11-24
01:33:02 UTC (rev 20154)
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
.rf-fu {
background: '#{richSkin.generalBackgroundColor}';
border-color: '#{richSkin.panelBorderColor}';
@@ -41,12 +62,9 @@
width: 34%;
}
-.rf-fu-btn-add, .rf-fu-btn-upl, .rf-fu-btn-clr {
- background-color: '#{richSkin.trimColor}';
- background-image:
url("#{resource['org.richfaces.images:fuBtnGrad.png']}");
+.rf-fu-btn-add, .rf-fu-btn-add-dis, .rf-fu-btn-upl, .rf-fu-btn-clr {
background-position:left top;
background-repeat:repeat-x;
- border-color: '#{richSkin.panelBorderColor}';
border-style: solid;
border-width: 1px;
cursor: default;
@@ -55,11 +73,23 @@
vertical-align: top;
}
+.rf-fu-btn-add, .rf-fu-btn-upl, .rf-fu-btn-clr {
+ background-color: '#{richSkin.trimColor}';
+ background-image:
url("#{resource['org.richfaces.images:fuBtnGrad.png']}");
+ border-color: '#{richSkin.panelBorderColor}';
+}
+
+.rf-fu-btn-add-dis {
+ background-color: '#{richSkin.tableFooterBackgroundColor}';
+ background-image:
url("#{resource['org.richfaces.images:fuBtnDisGrad.png']}");
+ border-color: '#{richSkin.tableFooterBackgroundColor}';
+}
+
.rf-fu-btn-upl, .rf-fu-btn-clr {
display: none;
}
-.rf-fu-btn-cnt-add, .rf-fu-btn-cnt-upl, .rf-fu-btn-cnt-clr, .rf-fu-itm-lbl,
.rf-fu-itm-st, .rf-fu-itm-lnk {
+.rf-fu-btn-cnt-add, .rf-fu-btn-cnt-add-dis, .rf-fu-btn-cnt-upl, .rf-fu-btn-cnt-clr,
.rf-fu-itm-lbl, .rf-fu-itm-st, .rf-fu-itm-lnk {
font-family: '#{richSkin.generalFamilyFont}';
font-size: '#{richSkin.generalSizeFont}';
}
@@ -68,7 +98,7 @@
color: '#{richSkin.generalTextColor}';
}
-.rf-fu-btn-cnt-add, .rf-fu-btn-cnt-upl, .rf-fu-btn-cnt-clr {
+.rf-fu-btn-cnt-add, .rf-fu-btn-cnt-add-dis, .rf-fu-btn-cnt-upl, .rf-fu-btn-cnt-clr {
background-position: 2px 2px;
background-repeat: no-repeat;
display: inline-block;
@@ -80,6 +110,10 @@
overflow: hidden;
position: relative;
}
+.rf-fu-btn-cnt-add-dis {
+ background-image: url("#{resource['org.richfaces:fu-add.gif']}");
+ color: '#{richSkin.tabDisabledTextColor}';
+}
.rf-fu-btn-cnt-upl, .rf-fu-itm-st {
font-weight: bold;
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
===================================================================
---
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-11-23
19:55:10 UTC (rev 20153)
+++
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-11-24
01:33:02 UTC (rev 20154)
@@ -1,2 +1,4 @@
org.richfaces.images\:fuBtnGrad.png=org.richfaces.renderkit.html.BaseGradient\
- {baseColorParam=additionalBackgroundColor, gradientColorParam=trimColor, height=18,
width=1}
\ No newline at end of file
+ {baseColorParam=additionalBackgroundColor, gradientColorParam=trimColor, height=18,
width=1}
+org.richfaces.images\:fuBtnDisGrad.png=org.richfaces.renderkit.html.BaseGradient\
+ {baseColorParam=tableSubfooterBackgroundColor,
gradientColorParam=tableFooterBackgroundColor, height=18, width=1}
\ No newline at end of file
Modified: sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-11-23
19:55:10 UTC (rev 20153)
+++ sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-11-24
01:33:02 UTC (rev 20154)
@@ -37,34 +37,43 @@
<cdk:resource-dependency library="org.richfaces"
name="fileupload.js" />
</cc:interface>
<cc:implementation>
+ <cdk:object name="enabled"
value="#{component.attributes['enabled']}"/>
<div id="#{clientId}" class="rf-fu">
<div class="rf-fu-hdr">
<span class="rf-fu-btns-lft">
- <span class="rf-fu-btn-add">
- <span class="rf-fu-btn-cnt-add">
- <span class="rf-fu-inp-cntr"> <!-- This span is needed for IE7
only. -->
- <input type="file" class="rf-fu-inp"/>
- </span>
+ <span class="rf-fu-btn-add#{enabled ? '' :
'-dis'}">
+ <span class="rf-fu-btn-cnt-add#{enabled ? '' :
'-dis'}">
+ <c:if test="#{enabled}">
+ <span class="rf-fu-inp-cntr"> <!-- This span is needed for IE7
only. -->
+ <input type="file" class="rf-fu-inp"/>
+ </span>
+ </c:if>
Add...
</span>
</span>
- <span class="rf-fu-btn-upl">
- <span class="rf-fu-btn-cnt-upl">Upload</span>
- </span>
+ <c:if test="#{enabled}">
+ <span class="rf-fu-btn-upl">
+ <span class="rf-fu-btn-cnt-upl">Upload</span>
+ </span>
+ </c:if>
</span>
- <span class="rf-fu-btns-rgh">
- <span class="rf-fu-btn-clr">
- <span class="rf-fu-btn-cnt-clr">Clear All</span>
+ <c:if test="#{enabled}">
+ <span class="rf-fu-btns-rgh">
+ <span class="rf-fu-btn-clr">
+ <span class="rf-fu-btn-cnt-clr">Clear All</span>
+ </span>
</span>
- </span>
+ </c:if>
</div>
<div class="rf-fu-lst"/>
- <cdk:object name="progressBar"
value="#{component.facets['progress']}"/>
- <c:if test="#{progressBar.isRendered()}">
- <cdk:call expression="progressBar.encodeAll(facesContext)" />
+ <c:if test="#{enabled}">
+ <cdk:object name="progressBar"
value="#{component.facets['progress']}"/>
+ <c:if test="#{progressBar.isRendered()}">
+ <cdk:call expression="progressBar.encodeAll(facesContext)" />
+ </c:if>
+ <iframe name="#{clientId}" class="rf-fu-frm"/>
+ <script type="text/javascript">new
RichFaces.ui.FileUpload('#{clientId}');</script>
</c:if>
- <iframe name="#{clientId}" class="rf-fu-frm"/>
- <script type="text/javascript">new
RichFaces.ui.FileUpload('#{clientId}');</script>
</div>
</cc:implementation>
</cdk:root>