JBoss Rich Faces SVN: r4369 - branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 20:16:54 -0500 (Thu, 29 Nov 2007)
New Revision: 4369
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-1428
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2007-11-30 00:50:10 UTC (rev 4368)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2007-11-30 01:16:54 UTC (rev 4369)
@@ -65,6 +65,8 @@
private final static String CONTROL_ID_BOTTOM = "last";
+ public static final String CONTROL_LABEL_ATTRIBUTE_SUFFIX = "ControlLabel";
+
private final static String DEFAULT_LABEL_TOP = "First";
private final static String DEFAULT_LABEL_UP = "Up";
private final static String DEFAULT_LABEL_DOWN = "Down";
@@ -73,7 +75,7 @@
protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
new OrderingComponentRendererBase.ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
"-top", ATTRIBUTE_CLASS_TOP_CONTROL, "",
- CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true) {
+ CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true, "top".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isFastOrderControlsVisible();
@@ -82,7 +84,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false, "top".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isFastOrderControlsVisible();
@@ -91,7 +93,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("up", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
"-up", ATTRIBUTE_CLASS_UP_CONTROL, "",
- CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true) {
+ CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true, "up".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isOrderControlsVisible();
@@ -100,7 +102,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false, "up".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isOrderControlsVisible();
@@ -109,7 +111,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("down", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
"-down", ATTRIBUTE_CLASS_DOWN_CONTROL, "",
- CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true) {
+ CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true, "down".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isOrderControlsVisible();
@@ -118,7 +120,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false, "down".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isOrderControlsVisible();
@@ -127,7 +129,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("bottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottom.class.getName(), FACET_BOTTOM,
"-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, "",
- CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true) {
+ CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true, "bottom".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isFastOrderControlsVisible();
@@ -136,7 +138,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false, "bottom".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return list.isFastOrderControlsVisible();
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-30 00:50:10 UTC (rev 4368)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-30 01:16:54 UTC (rev 4369)
@@ -70,7 +70,7 @@
public ControlsHelper(String name, String bundlePropertyName, String defaultText, String imageURI,
String facetName, String styleClassName, String styleFromAttribute, String buttonStyleClass,
- String idSuffix, String customEvent, boolean isEnable) {
+ String idSuffix, String customEvent, boolean isEnable, String labelAttributeName) {
super();
this.name = name;
this.bundlePropertyName = bundlePropertyName;
@@ -83,7 +83,7 @@
this.customEvent = customEvent;
this.buttonStyleClass = buttonStyleClass;
this.enable = isEnable;
- this.labelAttributeName = name + "ControlLabel";
+ this.labelAttributeName = labelAttributeName;
}
public String getName() {
17 years, 1 month
JBoss Rich Faces SVN: r4368 - in branches/3.1.x/ui/componentControl/src: main/java/org/richfaces and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 19:50:10 -0500 (Thu, 29 Nov 2007)
New Revision: 4368
Added:
branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/component/
Removed:
branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/sandbox/
Modified:
branches/3.1.x/ui/componentControl/src/main/config/component/componentControl.xml
branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java
branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java
branches/3.1.x/ui/componentControl/src/main/templates/htmlComponentControl.jspx
branches/3.1.x/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java
Log:
invalid package refactored in componentControl
Modified: branches/3.1.x/ui/componentControl/src/main/config/component/componentControl.xml
===================================================================
--- branches/3.1.x/ui/componentControl/src/main/config/component/componentControl.xml 2007-11-30 00:39:08 UTC (rev 4367)
+++ branches/3.1.x/ui/componentControl/src/main/config/component/componentControl.xml 2007-11-30 00:50:10 UTC (rev 4368)
@@ -2,21 +2,21 @@
<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
<components>
<component>
- <name>org.richfaces.sandbox.ComponentControl</name>
- <family>org.richfaces.sandbox.ComponentControl</family>
- <classname>org.richfaces.sandbox.component.html.HtmlComponentControl</classname>
- <superclass>org.richfaces.sandbox.component.UIComponentControl</superclass>
+ <name>org.richfaces.ComponentControl</name>
+ <family>org.richfaces.ComponentControl</family>
+ <classname>org.richfaces.component.html.HtmlComponentControl</classname>
+ <superclass>org.richfaces.component.UIComponentControl</superclass>
<description>
<![CDATA[
]]>
</description>
<renderer generate="true" override="true">
- <name>org.richfaces.sandbox.ComponentControlRenderer</name>
+ <name>org.richfaces.ComponentControlRenderer</name>
<template>htmlComponentControl.jspx</template>
</renderer>
<tag>
<name>componentControl</name>
- <classname>org.richfaces.sandbox.taglib.ComponentControlTag</classname>
+ <classname>org.richfaces.taglib.ComponentControlTag</classname>
<superclass>
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
Copied: branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/component (from rev 4347, branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/sandbox/component)
Modified: branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java
===================================================================
--- branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/sandbox/component/UIComponentControl.java 2007-11-29 14:06:11 UTC (rev 4347)
+++ branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/component/UIComponentControl.java 2007-11-30 00:50:10 UTC (rev 4368)
@@ -2,7 +2,7 @@
*
*/
-package org.richfaces.sandbox.component;
+package org.richfaces.component;
import java.util.Iterator;
@@ -28,9 +28,9 @@
*/
public abstract class UIComponentControl extends UIComponentBase implements AjaxSupport {
- public static final String COMPONENT_TYPE = "org.richfaces.sandbox.ComponentControl";
+ public static final String COMPONENT_TYPE = "org.richfaces.ComponentControl";
- public static final String COMPONENT_FAMILY = "org.richfaces.sandbox.ComponentControl";
+ public static final String COMPONENT_FAMILY = "org.richfaces.ComponentControl";
private static final Log log = LogFactory.getLog(UIComponentControl.class);
Modified: branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java
===================================================================
--- branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java 2007-11-30 00:39:08 UTC (rev 4367)
+++ branches/3.1.x/ui/componentControl/src/main/java/org/richfaces/renderkit/ComponentControlRendererBase.java 2007-11-30 00:50:10 UTC (rev 4368)
@@ -5,8 +5,8 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.richfaces.component.UIComponentControl;
import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.sandbox.component.UIComponentControl;
public class ComponentControlRendererBase extends HeaderResourcesRendererBase {
Modified: branches/3.1.x/ui/componentControl/src/main/templates/htmlComponentControl.jspx
===================================================================
--- branches/3.1.x/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2007-11-30 00:39:08 UTC (rev 4367)
+++ branches/3.1.x/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2007-11-30 00:50:10 UTC (rev 4368)
@@ -5,9 +5,9 @@
xmlns:ui=" http://ajax4jsf.org/cdk/ui"
xmlns:u=" http://ajax4jsf.org/cdk/u"
xmlns:x=" http://ajax4jsf.org/cdk/x"
- class="org.richfaces.sandbox.renderkit.html.ComponentControlRenderer"
+ class="org.richfaces.renderkit.html.ComponentControlRenderer"
baseclass="org.richfaces.renderkit.ComponentControlRendererBase"
- component="org.richfaces.sandbox.component.UIComponentControl"
+ component="org.richfaces.component.UIComponentControl"
>
<h:scripts>/org/richfaces/renderkit/html/scripts/jquery/jquery.js,/org/richfaces/renderkit/html/script/controlUtils.js</h:scripts>
Modified: branches/3.1.x/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java
===================================================================
--- branches/3.1.x/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java 2007-11-30 00:39:08 UTC (rev 4367)
+++ branches/3.1.x/ui/componentControl/src/test/java/org/richfaces/component/ComponentControlTest.java 2007-11-30 00:50:10 UTC (rev 4368)
@@ -30,7 +30,7 @@
import javax.faces.component.html.HtmlForm;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.sandbox.component.UIComponentControl;
+import org.richfaces.component.UIComponentControl;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -58,7 +58,7 @@
public void setUp() throws Exception {
super.setUp();
- application.addComponent(UIComponentControl.COMPONENT_TYPE, "org.richfaces.sandbox.component.html.HtmlComponentControl");
+ application.addComponent(UIComponentControl.COMPONENT_TYPE, "org.richfaces.component.html.HtmlComponentControl");
form = new HtmlForm();
form.setId("form");
17 years, 1 month
JBoss Rich Faces SVN: r4367 - in branches/3.1.x/sandbox/ui/listShuttle/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 19:39:08 -0500 (Thu, 29 Nov 2007)
New Revision: 4367
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
latest changes for listShuttle
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-29 20:58:10 UTC (rev 4366)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-30 00:39:08 UTC (rev 4367)
@@ -67,7 +67,8 @@
.ol_internal_tab .ol_endcol{border-right : 0px;}
-.ol_internal_tab td{font-family : Arial; font-size :11px; border-bottom : 1px solid #bfbfc0; border-top : 1px solid #FFFFFF; padding : 2px;}
+/*.ol_internal_tab td{font-family : Arial; font-size :11px; border-bottom : 1px solid #bfbfc0; border-top : 1px solid #FFFFFF; padding : 2px;}
+*/
.ol_internal_tab tr.ol_select{background : #EAF0F8}
@@ -452,12 +453,6 @@
<u:style name="font-weight" skin="headerWeightFont" />
</u:selector>
- <u:selector name=".rich-ordering-list-row-active">
- <u:style name="font-family" skin="headerFamilyFont" />
- <u:style name="font-size" skin="headerSizeFont" />
- <u:style name="font-weight" skin="headerWeightFont" />
- </u:selector>
-
<u:selector name=".rich-ordering-list-row-selected">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListSelectGradient" />
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-29 20:58:10 UTC (rev 4366)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-30 00:39:08 UTC (rev 4367)
@@ -138,14 +138,7 @@
<f:clientId var="cId"/>
<script type="text/javascript">
var clientId = '#{cId}';
- if (window.attachEvent) {
- window.attachEvent("onload", init);
- } else {
- window.addEventListener("load", init, false);
- }
- document.body.onselectstart = function() {return false;};
- document.body.className = "body";
- function init() {
+ Event.onReady(function() {
var cotrolsIdPrefix = [['up', 'disup'], ['down', 'disdown'], ['last', 'dislast'], ['first','disfirst']];
var listShuttleCotrolsIdPrefix = [['copy', 'discopy'], ['copyAll', 'discopyAll'], ['remove', 'disremove'], ['removeAll','disremoveAll']];
var listShuttle = new Richfaces.ListShuttle(new Richfaces.OrderingList('#{cId}', '#{cId}tlInternal_tab', '#{cId}tlInternal_header_tab', '#{cId}tlFocusKeeper', '#{cId}tlValueKeeper', cotrolsIdPrefix, '#{cId}sortLabel', function() {#{component.attributes['onorderchanged']}}),
@@ -155,7 +148,7 @@
var targetLayoutManager = new LayoutManager('#{cId}tlInternal_header_tab', '#{cId}tlInternal_tab');
sourceLayoutManager.widthSynchronization();
targetLayoutManager.widthSynchronization();
- }
+ });
//setTimeout(init, 0);
</script>
</f:root>
\ No newline at end of file
17 years, 1 month
JBoss Rich Faces SVN: r4366 - in branches/3.1.x/sandbox/ui/listShuttle/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 15:58:10 -0500 (Thu, 29 Nov 2007)
New Revision: 4366
Modified:
branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
latest changes for listShuttle & orderingList
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml 2007-11-29 20:58:01 UTC (rev 4365)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/config/component/listShuttle.xml 2007-11-29 20:58:10 UTC (rev 4366)
@@ -81,5 +81,47 @@
</description>
<defaultvalue>true</defaultvalue>
</property>
+
+ <property>
+ <name>showButtonLabels</name>
+ <classname>boolean</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[true]]></defaultvalue>
+ </property>
+
+ <property>
+ <name>topControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>upControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>downControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>bottomControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>copyAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>copyControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>removeControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>removeAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
</component>
</components>
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2007-11-29 20:58:01 UTC (rev 4365)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2007-11-29 20:58:10 UTC (rev 4366)
@@ -67,12 +67,9 @@
private final static String DEFAULT_LABEL_REMOVE = "Remove";
private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
- private final static String ATTRIBUTE_CLASS_BUTTON = "ol_button";
- private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED = "ol_button_disabled";
-
protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
new OrderingComponentRendererBase.ControlsHelper("copyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAll.class.getName(), FACET_COPY_ALL,
- " rich-shuttle-top", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-copyall", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, "",
CONTROL_ID_COPY_ALL, ATTRIBUTE_CE_ONCOPYALLCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -81,7 +78,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAllDisabled.class.getName(), FACET_DIS_COPY_ALL,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -90,7 +87,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("copy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopy.class.getName(), FACET_COPY,
- " rich-shuttle-up", ATTRIBUTE_CLASS_COPY_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "",
CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -99,7 +96,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(), FACET_DIS_COPY,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -108,7 +105,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("remove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemove.class.getName(), FACET_REMOVE,
- " rich-shuttle-down", ATTRIBUTE_CLASS_REMOVE_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -117,7 +114,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -126,7 +123,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("removeAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAll.class.getName(), FACET_REMOVE_ALL,
- " rich-shuttle-bottom", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-removeall", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, "",
CONTROL_ID_REMOVE_ALL, ATTRIBUTE_CE_ONREMOVEALLCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -135,7 +132,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemoveAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAllDisabled.class.getName(), FACET_DIS_REMOVE_ALL,
- " rich-shuttle-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-29 20:58:01 UTC (rev 4365)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-11-29 20:58:10 UTC (rev 4366)
@@ -7,9 +7,6 @@
import java.io.StringWriter;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
@@ -161,16 +158,14 @@
int divider = SHUTTLE_HELPERS.length / 2;
- int metric;
for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
- metric = Math.abs(i - divider) / 2;
SelectionState state = (i < divider ? sourceSelectionState : targetSelectionState);
boolean enabled;
- if (metric <= 1) {
- enabled = state.isSelected();
- } else {
+ if (i <= 1 || i >= SHUTTLE_HELPERS.length - 2) {
enabled = state.isItemExist();
+ } else {
+ enabled = state.isSelected();
}
if (i % 2 == 1) {
@@ -179,7 +174,8 @@
if (SHUTTLE_HELPERS[i].isRendered(context, component)) {
//proper assumption about helpers ordering
- encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enabled);
+ encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enabled,
+ "rich-list-shuttle-button", " rich-shuttle-control");
}
}
}
@@ -201,81 +197,12 @@
if (TL_HELPERS[i].isRendered(context, component)) {
//proper assumption about helpers ordering
- encodeControlFacet(context, component, TL_HELPERS[i], clientId, writer, enabled);
+ encodeControlFacet(context, component, TL_HELPERS[i], clientId, writer, enabled,
+ "rich-list-shuttle-button", " rich-shuttle-control");
}
}
}
- protected void renderDefaultControl(FacesContext context,
- UIOrderingBaseComponent orderingList, ResponseWriter writer,
- boolean useFacet, OrderingComponentRendererBase.ControlsHelper helper, String clientId, ResourceBundle bundle, boolean enabled)
- throws IOException {
- UIComponent facet = orderingList.getFacet(helper.getFacetName());
- String customEvent = null;
- Map attributes = orderingList.getAttributes();
- if (helper.customEvent != null) {
- customEvent = (String) attributes.get(helper.customEvent);
- }
-
- String styleFromAttribute = (String) attributes
- .get(helper.styleFromAttribute);
- String currentStyle = helper.getStyleClassName();
-
- if (styleFromAttribute != null) {
- currentStyle = styleFromAttribute.concat(currentStyle);
- }
-
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "shuttle_button " + currentStyle, null);
- if (helper.enable) {
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE,
- "Element.addClassName(this, 'shuttle_button_press'); Element.removeClassName(this, 'shuttle_button');", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE,
- "Element.addClassName(this, 'shuttle_button'); Element.removeClassName(this, 'shuttle_button_press');", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE,
- "Element.addClassName(this, 'shuttle_button'); Element.removeClassName(this, 'shuttle_button_press');", null);
- }
-
- if (customEvent != null) {
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,null);
- }
-
- if (useFacet) {
- renderChild(context, facet);
- } else {
- writer.startElement(HTML.IMG_ELEMENT, orderingList);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),
- null);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
- helper.getImageURI()).getUri(context, null), null);
-
- writer.endElement(HTML.IMG_ELEMENT);
-
- if (Boolean.TRUE.equals(attributes.get(SHOW_LABELS_ATTRIBUTE_NAME))) {
- String label = (String) attributes.get(helper.getLabelAttributeName());
-
- if (label == null && bundle != null) {
- try {
- label = bundle.getString(helper.getBundlePropertyName());
- } catch (MissingResourceException e) {
-
- }
- }
-
- if (label == null) {
- label = helper.getDefaultText();
- }
-
- writer.writeText(label, null);
- }
- }
- writer.endElement(HTML.DIV_ELEM);
- }
-
private boolean isEmpty(String s) {
return s == null || s.length() == 0;
}
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-29 20:58:01 UTC (rev 4365)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/css/listShuttle.xcss 2007-11-29 20:58:10 UTC (rev 4366)
@@ -187,78 +187,49 @@
<f:verbatim><![CDATA[
-.rich-ordering-control-disabled {
+.rich-shuttle-control-disabled, .rich-shuttle-control-top, .rich-shuttle-control-bottom, .rich-shuttle-control-up, .rich-shuttle-control-down,
+.rich-shuttle-control-copyall, .rich-shuttle-control-copy, .rich-shuttle-control-remove, .rich-shuttle-control-removeall {
border : 1px solid;
margin-bottom : 3px;
}
-.rich-ordering-control-top {
- border : 1px solid;
- margin-bottom : 3px;
-}
-
-.rich-ordering-control-bottom {
- border : 1px solid;
- margin-bottom : 3px;
-}
-
-.rich-ordering-control-up {
- border : 1px solid;
- margin-bottom : 3px;
-}
-
-.rich-ordering-control-down {
- border : 1px solid;
- margin-bottom : 3px;
-}
-
-.rich-ordering-list-button {
+.rich-list-shuttle-button, .rich-list-shuttle-button-disabled {
background : top left repeat-x;
- cursor : pointer;
padding : 2px;
}
-.rich-ordering-list-button-disabled {
- background : top left repeat-x;
- padding : 2px;
+.rich-list-shuttle-button {
+ cursor : pointer;
}
-.rich-ordering-list-button-light {
+.rich-list-shuttle-button-light {
background : top left repeat-x;
border-style: solid;
cursor : pointer;
padding: 1px;
}
-/*
-.rich-ordering-list-button-dis {
- border : 1px solid #bfbfc0;
- margin-bottom : 3px;
- padding : 1px
-}
-*/
-
-.rich-ordering-list-button-press {
+.rich-list-shuttle-button-press {
background : top left repeat-x;
border-style: solid;
padding : 2px 0px 0px 2px;
}
-.rich-ordering-list-button-valign {
+.rich-list-shuttle-button-valign {
vertical-align : middle;
}
-.rich-ordering-list-button-layout {
+.rich-list-shuttle-button-layout {
padding : 15px 8px 15px 0px;
}
-.rich-ordering-list-button-content {
+.rich-list-shuttle-button-content {
padding : 0px 4px 0px 1px;
text-align : left;
white-space: nowrap;
}
-.rich-ordering-list-button-content img {
+.rich-list-shuttle-button-content img {
margin-right: 2px;
vertical-align: middle;
}
@@ -338,8 +309,13 @@
white-space: nowrap;
}
-.rich-ordering-list-cell-active, .rich-ordering-list-cell-active * {
+.rich-ordering-list-cell-active {
+ border-top: 1px dotted gray;
+ border-bottom: 1px dotted gray;
+}
+.rich-ordering-list-cell-active * {
+
}
.rich-ordering-list-ds {
@@ -358,7 +334,7 @@
]]>
</f:verbatim>
-<u:selector name=".rich-ordering-list-button">
+<u:selector name=".rich-list-shuttle-button">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
</u:style>
@@ -368,7 +344,7 @@
<u:style name="font-size" skin="headerSizeFont"/>
</u:selector>
-<u:selector name=".rich-ordering-list-button-disabled">
+<u:selector name=".rich-list-shuttle-button-disabled">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
</u:style>
@@ -378,7 +354,7 @@
<u:style name="font-size" skin="headerSizeFont"/>
</u:selector>
- <u:selector name=".rich-ordering-list-button-light">
+ <u:selector name=".rich-list-shuttle-button-light">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
</u:style>
@@ -390,7 +366,7 @@
<u:style name="color" skin="generalTextColor"/>
</u:selector>
- <u:selector name=".rich-ordering-list-button-press">
+ <u:selector name=".rich-list-shuttle-button-press">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient" />
</u:style>
@@ -461,23 +437,11 @@
<u:style name="font-family" skin="generalFamilyFont" />
</u:selector>
- <u:selector name=".rich-ordering-control-disabled">
+ <u:selector name=".rich-shuttle-control-disabled, .rich-shuttle-control-top, .rich-shuttle-control-bottom, .rich-shuttle-control-up, .rich-shuttle-control-down, .rich-shuttle-control-copyall, .rich-shuttle-control-copy, .rich-shuttle-control-remove, .rich-shuttle-control-removeall">
<u:style name="border-color" skin="panelBorderColor" />
</u:selector>
- <u:selector name=".rich-ordering-control-top">
- <u:style name="border-color" skin="panelBorderColor" />
- </u:selector>
- <u:selector name=".rich-ordering-control-bottom">
- <u:style name="border-color" skin="panelBorderColor" />
- </u:selector>
- <u:selector name=".rich-ordering-control-up">
- <u:style name="border-color" skin="panelBorderColor" />
- </u:selector>
- <u:selector name=".rich-ordering-control-down">
- <u:style name="border-color" skin="panelBorderColor" />
- </u:selector>
- <u:selector name=".rich-ordering-list-button-content">
+ <u:selector name=".rich-list-shuttle-button-content">
<u:style name="font-family" skin="headerFamilyFont" />
<u:style name="font-size" skin="headerSizeFont" />
</u:selector>
@@ -492,10 +456,6 @@
<u:style name="font-family" skin="headerFamilyFont" />
<u:style name="font-size" skin="headerSizeFont" />
<u:style name="font-weight" skin="headerWeightFont" />
- <u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListSelectGradient" />
- </u:style>
- <u:style name="background-color" skin="headerGradientColor" />
</u:selector>
<u:selector name=".rich-ordering-list-row-selected">
Modified: branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-29 20:58:01 UTC (rev 4365)
+++ branches/3.1.x/sandbox/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-11-29 20:58:10 UTC (rev 4366)
@@ -120,18 +120,18 @@
</div>
</div>
</td>
- <td class="ol_center_button_col_valign">
- <div class="shuttle_button_layout rich-ordering-controls">
- <jsp:scriptlet><![CDATA[
- encodeTLControlsFacets(context, component, targetSelectionState);
- ]]></jsp:scriptlet>
- </div>
- </td>
</tr>
</tbody>
</table>
</div>
</td>
+ <td class="ol_center_button_col_valign">
+ <div class="shuttle_button_layout rich-orderingcontrols">
+ <jsp:scriptlet><![CDATA[
+ encodeTLControlsFacets(context, component, targetSelectionState);
+ ]]></jsp:scriptlet>
+ </div>
+ </td>
</tr>
</table>
</vcp:body>
17 years, 1 month
JBoss Rich Faces SVN: r4365 - branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 15:58:01 -0500 (Thu, 29 Nov 2007)
New Revision: 4365
Modified:
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
Log:
latest changes for listShuttle & orderingList
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2007-11-29 20:57:55 UTC (rev 4364)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2007-11-29 20:58:01 UTC (rev 4365)
@@ -70,12 +70,9 @@
private final static String DEFAULT_LABEL_DOWN = "Down";
private final static String DEFAULT_LABEL_BOTTOM = "Last";
- private final static String ATTRIBUTE_CLASS_BUTTON = "rich-ordering-list-button";
- private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED = "rich-ordering-list-button-disabled";
-
protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
new OrderingComponentRendererBase.ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
- " rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-top", ATTRIBUTE_CLASS_TOP_CONTROL, "",
CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -84,7 +81,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -93,7 +90,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("up", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
- " rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-up", ATTRIBUTE_CLASS_UP_CONTROL, "",
CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -102,7 +99,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -111,7 +108,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("down", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
- " rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-down", ATTRIBUTE_CLASS_DOWN_CONTROL, "",
CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -120,7 +117,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -129,7 +126,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("bottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottom.class.getName(), FACET_BOTTOM,
- " rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ "-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, "",
CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -138,7 +135,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-29 20:57:55 UTC (rev 4364)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2007-11-29 20:58:01 UTC (rev 4365)
@@ -242,7 +242,8 @@
protected void renderDefaultControl(FacesContext context,
UIOrderingBaseComponent orderingList, ResponseWriter writer,
- boolean useFacet, OrderingComponentRendererBase.ControlsHelper helper, String clientId, ResourceBundle bundle, boolean enabled)
+ boolean useFacet, OrderingComponentRendererBase.ControlsHelper helper, String clientId, ResourceBundle bundle,
+ boolean enabled, String baseStyle, String baseControlStyle)
throws IOException {
UIComponent facet = orderingList.getFacet(helper.getFacetName());
String customEvent = null;
@@ -253,8 +254,11 @@
String styleFromAttribute = (String) attributes
.get(helper.styleFromAttribute);
- String currentStyle = helper.getStyleClassName();
+ String baseStyleLight = baseStyle.concat("-light");
+ String baseStylePress = baseStyle.concat("-press");
+
+ String currentStyle = baseControlStyle + helper.getStyleClassName();
if (styleFromAttribute != null) {
currentStyle = styleFromAttribute.concat(currentStyle);
}
@@ -272,16 +276,16 @@
if (!useFacet) {
writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, helper.getButtonStyleClass(), null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
if (helper.enable) {
- writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='rich-ordering-list-button-light'", null);
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='rich-ordering-list-button-press'", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='rich-ordering-list-button'", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='rich-ordering-list-button'", null);
+ writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
+ writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
+ writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
+ writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='" + baseStyle + "'", null);
}
writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-ordering-list-button-content", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
}
@@ -303,7 +307,7 @@
writer.endElement(HTML.IMG_ELEMENT);
- if (Boolean.TRUE.equals(attributes.get(SHOW_LABELS_ATTRIBUTE_NAME))) {
+ if (getUtils().isBooleanAttribute(orderingList, SHOW_LABELS_ATTRIBUTE_NAME)) {
String label = (String) attributes.get(helper.getLabelAttributeName());
if (label == null && bundle != null) {
@@ -370,7 +374,8 @@
protected void encodeControlFacet(FacesContext context,
UIOrderingBaseComponent orderingList, OrderingComponentRendererBase.ControlsHelper helper,
- String clientId, ResponseWriter writer, boolean enabled) throws IOException {
+ String clientId, ResponseWriter writer, boolean enabled, String baseStyle,
+ String baseControlStyle) throws IOException {
Locale locale = null;
UIViewRoot viewRoot = context.getViewRoot();
@@ -400,7 +405,7 @@
}
} else {
renderDefaultControl(context, orderingList, writer, useFacet,
- helper, clientId, bundle ,enabled);
+ helper, clientId, bundle ,enabled, baseStyle, baseControlStyle);
}
}
Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-29 20:57:55 UTC (rev 4364)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-29 20:58:01 UTC (rev 4365)
@@ -71,7 +71,7 @@
if (HELPERS[i].isRendered(context, orderingList)) {
//proper assumption about helpers ordering
encodeControlFacet(context, orderingList, HELPERS[i], clientId, writer,
- enabled);
+ enabled, "rich-ordering-list-button", " rich-ordering-control");
}
}
}
17 years, 1 month
JBoss Rich Faces SVN: r4364 - in branches/3.1.x/sandbox/samples/listShuttleDemo: src/main/webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 15:57:55 -0500 (Thu, 29 Nov 2007)
New Revision: 4364
Modified:
branches/3.1.x/sandbox/samples/listShuttleDemo/pom.xml
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/web.xml
branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp
Log:
latest changes for listShuttle & orderingList
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/pom.xml
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/pom.xml 2007-11-29 19:05:02 UTC (rev 4363)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/pom.xml 2007-11-29 20:57:55 UTC (rev 4364)
@@ -19,5 +19,10 @@
<artifactId>listShuttle</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.samples</groupId>
+ <artifactId>skins</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-29 19:05:02 UTC (rev 4363)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-29 20:57:55 UTC (rev 4364)
@@ -13,4 +13,10 @@
<managed-bean-class>org.richfaces.ListShuttleDemoRequestBean</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: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/web.xml 2007-11-29 19:05:02 UTC (rev 4363)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/WEB-INF/web.xml 2007-11-29 20:57:55 UTC (rev 4364)
@@ -14,6 +14,10 @@
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
<!--
-->
<filter>
Modified: branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp
===================================================================
--- branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp 2007-11-29 19:05:02 UTC (rev 4363)
+++ branches/3.1.x/sandbox/samples/listShuttleDemo/src/main/webapp/pages/index.jsp 2007-11-29 20:57:55 UTC (rev 4364)
@@ -16,6 +16,10 @@
</a4j:outputPanel>
<h:form>
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set skin" />
+ <br />
+
<ls:listShuttle var="item" sourceValue="#{listShuttleDemoBean.source}" targetValue="#{listShuttleDemoBean.target}">
<h:column><h:outputText value="#{item.name}" /></h:column>
<h:column><h:outputText value="#{item.price}" /></h:column>
17 years, 1 month
JBoss Rich Faces SVN: r4363 - in trunk/sandbox/samples/fileUploadDemo/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-11-29 14:05:02 -0500 (Thu, 29 Nov 2007)
New Revision: 4363
Modified:
trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
RF-1214
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2007-11-29 19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2007-11-29 19:05:02 UTC (rev 4363)
@@ -20,10 +20,41 @@
*/
package org.richfaces;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.richfaces.org.jboss.seam.ui.component.UIFileUpload;
+
/**
* @author $Autor$
*
*/
public class Bean {
+ private UIFileUpload fileUpload;
+
+ public UIFileUpload getFileUpload() {
+ return fileUpload;
+ }
+
+ public void setFileUpload(UIFileUpload fileUpload) {
+ this.fileUpload = fileUpload;
+ }
+
+ public void printFile() {
+ int i = -1;
+ InputStream stream = fileUpload.getLocalInputStream();
+ do {
+ try {
+ i = stream.read();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out.print((char)i);
+ } while (i!=-1);
+ System.out.println();
+
+ }
}
\ No newline at end of file
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-29 19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-11-29 19:05:02 UTC (rev 4363)
@@ -5,6 +5,6 @@
<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-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml 2007-11-29 19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/WEB-INF/web.xml 2007-11-29 19:05:02 UTC (rev 4363)
@@ -17,7 +17,20 @@
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
+ <filter>
+ <display-name>FileUpload Filter</display-name>
+ <filter-name>fileUpload</filter-name>
+ <filter-class>org.richfaces.org.jboss.seam.web.MultipartFilter</filter-class>
+ </filter>
<filter-mapping>
+ <filter-name>fileUpload</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+ <filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2007-11-29 19:03:15 UTC (rev 4362)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp 2007-11-29 19:05:02 UTC (rev 4363)
@@ -1,12 +1,16 @@
<%@ 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/fileUpload" prefix="fu"%>
<html>
<head>
<title></title>
</head>
<body>
<f:view>
-
+ <h:form enctype="multipart/form-data" >
+ <fu:fileUpload binding="#{bean.fileUpload}"></fu:fileUpload>
+ <h:commandButton type="submit" action="#{bean.printFile}"></h:commandButton>
+ </h:form>
</f:view>
</body>
</html>
17 years, 1 month
JBoss Rich Faces SVN: r4362 - in trunk/sandbox/ui/fileUpload: src/main and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-11-29 14:03:15 -0500 (Thu, 29 Nov 2007)
New Revision: 4362
Added:
trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
trunk/sandbox/ui/fileUpload/src/main/java/
trunk/sandbox/ui/fileUpload/src/main/java/org/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/
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/
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/
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/FileUploadException.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
Modified:
trunk/sandbox/ui/fileUpload/pom.xml
Log:
RF-1209
Modified: trunk/sandbox/ui/fileUpload/pom.xml
===================================================================
--- trunk/sandbox/ui/fileUpload/pom.xml 2007-11-29 18:44:54 UTC (rev 4361)
+++ trunk/sandbox/ui/fileUpload/pom.xml 2007-11-29 19:03:15 UTC (rev 4362)
@@ -22,6 +22,13 @@
<goal>generate</goal>
</goals>
</execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<library>
Added: trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/config/component/fileUpload.xml 2007-11-29 19:03:15 UTC (rev 4362)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.component.FileUpload</name>
+ <family>org.richfaces.component.FileUpload</family>
+ <classname>org.richfaces.component.html.HtmlFileUpload</classname>
+ <superclass>org.richfaces.org.jboss.seam.ui.component.UIFileUpload</superclass>
+ <description>
+ <![CDATA[Renders a file upload control. This control must be used within a form with an encoding type of multipart/form-data, i.e:
+
+<h:form enctype="multipart/form-data">
+
+For multipart requests, the Seam Multipart servlet filter must also be configured in web.xml:
+
+<filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+</filter>
+
+<filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+The following configuration options for multipart requests may be configured in components.xml:
+
+* createTempFiles - if this option is set to true, uploaded files are streamed to a temporary file instead of in memory.
+* maxRequestSize - the maximum size of a file upload request, in bytes.
+
+Here's an example:
+
+<component class="org.jboss.seam.servlet.MultipartConfig">
+ <property name="createTempFiles">true</property>
+ <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>
+ <tag>
+ <name>fileUpload</name>
+ <classname>org.richfaces.taglib.FileUploadTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ &ui_component_attributes;
+ &ui_input_attributes;
+ &html_style_attributes;
+ &html_input_attributes;
+ &html_events;
+ &html_input_events;
+ <property transient="true">
+ <name>accept</name>
+ <classname>java.lang.String</classname>
+ <description>a comma-separated list of content types to accept, may not be supported by the browser. E.g. "images/png,images/jpg", "images/*".</description>
+ </property>
+ <property elonly="true">
+ <name>data</name>
+ <classname>java.lang.Object</classname>
+ <description>this value binding receives the file's content type (optional).</description>
+ </property>
+ <property elonly="true">
+ <name>contentType</name>
+ <classname>java.lang.String</classname>
+ <description>the property to receive the contentType</description>
+ </property>
+ <property elonly="true">
+ <name>fileName</name>
+ <classname>java.lang.String</classname>
+ <description>this value binding receives the filename (optional).</description>
+ </property>
+ <property elonly="true">
+ <name>fileSize</name>
+ <classname>java.lang.Integer</classname>
+ <description>this value binding receives the file size (optional).</description>
+ </property>
+ </component>
+</components>
Added: 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 (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2007-11-29 19:03:15 UTC (rev 4362)
@@ -0,0 +1,144 @@
+package org.richfaces.org.jboss.seam.ui.component;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIFileUpload extends UIInput
+{
+
+ private String localContentType;
+
+ private String localFileName;
+
+ private Integer localFileSize;
+
+ private InputStream localInputStream;
+
+ @Override
+ public void processUpdates(FacesContext context)
+ {
+ ValueExpression dataBinding = getValueExpression("data");
+ if (dataBinding != null)
+ {
+ Class clazz = dataBinding.getType(context.getELContext());
+ if (clazz.isAssignableFrom(InputStream.class))
+ {
+ dataBinding.setValue(context.getELContext(), getLocalInputStream());
+ }
+ else if (clazz.isAssignableFrom(byte[].class))
+ {
+ byte[] bytes = null;
+ if (getLocalInputStream() != null)
+ {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try
+ {
+ byte[] buffer = new byte[512];
+ int read = getLocalInputStream().read(buffer);
+ while (read != -1)
+ {
+ bos.write(buffer, 0, read);
+ read = getLocalInputStream().read(buffer);
+ }
+ bytes = bos.toByteArray();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ dataBinding.setValue(context.getELContext(), bytes);
+ }
+
+ if (getLocalContentType() != null)
+ {
+ ValueExpression valueExpression = getValueExpression("contentType");
+ if (valueExpression != null)
+ {
+ valueExpression.setValue(context.getELContext(), getLocalContentType());
+ }
+ }
+
+ if (getLocalFileName() != null)
+ {
+ ValueExpression valueExpression = getValueExpression("fileName");
+ if (valueExpression != null)
+ {
+ valueExpression.setValue(context.getELContext(), getLocalFileName());
+ }
+ }
+
+ if (getLocalFileSize() != null)
+ {
+ ValueExpression valueExpression = getValueExpression("fileSize");
+ if (valueExpression != null)
+ {
+ valueExpression.setValue(context.getELContext(), getLocalFileSize());
+ }
+ }
+ }
+ }
+
+ public String getLocalContentType()
+ {
+ return localContentType;
+ }
+
+ public void setLocalContentType(String localContentType)
+ {
+ this.localContentType = localContentType;
+ }
+
+ public String getLocalFileName()
+ {
+ return localFileName;
+ }
+
+ public void setLocalFileName(String localFileName)
+ {
+ this.localFileName = localFileName;
+ }
+
+ public Integer getLocalFileSize()
+ {
+ return localFileSize;
+ }
+
+ public void setLocalFileSize(Integer localFileSize)
+ {
+ this.localFileSize = localFileSize;
+ }
+
+ public InputStream getLocalInputStream()
+ {
+ return localInputStream;
+ }
+
+ public void setLocalInputStream(InputStream localInputStream)
+ {
+ this.localInputStream = localInputStream;
+ }
+
+ public abstract void setAccept(String accept);
+
+ public abstract String getAccept();
+
+ public abstract String getStyleClass();
+
+ public abstract String getStyle();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract void setStyle(String style);
+
+}
Added: 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 (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/renderkit/FileUploadRendererBase.java 2007-11-29 19:03:15 UTC (rev 4362)
@@ -0,0 +1,131 @@
+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.richfaces.org.jboss.seam.ui.component.UIFileUpload;
+import org.richfaces.org.jboss.seam.web.MultipartRequest;
+
+public class FileUploadRendererBase extends RendererBase
+{
+
+ @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;
+ ServletRequest request = (ServletRequest) context.getExternalContext().getRequest();
+
+ if (!(request instanceof MultipartRequest))
+ {
+ request = unwrapMultipartRequest(request);
+ }
+
+ if (request instanceof MultipartRequest)
+ {
+ MultipartRequest multipartRequest = (MultipartRequest) request;
+
+ String clientId = component.getClientId(context);
+ fileUpload.setLocalInputStream(multipartRequest.getFileInputStream(clientId));
+ fileUpload.setLocalContentType(multipartRequest.getFileContentType(clientId));
+ fileUpload.setLocalFileName(multipartRequest.getFileName(clientId));
+ fileUpload.setLocalFileSize(multipartRequest.getFileSize(clientId));
+ }
+ }
+
+ /**
+ * Finds an instance of MultipartRequest wrapped within a request or its
+ * (recursively) wrapped requests.
+ */
+ private static ServletRequest unwrapMultipartRequest(ServletRequest request)
+ {
+ while (!(request instanceof MultipartRequest))
+ {
+ boolean found = false;
+
+ for (Method m : request.getClass().getMethods())
+ {
+ if (ServletRequest.class.isAssignableFrom(m.getReturnType())
+ && m.getParameterTypes().length == 0)
+ {
+ try
+ {
+ request = (ServletRequest) m.invoke(request);
+ found = true;
+ break;
+ }
+ catch (Exception ex)
+ { /* Ignore, try the next one */
+ }
+ }
+ }
+
+ if (!found)
+ {
+ for (Field f : request.getClass().getDeclaredFields())
+ {
+ if (ServletRequest.class.isAssignableFrom(f.getType()))
+ {
+ try
+ {
+ request = (ServletRequest) f.get(request);
+ }
+ catch (Exception ex)
+ { /* Ignore */
+ }
+ }
+ }
+ }
+
+ if (!found) break;
+ }
+
+ return request;
+ }
+
+}
Added: trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/FileUploadException.java
===================================================================
--- trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/FileUploadException.java (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/FileUploadException.java 2007-11-29 19:03:15 UTC (rev 4362)
@@ -0,0 +1,24 @@
+package org.richfaces.org.jboss.seam.web;
+
+/**
+ * Thrown when an exception occurs while uploading a file.
+ *
+ * @author Shane Bryzak
+ */
+public class FileUploadException extends RuntimeException
+{
+ public FileUploadException()
+ {
+ this(null, null);
+ }
+
+ public FileUploadException(String message)
+ {
+ this(message, null);
+ }
+
+ public FileUploadException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: 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 (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartFilter.java 2007-11-29 19:03:15 UTC (rev 4362)
@@ -0,0 +1,112 @@
+package org.richfaces.org.jboss.seam.web;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A filter for decoding multipart requests, for
+ * use with the file upload control.
+ *
+ * @author Shane Bryzak
+ *
+ */
+//@Scope(APPLICATION)
+//@Name("org.jboss.seam.web.multipartFilter")
+//@Install(precedence = BUILT_IN)
+//@BypassInterceptors
+//@Filter(within={"org.jboss.seam.web.ajax4jsfFilter", "org.jboss.seam.web.exceptionFilter"})
+public class MultipartFilter implements Filter
+{
+ public static final String MULTIPART = "multipart/";
+
+ /**
+ * Flag indicating whether a temporary file should be used to cache the uploaded file
+ */
+ private boolean createTempFiles = false;
+
+ /**
+ * The maximum size of a file upload request. 0 means no limit.
+ */
+ private int maxRequestSize = 0;
+
+ public boolean getCreateTempFiles()
+ {
+ return createTempFiles;
+ }
+
+ public void setCreateTempFiles(boolean createTempFiles)
+ {
+ this.createTempFiles = createTempFiles;
+ }
+
+ public int getMaxRequestSize()
+ {
+ return maxRequestSize;
+ }
+
+ public void setMaxRequestSize(int maxFileSize)
+ {
+ this.maxRequestSize = maxFileSize;
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws IOException, ServletException
+ {
+ if (!(response instanceof HttpServletResponse))
+ {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+
+ if (isMultipartRequest(httpRequest))
+ {
+ chain.doFilter(new MultipartRequest(httpRequest, createTempFiles,
+ maxRequestSize), response);
+ }
+ else
+ {
+ chain.doFilter(request, response);
+ }
+ }
+
+ private boolean isMultipartRequest(HttpServletRequest request)
+ {
+ if (!"post".equals(request.getMethod().toLowerCase()))
+ {
+ return false;
+ }
+
+ String contentType = request.getContentType();
+ if (contentType == null)
+ {
+ return false;
+ }
+
+ if (contentType.toLowerCase().startsWith(MULTIPART))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+public void destroy() {
+ // TODO Auto-generated method stub
+
+}
+
+public void init(FilterConfig filterConfig) throws ServletException {
+ // TODO Auto-generated method stub
+
+}
+}
Added: 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 (rev 0)
+++ trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/web/MultipartRequest.java 2007-11-29 19:03:15 UTC (rev 4362)
@@ -0,0 +1,633 @@
+package org.richfaces.org.jboss.seam.web;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.rmi.server.UID;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * Request wrapper for supporting multipart requests, used for file uploading.
+ *
+ * @author Shane Bryzak
+ */
+public class MultipartRequest extends HttpServletRequestWrapper
+{
+ private static final String PARAM_NAME = "name";
+ private static final String PARAM_FILENAME = "filename";
+ private static final String PARAM_CONTENT_TYPE = "Content-Type";
+
+ private static final int BUFFER_SIZE = 2048;
+ private static final int CHUNK_SIZE = 512;
+
+ private boolean createTempFiles;
+
+ private String encoding = null;
+
+ private Map<String,Param> parameters = null;
+
+ private enum ReadState { BOUNDARY, HEADERS, DATA }
+
+ private static final byte CR = 0x0d;
+ private static final byte LF = 0x0a;
+ private static final byte[] CR_LF = {CR,LF};
+
+ private abstract class Param
+ {
+ private String name;
+
+ public Param(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public abstract void appendData(byte[] data, int start, int length)
+ throws IOException;
+ }
+
+ private class ValueParam extends Param
+ {
+ private Object value = null;
+ private ByteArrayOutputStream buf = new ByteArrayOutputStream();
+
+ public ValueParam(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ public void appendData(byte[] data, int start, int length)
+ throws IOException
+ {
+ buf.write(data, start, length);
+ }
+
+ public void complete()
+ throws UnsupportedEncodingException
+ {
+ String val = encoding == null ? new String(buf.toByteArray()) :
+ new String(buf.toByteArray(), encoding);
+ if (value == null)
+ {
+ value = val;
+ }
+ else
+ {
+ if (!(value instanceof List))
+ {
+ List<String> v = new ArrayList<String>();
+ v.add((String) value);
+ value = v;
+ }
+
+ ((List) value).add(val);
+ }
+ buf.reset();
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+ }
+
+ private class FileParam extends Param
+ {
+ private String filename;
+ private String contentType;
+ private int fileSize;
+
+ private ByteArrayOutputStream bOut = null;
+ private FileOutputStream fOut = null;
+ private File tempFile = null;
+
+ public FileParam(String name)
+ {
+ super(name);
+ }
+
+ public String getFilename()
+ {
+ return filename;
+ }
+
+ public void setFilename(String filename)
+ {
+ this.filename = filename;
+ }
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public int getFileSize()
+ {
+ return fileSize;
+ }
+
+ public void createTempFile()
+ {
+ try
+ {
+ tempFile = File.createTempFile(new UID().toString().replace(":", "-"), ".upload");
+ tempFile.deleteOnExit();
+ fOut = new FileOutputStream(tempFile);
+ }
+ catch (IOException ex)
+ {
+ throw new FileUploadException("Could not create temporary file");
+ }
+ }
+
+ @Override
+ public void appendData(byte[] data, int start, int length)
+ throws IOException
+ {
+ if (fOut != null)
+ {
+ fOut.write(data, start, length);
+ fOut.flush();
+ }
+ else
+ {
+ if (bOut == null) bOut = new ByteArrayOutputStream();
+ bOut.write(data, start, length);
+ }
+
+ fileSize += length;
+ }
+
+ public byte[] getData()
+ {
+ if (fOut != null)
+ {
+ try
+ {
+ fOut.close();
+ }
+ catch (IOException ex) {}
+ fOut = null;
+ }
+
+ if (bOut != null)
+ {
+ return bOut.toByteArray();
+ }
+ else if (tempFile != null)
+ {
+ if (tempFile.exists())
+ {
+ try
+ {
+ FileInputStream fIn = new FileInputStream(tempFile);
+ ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+ byte[] buf = new byte[512];
+ int read = fIn.read(buf);
+ while (read != -1)
+ {
+ bOut.write(buf, 0, read);
+ read = fIn.read(buf);
+ }
+ bOut.flush();
+
+ fIn.close();
+ tempFile.delete();
+ return bOut.toByteArray();
+ }
+ catch (IOException ex) { /* too bad? */}
+ }
+ }
+
+ return null;
+ }
+
+ public InputStream getInputStream()
+ {
+ if (fOut != null)
+ {
+ try
+ {
+ fOut.close();
+ }
+ catch (IOException ex) {}
+ fOut = null;
+ }
+
+ if (bOut!=null)
+ {
+ return new ByteArrayInputStream(bOut.toByteArray());
+ }
+ else if (tempFile!=null)
+ {
+ try
+ {
+ return new FileInputStream(tempFile) {
+ @Override
+ public void close() throws IOException
+ {
+ super.close();
+ tempFile.delete();
+ }
+ };
+ }
+ catch (FileNotFoundException ex) { }
+ }
+
+ return null;
+ }
+ }
+
+ private HttpServletRequest request;
+
+ public MultipartRequest(HttpServletRequest request, boolean createTempFiles,
+ int maxRequestSize)
+ {
+ super(request);
+ this.request = request;
+ this.createTempFiles = createTempFiles;
+
+ String contentLength = request.getHeader("Content-Length");
+ if (contentLength != null && maxRequestSize > 0 &&
+ Integer.parseInt(contentLength) > maxRequestSize)
+ {
+ throw new FileUploadException("Multipart request is larger than allowed size");
+ }
+ }
+
+ private void parseRequest()
+ {
+ byte[] boundaryMarker = getBoundaryMarker(request.getContentType());
+ if (boundaryMarker == null)
+ {
+ throw new FileUploadException("The request was rejected because "
+ + "no multipart boundary was found");
+ }
+
+ encoding = request.getCharacterEncoding();
+
+ parameters = new HashMap<String,Param>();
+
+ try
+ {
+ byte[] buffer = new byte[BUFFER_SIZE];
+ Map<String,String> headers = new HashMap<String,String>();
+
+ ReadState readState = ReadState.BOUNDARY;
+
+ InputStream input = request.getInputStream();
+ int read = input.read(buffer);
+ int pos = 0;
+
+ Param p = null;
+
+ while (read != -1)
+ {
+ for (int i = 0; i < read; i++)
+ {
+ switch (readState)
+ {
+ case BOUNDARY:
+ {
+ if (checkSequence(buffer, i, boundaryMarker) && checkSequence(buffer, i + 2, CR_LF))
+ {
+ readState = ReadState.HEADERS;
+ i += 2;
+ pos = i + 1;
+ }
+ break;
+ }
+ case HEADERS:
+ {
+ if (checkSequence(buffer, i, CR_LF))
+ {
+ String param = (encoding == null) ?
+ new String(buffer, pos, i - pos - 1) :
+ new String(buffer, pos, i - pos - 1, encoding);
+ parseParams(param, ";", headers);
+
+ if (checkSequence(buffer, i + CR_LF.length, CR_LF))
+ {
+ readState = ReadState.DATA;
+ i += CR_LF.length;
+ pos = i + 1;
+
+ String paramName = headers.get(PARAM_NAME);
+ if (paramName != null)
+ {
+ if (headers.containsKey(PARAM_FILENAME))
+ {
+ FileParam fp = new FileParam(paramName);
+ if (createTempFiles) fp.createTempFile();
+ fp.setContentType(headers.get(PARAM_CONTENT_TYPE));
+ fp.setFilename(headers.get(PARAM_FILENAME));
+ p = fp;
+ }
+ else
+ {
+ if (parameters.containsKey(paramName))
+ {
+ p = parameters.get(paramName);
+ }
+ else
+ {
+ p = new ValueParam(paramName);
+ }
+ }
+
+ if (!parameters.containsKey(paramName))
+ {
+ parameters.put(paramName, p);
+ }
+ }
+
+ headers.clear();
+ }
+ else
+ {
+ pos = i + 1;
+ }
+ }
+ break;
+ }
+ case DATA:
+ {
+ // If we've encountered another boundary...
+ if (checkSequence(buffer, i - boundaryMarker.length - CR_LF.length, CR_LF) &&
+ checkSequence(buffer, i, boundaryMarker))
+ {
+ // Write any data before the boundary (that hasn't already been written) to the param
+ if (pos < i - boundaryMarker.length - CR_LF.length - 1)
+ {
+ p.appendData(buffer, pos, i - pos - boundaryMarker.length - CR_LF.length - 1);
+ }
+
+ if (p instanceof ValueParam) ((ValueParam) p).complete();
+
+ if (checkSequence(buffer, i + CR_LF.length, CR_LF))
+ {
+ i += CR_LF.length;
+ pos = i + 1;
+ }
+ else
+ {
+ pos = i;
+ }
+
+ readState = ReadState.HEADERS;
+ }
+ // Otherwise write whatever data we have to the param
+ else if (i > (pos + boundaryMarker.length + CHUNK_SIZE + CR_LF.length))
+ {
+ p.appendData(buffer, pos, CHUNK_SIZE);
+ pos += CHUNK_SIZE;
+ }
+ break;
+ }
+ }
+ }
+
+ if (pos < read)
+ {
+ // move the bytes that weren't read to the start of the buffer
+ int bytesNotRead = read - pos;
+ System.arraycopy(buffer, pos, buffer, 0, bytesNotRead);
+ read = input.read(buffer, bytesNotRead, buffer.length - bytesNotRead);
+ read += bytesNotRead;
+ }
+ else
+ {
+ read = input.read(buffer);
+ }
+
+ pos = 0;
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new FileUploadException("IO Error parsing multipart request", ex);
+ }
+ }
+
+ private byte[] getBoundaryMarker(String contentType)
+ {
+ Map<String, Object> params = parseParams(contentType, ";");
+ String boundaryStr = (String) params.get("boundary");
+
+ if (boundaryStr == null) return null;
+
+ try
+ {
+ return boundaryStr.getBytes("ISO-8859-1");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ return boundaryStr.getBytes();
+ }
+ }
+
+ /**
+ * Checks if a specified sequence of bytes ends at a specific position
+ * within a byte array.
+ *
+ * @param data
+ * @param pos
+ * @param seq
+ * @return boolean indicating if the sequence was found at the specified position
+ */
+ private boolean checkSequence(byte[] data, int pos, byte[] seq)
+ {
+ if (pos - seq.length < -1 || pos >= data.length)
+ return false;
+
+ for (int i = 0; i < seq.length; i++)
+ {
+ if (data[(pos - seq.length) + i + 1] != seq[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ private static final Pattern PARAM_VALUE_PATTERN = Pattern
+ .compile("^\\s*([^\\s=]+)\\s*[=:]\\s*(.+)\\s*$");
+
+ private Map parseParams(String paramStr, String separator)
+ {
+ Map<String,String> paramMap = new HashMap<String, String>();
+ parseParams(paramStr, separator, paramMap);
+ return paramMap;
+ }
+
+ private void parseParams(String paramStr, String separator, Map paramMap)
+ {
+ String[] parts = paramStr.split("[" + separator + "]");
+
+ for (String part : parts)
+ {
+ Matcher m = PARAM_VALUE_PATTERN.matcher(part);
+ if (m.matches())
+ {
+ String key = m.group(1);
+ String value = m.group(2);
+
+ // Strip double quotes
+ if (value.startsWith("\"") && value.endsWith("\""))
+ value = value.substring(1, value.length() - 1);
+
+ paramMap.put(key, value);
+ }
+ }
+ }
+
+ private Param getParam(String name)
+ {
+ if (parameters == null)
+ parseRequest();
+ return parameters.get(name);
+ }
+
+ @Override
+ public Enumeration getParameterNames()
+ {
+ if (parameters == null)
+ parseRequest();
+
+ return Collections.enumeration(parameters.keySet());
+ }
+
+ public byte[] getFileBytes(String name)
+ {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ?
+ ((FileParam) p).getData() : null;
+ }
+
+ public InputStream getFileInputStream(String name)
+ {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ?
+ ((FileParam) p).getInputStream() : null;
+ }
+
+ public String getFileContentType(String name)
+ {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ?
+ ((FileParam) p).getContentType() : null;
+ }
+
+ public String getFileName(String name)
+ {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ?
+ ((FileParam) p).getFilename() : null;
+ }
+
+ public int getFileSize(String name)
+ {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ?
+ ((FileParam) p).getFileSize() : -1;
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ Param p = getParam(name);
+ if (p != null && p instanceof ValueParam)
+ {
+ ValueParam vp = (ValueParam) p;
+ if (vp.getValue() instanceof String) return (String) vp.getValue();
+ }
+ else if (p != null && p instanceof FileParam)
+ {
+ return "---BINARY DATA---";
+ }
+ else
+ {
+ return super.getParameter(name);
+ }
+
+ return null;
+ }
+
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ Param p = getParam(name);
+ if (p != null && p instanceof ValueParam)
+ {
+ ValueParam vp = (ValueParam) p;
+ if (vp.getValue() instanceof List)
+ {
+ List vals = (List) vp.getValue();
+ String[] values = new String[vals.size()];
+ vals.toArray(values);
+ return values;
+ }
+ else
+ {
+ return new String[] {(String) vp.getValue()};
+ }
+ }
+ else
+ {
+ return super.getParameterValues(name);
+ }
+ }
+
+ @Override
+ public Map getParameterMap()
+ {
+ if (parameters == null)
+ parseRequest();
+
+ Map<String,Object> params = new HashMap<String,Object>(super.getParameterMap());
+
+ for (String name : parameters.keySet())
+ {
+ Param p = parameters.get(name);
+ if (p instanceof ValueParam)
+ {
+ ValueParam vp = (ValueParam) p;
+ if (vp.getValue() instanceof String)
+ {
+ params.put(name, vp.getValue());
+ }
+ else if (vp.getValue() instanceof List)
+ {
+ params.put(name, getParameterValues(name));
+ }
+ }
+ }
+
+ return params;
+ }
+}
17 years, 1 month
JBoss Rich Faces SVN: r4360 - branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-29 13:05:20 -0500 (Thu, 29 Nov 2007)
New Revision: 4360
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/extend.js
Log:
extend.js fixed for new prototype
Modified: branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/extend.js
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/extend.js 2007-11-29 17:56:20 UTC (rev 4359)
+++ branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/extend.js 2007-11-29 18:05:20 UTC (rev 4360)
@@ -174,7 +174,7 @@
}
Class._create = Class.create
Class.create = function( declaration ) {
- var new_class = Extend.setupClass(Class._create(declaration), declaration)
+ var new_class = Extend.setupClass(declaration ? Class._create(declaration) : Class._create(), declaration)
// The following only works on FireFox
/*
new_class.watch("prototype", function(id,oldval,newval) {
17 years, 1 month