JBoss Rich Faces SVN: r11623 - trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 11:50:24 -0500 (Sun, 07 Dec 2008)
New Revision: 11623
Modified:
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
Log:
Wrong import removed
Modified: trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-12-07 16:49:46 UTC (rev 11622)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-12-07 16:50:24 UTC (rev 11623)
@@ -31,7 +31,6 @@
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.event.AjaxSource;
-import com.sun.org.apache.xpath.internal.operations.Bool;
/**
* JSF component class
16 years, 1 month
JBoss Rich Faces SVN: r11622 - trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 11:49:46 -0500 (Sun, 07 Dec 2008)
New Revision: 11622
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-5248
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2008-12-07 16:39:51 UTC (rev 11621)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRenderer.java 2008-12-07 16:49:46 UTC (rev 11622)
@@ -229,10 +229,13 @@
* @see org.ajax4jsf.renderkit.HeaderResourcesRendererBase#getScripts()
*/
protected InternetResource[] getScripts() {
- if (scripts == null) {
- scripts = new InternetResource[1];
- scripts[0] = getResource(FORM_SCRIPT);
+ synchronized (this) {
+ if (scripts == null) {
+ scripts = new InternetResource[1];
+ scripts[0] = getResource(FORM_SCRIPT);
+ }
}
- return scripts;
+
+ return scripts;
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-12-07 16:39:51 UTC (rev 11621)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/QueueRenderer.java 2008-12-07 16:49:46 UTC (rev 11622)
@@ -70,21 +70,13 @@
"timeout"
};
- private volatile InternetResource[] scripts;
+ private InternetResource[] scripts = new InternetResource[] {
+ getResource(AjaxScript.class.getName()),
+ getResource(QueueScript.class.getName())
+ };
@Override
protected InternetResource[] getScripts() {
- if (scripts == null) {
- synchronized (this) {
- if (scripts == null) {
- scripts = new InternetResource[] {
- getResource(AjaxScript.class.getName()),
- getResource(QueueScript.class.getName())
- };
- }
- }
- }
-
return scripts;
}
16 years, 1 month
JBoss Rich Faces SVN: r11621 - trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 11:39:51 -0500 (Sun, 07 Dec 2008)
New Revision: 11621
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-5248
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2008-12-07 16:25:20 UTC (rev 11620)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2008-12-07 16:39:51 UTC (rev 11621)
@@ -37,7 +37,7 @@
// private InternetResource ajaxScript = getResource("/com/exadel/vcp/framework/ajax/scripts/AJAX.js");
private static final String AJAX_SCRIPT = AjaxScript.class.getName();
- private volatile InternetResource[] scripts = null;
+ private InternetResource[] scripts = null;
/* (non-Javadoc)
* @see org.ajax4jsf.renderkit.HeaderResourceProducer#getHeaderScripts(javax.faces.context.FacesContext)
@@ -62,20 +62,18 @@
*/
protected InternetResource[] getScripts() {
// Lazy create
- if (scripts == null) {
- synchronized (this) {
- if (scripts == null) {
- InternetResource[] additionalScripts = getAdditionalScripts();
- // Custom scripts
- if (null != additionalScripts) {
- scripts = new InternetResource[additionalScripts.length+1];
- System.arraycopy(additionalScripts,0,scripts,1,additionalScripts.length);
- } else {
- scripts = new InternetResource[1];
- }
- // Ajax script
- scripts[0] = getResource(AJAX_SCRIPT);
+ synchronized (this) {
+ if (scripts == null) {
+ InternetResource[] additionalScripts = getAdditionalScripts();
+ // Custom scripts
+ if (null != additionalScripts) {
+ scripts = new InternetResource[additionalScripts.length+1];
+ System.arraycopy(additionalScripts,0,scripts,1,additionalScripts.length);
+ } else {
+ scripts = new InternetResource[1];
}
+ // Ajax script
+ scripts[0] = getResource(AJAX_SCRIPT);
}
}
16 years, 1 month
JBoss Rich Faces SVN: r11620 - trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 11:25:20 -0500 (Sun, 07 Dec 2008)
New Revision: 11620
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-5248
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2008-12-07 16:19:36 UTC (rev 11619)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxComponentRendererBase.java 2008-12-07 16:25:20 UTC (rev 11620)
@@ -37,7 +37,7 @@
// private InternetResource ajaxScript = getResource("/com/exadel/vcp/framework/ajax/scripts/AJAX.js");
private static final String AJAX_SCRIPT = AjaxScript.class.getName();
- private InternetResource[] scripts = null;
+ private volatile InternetResource[] scripts = null;
/* (non-Javadoc)
* @see org.ajax4jsf.renderkit.HeaderResourceProducer#getHeaderScripts(javax.faces.context.FacesContext)
@@ -63,16 +63,20 @@
protected InternetResource[] getScripts() {
// Lazy create
if (scripts == null) {
- InternetResource[] additionalScripts = getAdditionalScripts();
- // Custom scripts
- if (null != additionalScripts) {
- scripts = new InternetResource[additionalScripts.length+1];
- System.arraycopy(additionalScripts,0,scripts,1,additionalScripts.length);
- } else {
- scripts = new InternetResource[1];
+ synchronized (this) {
+ if (scripts == null) {
+ InternetResource[] additionalScripts = getAdditionalScripts();
+ // Custom scripts
+ if (null != additionalScripts) {
+ scripts = new InternetResource[additionalScripts.length+1];
+ System.arraycopy(additionalScripts,0,scripts,1,additionalScripts.length);
+ } else {
+ scripts = new InternetResource[1];
+ }
+ // Ajax script
+ scripts[0] = getResource(AJAX_SCRIPT);
+ }
}
- // Ajax script
- scripts[0] = getResource(AJAX_SCRIPT);
}
return scripts;
16 years, 1 month
JBoss Rich Faces SVN: r11619 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 11:19:36 -0500 (Sun, 07 Dec 2008)
New Revision: 11619
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
https://jira.jboss.org/jira/browse/RF-5271
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-12-07 14:52:32 UTC (rev 11618)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-12-07 16:19:36 UTC (rev 11619)
@@ -1165,8 +1165,10 @@
0);
} else {
- // mark status object ( if any ) for complete request ;
- A4J.AJAX.status(request.containerId,options.status,false);
+ setTimeout(function() {
+ // mark status object ( if any ) for complete request ;
+ A4J.AJAX.status(request.containerId,options.status,false);
+ }, 0)
}
if (request.shouldNotifyQueue && request.queue) {
16 years, 1 month
JBoss Rich Faces SVN: r11618 - in trunk/ui/fileUpload/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 09:52:32 -0500 (Sun, 07 Dec 2008)
New Revision: 11618
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-4815
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-12-07 14:49:33 UTC (rev 11617)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-12-07 14:52:32 UTC (rev 11618)
@@ -24,6 +24,8 @@
import java.util.Locale;
import java.util.Map;
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.Application;
@@ -76,14 +78,24 @@
private void setupProgressBarValueExpression(FacesContext context, String uid) {
FileUploadRendererBase renderer = (FileUploadRendererBase)this.getRenderer(context);
UIComponent progressBar = renderer.getProgressBar(context, this);
- String exprStr = "#{" + Filter.PERCENT_BEAN_NAME + "['"+uid+"']}";
- ValueExpression ex = context.getApplication().getExpressionFactory()
- .createValueExpression(context.getELContext(), exprStr,
+ String percentExpression = Filter.PERCENT_BEAN_NAME + "['"+uid+"']";
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+ ELContext elContext = context.getELContext();
+
+ ValueExpression value = expressionFactory
+ .createValueExpression(elContext, "#{" + percentExpression + "}",
Integer.class);
- progressBar.setValueExpression("value", ex);
- }
+ progressBar.setValueExpression("value", value);
+
+ ValueExpression enabled = expressionFactory
+ .createValueExpression(elContext,
+ "#{" + percentExpression + " < 100}", //100 - disable progress when upload reaches 100%
+ Boolean.class);
+ progressBar.setValueExpression("enabled", enabled);
+ }
+
public String getLocalContentType() {
return localContentType;
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-12-07 14:49:33 UTC (rev 11617)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-12-07 14:52:32 UTC (rev 11618)
@@ -32,6 +32,7 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.FactoryFinder;
import javax.faces.component.UIComponent;
@@ -678,7 +679,14 @@
progressBar = createProgressBar(context, component);
}
progressBar.getAttributes().put("minValue", -1);
- progressBar.getAttributes().put("enabled", false);
+
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+ ValueExpression falseExpression = expressionFactory.createValueExpression(
+ context.getELContext(),
+ "#{" + Boolean.FALSE + "}",
+ Boolean.class);
+
+ progressBar.setValueExpression("enabled", falseExpression);
progressBar.setTransient(false);
return progressBar;
}
16 years, 1 month
JBoss Rich Faces SVN: r11617 - trunk/samples/fileUploadDemo/src/main/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 09:49:33 -0500 (Sun, 07 Dec 2008)
New Revision: 11617
Modified:
trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
Log:
FileUploadDemo bean enhancement
Modified: trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2008-12-07 14:07:17 UTC (rev 11616)
+++ trunk/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java 2008-12-07 14:49:33 UTC (rev 11617)
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.rmi.server.UID;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -76,9 +77,16 @@
file.delete();
}else {
try {
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- b.write(item.getData());
- System.out.println(b.toString());
+ byte[] bytes = item.getData();
+ int numberOfBytes = 256;
+
+ if (bytes.length > numberOfBytes) {
+ System.out.println("First " + numberOfBytes + " bytes of uploaded file:");
+ System.out.println(new String(bytes, 0, numberOfBytes));
+ } else {
+ System.out.println("Uploaded file contents:");
+ System.out.println(new String(bytes, 0, bytes.length));
+ }
} catch (Exception e) {
// TODO: handle exception
}
16 years, 1 month
JBoss Rich Faces SVN: r11616 - trunk/ui/fileUpload/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 09:07:17 -0500 (Sun, 07 Dec 2008)
New Revision: 11616
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
Log:
https://jira.jboss.org/jira/browse/RF-4992
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-12-07 14:06:20 UTC (rev 11615)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-12-07 14:07:17 UTC (rev 11616)
@@ -182,9 +182,10 @@
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, String> requestParameterMap = externalContext.getRequestParameterMap();
- if ("progress".equals(requestParameterMap.get("action"))
- && requestParameterMap.containsKey(
- this.getClientId(facesContext))) {
+
+ String actionString = requestParameterMap.get("action");
+
+ if (actionString != null && requestParameterMap.containsKey(this.getClientId(facesContext))) {
AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(facesContext);
String uid = requestParameterMap.get(Filter.UPLOAD_FILES_ID);
@@ -195,8 +196,12 @@
if (sessions != null) {
MultipartRequest multipartRequest = sessions.get(uid);
if (multipartRequest != null) {
- setupProgressBarValueExpression(facesContext, uid);
- ajaxContext.setResponseData(multipartRequest.getSize());
+ if ("progress".equals(actionString)) {
+ setupProgressBarValueExpression(facesContext, uid);
+ ajaxContext.setResponseData(multipartRequest.getSize());
+ } else if ("richfaces_file_upload_action_stop".equals(actionString)) {
+ multipartRequest.stop();
+ }
}
}
}
16 years, 1 month
JBoss Rich Faces SVN: r11615 - trunk/framework/impl/src/main/java/org/ajax4jsf/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 09:06:20 -0500 (Sun, 07 Dec 2008)
New Revision: 11615
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
Log:
https://jira.jboss.org/jira/browse/RF-4992
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-12-07 14:04:12 UTC (rev 11614)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-12-07 14:06:20 UTC (rev 11615)
@@ -401,23 +401,7 @@
}
} else {
-
- if ("richfaces_file_upload_action_stop".equals(queryParamMap.get("action"))) {
- HttpSession session = httpRequest.getSession(false);
- if (session != null) {
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) session.getAttribute(REQUESTS_SESSIONS_BEAN_NAME);
-
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- multipartRequest.stop();
- }
- handleRequest(request, response, chain);
- }
- }
- } else {
- handleRequest(request, response, chain);
- }
+ handleRequest(request, response, chain);
}
} else {
handleRequest(request, response, chain);
16 years, 1 month
JBoss Rich Faces SVN: r11614 - trunk/framework/impl/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-07 09:04:12 -0500 (Sun, 07 Dec 2008)
New Revision: 11614
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
Log:
Null string passed to TemplateEncoderRendererBase encoded to JS null
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2008-12-07 02:08:14 UTC (rev 11613)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2008-12-07 14:04:12 UTC (rev 11614)
@@ -77,62 +77,66 @@
}
public void writeScriptBody(Writer writer, String string) throws IOException {
- Properties tidyProperties = new Properties();
- InputStream propertiesStream = null;
- try {
- propertiesStream = URLToStreamHelper.urlToStreamSafe(
- TidyXMLFilter.class.getResource("tidy.properties"));
- tidyProperties.load(propertiesStream);
- } finally {
- if (propertiesStream != null) {
- propertiesStream.close();
+ if (string != null) {
+ Properties tidyProperties = new Properties();
+ InputStream propertiesStream = null;
+ try {
+ propertiesStream = URLToStreamHelper.urlToStreamSafe(
+ TidyXMLFilter.class.getResource("tidy.properties"));
+ tidyProperties.load(propertiesStream);
+ } finally {
+ if (propertiesStream != null) {
+ propertiesStream.close();
+ }
}
- }
-
- TidyParser tidyParser = new TidyParser(tidyProperties);
- Document parsedHtml = tidyParser.parseHtmlByTidy(new StringReader(string), null);
-
- Element documentElement = null;
-
- if (parsedHtml != null) {
- documentElement = parsedHtml.getDocumentElement();
- }
-
- if (documentElement != null) {
- writer.write("[");
+
+ TidyParser tidyParser = new TidyParser(tidyProperties);
+ Document parsedHtml = tidyParser.parseHtmlByTidy(new StringReader(string), null);
+
+ Element documentElement = null;
- NodeList nodeList = documentElement.getChildNodes();
- Node bodyNode = nodeList.item(nodeList.getLength() - 1);
- NodeList bodyChildren = bodyNode.getChildNodes();
- int bodyChildrenLength = bodyChildren.getLength();
-
- try {
- Transformer transformer;
-
- TransformerFactory factory = getTransformerFactory();
+ if (parsedHtml != null) {
+ documentElement = parsedHtml.getDocumentElement();
+ }
+
+ if (documentElement != null) {
+ writer.write("[");
- synchronized (factory) {
- transformer = factory.newTransformer();
- }
-
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
-
- ContentHandler contentHandler = createContentHandler(writer);
- Result result = new SAXResult(contentHandler);
-
- for (int i = 0; i < bodyChildrenLength; i++) {
- if (i != 0) {
- writer.write(", ");
+ NodeList nodeList = documentElement.getChildNodes();
+ Node bodyNode = nodeList.item(nodeList.getLength() - 1);
+ NodeList bodyChildren = bodyNode.getChildNodes();
+ int bodyChildrenLength = bodyChildren.getLength();
+
+ try {
+ Transformer transformer;
+
+ TransformerFactory factory = getTransformerFactory();
+
+ synchronized (factory) {
+ transformer = factory.newTransformer();
}
- transformer.transform(new DOMSource(bodyChildren.item(i)), result);
+
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+
+ ContentHandler contentHandler = createContentHandler(writer);
+ Result result = new SAXResult(contentHandler);
+
+ for (int i = 0; i < bodyChildrenLength; i++) {
+ if (i != 0) {
+ writer.write(", ");
+ }
+ transformer.transform(new DOMSource(bodyChildren.item(i)), result);
+ }
+ } catch (TransformerException e) {
+ throw new IOException(e.getMessage());
}
- } catch (TransformerException e) {
- throw new IOException(e.getMessage());
+
+ writer.write("]");
+
+ } else {
+ writer.write(ScriptUtils.toScript(JSReference.NULL));
}
-
- writer.write("]");
-
} else {
writer.write(ScriptUtils.toScript(JSReference.NULL));
}
16 years, 1 month