JBoss Rich Faces SVN: r6918 - trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-03-18 12:25:12 -0400 (Tue, 18 Mar 2008)
New Revision: 6918
Removed:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java
Log:
Deleted: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java 2008-03-18 16:19:33 UTC (rev 6917)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/dataTableScroller/SortingBean.java 2008-03-18 16:25:12 UTC (rev 6918)
@@ -1,189 +0,0 @@
-/**
- *
- */
-package org.richfaces.demo.dataTableScroller;
-
-import java.util.ArrayList;
-
-import javax.faces.model.SelectItem;
-
-/**
- * @author Ilya Shaikovsky
- *
- */
-public class SortingBean {
- SelectItem[] sortByItems = new SelectItem[5];
- SelectItem[] sortDirectionItems = new SelectItem[3];
- private int firstSortOption=0;
- private int secondSortOption=0;
- private int thirdSortOption=0;
- private int fourthSortOption=0;
- private boolean modelSorted;
- private boolean makeSorted;
- private boolean priceSorted;
- private boolean mileageSorted;
- private String modelDirection = "UNSORTED";
- private String makeDirection = "UNSORTED";
- private String priceDirection = "UNSORTED";
- private String mileageDirection = "UNSORTED";
- ArrayList<String> prioritList = new ArrayList<String>();
-
- public SortingBean() {
- sortByItems[0] = new SelectItem(0,"None");
- sortByItems[1] = new SelectItem(1,"Model");
- sortByItems[2] = new SelectItem(2,"Price");
- sortByItems[3] = new SelectItem(3,"Make");
- sortByItems[4] = new SelectItem(4,"Mileage");
-
- sortDirectionItems[0] = new SelectItem("None");
- sortDirectionItems[1] = new SelectItem("Asc");
- sortDirectionItems[2] = new SelectItem("Desc");
- }
-
- public void checkSort(int value){
- switch (value) {
- case 1:
- prioritList.add("model");
- setModelDirection("ASCENDING");
- setModelSorted(true);
- break;
- case 2:
- prioritList.add("price");
- setPriceDirection("ASCENDING");
- setPriceSorted(true);
- break;
- case 3:
- prioritList.add("make");
- setMakeDirection("ASCENDING");
- setMakeSorted(true);
- break;
- case 4:
- prioritList.add("mileage");
- setMileageDirection("ASCENDING");
- setMileageSorted(true);
- break;
- }
-
- }
-
- public String changeSorting() {
- prioritList.clear();
- setModelSorted(false); setModelDirection("UNSORTED");
- setMakeSorted(false); setMakeDirection("UNSORTED");
- setPriceSorted(false); setPriceDirection("UNSORTED");
- setMileageSorted(false);setMileageDirection("UNSORTED");
- checkSort(firstSortOption);
- checkSort(secondSortOption);
- checkSort(thirdSortOption);
- checkSort(fourthSortOption);
- return null;
- }
-
- public SelectItem[] getSortByItems() {
- return sortByItems;
- }
-
- public SelectItem[] getSortDirectionItems() {
- return sortDirectionItems;
- }
-
- public boolean isModelSorted() {
- return modelSorted;
- }
-
- public void setModelSorted(boolean modelSorted) {
- this.modelSorted = modelSorted;
- }
-
- public boolean isMakeSorted() {
- return makeSorted;
- }
-
- public void setMakeSorted(boolean makeSorted) {
- this.makeSorted = makeSorted;
- }
-
- public boolean isPriceSorted() {
- return priceSorted;
- }
-
- public void setPriceSorted(boolean priceSorted) {
- this.priceSorted = priceSorted;
- }
-
- public boolean isMileageSorted() {
- return mileageSorted;
- }
-
- public void setMileageSorted(boolean mileageSorted) {
- this.mileageSorted = mileageSorted;
- }
-
- public ArrayList<String> getPrioritList() {
- return prioritList;
- }
-
- public String getModelDirection() {
- return modelDirection;
- }
-
- public void setModelDirection(String modelDirection) {
- this.modelDirection = modelDirection;
- }
-
- public String getMakeDirection() {
- return makeDirection;
- }
-
- public void setMakeDirection(String makeDirection) {
- this.makeDirection = makeDirection;
- }
-
- public String getPriceDirection() {
- return priceDirection;
- }
-
- public void setPriceDirection(String priceDirection) {
- this.priceDirection = priceDirection;
- }
-
- public String getMileageDirection() {
- return mileageDirection;
- }
-
- public void setMileageDirection(String mileageDirection) {
- this.mileageDirection = mileageDirection;
- }
-
- public int getFirstSortOption() {
- return firstSortOption;
- }
-
- public void setFirstSortOption(int firstSortOption) {
- this.firstSortOption = firstSortOption;
- }
-
- public int getSecondSortOption() {
- return secondSortOption;
- }
-
- public void setSecondSortOption(int secondSortOption) {
- this.secondSortOption = secondSortOption;
- }
-
- public int getThirdSortOption() {
- return thirdSortOption;
- }
-
- public void setThirdSortOption(int thirdSortOption) {
- this.thirdSortOption = thirdSortOption;
- }
-
- public int getFourthSortOption() {
- return fourthSortOption;
- }
-
- public void setFourthSortOption(int fourthSortOption) {
- this.fourthSortOption = fourthSortOption;
- }
-}
16 years, 10 months
JBoss Rich Faces SVN: r6917 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: vsukhov
Date: 2008-03-18 12:19:33 -0400 (Tue, 18 Mar 2008)
New Revision: 6917
Modified:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
Log:
http://jira.jboss.com/jira/browse/RF-1216 changed Skin Parameters Redefinition, Style Classes sections
Modified: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-03-18 16:19:07 UTC (rev 6916)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-03-18 16:19:33 UTC (rev 6917)
@@ -300,11 +300,11 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
+ <entry>tableBackgroundColor</entry>
<entry>background</entry>
</row>
<row>
- <entry>buttonBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-color</entry>
</row>
@@ -312,7 +312,7 @@
</tgroup>
</table>
<table>
- <title>Skin parameters redefinition for a button background, button background in pressed and disable state</title>
+ <title>Skin parameters redefinition for a button background, inactive button background, button background in pressed and disabled state</title>
<tgroup cols="2">
<thead>
<row>
@@ -322,12 +322,35 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
+ <entry>tabBackgroundColor</entry>
<entry>background-color</entry>
</row>
</tbody>
</tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for a button</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-top-color</entry>
+ </row>
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-left-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
</table>
<table>
<title>Skin parameters redefinition for an inactive button</title>
@@ -341,11 +364,11 @@
<tbody>
<row>
- <entry>buttonBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-top-color</entry>
</row>
<row>
- <entry>buttonBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-left-color</entry>
</row>
@@ -364,11 +387,11 @@
<tbody>
<row>
- <entry>buttonBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-top-color</entry>
</row>
<row>
- <entry>buttonBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-left-color</entry>
</row>
@@ -387,7 +410,7 @@
<tbody>
<row>
- <entry>buttonBorderColor</entry>
+ <entry>selectControlColor</entry>
<entry>border-color</entry>
</row>
@@ -406,15 +429,15 @@
</thead>
<tbody>
<row>
- <entry>itemSizeFont</entry>
+ <entry>generalSizeFont</entry>
<entry>font-size</entry>
</row>
<row>
- <entry>itemFamilyFont</entry>
+ <entry>generalFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>itemTextColor</entry>
+ <entry>generalTextColor</entry>
<entry>color</entry>
</row>
</tbody>
@@ -431,15 +454,15 @@
</thead>
<tbody>
<row>
- <entry>itemSizeFont</entry>
+ <entry>generalSizeFont</entry>
<entry>font-size</entry>
</row>
<row>
- <entry>itemFamilyFont</entry>
+ <entry>generalFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>itemTextColor</entry>
+ <entry>generalTextColor</entry>
<entry>color</entry>
</row>
</tbody>
@@ -456,11 +479,11 @@
</thead>
<tbody>
<row>
- <entry>itemSizeFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-size</entry>
</row>
<row>
- <entry>itemFamilyFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-family</entry>
</row>
@@ -478,15 +501,15 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
+ <entry>controlBackgroundColor</entry>
<entry>background-color</entry>
</row>
<row>
- <entry>inputFieldBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-bottom-color</entry>
</row>
<row>
- <entry>inputFieldBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-right-color</entry>
</row>
@@ -504,15 +527,15 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
+ <entry>controlBackgroundColor</entry>
<entry>background-color</entry>
</row>
<row>
- <entry>inputFieldBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-bottom-color</entry>
</row>
<row>
- <entry>inputFieldBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-right-color</entry>
</row>
@@ -530,15 +553,15 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
+ <entry>controlBackgroundColor</entry>
<entry>background-color</entry>
</row>
<row>
- <entry>inputFieldBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-bottom-color</entry>
</row>
<row>
- <entry>inputFieldBorderColor</entry>
+ <entry>panelBorderColor</entry>
<entry>border-right-color</entry>
</row>
@@ -556,15 +579,15 @@
</thead>
<tbody>
<row>
- <entry>itemSizeFont</entry>
+ <entry>generalSizeFont</entry>
<entry>font-size</entry>
</row>
<row>
- <entry>itemFamilyFont</entry>
+ <entry>generalFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>itemTextColor</entry>
+ <entry>generalTextColor</entry>
<entry>color</entry>
</row>
@@ -582,15 +605,15 @@
</thead>
<tbody>
<row>
- <entry>itemSizeFont</entry>
- <entry>font-size</entry>
+ <entry>headerBackgroundColor</entry>
+ <entry>background-color</entry>
</row>
<row>
- <entry>itemFamilyFont</entry>
- <entry>font-family</entry>
+ <entry>headerBackgroundColor</entry>
+ <entry>border-color</entry>
</row>
<row>
- <entry>itemTextColor</entry>
+ <entry>generalTextColor</entry>
<entry>color</entry>
</row>
@@ -641,8 +664,11 @@
</row>
</thead>
<tbody>
-
<row>
+ <entry>rich-combobox-button</entry>
+ <entry>Defines styles for a button</entry>
+ </row>
+ <row>
<entry>rich-combobox-button-inactive</entry>
<entry>Defines styles for an inactive button</entry>
</row>
@@ -659,6 +685,10 @@
<entry>Defines styles for a button background</entry>
</row>
<row>
+ <entry>rich-combobox-button-background-disabled</entry>
+ <entry>Defines styles for a disabled button background</entry>
+ </row>
+ <row>
<entry>rich-combobox-button-background-inactive</entry>
<entry>Defines styles for an inactive button background</entry>
</row>
16 years, 10 months
JBoss Rich Faces SVN: r6916 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: vsukhov
Date: 2008-03-18 12:19:07 -0400 (Tue, 18 Mar 2008)
New Revision: 6916
Modified:
trunk/docs/userguide/en/src/main/docbook/included/pickList.xml
Log:
http://jira.jboss.com/jira/browse/RF-2174 changed Skin Parameters Redefinition, Style Classes sections
Modified: trunk/docs/userguide/en/src/main/docbook/included/pickList.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/pickList.xml 2008-03-18 16:01:59 UTC (rev 6915)
+++ trunk/docs/userguide/en/src/main/docbook/included/pickList.xml 2008-03-18 16:19:07 UTC (rev 6916)
@@ -330,7 +330,7 @@
</thead>
<tbody>
<row>
- <entry>generalBackgroundColor</entry>
+ <entry>tableBackgroundColor</entry>
<entry>background-color</entry>
</row>
@@ -349,7 +349,7 @@
</thead>
<tbody>
<row>
- <entry>trimColor</entry>
+ <entry>tabBackgroundColorr</entry>
<entry>background-color</entry>
</row>
<row>
@@ -357,11 +357,11 @@
<entry>color</entry>
</row>
<row>
- <entry>generalFamilyFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>generalSizeFont</entry>
+ <entry>headerSizeFont</entry>
<entry>font-size</entry>
</row>
@@ -379,19 +379,19 @@
</thead>
<tbody>
<row>
- <entry>trimColor</entry>
+ <entry>tabBackgroundColor</entry>
<entry>background-color</entry>
</row>
<row>
- <entry>generalTextColor</entry>
+ <entry>tabDisabledTextColor</entry>
<entry>color</entry>
</row>
<row>
- <entry>generalFamilyFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>generalSizeFont</entry>
+ <entry>headerSizeFont</entry>
<entry>font-size</entry>
</row>
@@ -410,7 +410,7 @@
</thead>
<tbody>
<row>
- <entry>trimColor</entry>
+ <entry>tabBackgroundColor</entry>
<entry>background-color</entry>
</row>
<row>
@@ -418,11 +418,11 @@
<entry>color</entry>
</row>
<row>
- <entry>generalFamilyFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>generalSizeFont</entry>
+ <entry>headerSizeFont</entry>
<entry>font-size</entry>
</row>
<row>
@@ -448,7 +448,7 @@
</thead>
<tbody>
<row>
- <entry>trimColor</entry>
+ <entry>tabBackgroundColor</entry>
<entry>background-color</entry>
</row>
<row>
@@ -456,15 +456,15 @@
<entry>color</entry>
</row>
<row>
- <entry>generalFamilyFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>generalSizeFont</entry>
+ <entry>headerSizeFon</entry>
<entry>font-size</entry>
</row>
<row>
- <entry>tableBorderColor</entry>
+ <entry>selectControlColor</entry>
<entry>border-color</entry>
</row>
<row>
@@ -487,7 +487,7 @@
</thead>
<tbody>
<row>
- <entry>generalTextColor</entry>
+ <entry>generalTextColor</entry>
<entry>color</entry>
</row>
@@ -506,11 +506,11 @@
</thead>
<tbody>
<row>
- <entry>generalFamilyFont</entry>
+ <entry>headerFamilyFont</entry>
<entry>font-family</entry>
</row>
<row>
- <entry>generalSizeFont</entry>
+ <entry>headerSizeFont</entry>
<entry>font-size</entry>
</row>
@@ -571,9 +571,8 @@
</tbody>
</tgroup>
</table>
-
<table>
- <title>Skin parameters redefinition for a controls</title>
+ <title>Skin parameters redefinition for a selected source and target cell</title>
<tgroup cols="2">
<thead>
<row>
@@ -583,22 +582,90 @@
</thead>
<tbody>
<row>
- <entry>tableBorderColor</entry>
- <entry>border-color</entry>
+ <entry>generalTextColor</entry>
+ <entry>color</entry>
</row>
<row>
- <entry>tableBottomBorderColor</entry>
- <entry>border-bottom-color</entry>
+ <entry>generalSizeFont</entry>
+ <entry>font-size</entry>
</row>
<row>
- <entry>tableTopBorderColor</entry>
+ <entry>generalFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for an active source and target cell</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>generalSizeFont</entry>
+ <entry>font-size</entry>
+ </row>
+ <row>
+ <entry>generalFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+ <row>
+ <entry>generalTextColor</entry>
<entry>border-top-color</entry>
</row>
+ <row>
+ <entry>generalTextColor</entry>
+ <entry>border-bottom-color</entry>
+ </row>
</tbody>
</tgroup>
</table>
+ <table>
+ <title>Skin parameters redefinition for a selected source and target row</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>additionalBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+ <table>
+ <title>Skin parameters redefinition for a controls</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>tableBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+
+ </tbody>
+ </tgroup>
+ </table>
+
</section>
@@ -633,10 +700,7 @@
<entry>rich-picklist-list</entry>
<entry>Defines styles for a wrapper <table> element of a pickList</entry>
</row>
- <row>
- <entry>rich-list-picklist</entry>
- <entry>Defines styles for a wrapper <table> element of a pickList</entry>
- </row>
+
</tbody>
</tgroup>
</table>
@@ -659,29 +723,7 @@
<entry>rich-list-picklist-button-disabled</entry>
<entry>Defines styles for a disabled button</entry>
</row>
- </tbody>
- </tgroup>
- </table>
-
- <table >
- <title>Classes names that define pressed button representation</title>
- <tgroup cols="2">
- <thead>
<row>
- <entry>Class name</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>rich-list-picklist-button</entry>
- <entry>Defines styles for a button</entry>
- </row>
- <row>
- <entry>rich-list-picklist-button-disabled</entry>
- <entry>Defines styles for a disabled button</entry>
- </row>
- <row>
<entry>rich-list-picklist-button-press</entry>
<entry>Defines styles for a pressed button</entry>
</row>
@@ -689,41 +731,21 @@
<entry>rich-list-picklist-button-light</entry>
<entry>Defines styles for a button highlight</entry>
</row>
- </tbody>
- </tgroup>
- </table>
- <table >
- <title>Classes names that define highlighted button representation</title>
- <tgroup cols="2">
- <thead>
<row>
- <entry>Class name</entry>
- <entry>Description</entry>
+ <entry>rich-list-picklist-button-selection</entry>
+ <entry>Defines styles for a button selection</entry>
</row>
- </thead>
- <tbody>
<row>
- <entry>rich-list-picklist-button</entry>
- <entry>Defines styles for a button</entry>
+ <entry>rich-list-picklist-button-content</entry>
+ <entry>Defines styles for a button content</entry>
</row>
- <row>
- <entry>rich-list-picklist-button-disabled</entry>
- <entry>Defines styles for a disabled button</entry>
- </row>
- <row>
- <entry>rich-list-picklist-button-press</entry>
- <entry>Defines styles for a pressed button</entry>
- </row>
- <row>
- <entry>rich-list-picklist-button-light</entry>
- <entry>Defines styles for a button highlight</entry>
- </row>
</tbody>
</tgroup>
</table>
-
+
+
<table >
- <title>Classes names that define a button selection representation</title>
+ <title>Classes names that define a source and target items representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -733,15 +755,20 @@
</thead>
<tbody>
<row>
- <entry>rich-list-picklist-button-selection</entry>
- <entry>Defines styles for a button selection</entry>
+ <entry>rich-picklist-source-items</entry>
+ <entry>Defines styles for an item in a source list</entry>
</row>
+ <row>
+ <entry>rich-picklist-target-items</entry>
+ <entry>Defines styles for an item in a target list</entry>
+ </row>
+
</tbody>
</tgroup>
</table>
<table >
- <title>Classes names that define a button content representation</title>
+ <title>Classes names that define a source cell representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -750,17 +777,24 @@
</row>
</thead>
<tbody>
- <row>
- <entry>rich-list-picklist-button-content</entry>
- <entry>Defines styles for a button content</entry>
+ <row>
+ <entry>rich-picklist-source-cell</entry>
+ <entry>Defines styles for a cell in a source list</entry>
</row>
-
+ <row>
+ <entry>rich-picklist-source-cell-selected</entry>
+ <entry>Defines styles for a selected cell in a source list</entry>
+ </row>
+ <row>
+ <entry>rich-picklist-source-cell-active</entry>
+ <entry>Defines styles for an active cell in a source list</entry>
+ </row>
</tbody>
</tgroup>
</table>
<table >
- <title>Classes names that define a source and target items representation</title>
+ <title>Classes names that define a target cell representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -770,20 +804,22 @@
</thead>
<tbody>
<row>
- <entry>rich-picklist-source-items</entry>
- <entry>Defines styles for an item in a source list</entry>
+ <entry>rich-picklist-target-cel</entry>
+ <entry>Defines styles for a cell in a source list</entry>
</row>
<row>
- <entry>rich-picklist-target-items</entry>
- <entry>Defines styles for an item in a target list</entry>
+ <entry>rich-picklist-target-cell-selected</entry>
+ <entry>Defines styles for a selected cell in a target list</entry>
</row>
-
+ <row>
+ <entry>rich-picklist-target-cell-active</entry>
+ <entry>Defines styles for an active cell in a target list</entry>
+ </row>
</tbody>
</tgroup>
</table>
-
<table >
- <title>Classes names that define a source and target cell representation</title>
+ <title>Classes names that define a selected source and target rows representation</title>
<tgroup cols="2">
<thead>
<row>
@@ -793,19 +829,17 @@
</thead>
<tbody>
<row>
- <entry>rich-picklist-source-cell</entry>
- <entry>Defines styles for a cell in a source list</entry>
+ <entry>rich-picklist-source-row-selected</entry>
+ <entry>Defines styles for a selected row in a source list</entry>
</row>
<row>
- <entry>rich-picklist-target-cell</entry>
- <entry>Defines styles for a cell in a target list</entry>
+ <entry>rich-picklist-target-row-selected</entry>
+ <entry>Defines styles for a selected row in a target list</entry>
</row>
+
</tbody>
</tgroup>
</table>
-
-
-
<table >
<title>Classes names that define a control representation</title>
<tgroup cols="2">
@@ -840,7 +874,7 @@
</tbody>
</tgroup>
</table>
-
+
<para>In order to redefine styles for all <emphasis role="bold">
<property><rich:pickList></property>
</emphasis> components on a page using CSS, it's enough to create classes with the
16 years, 10 months
JBoss Rich Faces SVN: r6915 - trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-03-18 12:01:59 -0400 (Tue, 18 Mar 2008)
New Revision: 6915
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
RF-2038
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-03-18 15:51:27 UTC (rev 6914)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-03-18 16:01:59 UTC (rev 6915)
@@ -493,43 +493,30 @@
}
else if(options.switchType === 1 || options.switchType === 2) {
// store visible row pos to restore after rows reerrange
- var count = frozenTbl.rows.length;
- var frows = new Array(count), nrows = new Array(count);
+ var ncount = normalTbl.rows.length;
+ var fcount = frozenTbl.rows.length;
+ var frows = new Array(fcount), nrows = new Array(ncount);
var j = 0, i;
var index = options.index;
-
- if(options.switchType === 1) {
- for(i=options.count; i<this.rowsCount; i++) {
+ var count = options.count;
+ if(options.switchType === 2) {
+ count = this.rowsCount - count;
+ }
+ for(i=count; i<this.rowsCount; i++) {
+ if (fcount) {
frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- j++;
}
- for(i=0; i<options.count; i++) {
- frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- /*if(updateCash) {
- cash.setRow(index+i, {f: frows[j].innerHTML, n: nrows[j].innerHTML});
- }*/
- j++;
- }
+ nrows[j] = normalTbl.rows[i];
+ j++;
}
- else {
- for(i=this.rowsCount - options.count; i<this.rowsCount; i++) {
+ for(i=0; i<count; i++) {
+ if (fcount) {
frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- /*if(updateCash) {
- cash.setRow(index+j, {f: frows[j].innerHTML, n: nrows[j].innerHTML});
- }*/
- j++;
}
- for(i=0; i<this.rowsCount - options.count; i++) {
- frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- j++;
- }
+ nrows[j] = normalTbl.rows[i];
+ j++;
}
-
// Mozilla is faster when doing the DOM manipulations on
// an orphaned element. MSIE is not
var removeChilds = navigator.product == "Gecko";
@@ -546,8 +533,10 @@
}
// insert in the new order
- for (i = 0; i < count; i++) {
- fbody.appendChild(frows[i]);
+ for (i = 0; i < ncount; i++) {
+ if (fcount) {
+ fbody.appendChild(frows[i]);
+ }
nbody.appendChild(nrows[i]);
}
16 years, 10 months
JBoss Rich Faces SVN: r6914 - trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-03-18 11:51:27 -0400 (Tue, 18 Mar 2008)
New Revision: 6914
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
RF-2202
Modified: trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-03-18 15:48:28 UTC (rev 6913)
+++ trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-03-18 15:51:27 UTC (rev 6914)
@@ -855,6 +855,9 @@
isWithin : function(event){
var within = true;
var targetElement = event.relatedTarget;
+
+ while (targetElement.nodeType!=1) targetElement = targetElement.parentNode;
+
var srcElement = event.target;
var layer = $(this.id);
if (targetElement) {
@@ -1186,8 +1189,9 @@
var within = false;
Event.extend(event);
var targetElement = event.relatedTarget;
- var srcElement = Event.element(event);
-
+
+ while (targetElement.nodeType!=1) targetElement = targetElement.parentNode;
+
if (targetElement) {
within = targetElement == element ||
$(targetElement).descendantOf(element);
16 years, 10 months
JBoss Rich Faces SVN: r6913 - trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-03-18 11:48:28 -0400 (Tue, 18 Mar 2008)
New Revision: 6913
Modified:
trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
Log:
bug: http://jira.jboss.com/jira/browse/RF-2097
Modified: trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
===================================================================
--- trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2008-03-18 15:47:28 UTC (rev 6912)
+++ trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2008-03-18 15:48:28 UTC (rev 6913)
@@ -120,7 +120,7 @@
onclickHandler : function(event, component) {
component._onclickHandler(event);
this.controlListManager();
- Event.stop(event);
+ //Event.stop(event); //bug: RF-2097
},
onkeydownHandler : function(event, component) {
16 years, 10 months
JBoss Rich Faces SVN: r6912 - trunk/ui/orderingList/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-03-18 11:47:28 -0400 (Tue, 18 Mar 2008)
New Revision: 6912
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
Log:
bug RF-2339
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2008-03-18 15:38:00 UTC (rev 6911)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2008-03-18 15:47:28 UTC (rev 6912)
@@ -369,7 +369,7 @@
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(),
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getDefaultText(),
null);
writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
helper.getImageURI()).getUri(context, null), null);
16 years, 10 months
JBoss Rich Faces SVN: r6911 - trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-03-18 11:38:00 -0400 (Tue, 18 Mar 2008)
New Revision: 6911
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
RF-2571
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-18 15:11:24 UTC (rev 6910)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-18 15:38:00 UTC (rev 6911)
@@ -445,8 +445,9 @@
public Object getAcceptedTypes(FacesContext context, UIComponent component) {
String acceptedTypes = (String) component.getAttributes().get(
"acceptedTypes");
- if (acceptedTypes != null) {
+ if (acceptedTypes != null && acceptedTypes.length() > 0) {
Map<String, Boolean> accepted = new HashMap<String, Boolean>();
+ acceptedTypes = acceptedTypes.replaceAll("[\\s]", "");
String[] types = acceptedTypes.split("[,;|]");
if (types != null) {
for (String type : types) {
16 years, 10 months
JBoss Rich Faces SVN: r6910 - in trunk/ui/fileUpload/src/main: resources/org/richfaces/renderkit/html/js and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-03-18 11:11:24 -0400 (Tue, 18 Mar 2008)
New Revision: 6910
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
Log:
RF-2507
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-18 15:11:16 UTC (rev 6909)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-18 15:11:24 UTC (rev 6910)
@@ -3,6 +3,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.MissingResourceException;
@@ -48,581 +49,624 @@
*
*/
public abstract class FileUploadRendererBase extends
- TemplateEncoderRendererBase {
+ TemplateEncoderRendererBase {
- /** Attribute name where collection of files uploaded will be stored */
- private static final String _FILES_UPLOADED_ATTRIBUTE_NAME = "uploadData";
+ /** Attribute name where collection of files uploaded will be stored */
+ private static final String _FILES_UPLOADED_ATTRIBUTE_NAME = "uploadData";
- /** Multipart request class name */
- private static final String _MULTIPART_REQUEST_CLASS_NAME = MultipartRequest.class
- .getName();
+ /** Multipart request class name */
+ private static final String _MULTIPART_REQUEST_CLASS_NAME = MultipartRequest.class
+ .getName();
- /** File upload bundle name */
- private static final String FILE_UPLOAD_BUNDLE = "org.richfaces.renderkit.fileUpload";
+ /** File upload bundle name */
+ private static final String FILE_UPLOAD_BUNDLE = "org.richfaces.renderkit.fileUpload";
- /** Bundle prefix */
- private static final String bundlePrefix = "RICH_FILE_UPLOAD_";
+ /** Bundle prefix */
+ private static final String bundlePrefix = "RICH_FILE_UPLOAD_";
- /** Bundle postfix */
- private static final String bundlePostfix = "_LABEL";
+ /** Bundle postfix */
+ private static final String bundlePostfix = "_LABEL";
- /** Set of bundles that can be defined */
- private static final String[] bundlesLables = { "add", "upload", "stop",
- "clear_all", "entry_cancel", "entry_clear", "entry_stop", "done",
- "size_error", "transfer_error" };
+ /** Set of bundles that can be defined */
+ private static final String[] bundlesLables = { "add", "upload", "stop",
+ "clear_all", "entry_cancel", "entry_clear", "entry_stop", "done",
+ "size_error", "transfer_error" };
- /** Default labels values */
- private static final String[] defaultLables = { "Add...", "<b>Upload</b>",
- "<b>Stop</b>", "Clear All", "Cancel", "Clear", "Stop",
- "<b>Done</b>", "File size restricted", "Transfer error occuried" };
+ /** Default labels values */
+ private static final String[] defaultLables = { "Add...", "<b>Upload</b>",
+ "<b>Stop</b>", "Clear All", "Cancel", "Clear", "Stop",
+ "<b>Done</b>", "File size restricted", "Transfer error occuried" };
- /** Set of attributes that can define label's value */
- private static final String[] labelAttribues = { "addControlLabel",
- "uploadControlLabel", "stopControlLabel", "clearAllControlLabel",
- "cancelEntryControlLabel", "clearControlLabel",
- "stopEntryControlLabel", null, null, null };
+ /** Set of attributes that can define label's value */
+ private static final String[] labelAttribues = { "addControlLabel",
+ "uploadControlLabel", "stopControlLabel", "clearAllControlLabel",
+ "cancelEntryControlLabel", "clearControlLabel",
+ "stopEntryControlLabel", null, null, null };
- /**
- * Overrides standard JSF component method.
- *
- * @param context
- * faces context
- * @param component
- * file upload component
- */
- @Override
- @SuppressWarnings("unchecked")
- protected void doDecode(FacesContext context, UIComponent component) {
- UIFileUpload fileUpload = (UIFileUpload) component;
- ServletRequest request = (ServletRequest) context.getExternalContext()
- .getRequest();
+ /**
+ * Overrides standard JSF component method.
+ *
+ * @param context
+ * faces context
+ * @param component
+ * file upload component
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void doDecode(FacesContext context, UIComponent component) {
+ UIFileUpload fileUpload = (UIFileUpload) component;
+ ServletRequest request = (ServletRequest) context.getExternalContext()
+ .getRequest();
- String clientId = component.getClientId(context);
+ String clientId = component.getClientId(context);
- new AjaxEvent(component).queue();
+ new AjaxEvent(component).queue();
- Class requestClazz = request.getClass();
+ Class requestClazz = request.getClass();
- if (_MULTIPART_REQUEST_CLASS_NAME.equals(requestClazz.getName())
- || "org.jboss.seam.web.MultipartRequest".equals(requestClazz
- .getName())) {
+ if (_MULTIPART_REQUEST_CLASS_NAME.equals(requestClazz.getName())
+ || "org.jboss.seam.web.MultipartRequest".equals(requestClazz
+ .getName())) {
- HttpSession session = (HttpSession) context.getExternalContext()
- .getSession(false);
- String uid = request.getParameter(Filter.UPLOAD_FILES_ID);
- Map<String, MultipartRequest> map = (Map<String, MultipartRequest>) session
- .getAttribute(Filter.REQUESTS_SESSIONS_BEAN_NAME);
+ HttpSession session = (HttpSession) context.getExternalContext()
+ .getSession(false);
+ String uid = request.getParameter(Filter.UPLOAD_FILES_ID);
+ String id = request.getParameter("id");
+ decreaseFileCounter(session, id);
+ Map<String, MultipartRequest> map = (Map<String, MultipartRequest>) session
+ .getAttribute(Filter.REQUESTS_SESSIONS_BEAN_NAME);
- MultipartRequest multipartRequest = map.get(uid);
+ MultipartRequest multipartRequest = map.get(uid);
- clientId = clientId + ":file";
- String fileName = multipartRequest.getFileName(clientId);
- Object file = multipartRequest.getFile(clientId);
- fileUpload.setLocalFileName(fileName);
- onUploadComplete(context, file, fileUpload);
+ clientId = clientId + ":file";
+ String fileName = multipartRequest.getFileName(clientId);
+ Object file = multipartRequest.getFile(clientId);
+ fileUpload.setLocalFileName(fileName);
+ onUploadComplete(context, file, fileUpload);
+ }
+
}
- }
-
- /**
- * Gets form id
- * @param context - faces context
- * @param component - component
- * @return String form id
- */
- public String getFormId(FacesContext context, UIComponent component) {
- UIComponent form = AjaxRendererUtils.getNestingForm(component);
- if (form != null) {
- return form.getClientId(context);
+ /**
+ * Put max file count into session scope
+ *
+ * @param context
+ * @param component
+ * @param clientId
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public Integer initMaxFilesCount(FacesContext context,
+ UIComponent component, String clientId) {
+ Integer max = (Integer) component.getAttributes().get(
+ "maxFilesQuantity");
+ HttpSession session = (HttpSession) context.getExternalContext()
+ .getSession(false);
+ synchronized (session) {
+ Map<String, Integer> map = (Map<String, Integer>) session
+ .getAttribute(Filter.UPLOADED_COUNTER);
+ if (map == null) {
+ map = Collections
+ .synchronizedMap(new HashMap<String, Integer>());
+ }
+ map.put(clientId, max);
+ }
+ return max;
}
- return "";
- }
-
-
- /**
- * Gets container id
- * @param context - faces context
- * @param component - component
- * @return String container id
- */
- public String getContainerId(FacesContext context, UIComponent component) {
- UIComponent container = (UIComponent)AjaxRendererUtils.findAjaxContainer(context, component);
- if (container != null) {
- return container.getClientId(context);
+
+ /**
+ * Gets form id
+ *
+ * @param context -
+ * faces context
+ * @param component -
+ * component
+ * @return String form id
+ */
+ public String getFormId(FacesContext context, UIComponent component) {
+ UIComponent form = AjaxRendererUtils.getNestingForm(component);
+ if (form != null) {
+ return form.getClientId(context);
+ }
+ return "";
}
- return null;
- }
- /**
- * Generates map with internalized labels to be put into JS
- *
- * @param o
- * map of labels
- * @return javascript hash map
- */
- public Object _getLabels(Object o) {
- return ScriptUtils.toScript(o);
- }
-
- /**
- * Gets internalized labels. At the first system is looking for them in
- * appropriate attributes if they are defined. Next search place is
- * application and file upload bundles. If no result - default label value
- * will be set up.
- *
- * @param context
- * facesContext instance
- * @param component
- * UIComponent
- * @return map of labels
- */
- public Map<String, String> getLabels(FacesContext context,
- UIComponent component) {
- Map<String, String> labelsMap = new HashMap<String, String>();
- ResourceBundle bundle1 = null;
- ResourceBundle bundle2 = null;
- UIFileUpload fileUpload = (UIFileUpload) component;
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- String messageBundle = context.getApplication().getMessageBundle();
- Object locale = fileUpload.getLocale();
- if (locale == null) {
- HttpServletRequest request = (HttpServletRequest) context
- .getExternalContext().getRequest();
- locale = request.getLocale();
+ /**
+ * Gets container id
+ *
+ * @param context -
+ * faces context
+ * @param component -
+ * component
+ * @return String container id
+ */
+ public String getContainerId(FacesContext context, UIComponent component) {
+ UIComponent container = (UIComponent) AjaxRendererUtils
+ .findAjaxContainer(context, component);
+ if (container != null) {
+ return container.getClientId(context);
+ }
+ return null;
}
- if (null != messageBundle) {
- bundle1 = ResourceBundle.getBundle(messageBundle, fileUpload
- .getAsLocale(locale), loader);
- }
- try {
- bundle2 = ResourceBundle.getBundle(FILE_UPLOAD_BUNDLE, fileUpload
- .getAsLocale(locale), loader);
- } catch (MissingResourceException e) {
- // No external bundle was found, ignore this exception.
+ /**
+ * Generates map with internalized labels to be put into JS
+ *
+ * @param o
+ * map of labels
+ * @return javascript hash map
+ */
+ public Object _getLabels(Object o) {
+ return ScriptUtils.toScript(o);
}
- initLabels(labelsMap, bundle1, bundle2, fileUpload);
- return labelsMap;
- }
- /**
- * Sets values for labels.
- *
- * @param map
- * map of labels
- * @param bundle1
- * application bundle
- * @param bundle2
- * file upload bundle
- * @param fileUpload
- */
- private void initLabels(Map<String, String> map, ResourceBundle bundle1,
- ResourceBundle bundle2, UIFileUpload fileUpload) {
- int i = 0;
- for (String name : bundlesLables) {
- boolean found = false;
- if (labelAttribues[i] != null) {
- String attributeName = labelAttribues[i];
- if (fileUpload.getAttributes().get(attributeName) != null) {
- map.put(name, (String) fileUpload.getAttributes().get(
- attributeName));
- found = true;
+ /**
+ * Gets internalized labels. At the first system is looking for them in
+ * appropriate attributes if they are defined. Next search place is
+ * application and file upload bundles. If no result - default label value
+ * will be set up.
+ *
+ * @param context
+ * facesContext instance
+ * @param component
+ * UIComponent
+ * @return map of labels
+ */
+ public Map<String, String> getLabels(FacesContext context,
+ UIComponent component) {
+ Map<String, String> labelsMap = new HashMap<String, String>();
+ ResourceBundle bundle1 = null;
+ ResourceBundle bundle2 = null;
+ UIFileUpload fileUpload = (UIFileUpload) component;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String messageBundle = context.getApplication().getMessageBundle();
+ Object locale = fileUpload.getLocale();
+ if (locale == null) {
+ HttpServletRequest request = (HttpServletRequest) context
+ .getExternalContext().getRequest();
+ locale = request.getLocale();
}
- }
- if (!found && (bundle1 != null || bundle2 != null)) {
- String label = getFromBundle(name, bundle1, bundle2);
- if (label != null) {
- map.put(name, getFromBundle(name, bundle1, bundle2));
- found = true;
+ if (null != messageBundle) {
+ bundle1 = ResourceBundle.getBundle(messageBundle, fileUpload
+ .getAsLocale(locale), loader);
}
- }
- if (!found) {
- map.put(name, defaultLables[i]);
- }
- i++;
+ try {
+ bundle2 = ResourceBundle.getBundle(FILE_UPLOAD_BUNDLE, fileUpload
+ .getAsLocale(locale), loader);
+
+ } catch (MissingResourceException e) {
+ // No external bundle was found, ignore this exception.
+ }
+ initLabels(labelsMap, bundle1, bundle2, fileUpload);
+ return labelsMap;
}
- }
- /**
- * Looking for labels name in bundles provided.
- *
- * @param bundle1
- * application bundle
- * @param bundle2
- * file upload bundle
- * @return String label value
- */
- private String getFromBundle(String name, ResourceBundle bundle1,
- ResourceBundle bundle2) {
- name = bundlePrefix + name.toUpperCase() + bundlePostfix;
- String v = null;
- if (bundle1 != null) {
- try {
- v = bundle1.getString(name);
- } catch (Exception e) {
- if (bundle2 != null) {
- try {
- v = bundle2.getString(name);
- } catch (Exception ex) {
- // no value has been found
- }
+ /**
+ * Sets values for labels.
+ *
+ * @param map
+ * map of labels
+ * @param bundle1
+ * application bundle
+ * @param bundle2
+ * file upload bundle
+ * @param fileUpload
+ */
+ private void initLabels(Map<String, String> map, ResourceBundle bundle1,
+ ResourceBundle bundle2, UIFileUpload fileUpload) {
+ int i = 0;
+ for (String name : bundlesLables) {
+ boolean found = false;
+ if (labelAttribues[i] != null) {
+ String attributeName = labelAttribues[i];
+ if (fileUpload.getAttributes().get(attributeName) != null) {
+ map.put(name, (String) fileUpload.getAttributes().get(
+ attributeName));
+ found = true;
+ }
+ }
+ if (!found && (bundle1 != null || bundle2 != null)) {
+ String label = getFromBundle(name, bundle1, bundle2);
+ if (label != null) {
+ map.put(name, getFromBundle(name, bundle1, bundle2));
+ found = true;
+ }
+ }
+ if (!found) {
+ map.put(name, defaultLables[i]);
+ }
+ i++;
}
+ }
- }
+ /**
+ * Looking for labels name in bundles provided.
+ *
+ * @param bundle1
+ * application bundle
+ * @param bundle2
+ * file upload bundle
+ * @return String label value
+ */
+ private String getFromBundle(String name, ResourceBundle bundle1,
+ ResourceBundle bundle2) {
+ name = bundlePrefix + name.toUpperCase() + bundlePostfix;
+ String v = null;
+ if (bundle1 != null) {
+ try {
+ v = bundle1.getString(name);
+ } catch (Exception e) {
+ if (bundle2 != null) {
+ try {
+ v = bundle2.getString(name);
+ } catch (Exception ex) {
+ // no value has been found
+ }
+ }
- } else if (bundle2 != null) {
- try {
- v = bundle2.getString(name);
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- b.write(v.getBytes());
- b.toString("UTF-8");
- } catch (Exception e) {
- // no value has been found
- }
+ }
+
+ } else if (bundle2 != null) {
+ try {
+ v = bundle2.getString(name);
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ b.write(v.getBytes());
+ b.toString("UTF-8");
+ } catch (Exception e) {
+ // no value has been found
+ }
+ }
+ return v;
}
- return v;
- }
- /**
- * Method checks if uploaded files count overflowed
- *
- * @param fileUpload
- * @param map
- * @return
- */
- private boolean checkFileCount(UIFileUpload fileUpload,
- Collection filesUploaded) {
- Integer max = fileUpload.getMaxFilesQuantity();
- if (filesUploaded != null && filesUploaded.size() >= max) {
- fileUpload.reset();
- return false;
+ /**
+ * Method decrease file counter
+ *
+ * @param session
+ * @param id
+ */
+ @SuppressWarnings("unchecked")
+ private void decreaseFileCounter(HttpSession session, String id) {
+ Map<String, Integer> map = (Map<String, Integer>) session
+ .getAttribute(Filter.UPLOADED_COUNTER);
+ if (map != null) {
+ Integer i = map.get(id);
+ if (i == null) {
+ i = 0;
+ } else {
+ i--;
+ }
+ map.put(id, i);
+ }
}
- return true;
- }
- /**
- * Put uploaded file into data attribute defined
- *
- * @param context
- * @param fileUpload
- * @param file
- */
- @SuppressWarnings("unchecked")
- private void storeData(FacesContext context, UIFileUpload fileUpload,
- Object file) {
- ValueExpression data = fileUpload
- .getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
- UploadItem item = new UploadItem(fileUpload.getLocalFileName(), file);
- if (data != null) {
- if (data.getValue(context.getELContext()) instanceof Collection) {
- Collection collection = (Collection) data.getValue(context
- .getELContext());
- if (checkFileCount(fileUpload, collection)) {
- collection.add(item);
- } else {
- throw new FileUploadException("Files count overflow");
+ /**
+ * Put uploaded file into data attribute defined
+ *
+ * @param context
+ * @param fileUpload
+ * @param file
+ */
+ @SuppressWarnings("unchecked")
+ private void storeData(FacesContext context, UIFileUpload fileUpload,
+ Object file) {
+ ValueExpression data = fileUpload
+ .getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
+ UploadItem item = new UploadItem(fileUpload.getLocalFileName(), file);
+ if (data != null) {
+ if (data.getValue(context.getELContext()) instanceof Collection) {
+ Collection collection = (Collection) data.getValue(context
+ .getELContext());
+ collection.add(item);
+ }
}
- }
+ new UploadEvent(fileUpload, item).queue();
}
- new UploadEvent(fileUpload, item).queue();
- }
- /**
- * Call with method after uploading completed
- *
- * @param context
- * @param file
- * @param fileUpload
- */
- private void onUploadComplete(FacesContext context, Object file,
- UIFileUpload fileUpload) {
- storeData(context, fileUpload, file);
- try {
- AjaxContext ajaxContext = AjaxContextImpl
- .getCurrentInstance(context);
- ajaxContext.setAjaxRequest(true);
- } catch (Exception e) {
- e.getMessage();
+ /**
+ * Call with method after uploading completed
+ *
+ * @param context
+ * @param file
+ * @param fileUpload
+ */
+ private void onUploadComplete(FacesContext context, Object file,
+ UIFileUpload fileUpload) {
+ storeData(context, fileUpload, file);
+ try {
+ AjaxContext ajaxContext = AjaxContextImpl
+ .getCurrentInstance(context);
+ ajaxContext.setAjaxRequest(true);
+ } catch (Exception e) {
+ e.getMessage();
+ }
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- @Override
- protected Class<? extends UIComponent> getComponentClass() {
- return UIFileUpload.class;
- }
-
- /**
- * Generates common JS script by action value
- *
- * @param context
- * @param component
- * @param action
- * @param oncomplete
- * @return
- * @throws IOException
- */
- @SuppressWarnings("unchecked")
- private String getActionScript(FacesContext context, UIComponent component,
- String action, Object oncomplete) throws IOException {
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, component);
- String clientId = component.getClientId(context);
- String containerId = (String)variables.getVariable("containerId");
- JSFunction ajaxFunction = new JSFunction(AjaxRendererUtils.AJAX_FUNCTION_NAME);
- ajaxFunction.addParameter(containerId);
- ajaxFunction.addParameter(new JSReference("formId"));
- ajaxFunction.addParameter(new JSReference("event"));
-// AjaxRendererUtils.buildAjaxFunction(
-// component, context);
-
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
- Map parameters = (Map) options.get("parameters");
- parameters.put("action", action);
- parameters.put(Filter.UPLOAD_FILES_ID, new JSReference("uid"));
- parameters.put(clientId, clientId);
- if (oncomplete != null) {
- options.put("onbeforedomupdate", oncomplete);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIFileUpload.class;
}
- ajaxFunction.addParameter(options);
- JSFunctionDefinition function = new JSFunctionDefinition("uid");
- function.addParameter("formId");
- function.addParameter("event");
- function.addToBody(ajaxFunction.toScript());
+ /**
+ * Generates common JS script by action value
+ *
+ * @param context
+ * @param component
+ * @param action
+ * @param oncomplete
+ * @return
+ * @throws IOException
+ */
+ @SuppressWarnings("unchecked")
+ private String getActionScript(FacesContext context, UIComponent component,
+ String action, Object oncomplete) throws IOException {
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(
+ this, component);
+ String clientId = component.getClientId(context);
+ String containerId = (String) variables.getVariable("containerId");
+ JSFunction ajaxFunction = new JSFunction(
+ AjaxRendererUtils.AJAX_FUNCTION_NAME);
+ ajaxFunction.addParameter(containerId);
+ ajaxFunction.addParameter(new JSReference("formId"));
+ ajaxFunction.addParameter(new JSReference("event"));
+ // AjaxRendererUtils.buildAjaxFunction(
+ // component, context);
- return function.toScript();
- }
+ Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map parameters = (Map) options.get("parameters");
+ parameters.put("action", action);
+ parameters.put(Filter.UPLOAD_FILES_ID, new JSReference("uid"));
+ parameters.put(clientId, clientId);
+ if (oncomplete != null) {
+ options.put("onbeforedomupdate", oncomplete);
+ }
+ ajaxFunction.addParameter(options);
- /**
- * Return accepted types map
- *
- * @param context
- * @param component
- * @return
- */
- public Object getAcceptedTypes(FacesContext context, UIComponent component) {
- String acceptedTypes = (String) component.getAttributes().get(
- "acceptedTypes");
- if (acceptedTypes != null) {
- Map<String, Boolean> accepted = new HashMap<String, Boolean>();
- String[] types = acceptedTypes.split("[,;|]");
- if (types != null) {
- for (String type : types) {
- accepted.put(type.toLowerCase(), true);
+ JSFunctionDefinition function = new JSFunctionDefinition("uid");
+ function.addParameter("formId");
+ function.addParameter("event");
+ function.addToBody(ajaxFunction.toScript());
+
+ return function.toScript();
+ }
+
+ /**
+ * Return accepted types map
+ *
+ * @param context
+ * @param component
+ * @return
+ */
+ public Object getAcceptedTypes(FacesContext context, UIComponent component) {
+ String acceptedTypes = (String) component.getAttributes().get(
+ "acceptedTypes");
+ if (acceptedTypes != null) {
+ Map<String, Boolean> accepted = new HashMap<String, Boolean>();
+ String[] types = acceptedTypes.split("[,;|]");
+ if (types != null) {
+ for (String type : types) {
+ accepted.put(type.toLowerCase(), true);
+ }
+ return ScriptUtils.toScript(accepted);
+ }
}
- return ScriptUtils.toScript(accepted);
- }
+ return JSReference.NULL;
}
- return JSReference.NULL;
- }
- /**
- * Generates JS script for stopping uploading process
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getStopScript(FacesContext context, UIComponent component)
- throws IOException {
- return getActionScript(context, component, "stop", null);
- }
+ /**
+ * Generates JS script for stopping uploading process
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public String getStopScript(FacesContext context, UIComponent component)
+ throws IOException {
+ return getActionScript(context, component, "stop", null);
+ }
- /**
- * Generates JS script for getting file size from server
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getFileSizeScript(FacesContext context, UIComponent component)
- throws IOException {
- JSFunctionDefinition oncomplete = new JSFunctionDefinition();
- oncomplete.addParameter("request");
- oncomplete.addParameter("event");
- oncomplete.addParameter("data");
- StringBuffer body = new StringBuffer("$('");
- body.append(component.getClientId(context));
- body.append("').component.getFileSize(data);");
- oncomplete.addToBody(body);
- return getActionScript(context, component, "progress", oncomplete);
+ /**
+ * Generates JS script for getting file size from server
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public String getFileSizeScript(FacesContext context, UIComponent component)
+ throws IOException {
+ JSFunctionDefinition oncomplete = new JSFunctionDefinition();
+ oncomplete.addParameter("request");
+ oncomplete.addParameter("event");
+ oncomplete.addParameter("data");
+ StringBuffer body = new StringBuffer("$('");
+ body.append(component.getClientId(context));
+ body.append("').component.getFileSize(data);");
+ oncomplete.addToBody(body);
+ return getActionScript(context, component, "progress", oncomplete);
- }
+ }
- /**
- * Generates progress label markup
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public Object getLabelMarkup(FacesContext context, UIComponent component)
- throws IOException {
- CountingOutputWriter customWriter = new CountingOutputWriter();
- StringBuffer result = null;
- UIComponent label = component.getFacet("label");
- try {
- if (label != null) {
+ /**
+ * Generates progress label markup
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public Object getLabelMarkup(FacesContext context, UIComponent component)
+ throws IOException {
+ CountingOutputWriter customWriter = new CountingOutputWriter();
+ StringBuffer result = null;
+ UIComponent label = component.getFacet("label");
+ try {
+ if (label != null) {
- ResponseWriter writer = context.getResponseWriter();
+ ResponseWriter writer = context.getResponseWriter();
- String defaultRenderKitId = context.getApplication()
- .getDefaultRenderKitId();
- if (null == defaultRenderKitId) {
- defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
- }
- RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit = renderKitFactory.getRenderKit(context,
- defaultRenderKitId);
+ String defaultRenderKitId = context.getApplication()
+ .getDefaultRenderKitId();
+ if (null == defaultRenderKitId) {
+ defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
+ }
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit = renderKitFactory.getRenderKit(context,
+ defaultRenderKitId);
- ResponseWriter responseWriter = renderKit.createResponseWriter(
- customWriter, null, "UTF-8");
- context.setResponseWriter(responseWriter);
- writeScriptBody(context, label, false);
- if (writer != null) {
- context.setResponseWriter(writer);
+ ResponseWriter responseWriter = renderKit.createResponseWriter(
+ customWriter, null, "UTF-8");
+ context.setResponseWriter(responseWriter);
+ writeScriptBody(context, label, false);
+ if (writer != null) {
+ context.setResponseWriter(writer);
+ }
+ result = customWriter.getContent();
+ }
+
+ } catch (Exception e) {
+ e.getMessage();
}
- result = customWriter.getContent();
- }
+ return (result != null) ? new JSLiteral(result.toString())
+ : JSReference.NULL;
+ }
- } catch (Exception e) {
- e.getMessage();
+ /**
+ * Gets a string representing css specific height of downloaded file list
+ * panel.
+ *
+ * @param component
+ * file upload component
+ * @return a string representing css specific height of downloaded file list
+ * panel
+ */
+ public String getFileListHeight(UIFileUpload component) {
+ return HtmlUtil.qualifySize(component.getListHeight());
}
- return (result != null) ? new JSLiteral(result.toString())
- : JSReference.NULL;
- }
- /**
- * Gets a string representing css specific height of downloaded file list panel.
- *
- * @param component file upload component
- * @return a string representing css specific height of downloaded file list panel
- */
- public String getFileListHeight(UIFileUpload component) {
- return HtmlUtil.qualifySize(component.getListHeight());
- }
+ /**
+ * Gets a string representing css specific width of downloaded file list
+ * panel.
+ *
+ * @param component
+ * file upload component
+ * @return a string representing css specific width of downloaded file list
+ * panel
+ */
+ public String getFileListWidth(UIFileUpload component) {
+ return HtmlUtil.qualifySize(component.getListWidth());
+ }
- /**
- * Gets a string representing css specific width of downloaded file list panel.
- *
- * @param component file upload component
- * @return a string representing css specific width of downloaded file list panel
- */
- public String getFileListWidth(UIFileUpload component) {
- return HtmlUtil.qualifySize(component.getListWidth());
- }
+ /**
+ * Generate component custom events functions
+ *
+ * @param context
+ * @param component
+ * @param attributeName
+ * @return
+ */
+ public String getAsEventHandler(FacesContext context,
+ UIComponent component, String attributeName) {
+ Object eventHandler = RendererUtils.getInstance().getAsEventHandler(
+ context, component, attributeName, "");
+ if (eventHandler != null) {
+ return eventHandler.toString();
+ }
+ return JSReference.NULL.toScript();
+ }
- /**
- * Generate component custom events functions
- *
- * @param context
- * @param component
- * @param attributeName
- * @return
- */
- public String getAsEventHandler(FacesContext context,
- UIComponent component, String attributeName) {
- Object eventHandler = RendererUtils.getInstance().getAsEventHandler(
- context, component, attributeName, "");
- if (eventHandler != null) {
- return eventHandler.toString();
+ /**
+ * Gets progress bar Id
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public String getProgressBarId(FacesContext context, UIComponent component)
+ throws IOException {
+ return getProgressBar(context, component).getClientId(context);
}
- return JSReference.NULL.toScript();
- }
- /**
- * Gets progress bar Id
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getProgressBarId(FacesContext context, UIComponent component)
- throws IOException {
- return getProgressBar(context, component).getClientId(context);
- }
+ /**
+ * Renders progress bar
+ *
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void renderProgress(FacesContext context, UIComponent component)
+ throws IOException {
+ UIComponent progressBar = getProgressBar(context, component);
+ renderChild(context, progressBar);
+ }
- /**
- * Renders progress bar
- *
- * @param context
- * @param component
- * @throws IOException
- */
- public void renderProgress(FacesContext context, UIComponent component)
- throws IOException {
- UIComponent progressBar = getProgressBar(context, component);
- renderChild(context, progressBar);
- }
+ /**
+ * Creates progress bar component
+ *
+ * @param context
+ * @param fileUpload
+ * @return
+ */
+ private UIComponent createProgressBar(FacesContext context,
+ UIComponent fileUpload) {
+ UIComponent progressBar = fileUpload.getFacet("progress");
+ if (null == progressBar) {
+ progressBar = context.getApplication().createComponent(
+ UIProgressBar.COMPONENT_TYPE);
+ }
+ fileUpload.getFacets().put("progress", progressBar);
+ return progressBar;
+ }
- /**
- * Creates progress bar component
- *
- * @param context
- * @param fileUpload
- * @return
- */
- private UIComponent createProgressBar(FacesContext context,
- UIComponent fileUpload) {
- UIComponent progressBar = fileUpload.getFacet("progress");
- if (null == progressBar) {
- progressBar = context.getApplication().createComponent(
- UIProgressBar.COMPONENT_TYPE);
+ /**
+ * Returns progress bar
+ *
+ * @param context
+ * @param component
+ * @return
+ */
+ public UIComponent getProgressBar(FacesContext context,
+ UIComponent component) {
+ UIComponent progressBar = component.getFacet("progress");
+ if (null == progressBar) {
+ progressBar = createProgressBar(context, component);
+ }
+ progressBar.getAttributes().put("minValue", -1);
+ progressBar.getAttributes().put("enabled", false);
+ progressBar.setTransient(false);
+ return progressBar;
}
- fileUpload.getFacets().put("progress", progressBar);
- return progressBar;
- }
- /**
- * Returns progress bar
- *
- * @param context
- * @param component
- * @return
- */
- public UIComponent getProgressBar(FacesContext context,
- UIComponent component) {
- UIComponent progressBar = component.getFacet("progress");
- if (null == progressBar) {
- progressBar = createProgressBar(context, component);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ ; // We should not render children
}
- progressBar.getAttributes().put("minValue", -1);
- progressBar.getAttributes().put("enabled", false);
- progressBar.setTransient(false);
- return progressBar;
- }
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- @Override
- public void encodeChildren(FacesContext context, UIComponent component)
- throws IOException {
- ; // We should not render children
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeChildren(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ @Override
+ public void doEncodeChildren(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ ; // We should not render children
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeChildren(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- @Override
- public void doEncodeChildren(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- ; // We should not render children
- }
-
}
Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-18 15:11:16 UTC (rev 6909)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-03-18 15:11:24 UTC (rev 6910)
@@ -11,14 +11,15 @@
FileUploadEntry.UPLOAD_TRANSFER_ERROR = "transfer_error";
FileUploadEntry.UPLOAD_SERVER_ERROR = "server_error";
FileUploadEntry.UPLOAD_SIZE_ERROR = "size_error";
+FileUploadEntry.UPLOAD_FORBIDDEN = "forbidden";
FileUploadEntry.LABELS = {};
FileUploadEntry.LABELS[FileUploadEntry.INITIALIZED] = '';
FileUploadEntry.LABELS[FileUploadEntry.READY] = '';
FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_IN_PROGRESS] = 'uploading';
FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_CANCELED] = '';
+FileUploadEntry.LABELS[FileUploadEntry.UPLOAD_FORBIDDEN] = 'Uploading forbidden';
-
FileUploadEntry.clearControlTemplate =
[
new E('a',
@@ -315,10 +316,13 @@
var iframeDocument = this.iframe.contentWindow.document;
var elt = iframeDocument.getElementById('_richfaces_file_upload_stopped');
var restr = iframeDocument.getElementById('_richfaces_file_upload_size_restricted');
+ var forb = iframeDocument.getElementById('_richfaces_file_upload_forbidden');
if (elt) {
this.callback(FileUploadEntry.UPLOAD_CANCELED);
} else if (restr) {
this.callback(FileUploadEntry.UPLOAD_SIZE_ERROR);
+ } else if (forb) {
+ this.callback(FileUploadEntry.UPLOAD_SIZE_ERROR);
} else {
var state = iframeDocument.getElementById('javax.faces.ViewState');
if (state) {
@@ -891,7 +895,7 @@
parentForm.encoding = "multipart/form-data";
parentForm.enctype = "multipart/form-data";
parentForm.target = this.id + "_iframe";//this.id;
- parentForm.action = oldAction + (/\?/.test(oldAction) ? '&_richfaces_upload_uid' : '?_richfaces_upload_uid') + '=' + encodeURI(entry.uid);
+ parentForm.action = oldAction + (/\?/.test(oldAction) ? '&_richfaces_upload_uid' : '?_richfaces_upload_uid') + '=' + encodeURI(entry.uid) + "&id=" + this.id;
try {
var inputs = parentForm.elements;
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-18 15:11:16 UTC (rev 6909)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-03-18 15:11:24 UTC (rev 6910)
@@ -46,6 +46,14 @@
variables.setVariable("listWidth", getFileListWidth(component));
variables.setVariable("listHeight", getFileListHeight(component));
+
+ Integer max = initMaxFilesCount(context, component, clientId);
+ String addStyle = "";
+ if (max == 0) {
+ addStyle = "; display: none;";
+ }
+ variables.setVariable("addStyle", addStyle);
+ variables.setVariable("maxCount", max);
]]>
</jsp:scriptlet>
@@ -65,7 +73,7 @@
<table class="upload_toolbar_decor">
<tr>
<td>
- <div class="upload_button_border" style=" float:left;">
+ <div class="upload_button_border" style=" float:left; #{addStyle}">
<div class="#{addButtonClass}" onmouseover="this.className='upload_button_light upload_font'" onmousedown="this.className='upload_button_press upload_font'" onmouseup="this.className='upload_button upload_font'" onmouseout="this.className='upload_button upload_font'"
style="position: relative;"
id="#{clientId}:add1">
@@ -175,7 +183,7 @@
onerror : #{this:getAsEventHandler(context, component, "onerror")}
};
- new FileUpload('#{clientId}','#{formId}',#{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, '#{component.attributes["maxFilesQuantity"]}', events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]},'autoUpload':#{component.attributes["immediateUpload"]}},#{this:_getLabels(labels)});
+ new FileUpload('#{clientId}','#{formId}',#{this:getStopScript(context, component)}, #{this:getFileSizeScript(context, component)} ,'#{this:getProgressBarId(context, component)}', FileUpload.CLASSES, #{this:getLabelMarkup(context, component)}, #{maxCount}, events, #{component.attributes["disabled"]}, #{this:getAcceptedTypes(context, component)}, {'autoclear':#{component.attributes["autoclear"]},'autoUpload':#{component.attributes["immediateUpload"]}},#{this:_getLabels(labels)});
</script>
</span>
<f:call name="utils.encodeEndFormIfNessesary" />
16 years, 10 months
JBoss Rich Faces SVN: r6909 - trunk/framework/impl/src/main/java/org/ajax4jsf.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-03-18 11:11:16 -0400 (Tue, 18 Mar 2008)
New Revision: 6909
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java
Log:
RF-2507
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java 2008-03-18 14:40:26 UTC (rev 6908)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/FastFilter.java 2008-03-18 15:11:16 UTC (rev 6909)
@@ -78,90 +78,91 @@
* @param response
* @param chain
*/
- @Override
public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- if (!(response instanceof HttpServletResponse)) {
- chain.doFilter(request, response);
- return;
- }
+ FilterChain chain) throws IOException, ServletException {
+ if (!(response instanceof HttpServletResponse)) {
+ chain.doFilter(request, response);
+ return;
+ }
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
- if (uid != null) {
- if (isMultipartRequest(httpRequest)) {
- MultipartRequest multipartRequest = new MultipartRequest(
- httpRequest, createTempFiles, maxRequestSize, uid);
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
+ if (uid != null) {
+ if (isMultipartRequest(httpRequest)) {
+ MultipartRequest multipartRequest = new MultipartRequest(
+ httpRequest, createTempFiles, maxRequestSize, uid);
- Map<String, MultipartRequest> sessionsMap = null;
- Map<String, Object> percentMap = null;
- try {
- if (!isFileSizeRestricted(request, maxRequestSize)) {
- HttpSession session = httpRequest.getSession();
- synchronized (session) {
- sessionsMap = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- percentMap = (Map<String, Object>) session
- .getAttribute(PERCENT_BEAN_NAME);
- if (sessionsMap == null) {
- sessionsMap = Collections
- .synchronizedMap(new HashMap<String, MultipartRequest>());
- session.setAttribute(
- REQUESTS_SESSIONS_BEAN_NAME,
- sessionsMap);
- }
- if (percentMap == null) {
- percentMap = new HashMap<String, Object>();
- session.setAttribute(PERCENT_BEAN_NAME,
- percentMap);
- }
- }
+ Map<String, MultipartRequest> sessionsMap = null;
+ Map<String, Object> percentMap = null;
+ try {
+ if (isFileSizeRestricted(request, maxRequestSize)) {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
+ } else if (!checkFileCount(httpRequest)) {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_forbidden\"></html>");
+ } else {
+ HttpSession session = httpRequest.getSession();
+ synchronized (session) {
+ sessionsMap = (Map<String, MultipartRequest>) session
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+ percentMap = (Map<String, Object>) session
+ .getAttribute(PERCENT_BEAN_NAME);
+ if (sessionsMap == null) {
+ sessionsMap = Collections
+ .synchronizedMap(new HashMap<String, MultipartRequest>());
+ session.setAttribute(
+ REQUESTS_SESSIONS_BEAN_NAME,
+ sessionsMap);
+ }
+ if (percentMap == null) {
+ percentMap = new HashMap<String, Object>();
+ session.setAttribute(PERCENT_BEAN_NAME,
+ percentMap);
+ }
+ }
+ percentMap.put(uid, 0); // associate percent value with
+ // file
+ // entry uid
+ sessionsMap.put(uid, multipartRequest);
- percentMap.put(uid, 0); // associate percent value with
- // file
- // entry uid
- sessionsMap.put(uid, multipartRequest);
-
- if (multipartRequest.parseRequest()) {
- super.doFilter(multipartRequest, response, chain);
+ if (multipartRequest.parseRequest()) {
+ super.doFilter(multipartRequest, response, chain);
+ } else {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_stopped\"></html>");
+ }
+ }
+ } finally {
+ if (sessionsMap != null) {
+ sessionsMap.remove(uid);
+ percentMap.remove(uid);
+ }
+ }
} else {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_stopped\"></html>");
- }
- } else {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
- }
- } finally {
- if (sessionsMap != null) {
- sessionsMap.remove(uid);
- percentMap.remove(uid);
- }
- }
- } else {
- if ("stop".equals(httpRequest.getParameter("action"))) {
- HttpSession session = httpRequest.getSession();
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+ if ("stop".equals(httpRequest.getParameter("action"))) {
+ HttpSession session = httpRequest.getSession();
+ Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- multipartRequest.stop();
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse
- .setStatus(HttpServletResponse.SC_NO_CONTENT);
- httpResponse.getOutputStream().close();
+ if (sessions != null) {
+ MultipartRequest multipartRequest = sessions.get(uid);
+ if (multipartRequest != null) {
+ multipartRequest.stop();
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse
+ .setStatus(HttpServletResponse.SC_NO_CONTENT);
+ httpResponse.getOutputStream().close();
+ }
+ }
+ } else {
+ super.doFilter(request, response, chain);
+ }
}
- }
} else {
- super.doFilter(request, response, chain);
+ super.doFilter(request, response, chain);
}
- }
- } else {
- super.doFilter(request, response, chain);
}
- }
/*
* (non-Javadoc)
@@ -206,6 +207,22 @@
}
return false;
}
+
+ private boolean checkFileCount(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ Map<String, Integer> map = (Map<String, Integer>) session
+ .getAttribute(Filter.UPLOADED_COUNTER);
+ if (map != null) {
+ String id = request.getParameter("id");
+ if (id != null) {
+ Integer i = map.get(id);
+ if (i != null && i == 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
private void printResponse(ServletResponse response, String message)
throws IOException {
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java 2008-03-18 14:40:26 UTC (rev 6908)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/Filter.java 2008-03-18 15:11:16 UTC (rev 6909)
@@ -39,6 +39,8 @@
import org.ajax4jsf.request.MultipartRequest;
import org.ajax4jsf.webapp.ConfigurableFilter;
+import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
+
/**
* Proxy for resource/ajax xml parsing filter.
*
@@ -48,176 +50,202 @@
*/
public class Filter extends ConfigurableFilter {
- /** Multipart request start */
- public static final String MULTIPART = "multipart/";
+ /** Multipart request start */
+ public static final String MULTIPART = "multipart/";
- /** Session bean name where multipart requests map will be stored */
- public static final String REQUESTS_SESSIONS_BEAN_NAME = "_richfaces_upload_sessions";
+ /** Session bean name where multipart requests map will be stored */
+ public static final String REQUESTS_SESSIONS_BEAN_NAME = "_richfaces_upload_sessions";
- /** Session bean name where progress bar's percent map will be stored */
- public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
-
- /** Request parameter that indicates if multipart request forced by rich file upload component */
- public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
+ /** Session bean name where progress bar's percent map will be stored */
+ public static final String PERCENT_BEAN_NAME = "_richfaces_upload_percents";
- /**
- * Flag indicating whether a temporary file should be used to cache the
- * uploaded file
- */
- private boolean createTempFiles = false;
+ /**
+ * Request parameter that indicates if multipart request forced by rich file
+ * upload component
+ */
+ public static final String UPLOAD_FILES_ID = "_richfaces_upload_uid";
- /**
- * The maximum size of a file upload request. 0 means no limit.
- */
- private int maxRequestSize = 0;
+ /** Session bean name to store max files count allowed to upload */
+ public static final String UPLOADED_COUNTER = "_richfaces_uploaded_file_counter";
- /***
- * Method catches upload files request.
- * Request parameter <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request generated by rich-upload component.
- * If it was detected custom parsing request should be done.
- * Processing information about percent of completion and file size will be put into session scope.
- * In other case super filter's method will be invoked for request processing.
- * @param request
- * @param response
- * @param chain
- */
- @Override
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- if (!(response instanceof HttpServletResponse)) {
- chain.doFilter(request, response);
- return;
- }
+ /**
+ * Flag indicating whether a temporary file should be used to cache the
+ * uploaded file
+ */
+ private boolean createTempFiles = false;
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
- if (uid != null) {
- if (isMultipartRequest(httpRequest)) {
- MultipartRequest multipartRequest = new MultipartRequest(
- httpRequest, createTempFiles, maxRequestSize, uid);
+ /**
+ * The maximum size of a file upload request. 0 means no limit.
+ */
+ private int maxRequestSize = 0;
- Map<String, MultipartRequest> sessionsMap = null;
- Map<String, Object> percentMap = null;
- try {
- if (!isFileSizeRestricted(request, maxRequestSize)) {
- HttpSession session = httpRequest.getSession();
- synchronized (session) {
- sessionsMap = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- percentMap = (Map<String, Object>) session
- .getAttribute(PERCENT_BEAN_NAME);
- if (sessionsMap == null) {
- sessionsMap = Collections
- .synchronizedMap(new HashMap<String, MultipartRequest>());
- session.setAttribute(
- REQUESTS_SESSIONS_BEAN_NAME,
- sessionsMap);
- }
- if (percentMap == null) {
- percentMap = new HashMap<String, Object>();
- session.setAttribute(PERCENT_BEAN_NAME,
- percentMap);
- }
- }
+ /***************************************************************************
+ * Method catches upload files request. Request parameter
+ * <b>org.ajax4jsf.Filter.UPLOAD_FILES_ID</b> indicates if request
+ * generated by rich-upload component. If it was detected custom parsing
+ * request should be done. Processing information about percent of
+ * completion and file size will be put into session scope. In other case
+ * super filter's method will be invoked for request processing.
+ *
+ * @param request
+ * @param response
+ * @param chain
+ */
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ if (!(response instanceof HttpServletResponse)) {
+ chain.doFilter(request, response);
+ return;
+ }
- percentMap.put(uid, 0); // associate percent value with
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ String uid = httpRequest.getParameter(UPLOAD_FILES_ID);
+ if (uid != null) {
+ if (isMultipartRequest(httpRequest)) {
+ MultipartRequest multipartRequest = new MultipartRequest(
+ httpRequest, createTempFiles, maxRequestSize, uid);
+
+ Map<String, MultipartRequest> sessionsMap = null;
+ Map<String, Object> percentMap = null;
+ try {
+ if (isFileSizeRestricted(request, maxRequestSize)) {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
+ } else if (!checkFileCount(httpRequest)) {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_forbidden\"></html>");
+ } else {
+ HttpSession session = httpRequest.getSession();
+ synchronized (session) {
+ sessionsMap = (Map<String, MultipartRequest>) session
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+ percentMap = (Map<String, Object>) session
+ .getAttribute(PERCENT_BEAN_NAME);
+ if (sessionsMap == null) {
+ sessionsMap = Collections
+ .synchronizedMap(new HashMap<String, MultipartRequest>());
+ session.setAttribute(
+ REQUESTS_SESSIONS_BEAN_NAME,
+ sessionsMap);
+ }
+ if (percentMap == null) {
+ percentMap = new HashMap<String, Object>();
+ session.setAttribute(PERCENT_BEAN_NAME,
+ percentMap);
+ }
+ }
+ percentMap.put(uid, 0); // associate percent value with
// file
- // entry uid
- sessionsMap.put(uid, multipartRequest);
+ // entry uid
+ sessionsMap.put(uid, multipartRequest);
- if (multipartRequest.parseRequest()) {
- super.doFilter(multipartRequest, response, chain);
+ if (multipartRequest.parseRequest()) {
+ super.doFilter(multipartRequest, response, chain);
+ } else {
+ printResponse(response,
+ "<html id=\"_richfaces_file_upload_stopped\"></html>");
+ }
+ }
+ } finally {
+ if (sessionsMap != null) {
+ sessionsMap.remove(uid);
+ percentMap.remove(uid);
+ }
+ }
} else {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_stopped\"></html>");
- }
- } else {
- printResponse(response,
- "<html id=\"_richfaces_file_upload_size_restricted\"></html>");
- }
- } finally {
- if (sessionsMap != null) {
- sessionsMap.remove(uid);
- percentMap.remove(uid);
- }
- }
- } else {
- if ("stop".equals(httpRequest.getParameter("action"))) {
- HttpSession session = httpRequest.getSession();
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
- .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
+ if ("stop".equals(httpRequest.getParameter("action"))) {
+ HttpSession session = httpRequest.getSession();
+ Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session
+ .getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- multipartRequest.stop();
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse
- .setStatus(HttpServletResponse.SC_NO_CONTENT);
- httpResponse.getOutputStream().close();
+ if (sessions != null) {
+ MultipartRequest multipartRequest = sessions.get(uid);
+ if (multipartRequest != null) {
+ multipartRequest.stop();
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse
+ .setStatus(HttpServletResponse.SC_NO_CONTENT);
+ httpResponse.getOutputStream().close();
+ }
+ }
+ } else {
+ super.doFilter(request, response, chain);
+ }
}
- }
} else {
- super.doFilter(request, response, chain);
+ super.doFilter(request, response, chain);
}
- }
- } else {
- super.doFilter(request, response, chain);
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.webapp.BaseFilter#init(javax.servlet.FilterConfig)
- */
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
- super.init(filterConfig);
- String param = filterConfig.getInitParameter("createTempFiles");
- if (param != null) {
- this.createTempFiles = Boolean.parseBoolean(param);
- }else {
- this.createTempFiles = true;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.webapp.BaseFilter#init(javax.servlet.FilterConfig)
+ */
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ super.init(filterConfig);
+ String param = filterConfig.getInitParameter("createTempFiles");
+ if (param != null) {
+ this.createTempFiles = Boolean.parseBoolean(param);
+ } else {
+ this.createTempFiles = true;
+ }
+ param = filterConfig.getInitParameter("maxRequestSize");
+ if (param != null) {
+ this.maxRequestSize = Integer.parseInt(param);
+ }
}
- param = filterConfig.getInitParameter("maxRequestSize");
- if (param != null) {
- this.maxRequestSize = Integer.parseInt(param);
- }
- }
- private boolean isMultipartRequest(HttpServletRequest request) {
- if (!"post".equals(request.getMethod().toLowerCase())) {
- return false;
+ 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;
}
- String contentType = request.getContentType();
- if (contentType == null) {
- return false;
+ private boolean isFileSizeRestricted(ServletRequest request, int maxSize) {
+ if (maxSize != 0 && request.getContentLength() > maxSize) {
+ return true;
+ }
+ return false;
}
- if (contentType.toLowerCase().startsWith(MULTIPART)) {
- return true;
+ private boolean checkFileCount(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ Map<String, Integer> map = (Map<String, Integer>) session
+ .getAttribute(UPLOADED_COUNTER);
+ if (map != null) {
+ String id = request.getParameter("id");
+ if (id != null) {
+ Integer i = map.get(id);
+ if (i != null && i == 0) {
+ return false;
+ }
+ }
+ }
+ return true;
}
- return false;
- }
-
- private boolean isFileSizeRestricted(ServletRequest request, int maxSize) {
- if (maxSize != 0 && request.getContentLength() > maxSize) {
- return true;
+ private void printResponse(ServletResponse response, String message)
+ throws IOException {
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ httpResponse.setStatus(HttpServletResponse.SC_OK);
+ httpResponse.setContentType("text/html");
+ PrintWriter writer = httpResponse.getWriter();
+ writer.write(message);
+ writer.close();
}
- return false;
- }
- private void printResponse(ServletResponse response, String message)
- throws IOException {
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- httpResponse.setStatus(HttpServletResponse.SC_OK);
- httpResponse.setContentType("text/html");
- PrintWriter writer = httpResponse.getWriter();
- writer.write(message);
- writer.close();
- }
-
}
16 years, 10 months