JBoss Rich Faces SVN: r9310 - trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-06-30 14:36:08 -0400 (Mon, 30 Jun 2008)
New Revision: 9310
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
Log:
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-06-30 18:04:08 UTC (rev 9309)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-06-30 18:36:08 UTC (rev 9310)
@@ -64,7 +64,7 @@
boolean haveHtml = false;
boolean haveHead = false;
boolean closingElement = false;
-//see if any characters has been wrote http://jira.jboss.com/jira/browse/RF-3685
+//see if any characters has been written http://jira.jboss.com/jira/browse/RF-3685
boolean parsed = false;
// Always parse content, see http://jira.jboss.com/jira/browse/RF-3577
// if (null != scripts || null != styles || null != userStyles) {
16 years, 5 months
JBoss Rich Faces SVN: r9308 - trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-06-30 14:02:24 -0400 (Mon, 30 Jun 2008)
New Revision: 9308
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
Log:
http://jira.jboss.com/jira/browse/RF-3685
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-06-30 16:27:04 UTC (rev 9307)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-06-30 18:02:24 UTC (rev 9308)
@@ -64,6 +64,8 @@
boolean haveHtml = false;
boolean haveHead = false;
boolean closingElement = false;
+// http://jira.jboss.com/jira/browse/RF-3685
+ boolean parsed = false;
// Always parse content, see http://jira.jboss.com/jira/browse/RF-3577
// if (null != scripts || null != styles || null != userStyles) {
ParsingStateManager stateManager = ParsingStateManager
@@ -72,6 +74,7 @@
ParsingContext context = new ParsingContext(out);
int nextChar;
while ((nextChar = in.read()) > 0) {
+ parsed = true;
char c = (char)nextChar;
state = state.getNextState(c, context);
if (log.isDebugEnabled()) {
16 years, 5 months
JBoss Rich Faces SVN: r9307 - trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-06-30 12:27:04 -0400 (Mon, 30 Jun 2008)
New Revision: 9307
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
Log:
RF-2997
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-06-30 16:01:11 UTC (rev 9306)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-06-30 16:27:04 UTC (rev 9307)
@@ -189,7 +189,7 @@
AJAX : {
updateRows: function(options,request,grid,clientid, callbacks, callbacksPost){
var localOptions = options;
- var rowCount = grid.getBody().templFrozen.getElement().rows.length;
+ var rowCount = grid.getBody().templNormal.getElement().rows.length;
var startRow = localOptions.startRow;
var count = localOptions.count;
var rowindex, i, el;
16 years, 5 months
JBoss Rich Faces SVN: r9306 - in trunk/test-applications/seleniumTest/src: main/webapp/WEB-INF and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-06-30 12:01:11 -0400 (Mon, 30 Jun 2008)
New Revision: 9306
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxMediaOutput/
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxMediaOutput/ajaxMediaOutputTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxMediaOutputTest.java
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/Media.java
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaBean.java
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaData.java
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
Add a4j:mediaOutput selenium test
Modified: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/Media.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/Media.java 2008-06-30 14:26:16 UTC (rev 9305)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/Media.java 2008-06-30 16:01:11 UTC (rev 9306)
@@ -3,15 +3,12 @@
import java.io.IOException;
import java.io.OutputStream;
-
public interface Media {
- public void paint(OutputStream out, Object data) throws IOException;
+ public void paint(OutputStream out, Object data) throws IOException;
- public void initData();
+ public void setData(MediaData data);
- public void setData(MediaData data);
+ public MediaData getData();
- public MediaData getData();
-
}
Modified: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaBean.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaBean.java 2008-06-30 14:26:16 UTC (rev 9305)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaBean.java 2008-06-30 16:01:11 UTC (rev 9306)
@@ -8,48 +8,65 @@
import javax.imageio.ImageIO;
-
public class MediaBean implements Media {
-
- private MediaData data;
- /**
- * @return the data
- */
- public MediaData getData() {
- return data;
- }
+ private MediaData data = new MediaData();
+ private MediaData data2 = new MediaData(50, 10, Color.BLACK, Color.WHITE);
- /**
- * @param data the data to set
- */
- public void setData(MediaData data) {
- this.data = data;
- }
-
- public void initData(){
- data= new MediaData();
- data.setWidth(100);
- data.setHeight(100);
- data.setBackground(Color.BLUE);
- data.setDrawColor(Color.RED);
- }
+
+ /**
+ * @return the data2
+ */
+ public MediaData getData2() {
+ return data2;
+ }
- public void paint(OutputStream out, Object data) throws IOException{
- if (data instanceof MediaData) {
-
- MediaData paintData = (MediaData) data;
- BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
- Graphics2D graphics2D = img.createGraphics();
- graphics2D.setBackground(paintData.getBackground());
- graphics2D.setColor(paintData.getDrawColor());
- graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
- graphics2D.drawLine(5,5,paintData.getWidth()-5,paintData.getHeight()-5);
- graphics2D.drawChars(new String("RichFaces").toCharArray(),0,9,40,15);
- graphics2D.drawChars(new String("mediaOutput").toCharArray(),0,11,5,45);
-
- ImageIO.write(img,"jpeg",out);
-
- }
+ /**
+ * @param data2 the data2 to set
+ */
+ public void setData2(MediaData data2) {
+ this.data2 = data2;
+ }
+
+ /**
+ * @return the data
+ */
+ public MediaData getData() {
+ return data;
+ }
+
+ /**
+ * @param data
+ * the data to set
+ */
+ public void setData(MediaData data) {
+ this.data = data;
+ }
+
+ public String reInitData() {
+ data = new MediaData(200, 200, Color.WHITE, Color.BLACK);
+ return null;
+ }
+
+ public String resetData() {
+ data = new MediaData();
+ return null;
+ }
+
+ public void paint(OutputStream out, Object data) throws IOException {
+ if (data instanceof MediaData) {
+
+ MediaData paintData = (MediaData) data;
+ BufferedImage img = new BufferedImage(paintData.getWidth(), paintData.getHeight(), BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics2D = img.createGraphics();
+ graphics2D.setBackground(paintData.getBackground());
+ graphics2D.setColor(paintData.getDrawColor());
+ graphics2D.clearRect(0, 0, paintData.getWidth(), paintData.getHeight());
+ graphics2D.drawChars(new String("mediaOutput").toCharArray(), 0, 11, 5, 35);
+ graphics2D.drawChars(new String("selenium test").toCharArray(), 0, 13, 5, 55);
+
+ ImageIO.write(img, "jpeg", out);
+
}
+ }
}
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaData.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaData.java 2008-06-30 14:26:16 UTC (rev 9305)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/MediaData.java 2008-06-30 16:01:11 UTC (rev 9306)
@@ -3,37 +3,86 @@
import java.awt.Color;
import java.io.Serializable;
-public class MediaData implements Serializable{
+public class MediaData implements Serializable {
- private static final long serialVersionUID = 1L;
- Integer Width=110;
- Integer Height=50;
- Color Background=new Color(0,0,0);
- Color DrawColor=new Color(255,255,255);
- public MediaData() {
- }
- public Color getBackground() {
- return Background;
- }
- public void setBackground(Color background) {
- Background = background;
- }
- public Color getDrawColor() {
- return DrawColor;
- }
- public void setDrawColor(Color drawColor) {
- DrawColor = drawColor;
- }
- public Integer getHeight() {
- return Height;
- }
- public void setHeight(Integer height) {
- Height = height;
- }
- public Integer getWidth() {
- return Width;
- }
- public void setWidth(Integer width) {
- Width = width;
- }
+ private static final long serialVersionUID = 1L;
+
+ Integer width;
+
+ Integer height;
+
+ Color background;
+
+ Color drawColor;
+
+ public MediaData() {
+ this.width = 100;
+ this.height = 100;
+ background = Color.BLACK;
+ drawColor = Color.WHITE;
+ }
+
+ public MediaData(Integer width, Integer height, Color background, Color drawColor) {
+ this.width = width;
+ this.height = height;
+ this.background = background;
+ this.drawColor = drawColor;
+ }
+
+ /**
+ * @return the width
+ */
+ public Integer getWidth() {
+ return width;
+ }
+
+ /**
+ * @param width the width to set
+ */
+ public void setWidth(Integer width) {
+ this.width = width;
+ }
+
+ /**
+ * @return the height
+ */
+ public Integer getHeight() {
+ return height;
+ }
+
+ /**
+ * @param height the height to set
+ */
+ public void setHeight(Integer height) {
+ this.height = height;
+ }
+
+ /**
+ * @return the background
+ */
+ public Color getBackground() {
+ return background;
+ }
+
+ /**
+ * @param background the background to set
+ */
+ public void setBackground(Color background) {
+ this.background = background;
+ }
+
+ /**
+ * @return the drawColor
+ */
+ public Color getDrawColor() {
+ return drawColor;
+ }
+
+ /**
+ * @param drawColor the drawColor to set
+ */
+ public void setDrawColor(Color drawColor) {
+ this.drawColor = drawColor;
+ }
+
}
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-06-30 14:26:16 UTC (rev 9305)
+++ trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-06-30 16:01:11 UTC (rev 9306)
@@ -141,6 +141,11 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>a4jMediaBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.MediaBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>calendarBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.CalendarTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxMediaOutput/ajaxMediaOutputTest.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxMediaOutput/ajaxMediaOutputTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-06-30 14:26:16 UTC (rev 9305)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-06-30 16:01:11 UTC (rev 9306)
@@ -699,9 +699,87 @@
}
}
+
+ public void testOnclickEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onclick event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.click(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+ public void testOnDblclickEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing ondblclick event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.doubleClick(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnfocusEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onfocus event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.focus(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnkeydownEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onkeydown event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.keyDown(testElementId, "1");
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnkeypressEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onkeypress event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.keyPress(testElementId, "1");
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnkeyupEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onkeyup event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.keyUp(testElementId, "1");
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmousedownEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onmousedown event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseDown(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmousemoveEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onmousemove event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseMove(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmouseoutEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onmouseout event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseOut(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmouseoverEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onmouseover event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseOver(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmouseupEvent(String testElementId, String testElementResultId, String beforeResult, String afterResult) {
+ writeStatus("Testing onmouseup event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseUp(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
/**
* Checks whether client is FireFox
+ *
* @return true if client is FireFox
*/
public boolean isFF() {
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxMediaOutputTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxMediaOutputTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxMediaOutputTest.java 2008-06-30 16:01:11 UTC (rev 9306)
@@ -0,0 +1,108 @@
+/*
+ * AjaxMediaOutputTest.java Date created: 26.06.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.testng;
+
+import junit.framework.Assert;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+/**
+ * ajaxMediaOutput component selenium test
+ * @author Alexandr Levkovsky
+ *
+ */
+public class AjaxMediaOutputTest extends SeleniumTestBase {
+
+ private final static String FORM_ID = "form:";
+ private final static String IMAGE_ID = FORM_ID + "media_data";
+ private final static String IMAGE_EVENT_ID = FORM_ID + "media_data_event_";
+ private final static String EVENT_RESULT_ID = "_result";
+ private final static String EVENT_TEST_RESULT_FAILED_TEXT = "No";
+ private final static String EVENT_TEST_RESULT_PASSED_TEXT = "Passed";
+ /**
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/ajaxMediaOutput/ajaxMediaOutputTest.xhtml";
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAjaxMediaOutput(Template template) throws Exception {
+ renderPage(template);
+ writeStatus("Testing media output");
+
+ String imageId = getParentId() + IMAGE_ID;
+
+ AssertPresent(imageId);
+
+ String tagName = runScript("getElementType('" + imageId +"');");
+ Assert.assertEquals(tagName.toLowerCase(), "img");
+
+
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclickEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 1;
+ super.testOnclickEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnDblclickEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 2;
+ super.testOnDblclickEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedownEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 7;
+ super.testOnmousedownEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemoveEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 8;
+ super.testOnmousemoveEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseoutEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 9;
+ super.testOnmouseoutEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseoverEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 10;
+ super.testOnmouseoverEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseupEvent(Template template) throws Exception {
+ renderPage(template);
+ String imageId = getParentId() + IMAGE_EVENT_ID + 11;
+ super.testOnmouseupEvent(imageId, imageId + EVENT_RESULT_ID, EVENT_TEST_RESULT_FAILED_TEXT, EVENT_TEST_RESULT_PASSED_TEXT);
+ runScript("resetEventTestResult('" + imageId + EVENT_RESULT_ID + "');");
+ }
+
+}
Property changes on: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxMediaOutputTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
16 years, 5 months
JBoss Rich Faces SVN: r9305 - trunk/framework/impl/src/main/java/org/ajax4jsf/request.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-06-30 10:26:16 -0400 (Mon, 30 Jun 2008)
New Revision: 9305
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
refactoring
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-06-30 14:25:04 UTC (rev 9304)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-06-30 14:26:16 UTC (rev 9305)
@@ -292,14 +292,11 @@
private String decodeFileName(String name) {
String fileName = null;
- if (request.getParameter("_richfaces_send_http_error") != null) { // Flash upload
- try {
- fileName = new String(name.getBytes("ISO-8859-1"), "UTF-8");
- } catch (Exception e) {
- }
- } else {
- try {
+ try {
+ if (request.getParameter("_richfaces_send_http_error") != null) {
+ fileName = new String(name.getBytes(encoding), "UTF-8");
+ } else {
StringBuffer buffer = new StringBuffer();
String[] codes = name.split(";");
if (codes != null) {
@@ -314,10 +311,11 @@
}
fileName = buffer.toString();
}
- } catch (Exception e) {
- fileName = name;
}
+ } catch (Exception e) {
+ fileName = name;
}
+
return fileName;
}
@@ -488,7 +486,7 @@
return false;
}
}
-
+
return true;
} else {
cancel();
16 years, 5 months
JBoss Rich Faces SVN: r9304 - in trunk/test-applications/jsp/src/main/webapp: Combobox and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-06-30 10:25:04 -0400 (Mon, 30 Jun 2008)
New Revision: 9304
Modified:
trunk/test-applications/jsp/src/main/webapp/Calendar/CalendarProperty.jsp
trunk/test-applications/jsp/src/main/webapp/Combobox/ComboboxProperty.jsp
trunk/test-applications/jsp/src/main/webapp/ComponentControl/ComponentControl.jsp
trunk/test-applications/jsp/src/main/webapp/ContextMenu/ContextMenuProperty.jsp
trunk/test-applications/jsp/src/main/webapp/DataDefinitionList/DataDefinitionListProperty.jsp
trunk/test-applications/jsp/src/main/webapp/DataFilterSlider/DataFilterSliderProperty.jsp
trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedList.jsp
trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedListProperty.jsp
trunk/test-applications/jsp/src/main/webapp/DataScroller/DataScrollerProperty.jsp
Log:
+findComponent
Modified: trunk/test-applications/jsp/src/main/webapp/Calendar/CalendarProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Calendar/CalendarProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/Calendar/CalendarProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -294,8 +294,8 @@
value="switch"></a4j:commandLink>
</h:panelGrid>
- <h:outputText value="JS API with componentControl"></h:outputText>
-
+ <h:outputText value="JS API with componentControl"></h:outputText>
+
<f:verbatim>
<br />
<a href="#" id="doExpandCalendarID">Calendar (expand)</a>
@@ -311,26 +311,53 @@
<a href="#" id="doPrevMonthCalendarID">Calendar (prevMonth)</a>
<br />
<a href="#" id="doTodayCalendarID">Calendar (today)</a>
- <br />
+ <br />
<a href="#" id="getSelectedDateID">Calendar(getSelectedDate)</a>
- <br />
+ <br />
<a href="#" id="getCurrentDateID">Calendar(getCurrentDate)</a>
- <br />
+ <br />
<a href="#" id="getCurrentMonthID">Calendar(getCurrentMonth)</a>
- <br />
+ <br />
<a href="#" id="getCurrentYearID">Calendar(getCurrentYear)</a>
</f:verbatim>
- <rich:componentControl attachTo="doExpandCalendarID" for="calendarClientID" event="onclick" operation="expand" />
- <rich:componentControl attachTo="collapseCalendarID" for="calendarClientID" event="onclick" operation="collapse" />
- <rich:componentControl attachTo="doNextYearCalendarID" for="calendarClientID" event="onclick" operation="nextYear" />
- <rich:componentControl attachTo="doPrevYearCalendarID" for="calendarClientID" event="onclick" operation="prevYear" />
- <rich:componentControl attachTo="doNextMonthCalendarID" for="calendarClientID" event="onclick" operation="nextMonth" />
- <rich:componentControl attachTo="doPrevMonthCalendarID" for="calendarClientID" event="onclick" operation="prevMonth" />
- <rich:componentControl attachTo="doTodayCalendarID" for="calendarClientID" event="onclick" operation="today" />
- <rich:componentControl attachTo="doTodayCalendarRenderedID" for="calendarClientID" event="onclick" operation="today" />
- <rich:componentControl attachTo="getSelectedDateID" for="calendarClientID" event="onclick" operation="alert(getSelectedDate())" />
- <rich:componentControl attachTo="getCurrentDateID" for="calendarClientID" event="onclick" operation="alert(getCurrentDate())" />
- <rich:componentControl attachTo="getCurrentMonthID" for="calendarClientID" event="onclick" operation="alert(getCurrentMonth())" />
- <rich:componentControl attachTo="getCurrentYearID" for="calendarClientID" event="onclick" operation="alert(getCurrentYear())" />
+ <rich:componentControl attachTo="doExpandCalendarID"
+ for="calendarClientID" event="onclick" operation="expand" />
+ <rich:componentControl attachTo="collapseCalendarID"
+ for="calendarClientID" event="onclick" operation="collapse" />
+ <rich:componentControl attachTo="doNextYearCalendarID"
+ for="calendarClientID" event="onclick" operation="nextYear" />
+ <rich:componentControl attachTo="doPrevYearCalendarID"
+ for="calendarClientID" event="onclick" operation="prevYear" />
+ <rich:componentControl attachTo="doNextMonthCalendarID"
+ for="calendarClientID" event="onclick" operation="nextMonth" />
+ <rich:componentControl attachTo="doPrevMonthCalendarID"
+ for="calendarClientID" event="onclick" operation="prevMonth" />
+ <rich:componentControl attachTo="doTodayCalendarID"
+ for="calendarClientID" event="onclick" operation="today" />
+ <rich:componentControl attachTo="doTodayCalendarRenderedID"
+ for="calendarClientID" event="onclick" operation="today" />
+ <rich:componentControl attachTo="getSelectedDateID"
+ for="calendarClientID" event="onclick"
+ operation="alert(getSelectedDate())" />
+ <rich:componentControl attachTo="getCurrentDateID"
+ for="calendarClientID" event="onclick"
+ operation="alert(getCurrentDate())" />
+ <rich:componentControl attachTo="getCurrentMonthID"
+ for="calendarClientID" event="onclick"
+ operation="alert(getCurrentMonth())" />
+ <rich:componentControl attachTo="getCurrentYearID"
+ for="calendarClientID" event="onclick"
+ operation="alert(getCurrentYear())" />
+ <br />
+ <br />
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getValue" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText value="#{rich:findComponent('calendarClientID').value}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/Combobox/ComboboxProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Combobox/ComboboxProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/Combobox/ComboboxProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -69,9 +69,19 @@
<br />
<a href="#" id="disableID">disable</a>
</f:verbatim>
- <rich:componentControl attachTo="showListID" event="onclick" for="comboboxID" operation="showList"></rich:componentControl>
+ <rich:componentControl attachTo="showListID" event="onclick" for="comboboxID" operation="showList" params="label:label"></rich:componentControl>
<rich:componentControl attachTo="hideListID" event="onclick" for="comboboxID" operation="hideList"></rich:componentControl>
<rich:componentControl attachTo="enableID" event="onclick" for="comboboxID" operation="enable"></rich:componentControl>
<rich:componentControl attachTo="disableID" event="onclick" for="comboboxID" operation="disable"></rich:componentControl>
-
+ <br/>
+ <br/>
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getValue" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText value="#{rich:findComponent('comboboxID').value}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/ComponentControl/ComponentControl.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ComponentControl/ComponentControl.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/ComponentControl/ComponentControl.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -95,6 +95,17 @@
<rich:menuItem icon="/pics/info.gif" value="c">
</rich:menuItem>
</rich:contextMenu>
- <rich:componentControl event="oncontextmenu" attachTo="ccContextMenuPanelMenuID" for="ccContextMenuID" operation="show"
+ <rich:componentControl id="componentID" event="oncontextmenu" attachTo="ccContextMenuPanelMenuID" for="ccContextMenuID" operation="show"
params="expand:'show work'" />
+ <br/>
+ <br/>
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getOperation" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText value="#{rich:findComponent('componentID').operation}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/ContextMenu/ContextMenuProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ContextMenu/ContextMenuProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/ContextMenu/ContextMenuProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -89,4 +89,15 @@
<rich:componentControl attachTo="hideID" event="onclick" for="contextMenuDefaultID" operation="hide"></rich:componentControl>
<rich:componentControl attachTo="enableID" event="onclick" for="contextMenuDefaultID" operation="enable"></rich:componentControl>
<rich:componentControl attachTo="disableID" event="onclick" for="contextMenuDefaultID" operation="disable"></rich:componentControl>
+ <br/>
+ <br/>
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getChildCount" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText value="#{rich:findComponent('contextMenuDefaultID').childCount}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/DataDefinitionList/DataDefinitionListProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/DataDefinitionList/DataDefinitionListProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/DataDefinitionList/DataDefinitionListProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -4,30 +4,43 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="dataDefinitionListPropertySubviewID">
- <h:panelGrid columns="2">
- <h:outputText value="title" />
- <h:inputText value="#{dataDefinitionList.title}" >
- <a4j:support event="onchange" reRender="ddListID"></a4j:support>
- </h:inputText>
-
- <h:outputText value="first" />
- <h:inputText value="#{dataDefinitionList.first}" >
- <a4j:support event="onchange" reRender="ddListID"></a4j:support>
- </h:inputText>
-
- <h:outputText value="rows" />
- <h:inputText value="#{dataDefinitionList.rows}" >
- <a4j:support event="onchange" reRender="ddListID"></a4j:support>
- </h:inputText>
-
- <h:outputText value="dir" />
- <h:selectOneRadio value="#{dataDefinitionList.dir}">
- <f:selectItem itemValue="LTR" itemLabel="LTR"/>
- <f:selectItem itemValue="RTL" itemLabel="RTL"/>
- <a4j:support event="onchange" reRender="ddListID"></a4j:support>
- </h:selectOneRadio>
+ <h:panelGrid columns="2">
+ <h:outputText value="title" />
+ <h:inputText value="#{dataDefinitionList.title}">
+ <a4j:support event="onchange" reRender="ddListID"></a4j:support>
+ </h:inputText>
- <h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{dataDefinitionList.rendered}" onchange="submit();" />
- </h:panelGrid>
+ <h:outputText value="first" />
+ <h:inputText value="#{dataDefinitionList.first}">
+ <a4j:support event="onchange" reRender="ddListID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="rows" />
+ <h:inputText value="#{dataDefinitionList.rows}">
+ <a4j:support event="onchange" reRender="ddListID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="dir" />
+ <h:selectOneRadio value="#{dataDefinitionList.dir}">
+ <f:selectItem itemValue="LTR" itemLabel="LTR" />
+ <f:selectItem itemValue="RTL" itemLabel="RTL" />
+ <a4j:support event="onchange" reRender="ddListID"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox value="#{dataDefinitionList.rendered}"
+ onchange="submit();" />
+ </h:panelGrid>
+ <br />
+ <br />
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getRowCount" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText
+ value="#{rich:findComponent('ddListID').rowCount}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/DataFilterSlider/DataFilterSliderProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/DataFilterSlider/DataFilterSliderProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/DataFilterSlider/DataFilterSliderProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -10,4 +10,16 @@
<a4j:support event="onclick" reRender="p1"></a4j:support>
</h:selectBooleanCheckbox>
</h:panelGrid>
+ <br />
+ <br />
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getEndRange" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText
+ value="#{rich:findComponent('dfsID').endRange}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedList.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedList.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedList.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -7,7 +7,7 @@
<rich:dataOrderedList id="doListID" value="#{dataOrderedList.arr}" var="arr" first="#{dataOrderedList.first}"
rendered="#{dataOrderedList.rendered}" title="#{dataOrderedList.title}" type="#{dataOrderedList.type}" dir="#{dataOrderedList.dir}"
rows="#{dataOrderedList.rows}"
- columnClasses="#{style.columnClasses}" footerClass="#{style.footerClass}" headerClass="#{style.headerClass}" rowClasses="#{style.rowClasses}" style="#{style.style}" styleClass="#{style.styleClass}" >
+ footerClass="#{style.footerClass}" headerClass="#{style.headerClass}" rowClasses="#{style.rowClasses}" style="#{style.style}" styleClass="#{style.styleClass}" >
<f:facet name="header">
<h:outputText value="Africa(header):" />
</f:facet>
Modified: trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedListProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedListProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/DataOrderedList/DataOrderedListProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -43,4 +43,17 @@
<h:outputText value="rendered" />
<h:selectBooleanCheckbox value="#{dataOrderedList.rendered}" onchange="submit();"/>
</h:panelGrid>
+
+ <br />
+ <br />
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getRowCount" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText
+ value="#{rich:findComponent('doListID').rowCount}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/DataScroller/DataScrollerProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/DataScroller/DataScrollerProperty.jsp 2008-06-30 14:10:46 UTC (rev 9303)
+++ trunk/test-applications/jsp/src/main/webapp/DataScroller/DataScrollerProperty.jsp 2008-06-30 14:25:04 UTC (rev 9304)
@@ -5,90 +5,98 @@
<f:subview id="datascrollerPropertySubviewID">
- <h:commandButton action="#{dataScroller.CutArray}" value="CutArray" />
- <h:commandButton action="#{dataScroller.RestoreArray}"
- value="RestoreArray" />
+ <h:commandButton action="#{dataScroller.CutArray}" value="CutArray" />
+ <h:commandButton action="#{dataScroller.RestoreArray}"
+ value="RestoreArray" />
- <h:panelGrid columns="2">
- <h:outputText value="maxPages" />
- <h:inputText value="#{dataScroller.maxPages}">
- <a4j:support event="onchange" reRender="dataScrollerID"></a4j:support>
- </h:inputText>
+ <h:panelGrid columns="2">
+ <h:outputText value="maxPages" />
+ <h:inputText value="#{dataScroller.maxPages}">
+ <a4j:support event="onchange" reRender="dataScrollerID"></a4j:support>
+ </h:inputText>
- <h:outputText value="Rendered:" />
- <h:selectBooleanCheckbox value="#{dataScroller.render}"
- onclick="submit();" />
+ <h:outputText value="Rendered:" />
+ <h:selectBooleanCheckbox value="#{dataScroller.render}"
+ onclick="submit();" />
- <h:outputText value="renderIfSinglePage:" />
- <h:selectBooleanCheckbox value="#{dataScroller.renderIfSinglePage}"
- onclick="submit();" />
+ <h:outputText value="renderIfSinglePage:" />
+ <h:selectBooleanCheckbox value="#{dataScroller.renderIfSinglePage}"
+ onclick="submit();" />
- <h:outputText value="limitToList:" />
- <h:selectBooleanCheckbox value="#{dataScroller.limitToList}"
- onclick="submit();" />
+ <h:outputText value="limitToList:" />
+ <h:selectBooleanCheckbox value="#{dataScroller.limitToList}"
+ onclick="submit();" />
- <h:outputText value="fastControls" />
- <h:selectOneRadio value="#{dataScroller.fastControls}">
- <f:selectItem itemLabel="auto" itemValue="auto" />
- <f:selectItem itemLabel="show" itemValue="show" />
- <f:selectItem itemLabel="hide" itemValue="hide" />
- <a4j:support event="onclick" reRender="dataTableId"></a4j:support>
- </h:selectOneRadio>
+ <h:outputText value="fastControls" />
+ <h:selectOneRadio value="#{dataScroller.fastControls}">
+ <f:selectItem itemLabel="auto" itemValue="auto" />
+ <f:selectItem itemLabel="show" itemValue="show" />
+ <f:selectItem itemLabel="hide" itemValue="hide" />
+ <a4j:support event="onclick" reRender="dataTableId"></a4j:support>
+ </h:selectOneRadio>
- <h:outputText value="align" />
- <h:selectOneRadio value="#{dataScroller.align}">
- <f:selectItem itemLabel="left" itemValue="left" />
- <f:selectItem itemLabel="right" itemValue="right" />
- <f:selectItem itemLabel="center" itemValue="center" />
- <a4j:support event="onclick" reRender="dataTableId"></a4j:support>
- </h:selectOneRadio>
-
- <h:outputText value="ajaxSingle" />
- <h:selectBooleanCheckbox value="#{dataScroller.ajaxSingle}"></h:selectBooleanCheckbox>
-
- <h:outputText value="boundaryControls" />
- <h:selectOneRadio value="#{dataScroller.boundaryControls}">
- <f:selectItem itemLabel="auto" itemValue="auto" />
- <f:selectItem itemLabel="show" itemValue="show" />
- <f:selectItem itemLabel="hide" itemValue="hide" />
- <a4j:support event="onclick" reRender="dataTableId"></a4j:support>
- </h:selectOneRadio>
-
- <h:outputText value="fastStep"></h:outputText>
- <h:inputText value="#{dataScroller.fastStep}"/>
-
- <h:outputText value="page"/>
- <h:inputText value="#{dataScroller.page}"></h:inputText>
-
- <h:outputText value="value"></h:outputText>
- <h:outputText value="#{dataScroller.value}"></h:outputText>
-
- <h:outputText value="stepControls"></h:outputText>
- <h:selectOneRadio value="#{dataScroller.stepControls}">
- <f:selectItem itemLabel="auto" itemValue="auto" />
- <f:selectItem itemLabel="show" itemValue="show" />
- <f:selectItem itemLabel="hide" itemValue="hide" />
- <a4j:support event="onclick" reRender="dataTableId,dsID"></a4j:support>
- </h:selectOneRadio>
-
- <h:outputText value="sortMode"></h:outputText>
- <h:selectOneRadio value="#{dataScroller.sortMode}">
- <f:selectItem itemLabel="single" itemValue="single"/>
- <f:selectItem itemLabel="multi" itemValue="multi"/>
- <a4j:support event="onchange" reRender="dataTableId,dsID"></a4j:support>
- </h:selectOneRadio>
-
- <h:outputText value="sortOrder"></h:outputText>
- <h:selectOneRadio value="#{dataScroller.currentSortOrder}">
- <f:selectItem itemLabel="ASCENDING" itemValue="ASCENDING"/>
- <f:selectItem itemLabel="DESCENDING" itemValue="DESCENDING"/>
- <f:selectItem itemLabel="UNSORTED" itemValue="UNSORTED"/>
- <a4j:support event="onchange" reRender="dataTableId,dsID"></a4j:support>
- </h:selectOneRadio>
-
- <h:outputText value="selfSorted(1st)"></h:outputText>
- <h:selectBooleanCheckbox value="#{dataScroller.selfSorted}">
- <a4j:support event="onchange" reRender="dataTableId,dsID"></a4j:support>
- </h:selectBooleanCheckbox>
- </h:panelGrid>
+ <h:outputText value="align" />
+ <h:selectOneRadio value="#{dataScroller.align}">
+ <f:selectItem itemLabel="left" itemValue="left" />
+ <f:selectItem itemLabel="right" itemValue="right" />
+ <f:selectItem itemLabel="center" itemValue="center" />
+ <a4j:support event="onclick" reRender="dataTableId"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="ajaxSingle" />
+ <h:selectBooleanCheckbox value="#{dataScroller.ajaxSingle}"></h:selectBooleanCheckbox>
+
+ <h:outputText value="boundaryControls" />
+ <h:selectOneRadio value="#{dataScroller.boundaryControls}">
+ <f:selectItem itemLabel="auto" itemValue="auto" />
+ <f:selectItem itemLabel="show" itemValue="show" />
+ <f:selectItem itemLabel="hide" itemValue="hide" />
+ <a4j:support event="onclick" reRender="dataTableId"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="fastStep"></h:outputText>
+ <h:inputText value="#{dataScroller.fastStep}" />
+
+ <h:outputText value="value"></h:outputText>
+ <h:outputText value="#{dataScroller.value}"></h:outputText>
+
+ <h:outputText value="stepControls"></h:outputText>
+ <h:selectOneRadio value="#{dataScroller.stepControls}">
+ <f:selectItem itemLabel="auto" itemValue="auto" />
+ <f:selectItem itemLabel="show" itemValue="show" />
+ <f:selectItem itemLabel="hide" itemValue="hide" />
+ <a4j:support event="onclick" reRender="dataTableId,dsID"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="sortMode"></h:outputText>
+ <h:selectOneRadio value="#{dataScroller.sortMode}">
+ <f:selectItem itemLabel="single" itemValue="single" />
+ <f:selectItem itemLabel="multi" itemValue="multi" />
+ <a4j:support event="onchange" reRender="dataTableId,dsID"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="sortOrder"></h:outputText>
+ <h:selectOneRadio value="#{dataScroller.currentSortOrder}">
+ <f:selectItem itemLabel="ASCENDING" itemValue="ASCENDING" />
+ <f:selectItem itemLabel="DESCENDING" itemValue="DESCENDING" />
+ <f:selectItem itemLabel="UNSORTED" itemValue="UNSORTED" />
+ <a4j:support event="onchange" reRender="dataTableId,dsID"></a4j:support>
+ </h:selectOneRadio>
+
+ <h:outputText value="selfSorted(1st)"></h:outputText>
+ <h:selectBooleanCheckbox value="#{dataScroller.selfSorted}">
+ <a4j:support event="onchange" reRender="dataTableId,dsID"></a4j:support>
+ </h:selectBooleanCheckbox>
+ </h:panelGrid>
+ <br />
+ <br />
+ <div style="FONT-WEIGHT: bold;">rich:findComponent</div>
+ <h:panelGrid columns="2">
+ <rich:column>
+ <a4j:commandLink value="getPage" reRender="findID"></a4j:commandLink>
+ </rich:column>
+ <rich:column id="findID">
+ <h:outputText value="#{rich:findComponent('dsID').page}" />
+ </rich:column>
+ </h:panelGrid>
</f:subview>
\ No newline at end of file
16 years, 5 months
JBoss Rich Faces SVN: r9303 - Plan/3.2.0 and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-06-30 10:10:46 -0400 (Mon, 30 Jun 2008)
New Revision: 9303
Modified:
trunk/test-applications/qa/Test Plan/3.2.0/TestPlan-RF-3.2.0.doc
Log:
Modified: trunk/test-applications/qa/Test Plan/3.2.0/TestPlan-RF-3.2.0.doc
===================================================================
(Binary files differ)
16 years, 5 months
JBoss Rich Faces SVN: r9302 - trunk/framework/impl/src/main/java/org/ajax4jsf/request.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-06-30 10:05:50 -0400 (Mon, 30 Jun 2008)
New Revision: 9302
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
solve problems with filename encoding
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-06-30 14:02:22 UTC (rev 9301)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-06-30 14:05:50 UTC (rev 9302)
@@ -32,102 +32,102 @@
* @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 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 static final int BUFFER_SIZE = 2048;
+ private static final int CHUNK_SIZE = 512;
- private boolean createTempFiles;
-
- private String uid;
+ private boolean createTempFiles;
- private String encoding = null;
+ private String uid;
- private Integer contentLength = 0;
+ private String encoding = null;
- private int read = 0;
-
- private Map<String, Param> parameters = null;
-
- private Map<String, Object> percentMap = null;
+ private Integer contentLength = 0;
- private enum ReadState {
- BOUNDARY, HEADERS, DATA
- }
+ private int read = 0;
- private static final byte CR = 0x0d;
- private static final byte LF = 0x0a;
- private static final byte[] CR_LF = { CR, LF };
+ private Map<String, Param> parameters = null;
- private abstract class Param {
- private String name;
+ private Map<String, Object> percentMap = null;
- public Param(String name) {
- this.name = name;
+ private enum ReadState {
+ BOUNDARY, HEADERS, DATA
}
- public String getName() {
- return name;
- }
+ private static final byte CR = 0x0d;
+ private static final byte LF = 0x0a;
+ private static final byte[] CR_LF = { CR, LF };
- public abstract void appendData(byte[] data, int start, int length)
- throws IOException;
+ private abstract class Param {
+ private String name;
- }
+ public Param(String name) {
+ this.name = name;
+ }
- private class ValueParam extends Param {
- private Object value = null;
- private ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ public String getName() {
+ return name;
+ }
- public ValueParam(String name) {
- super(name);
- }
+ public abstract void appendData(byte[] data, int start, int length)
+ throws IOException;
- @Override
- public void appendData(byte[] data, int start, int length)
- throws IOException {
- // read += length;
- 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;
+ private class ValueParam extends Param {
+ private Object value = null;
+ private ByteArrayOutputStream buf = new ByteArrayOutputStream();
+
+ public ValueParam(String name) {
+ super(name);
}
- ((List) value).add(val);
- }
- buf.reset();
- }
+ @Override
+ public void appendData(byte[] data, int start, int length)
+ throws IOException {
+ // read += length;
+ buf.write(data, start, length);
+ }
- public Object getValue() {
- return value;
+ 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 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 Object getFile() {
+ private ByteArrayOutputStream bOut = null;
+ private FileOutputStream fOut = null;
+ private File tempFile = null;
+
+ public FileParam(String name) {
+ super(name);
+ }
+
+ public Object getFile() {
if (null != tempFile) {
if (fOut != null) {
try {
@@ -141,42 +141,42 @@
return bOut.toByteArray();
}
return null;
- }
+ }
- public String getFilename() {
- return filename;
- }
+ public String getFilename() {
+ return filename;
+ }
- public void setFilename(String filename) {
- this.filename = filename;
- }
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
- public String getContentType() {
- return contentType;
- }
+ public String getContentType() {
+ return contentType;
+ }
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
- public int getFileSize() {
- return fileSize;
- }
+ public int getFileSize() {
+ return fileSize;
+ }
- public File createTempFile() {
- try {
+ public File 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");
- }
- return tempFile;
- }
-
- public void deleteFile() {
+ 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");
+ }
+ return tempFile;
+ }
+
+ public void deleteFile() {
try {
if (fOut != null) {
fOut.close();
@@ -189,508 +189,525 @@
}
}
- @Override
- public void appendData(byte[] data, int start, int length)
- throws IOException {
- // read += length;
- if (fOut != null) {
- fOut.write(data, start, length);
- fOut.flush();
- } else {
- if (bOut == null)
- bOut = new ByteArrayOutputStream();
- bOut.write(data, start, length);
- }
+ @Override
+ public void appendData(byte[] data, int start, int length)
+ throws IOException {
+ // read += length;
+ 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) {
+ fileSize += length;
}
- 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);
+ public byte[] getData() {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException ex) {
+ }
+ fOut = null;
}
- bOut.flush();
- fIn.close();
- tempFile.delete();
- return bOut.toByteArray();
- } catch (IOException ex) { /* too bad? */
- }
- }
- }
+ 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();
- return null;
- }
+ fIn.close();
+ tempFile.delete();
+ return bOut.toByteArray();
+ } catch (IOException ex) { /* too bad? */
+ }
+ }
+ }
- public InputStream getInputStream() {
- if (fOut != null) {
- try {
- fOut.close();
- } catch (IOException ex) {
+ return null;
}
- 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();
+ public InputStream getInputStream() {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException ex) {
+ }
+ fOut = null;
}
- };
- } catch (FileNotFoundException ex) {
+
+ 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;
}
- }
-
- return null;
}
- }
- private HttpServletRequest request;
-
- private boolean shouldStop = false;
+ private HttpServletRequest request;
- public MultipartRequest(HttpServletRequest request,
- boolean createTempFiles, int maxRequestSize, String uid) {
- super(request);
- this.request = request;
- this.createTempFiles = createTempFiles;
- this.uid = uid;
+ private boolean shouldStop = false;
- String contentLength = request.getHeader("Content-Length");
- this.contentLength = Integer.parseInt(contentLength);
- if (contentLength != null && maxRequestSize > 0
- && this.contentLength > maxRequestSize) {
- //TODO : we should make decision if can generate exception in this place
- //throw new FileUploadException(
- // "Multipart request is larger than allowed size");
+ public MultipartRequest(HttpServletRequest request,
+ boolean createTempFiles, int maxRequestSize, String uid) {
+ super(request);
+ this.request = request;
+ this.createTempFiles = createTempFiles;
+ this.uid = uid;
+
+ String contentLength = request.getHeader("Content-Length");
+ this.contentLength = Integer.parseInt(contentLength);
+ if (contentLength != null && maxRequestSize > 0
+ && this.contentLength > maxRequestSize) {
+ // TODO : we should make decision if can generate exception in this
+ // place
+ // throw new FileUploadException(
+ // "Multipart request is larger than allowed size");
+ }
}
- }
- private String decodeFileName(String name) {
- String fileName = null;
- try {
- StringBuffer buffer = new StringBuffer();
- String[] codes = name.split(";");
- if (codes != null) {
- for (String code : codes) {
- if (code.startsWith("&")) {
- String sCode = code.replaceAll("[&#]*", "");
- Integer iCode = Integer.parseInt(sCode);
- buffer.append(Character.toChars(iCode));
- } else {
- buffer.append(code);
+ private String decodeFileName(String name) {
+ String fileName = null;
+ if (request.getParameter("_richfaces_send_http_error") != null) { // Flash upload
+ try {
+ fileName = new String(name.getBytes("ISO-8859-1"), "UTF-8");
+ } catch (Exception e) {
+
+ }
+ } else {
+ try {
+ StringBuffer buffer = new StringBuffer();
+ String[] codes = name.split(";");
+ if (codes != null) {
+ for (String code : codes) {
+ if (code.startsWith("&")) {
+ String sCode = code.replaceAll("[&#]*", "");
+ Integer iCode = Integer.parseInt(sCode);
+ buffer.append(Character.toChars(iCode));
+ } else {
+ buffer.append(code);
+ }
}
+ fileName = buffer.toString();
}
- fileName = buffer.toString();
+ } catch (Exception e) {
+ fileName = name;
}
- } catch (Exception e) {
- fileName = name;
}
return fileName;
}
-
- public void cancel() {
- if (parameters != null) {
- Iterator<Param> it = parameters.values().iterator();
- while (it.hasNext()) {
- Param p = it.next();
- if (p instanceof FileParam) {
- ((FileParam)p).deleteFile();
- }
- }
- }
- }
- public boolean parseRequest() {
- byte[] boundaryMarker = getBoundaryMarker(request.getContentType());
- if (boundaryMarker == null) {
- throw new FileUploadException("The request was rejected because "
- + "no multipart boundary was found");
- }
+ public void cancel() {
+ if (parameters != null) {
+ Iterator<Param> it = parameters.values().iterator();
+ while (it.hasNext()) {
+ Param p = it.next();
+ if (p instanceof FileParam) {
+ ((FileParam) p).deleteFile();
+ }
+ }
+ }
+ }
- encoding = request.getCharacterEncoding();
+ public boolean parseRequest() {
+ byte[] boundaryMarker = getBoundaryMarker(request.getContentType());
+ if (boundaryMarker == null) {
+ throw new FileUploadException("The request was rejected because "
+ + "no multipart boundary was found");
+ }
- parameters = new HashMap<String, Param>();
-
- int loopCounter = 20; // 20 attempts to read not-readable data
-
- this.percentMap = getProgressData();
+ encoding = request.getCharacterEncoding();
- try {
- byte[] buffer = new byte[BUFFER_SIZE];
- Map<String, String> headers = new HashMap<String, String>();
+ parameters = new HashMap<String, Param>();
- ReadState readState = ReadState.BOUNDARY;
+ int loopCounter = 20; // 20 attempts to read not-readable data
- InputStream input = request.getInputStream();
- if (!shouldStop) {
+ this.percentMap = getProgressData();
- int read = input.read(buffer);
- int pos = 0;
+ try {
+ byte[] buffer = new byte[BUFFER_SIZE];
+ Map<String, String> headers = new HashMap<String, String>();
- Param p = null;
+ ReadState readState = ReadState.BOUNDARY;
- while (read > 0 && loopCounter > 0) {
- 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;
+ InputStream input = request.getInputStream();
+ if (!shouldStop) {
- }
- 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);
+ int read = input.read(buffer);
+ int pos = 0;
- if (checkSequence(buffer, i + CR_LF.length, CR_LF)) {
- readState = ReadState.DATA;
- i += CR_LF.length;
- pos = i + 1;
+ Param p = null;
- 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(decodeFileName(headers
- .get(PARAM_FILENAME)));
- p = fp;
- } else {
- if (parameters.containsKey(paramName)) {
- p = parameters.get(paramName);
- } else {
- p = new ValueParam(paramName);
- }
- }
+ while (read > 0 && loopCounter > 0) {
+ 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;
- if (!parameters.containsKey(paramName)) {
- parameters.put(paramName, p);
- }
- }
+ }
+ 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);
- 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 (checkSequence(buffer, i + CR_LF.length,
+ CR_LF)) {
+ readState = ReadState.DATA;
+ i += CR_LF.length;
+ pos = i + 1;
- if (p instanceof ValueParam)
- ((ValueParam) p).complete();
+ 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(decodeFileName(headers
+ .get(PARAM_FILENAME)));
+ p = fp;
+ } else {
+ if (parameters
+ .containsKey(paramName)) {
+ p = parameters.get(paramName);
+ } else {
+ p = new ValueParam(paramName);
+ }
+ }
- if (checkSequence(buffer, i + CR_LF.length, CR_LF)) {
- i += CR_LF.length;
- pos = i + 1;
- } else {
- pos = i;
- }
+ if (!parameters.containsKey(paramName)) {
+ parameters.put(paramName, p);
+ }
+ }
- 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;
+ 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);
+ }
- }
- break;
- }
- }
- }
+ if (p instanceof ValueParam)
+ ((ValueParam) p).complete();
- if (!shouldStop) {
- 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);
- if (read <= 0) {
- loopCounter--;
- }
- read += bytesNotRead;
- } else {
- read = input.read(buffer);
- }
- this.read += pos;
- pos = 0;
- fillProgressInfo();
- } else {
- cancel();
- return false;
- }
- }
+ if (checkSequence(buffer, i + CR_LF.length,
+ CR_LF)) {
+ i += CR_LF.length;
+ pos = i + 1;
+ } else {
+ pos = i;
+ }
-// if (((Double)percentMap.get(uid)).compareTo(99.0) < 0) {
-// return false;
-// }
- return true;
- } else {
- cancel();
- return false;
- }
- } catch (IOException ex) {
- throw new FileUploadException("IO Error parsing multipart request",
- ex);
- }
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, Object> getProgressData () {
- percentMap = (Map<String, Object>)getSession().getAttribute(Filter.PERCENT_BEAN_NAME);
- return percentMap;
- }
-
- private void fillProgressInfo () {
- Double percent = (Double) (100.0 * this.read / this.contentLength);
- percentMap.put(uid, percent);
- //this.percent = percent;
- }
+ 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;
- private byte[] getBoundaryMarker(String contentType) {
- Map<String, String> params = parseParams(contentType, ";");
- String boundaryStr = (String) params.get("boundary");
+ }
+ break;
+ }
+ }
+ }
- if (boundaryStr == null)
- return null;
+ if (!shouldStop) {
+ 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);
+ if (read <= 0) {
+ loopCounter--;
+ }
+ read += bytesNotRead;
+ } else {
+ read = input.read(buffer);
+ }
+ this.read += pos;
+ pos = 0;
+ fillProgressInfo();
+ } else {
+ cancel();
+ return false;
+ }
+ }
+
+ return true;
+ } else {
+ cancel();
+ return false;
+ }
+ } catch (IOException ex) {
+ throw new FileUploadException("IO Error parsing multipart request",
+ ex);
+ }
+ }
- try {
- return boundaryStr.getBytes("ISO-8859-1");
- } catch (UnsupportedEncodingException e) {
- return boundaryStr.getBytes();
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getProgressData() {
+ percentMap = (Map<String, Object>) getSession().getAttribute(
+ Filter.PERCENT_BEAN_NAME);
+ return percentMap;
}
- }
- /**
- * 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;
+ private void fillProgressInfo() {
+ Double percent = (Double) (100.0 * this.read / this.contentLength);
+ percentMap.put(uid, percent);
+ // this.percent = percent;
+ }
- for (int i = 0; i < seq.length; i++) {
- if (data[(pos - seq.length) + i + 1] != seq[i])
- return false;
+ private byte[] getBoundaryMarker(String contentType) {
+ Map<String, String> 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();
+ }
}
- return true;
- }
+ /**
+ * 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;
- private static final Pattern PARAM_VALUE_PATTERN = Pattern
- .compile("^\\s*([^\\s=]+)\\s*[=:]\\s*(.+)\\s*$");
-
- private static final Pattern FILE_NAME_PATTERN = Pattern
- .compile(".*filename=\"(.*)\"");
+ for (int i = 0; i < seq.length; i++) {
+ if (data[(pos - seq.length) + i + 1] != seq[i])
+ return false;
+ }
- private Map<String, String> parseParams(String paramStr, String separator) {
- Map<String, String> paramMap = new HashMap<String, String>();
- parseParams(paramStr, separator, paramMap);
- return paramMap;
- }
+ return true;
+ }
- private void parseParams(String paramStr, String separator, Map<String, String> paramMap) {
- String[] parts = paramStr.split(separator);
+ private static final Pattern PARAM_VALUE_PATTERN = Pattern
+ .compile("^\\s*([^\\s=]+)\\s*[=:]\\s*(.+)\\s*$");
- for (String part : parts) {
- Matcher m = PARAM_VALUE_PATTERN.matcher(part);
- if (m.matches()) {
- String key = m.group(1);
- String value = m.group(2);
+ private static final Pattern FILE_NAME_PATTERN = Pattern
+ .compile(".*filename=\"(.*)\"");
- // Strip double quotes
- if (value.startsWith("\"") && value.endsWith("\""))
- value = value.substring(1, value.length() - 1);
- if (!"filename".equals(key)) {
- paramMap.put(key, value);
- }else {
- paramMap.put(key, parseFileName(paramStr));
+ private Map<String, String> 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<String, String> 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);
+ if (!"filename".equals(key)) {
+ paramMap.put(key, value);
+ } else {
+ paramMap.put(key, parseFileName(paramStr));
+ }
+ }
}
- }
}
- }
-
- private String parseFileName(String parseStr) {
- Matcher m = FILE_NAME_PATTERN.matcher(parseStr);
- if (m.matches()) {
- String name = m.group(1);
- if (name.startsWith("&")) {
- return decodeFileName(name);
- } else{
- return name;
+
+ private String parseFileName(String parseStr) {
+ Matcher m = FILE_NAME_PATTERN.matcher(parseStr);
+ if (m.matches()) {
+ String name = m.group(1);
+ if (name.startsWith("&")) {
+ return decodeFileName(name);
+ } else {
+ return name;
+ }
}
+ return null;
}
- return null;
- }
- private Param getParam(String name) {
- if (parameters == null)
- parseRequest();
- return parameters.get(name);
- }
-
-
- public Integer getSize() {
- return contentLength;
- }
+ private Param getParam(String name) {
+ if (parameters == null)
+ parseRequest();
+ return parameters.get(name);
+ }
- @Override
- public Enumeration getParameterNames() {
- if (parameters == null)
- parseRequest();
+ public Integer getSize() {
+ return contentLength;
+ }
- return Collections.enumeration(parameters.keySet());
- }
+ @Override
+ public Enumeration getParameterNames() {
+ if (parameters == null)
+ parseRequest();
- public byte[] getFileBytes(String name) {
- Param p = getParam(name);
- return (p != null && p instanceof FileParam) ? ((FileParam) p)
- .getData() : null;
- }
+ return Collections.enumeration(parameters.keySet());
+ }
- public InputStream getFileInputStream(String name) {
- Param p = getParam(name);
- return (p != null && p instanceof FileParam) ? ((FileParam) p)
- .getInputStream() : null;
- }
+ public byte[] getFileBytes(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getData() : null;
+ }
- public String getFileContentType(String name) {
- Param p = getParam(name);
- return (p != null && p instanceof FileParam) ? ((FileParam) p)
- .getContentType() : null;
- }
-
- public Object getFile(String name) {
- Param p = getParam(name);
- return (p != null && p instanceof FileParam) ? ((FileParam) p)
- .getFile() : null;
- }
-
- public String getFileName(String name) {
- Param p = getParam(name);
- return (p != null && p instanceof FileParam) ? ((FileParam) p)
- .getFilename() : null;
- }
+ public InputStream getFileInputStream(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getInputStream() : null;
+ }
- public int getFileSize(String name) {
- Param p = getParam(name);
- return (p != null && p instanceof FileParam) ? ((FileParam) p)
- .getFileSize() : -1;
- }
+ public String getFileContentType(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getContentType() : null;
+ }
- @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);
+ public Object getFile(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getFile() : null;
}
- return null;
- }
+ public String getFileName(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getFilename() : 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);
+ public int getFileSize(String name) {
+ Param p = getParam(name);
+ return (p != null && p instanceof FileParam) ? ((FileParam) p)
+ .getFileSize() : -1;
}
- }
- @Override
- public Map getParameterMap() {
- if (parameters == null)
- parseRequest();
+ @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);
+ }
- Map<String, Object> params = new HashMap<String, Object>(super
- .getParameterMap());
+ return null;
+ }
- 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));
+ @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);
}
- }
}
- return params;
- }
-
- public void stop() {
- shouldStop = true;
- }
+ @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;
+ }
+
+ public void stop() {
+ shouldStop = true;
+ }
}
16 years, 5 months
JBoss Rich Faces SVN: r9301 - in trunk/samples/richfaces-demo/src/main: java/org/richfaces/demo/calendar and 12 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-06-30 10:02:22 -0400 (Mon, 30 Jun 2008)
New Revision: 9301
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/scripts/
trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
Modified:
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml
Log:
organiser demo started
hotKey demo draft finished
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelImpl.java 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,187 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo.calendar.modelImpl;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.event.ValueChangeEvent;
+
+import org.richfaces.model.CalendarDataModel;
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class CalendarDataModelImpl implements CalendarDataModel {
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModel#getData(java.util.Date[])
+ */
+
+ private CalendarDataModelItem[] items;
+
+ private String currentDescription;
+ private String currentShortDescription;
+ private Date currentDate;
+ private boolean currentDisabled;
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.CalendarDataModel#getData(java.util.Date[])
+ */
+ public CalendarDataModelItem[] getData(Date[] dateArray) {
+ if (dateArray == null) {
+ return null;
+ }
+ if (items==null) {
+ items = new CalendarDataModelItem[dateArray.length];
+ for (int i = 0; i < dateArray.length; i++) {
+ items[i] = createDataModelItem(dateArray[i]);
+ }
+ }
+ return items;
+ }
+
+ /**
+ * @param date
+ * @return CalendarDataModelItem for date
+ */
+ protected CalendarDataModelItem createDataModelItem(Date date) {
+ CalendarDataModelItemImpl item = new CalendarDataModelItemImpl();
+ Map data = new HashMap();
+ data.put("shortDescription", "Nothing planned");
+ data.put("description", "");
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ item.setDay(c.get(Calendar.DAY_OF_MONTH));
+ item.setEnabled(true);
+ item.setStyleClass("rel-hol");
+ item.setData(data);
+ return item;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.CalendarDataModel#getToolTip(java.util.Date)
+ */
+ public Object getToolTip(Date date) {
+
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @return items
+ */
+ public CalendarDataModelItem[] getItems() {
+ return items;
+ }
+
+ /**
+ * @param setter for items
+ */
+ public void setItems(CalendarDataModelItem[] items) {
+ this.items = items;
+ }
+
+ /**
+ * @param valueChangeEvent handling
+ */
+ public void valueChanged(ValueChangeEvent event) {
+ System.out.println(event.getNewValue()+"selected");
+ setCurrentDate((Date)event.getNewValue());
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(getCurrentDate());
+ setCurrentDescription((String)((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).get("description"));
+ setCurrentShortDescription((String)((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).get("shortDescription"));
+ }
+
+ /**
+ * Storing changes action
+ */
+ public void storeDayDetails() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(getCurrentDate());
+ ((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).put("shortDescription", getCurrentShortDescription());
+ ((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).put("description", getCurrentDescription());
+ }
+
+ /**
+ * @return currentDescription
+ */
+ public String getCurrentDescription() {
+ return currentDescription;
+ }
+
+ /**
+ * @param currentDescription
+ */
+ public void setCurrentDescription(String currentDescription) {
+ this.currentDescription = currentDescription;
+ }
+
+ /**
+ * @return currentDisabled
+ */
+ public boolean isCurrentDisabled() {
+ return currentDisabled;
+ }
+
+ /**
+ * @param currentDisabled
+ */
+ public void setCurrentDisabled(boolean currentDisabled) {
+ this.currentDisabled = currentDisabled;
+ }
+
+ /**
+ * @return currentShortDescription
+ */
+ public String getCurrentShortDescription() {
+ return currentShortDescription;
+ }
+
+ /**
+ * @param currentShortDescription
+ */
+ public void setCurrentShortDescription(String currentShortDescription) {
+ this.currentShortDescription = currentShortDescription;
+ }
+
+ /**
+ * @return currentDate
+ */
+ public Date getCurrentDate() {
+ return currentDate;
+ }
+
+ /**
+ * @param currentDate
+ */
+ public void setCurrentDate(Date currentDate) {
+ this.currentDate = currentDate;
+ }
+
+}
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/modelImpl/CalendarDataModelItemImpl.java 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,111 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.demo.calendar.modelImpl;
+
+import org.richfaces.model.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 04.07.2007
+ *
+ */
+public class CalendarDataModelItemImpl implements CalendarDataModelItem {
+
+ private Object data;
+ private String styleClass;
+ private Object toolTip;
+ private int day;
+ private boolean enabled = true;
+
+
+ public int getDay() {
+ return day;
+ }
+
+ public void setDay(int day) {
+ this.day = day;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#getData()
+ */
+ public Object getData() {
+ return data;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#getStyleClass()
+ */
+ public String getStyleClass() {
+ return styleClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#getToolTip()
+ */
+ public Object getToolTip() {
+ return toolTip;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#hasToolTip()
+ */
+ public boolean hasToolTip() {
+ return getToolTip() != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.CalendarDataModelItem#isEnabled()
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @param data the data to set
+ */
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ /**
+ * @param styleClass the styleClass to set
+ */
+ public void setStyleClass(String styleClass) {
+ this.styleClass = styleClass;
+ }
+
+ /**
+ * @param toolTip the toolTip to set
+ */
+ public void setToolTip(Object toolTip) {
+ this.toolTip = toolTip;
+ }
+
+ /**
+ * @param enabled the enabled to set
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+}
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/slides/SlidesBean.java 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,82 @@
+/**
+ *
+ */
+package org.richfaces.demo.slides;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+public class SlidesBean {
+
+ private final static String FILE_EXT = ".jpg";
+ private final static int FILES_COUNT = 8;
+ private final static String PATH_PREFIX = "/richfaces/jQuery/images/";
+ private final static String PIC_NAME = "pic";
+
+ private List<String> pictures;
+ private int currentIndex = 1;
+
+ public SlidesBean() {
+ pictures = new ArrayList<String>();
+ for (int i = 1; i <= FILES_COUNT; i++) {
+ pictures.add(PATH_PREFIX + PIC_NAME + i + FILE_EXT);
+ }
+ }
+
+ public void next() {
+ if (currentIndex<FILES_COUNT) {
+ currentIndex++;
+ }else{
+ setCurrentIndex(1);
+ }
+ }
+
+ public void previous() {
+ if (currentIndex>1) {
+ currentIndex--;
+ }else
+ {
+ setCurrentIndex(FILES_COUNT);
+ }
+ }
+
+ public List<String> getPictures() {
+ return pictures;
+ }
+
+ public void setPictures(List<String> pictures) {
+ this.pictures = pictures;
+ }
+
+ public int getCurrentIndex() {
+ return currentIndex;
+ }
+
+ public void setCurrentIndex(int currentIndex) {
+ this.currentIndex = currentIndex;
+ }
+
+ public String getCurrentPicture() {
+ return pictures.get(currentIndex-1);
+ }
+
+ public static String getFILE_EXT() {
+ return FILE_EXT;
+ }
+
+ public static int getFILES_COUNT() {
+ return FILES_COUNT;
+ }
+
+ public static String getPATH_PREFIX() {
+ return PATH_PREFIX;
+ }
+
+ public static String getPIC_NAME() {
+ return PIC_NAME;
+ }
+}
Modified: trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2008-06-30 13:34:04 UTC (rev 9300)
+++ trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2008-06-30 14:02:22 UTC (rev 9301)
@@ -82,4 +82,5 @@
columns =richDataIterators, \t Columns, \t\t\t/images/ico_columns.gif, \t\t/images/cn_Columns.gif, columns.html, jbossrichfaces/freezone/docs/tlddoc/rich/columns.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/taglib/ColumnsTag.html, \t\t\t\t\t/richfaces/columns.jsf
fileUpload =richInputs, \t File Upload, \t\t/images/ico_FileUpload.gif, \t\t/images/cn_FileUpload.gif, fileUpload.html, jbossrichfaces/freezone/docs/tlddoc/rich/fileUpload.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIFileUpload.html, \t\t\t\t\t/richfaces/fileUpload.jsf
StandardSkinning =richMisc, \t Standard Skinning, \t\t/images/ico_StandardComponentsSkinning.gif, \t\t/images/cn_StandardComponentsSkinning.gif, ArchitectureOverview.html\#StControlsSkinning, jbossrichfaces/freezone/docs/tlddoc/rich/StandardSkinning.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html, \t\t\t\t\t/richfaces/standardSkinning.jsf
-plugnskin =richMisc, \t Plug'n'Skin, \t\t/images/ico_plugnskin.gif, \t\t/images/cn_plugnskin.gif, ArchitectureOverview.html\#plugnskin, jbossrichfaces/freezone/docs/tlddoc/rich/plugnskin.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html, \t\t\t\t\t/richfaces/plugnskin.jsf
\ No newline at end of file
+plugnskin =richMisc, \t Plug'n'Skin, \t\t/images/ico_plugnskin.gif, \t\t/images/cn_plugnskin.gif, ArchitectureOverview.html\#plugnskin, jbossrichfaces/freezone/docs/tlddoc/rich/plugnskin.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIfileUpload.html, \t\t\t\t\t/richfaces/plugnskin.jsf
+hotKey=richMisc, \t Hot Key, \t\t/images/ico_hotkey.gif, \t\t/images/cn_hotkey.gif, ArchitectureOverview.html\#hotkey, jbossrichfaces/freezone/docs/tlddoc/rich/hotkey.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIhotkey.html, \t\t\t\t\t/richfaces/hotKey.jsf
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-06-30 13:34:04 UTC (rev 9300)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -313,6 +313,16 @@
<managed-bean-class>org.richfaces.demo.push.PushBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>calendarDataModelImpl</managed-bean-name>
+ <managed-bean-class>org.richfaces.demo.calendar.modelImpl.CalendarDataModelImpl</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>slidesBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.demo.slides.SlidesBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<navigation-rule>
<from-view-id>/richfaces/include/examples/wstep1.xhtml</from-view-id>
<navigation-case>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/organiser.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,50 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:form id="form">
+ <rich:messages/>
+ <rich:calendar value="#{calendarBean.selectedDate}"
+ popup="false" showApplyButton="false"
+ cellWidth="120px" cellHeight="120px"
+ boundaryDatesMode="none" showWeeksBar="false"
+ dataModel="#{calendarDataModel}" oncurrentdateselect="return false" id="organizer" valueChangeListener="#{calendarDataModel.valueChanged}" showFooter="false">
+ <f:facet name="header">
+ <h:outputText value="{currentMonthControl}"/>
+ </f:facet>
+ <a4j:outputPanel layout="block" id="cell">
+ <h:panelGrid columns="1">
+ <h:outputText value="{day}" style="align:center"/>
+ <h:outputText value="{data.shortDescription}"/>
+ <h:outputText value="{data.description}"/>
+ </h:panelGrid>
+ <rich:contextMenu attached="true" disableDefaultMenu="true" submitMode="ajax" event="oncontextmenu" id="menu">
+ <rich:menuItem value="Disable({day})"/>
+ </rich:contextMenu>
+ </a4j:outputPanel>
+ <a4j:support event="onchanged" oncomplete="#{rich:component('panel')}.show()" reRender="editContent"/>
+ </rich:calendar>
+ </h:form>
+ <rich:modalPanel id="panel">
+ <f:facet name="header">Edit Day:</f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/modal/close.png" style="cursor:pointer" id="hidelink"/>
+ <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+ <h:form>
+ <h:panelGrid columns="2" id="editContent">
+ <h:outputText value="Short Descrition:"/>
+ <h:inputText value="#{calendarDataModel.currentShortDescription}"/>
+ <h:outputText value="Day Notes:"/>
+ <h:inputTextarea value="#{calendarDataModel.currentDescription}"/>
+ <a4j:commandButton value="Store" action="#{calendarDataModel.storeDayDetails}" id="storebutton" oncomplete="#{rich:component('panel')}.hide()" reRender="organizer"/>
+ <button type="button" id="cancelbutton" onclick="#{rich:component('panel')}.hide()">Cancel</button>
+ </h:panelGrid>
+ </h:form>
+ </rich:modalPanel>
+</ui:composition>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/organizer.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+ <p>
+ Description
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Calendar Demo</legend>
+ <div class="sample-container" >
+ <ui:include src="/richfaces/calendar/examples/organiser.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/calendar/examples/organiser.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ <p>
+ More description
+ </p>
+ </ui:define>
+
+</ui:composition>
+</html>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml 2008-06-30 13:34:04 UTC (rev 9300)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -13,6 +13,9 @@
<rich:tab name="usage" label="Usage">
<ui:include src="/richfaces/calendar/usage.xhtml" />
</rich:tab>
+ <rich:tab name="organizer" label="Organizer Creation">
+ <ui:include src="/richfaces/calendar/organizer.xhtml" />
+ </rich:tab>
<rich:tab name="model" label="Calendar Model">
<ui:include src="/richfaces/calendar/model.xhtml" />
</rich:tab>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml 2008-06-30 13:34:04 UTC (rev 9300)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/contextMenu/example/menu.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -15,26 +15,16 @@
text-align:left;
}
</style>
+ <a4j:loadScript src="/scripts/picturesUtils.js"/>
<h:panelGrid columns="1" columnClasses="cent">
<h:panelGroup id="picture">
<h:graphicImage value="/richfaces/jQuery/images/pic1.jpg" id="pic" style="border : 5px solid #E4EAEF"/>
<rich:contextMenu event="oncontextmenu" attachTo="pic" submitMode="none">
- <rich:menuItem value="Zoom In" onclick="enlarge();" id="zin"></rich:menuItem>
- <rich:menuItem value="Zoom Out" onclick="decrease();" id="zout"></rich:menuItem>
+ <rich:menuItem value="Zoom In" onclick="enlarge('pic');" id="zin"></rich:menuItem>
+ <rich:menuItem value="Zoom Out" onclick="decrease('pic');" id="zout"></rich:menuItem>
</rich:contextMenu>
</h:panelGroup>
</h:panelGrid>
- <script type="text/javascript">
- function enlarge(){
- document.getElementById('pic').width=document.getElementById('pic').width*1.1;
- document.getElementById('pic').height=document.getElementById('pic').height*1.1;
- }
- function decrease(){
- document.getElementById('pic').width=document.getElementById('pic').width*0.9;
- document.getElementById('pic').height=document.getElementById('pic').height*0.9;
- }
- </script>
-
</ui:composition>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/example.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition>
+ <a4j:loadScript src="/scripts/picturesUtils.js"/>
+ <h:form>
+ <a4j:jsFunction name="prev" action="#{slidesBean.previous}" reRender="slideContainer"/>
+ <a4j:jsFunction name="next" action="#{slidesBean.next}" reRender="slideContainer"/>
+ </h:form>
+ <rich:panel id="slideContainer">
+ <f:facet name="header">
+ <h:outputText value="Image #{slidesBean.currentIndex}"/>
+ </f:facet>
+ <h:graphicImage value="#{slidesBean.currentPicture}" id="pic"/>
+ </rich:panel>
+ <rich:hotKey key="ctrl+up" handler="enlarge('#{rich:clientId('pic')}');return false;"/>
+ <rich:hotKey key="ctrl+down" handler="decrease('#{rich:clientId('pic')}');return false;"/>
+ <rich:hotKey key="ctrl+left" handler="prev();return false;"/>
+ <rich:hotKey key="ctrl+right" handler="next();return false;"/>
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/examples/inputNumbers.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:a4j="http://richfaces.org/a4j">
+
+ <ui:composition>
+ <rich:listShuttle var="cap" sourceValue="#{capitalsBean.capitals}" id="ls"
+ sourceListWidth="300px" targetListWidth="300px">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="State flag"/>
+ </f:facet>
+ <h:graphicImage value="#{cap.stateFlag}"/>
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="State name"/>
+ </f:facet>
+ <h:outputText value="#{cap.name}"/>
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="State capital"/>
+ </f:facet>
+ <h:outputText value="#{cap.state}"/>
+ </rich:column>
+ </rich:listShuttle>
+ <rich:hotKey selector="#ls" key="right" handler="#{rich:component('ls')}.copy()"/>
+ <rich:hotKey selector="#ls" key="left" handler="#{rich:component('ls')}.remove()"/>
+ <rich:hotKey selector="#ls" key="end" handler="#{rich:component('ls')}.copyAll()"/>
+ <rich:hotKey selector="#ls" key="home" handler="#{rich:component('ls')}.removeAll()"/>
+ </ui:composition>
+
+
+</html>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey/usage.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+ <p>
+ The <b>hotKey </b>component allows registering hot keys on the page or
+ particular elements and defining client side processing functions for
+ these keys.
+ </p>
+ <p>
+ Main component attributes are:
+ </p>
+ <ul>
+ <li><b>key</b> - hot key definition <i>("up", "ctrl+a", etc...)</i></li>
+ <li><b>handler</b> - defines callback function for this hotKey</li>
+ <li>
+ <b>selector</b> - JQuerry selector, defines elements which will process
+ defined hotKey(<i>html[0] by default</i>)
+ </li>
+ </ul>
+ <p>
+ First example shows you simple <b>hotKey </b>components usage. In order to enlarge
+ or reduce image size - press <i>CTRL + Up/Down</i> combinations. And in order to
+ browse between images - use <i>CTRL + left/right</i> keys.
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Hot Key example</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/hotKey/examples/example.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/hotKey/examples/example.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ <p>
+ In next example we've used <b>selector</b> atribute. So the keys will works
+ only if listShuttle component focused.
+ </p>
+ <p>
+ Press <i>right</i> or <i>left</i> keys in order to move some selected items
+ between lists. Press <i>Home</i> or <i>End</i> buttons in order to move all items between
+ lists.
+ </p>
+ <fieldset class="demo_fieldset">
+ <legend class="demo_legend">Targeted Hot Key example</legend>
+ <div class="sample-container">
+ <ui:include src="/richfaces/hotKey/examples/inputNumbers.xhtml"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/hotKey/examples/inputNumbers.xhtml"/>
+ </ui:include>
+ </div>
+ </fieldset>
+ </ui:define>
+
+ </ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/hotKey.xhtml 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Hot Key</ui:define>
+ <ui:define name="body">
+ <ui:include src="/templates/include/tab-panel.xhtml" />
+ </ui:define>
+</ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js 2008-06-30 14:02:22 UTC (rev 9301)
@@ -0,0 +1,10 @@
+function enlarge(id){
+ var pic =document.getElementById(id);
+ pic.width=document.getElementById(id).width*1.1;
+ pic.height=document.getElementById(id).height*1.1;
+}
+function decrease(id){
+ var pic =document.getElementById(id);
+ pic.width=document.getElementById(id).width*0.9;
+ pic.height=document.getElementById(id).height*0.9;
+}
16 years, 5 months