JBoss Rich Faces SVN: r5846 - in trunk/sandbox/samples/progressBarDemo/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-05 21:09:36 -0500 (Tue, 05 Feb 2008)
New Revision: 5846
Modified:
trunk/sandbox/samples/progressBarDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java
trunk/sandbox/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp
Log:
Latest updates for progressBar & demo
Modified: trunk/sandbox/samples/progressBarDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java
===================================================================
--- trunk/sandbox/samples/progressBarDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java 2008-02-05 23:41:30 UTC (rev 5845)
+++ trunk/sandbox/samples/progressBarDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java 2008-02-06 02:09:36 UTC (rev 5846)
@@ -52,7 +52,7 @@
*/
public Integer getValue() {
//value = value.add(new BigDecimal(0.6));
- return value++;
+ return value;
}
/**
@@ -61,6 +61,10 @@
public void setValue(Integer value) {
this.value = value;
}
+
+ public Integer getIncValue() {
+ return value++;
+ }
/**
* @return the enabled
@@ -103,5 +107,5 @@
public String getModeString() {
return ajaxMode ? "ajax" : "client";
}
-
+
}
\ No newline at end of file
Modified: trunk/sandbox/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml 2008-02-05 23:41:30 UTC (rev 5845)
+++ trunk/sandbox/samples/progressBarDemo/src/main/webapp/WEB-INF/web.xml 2008-02-06 02:09:36 UTC (rev 5846)
@@ -27,6 +27,10 @@
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
<!--
-->
<filter>
Modified: trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp 2008-02-05 23:41:30 UTC (rev 5845)
+++ trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp 2008-02-06 02:09:36 UTC (rev 5846)
@@ -27,16 +27,27 @@
<h:selectOneRadio binding="#{skinBean.component}" />
<h:commandLink action="#{skinBean.change}" value="set skin" />
</h:form>
+
+ <h:form>
+ <h:panelGrid columns="3">
+ <h:outputText value="Progress value: " />
+ <h:inputText value="#{bean.value}" />
+
+ <h:commandButton value="Set" />
+ </h:panelGrid>
+
+ </h:form>
- <h:form>
- <progressBar:progressBar value="#{bean.value}" enabled="#{bean.enabled}" id="progrs"
+ <h:form id="_form">
+
+ <progressBar:progressBar value="#{bean.incValue}" enabled="#{bean.enabled}" id="progrs"
interval="700"
styleClass="main"
reRenderAfterComplete="per2"
mode="#{bean.modeString}"
progressVar="percent"
parameters="text:'crack'"
- style="width: 300px; height: 14px"
+ style="width: 300px; height: 18px"
>
<f:facet name="initial">
<h:outputText value="Process not started"></h:outputText>
@@ -66,7 +77,7 @@
<f:verbatim><br /></f:verbatim>
</h:form>
<script>
- var pr = new ProgressBar('j_id_jsp_2009877409_4:progrs');
+ var pr = $('_form:progrs').component;
</script>
<input type="button" value="Get value" onclick="alert(pr.getValue());" /><br/>
<input type="text" value="" id="percent"/>
16 years, 3 months
JBoss Rich Faces SVN: r5845 - in trunk/sandbox/ui/progressBAR/src/main: resources/org/richfaces/renderkit/html/css and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-05 18:41:30 -0500 (Tue, 05 Feb 2008)
New Revision: 5845
Modified:
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java
trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss
Log:
Animated background set as default
Image shift between frames corrected
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java 2008-02-05 23:30:23 UTC (rev 5844)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java 2008-02-05 23:41:30 UTC (rev 5845)
@@ -86,7 +86,7 @@
if (mainStage == null) {
mainStage = createMainStage(context);
}
- BufferedImage frame = mainStage.getSubimage(0, 48 - frameIndex * 4, frameSize.width, frameSize.height);
+ BufferedImage frame = mainStage.getSubimage(0, 48 - frameIndex * 2, frameSize.width, frameSize.height);
g2d.drawImage(frame, null, null);
// paint a shadow in the form of semi-transparent gradient
g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7, progressbarShadowEndColor));
Modified: trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss 2008-02-05 23:30:23 UTC (rev 5844)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss 2008-02-05 23:41:30 UTC (rev 5845)
@@ -28,7 +28,7 @@
<u:selector name=".rich-progress-bar-completed">
<u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.html.images.ProgressBarBg" />
+ <f:resource f:key="org.richfaces.renderkit.html.images.ProgressBarAnimatedBg" />
</u:style>
<u:style name="background-color" skin="selectControlColor" />
<u:style name="text-color" skin="controlBackgroundColor" />
16 years, 3 months
JBoss Rich Faces SVN: r5844 - in trunk: samples/combobox-sample and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-05 18:30:23 -0500 (Tue, 05 Feb 2008)
New Revision: 5844
Added:
trunk/samples/combobox-sample/
trunk/samples/pickList-sample/
trunk/ui/combobox/
trunk/ui/pickList/
Removed:
trunk/sandbox/samples/combobox-sample/
trunk/sandbox/samples/pickList-sample/
trunk/sandbox/ui/combobox/
trunk/sandbox/ui/pickList/
Modified:
trunk/samples/combobox-sample/pom.xml
trunk/samples/combobox-sample/src/main/webapp/pages/index.jsp
trunk/samples/combobox-sample/src/main/webapp/pages/index.xhtml
trunk/samples/pickList-sample/pom.xml
trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp
trunk/samples/pom.xml
trunk/sandbox/samples/pom.xml
trunk/sandbox/ui/pom.xml
trunk/ui/combobox/pom.xml
trunk/ui/pickList/pom.xml
trunk/ui/pom.xml
Log:
comboBox & pickList moved to main build
Copied: trunk/samples/combobox-sample (from rev 5842, trunk/sandbox/samples/combobox-sample)
Modified: trunk/samples/combobox-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/combobox-sample/pom.xml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/samples/combobox-sample/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -1,7 +1,7 @@
<?xml version="1.0"?><project>
<parent>
<artifactId>samples</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
+ <groupId>org.richfaces</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -57,7 +57,7 @@
</dependency>
<dependency>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>combobox</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
Modified: trunk/samples/combobox-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.jsp 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/samples/combobox-sample/src/main/webapp/pages/index.jsp 2008-02-05 23:30:23 UTC (rev 5844)
@@ -1,7 +1,7 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/combobox" prefix="cmb"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/combobox" prefix="cmb"%>
<html>
<head>
<title></title>
Modified: trunk/samples/combobox-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/combobox-sample/src/main/webapp/pages/index.xhtml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/samples/combobox-sample/src/main/webapp/pages/index.xhtml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -4,7 +4,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:cmb="http://labs.jboss.com/jbossrichfaces/ui/ui/combobox">
+ xmlns:cmb="http://labs.jboss.com/jbossrichfaces/ui/combobox">
<head>
<title></title>
Copied: trunk/samples/pickList-sample (from rev 5842, trunk/sandbox/samples/pickList-sample)
Modified: trunk/samples/pickList-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/pickList-sample/pom.xml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/samples/pickList-sample/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -1,7 +1,7 @@
<?xml version="1.0"?><project>
<parent>
<artifactId>samples</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
+ <groupId>org.richfaces</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -55,7 +55,7 @@
</dependency>
<dependency>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>pickList</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
Modified: trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/pickList-sample/src/main/webapp/pages/index.jsp 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/samples/pickList-sample/src/main/webapp/pages/index.jsp 2008-02-05 23:30:23 UTC (rev 5844)
@@ -1,6 +1,6 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/pickList" prefix="pickList"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/pickList" prefix="pickList"%>
<html>
<head>
<title></title>
Modified: trunk/samples/pom.xml
===================================================================
--- trunk/samples/pom.xml 2008-02-05 23:30:22 UTC (rev 5843)
+++ trunk/samples/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -460,5 +460,9 @@
<module>orderingListDemo</module>
<module>listShuttleDemo</module>
<module>columnsDemo</module>
+
+ <module>combobox-sample</module>
+ <module>pickList-sample</module>
+
</modules>
</project>
\ No newline at end of file
Modified: trunk/sandbox/samples/pom.xml
===================================================================
--- trunk/sandbox/samples/pom.xml 2008-02-05 23:30:22 UTC (rev 5843)
+++ trunk/sandbox/samples/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -18,9 +18,7 @@
<!--module>contextMenuDemo</module-->
<module>fileUploadPOC</module>
<module>fileUploadDemo</module>
- <module>combobox-sample</module>
<module>progressBarDemo</module>
- <module>pickList-sample</module>
<module>sortingFilteringDemo</module>
</modules>
</project>
\ No newline at end of file
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2008-02-05 23:30:22 UTC (rev 5843)
+++ trunk/sandbox/ui/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -20,8 +20,6 @@
<!--module>rex-button</module-->
<module>sortableHeader</module>
<module>fileUpload</module>
- <module>combobox</module>
<module>progressBAR</module>
- <module>pickList</module>
</modules>
</project>
\ No newline at end of file
Copied: trunk/ui/combobox (from rev 5842, trunk/sandbox/ui/combobox)
Modified: trunk/ui/combobox/pom.xml
===================================================================
--- trunk/sandbox/ui/combobox/pom.xml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/ui/combobox/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -1,11 +1,11 @@
<?xml version="1.0"?><project>
<parent>
<artifactId>ui</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
+ <groupId>org.richfaces</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>combobox</artifactId>
<name>combobox</name>
<version>3.2.0-SNAPSHOT</version>
@@ -25,7 +25,7 @@
</executions>
<configuration>
<library>
- <prefix>org.richfaces.sandbox.ui</prefix>
+ <prefix>org.richfaces.ui</prefix>
<taglib>
<shortName>combobox</shortName>
</taglib>
Copied: trunk/ui/pickList (from rev 5842, trunk/sandbox/ui/pickList)
Modified: trunk/ui/pickList/pom.xml
===================================================================
--- trunk/sandbox/ui/pickList/pom.xml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/ui/pickList/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -1,11 +1,11 @@
<?xml version="1.0"?><project>
<parent>
<artifactId>ui</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
+ <groupId>org.richfaces</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>pickList</artifactId>
<name>pickList</name>
<version>3.2.0-SNAPSHOT</version>
Modified: trunk/ui/pom.xml
===================================================================
--- trunk/ui/pom.xml 2008-02-05 23:30:22 UTC (rev 5843)
+++ trunk/ui/pom.xml 2008-02-05 23:30:23 UTC (rev 5844)
@@ -104,6 +104,8 @@
<module>listShuttle</module>
<module>contextMenu</module>
<module>columns</module>
+ <module>combobox</module>
+ <module>pickList</module>
</modules>
<dependencies>
<dependency>
16 years, 3 months
JBoss Rich Faces SVN: r5843 - in trunk: extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-02-05 18:30:22 -0500 (Tue, 05 Feb 2008)
New Revision: 5843
Modified:
trunk/extensions/portletbridge/portletbridge-impl/pom.xml
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java
trunk/extensions/portletbridge/portletbridge-impl/src/test/java/org/ajax4jsf/portlet/context/PortletExternalContextTest.java
trunk/samples/seamPortletEar/pom.xml
Log:
Switch Portlet bridge to a Seam 2.1.0-SNAPSHOT
Modified: trunk/extensions/portletbridge/portletbridge-impl/pom.xml
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/pom.xml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/extensions/portletbridge/portletbridge-impl/pom.xml 2008-02-05 23:30:22 UTC (rev 5843)
@@ -40,7 +40,7 @@
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
- <version>2.0.1-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java 2008-02-05 23:30:22 UTC (rev 5843)
@@ -68,10 +68,13 @@
if (null != stateId) {
PortletViewState windowState = portletStateHolder
.getWindowState(stateId);
- namespace = windowState.getNamespace();
- sessionPrefix = WindowIDRetriver.PORTLET_SCOPE_PREFIX
- + windowState.getWindowId() + '?';
- portalActionUrl = windowState.getPortalActionURL();
+ if (null != windowState) {
+ namespace = windowState.getNamespace();
+ sessionPrefix = WindowIDRetriver.PORTLET_SCOPE_PREFIX
+ + windowState.getWindowId() + '?';
+ portalActionUrl = windowState.getPortalActionURL();
+
+ }
}
}
}
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/LifecyclePhase.java 2008-02-05 23:30:22 UTC (rev 5843)
@@ -52,7 +52,7 @@
try {
executePhase(context);
} catch (Exception e) {
- _log.error("Error execute phase "+getPhaseId().toString());
+ _log.error("Error execute phase "+getPhaseId().toString(),e);
if(PhaseId.RENDER_RESPONSE.compareTo(getPhaseId())==0){
throw new FacesException(e);
}
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/RestoreViewPhase.java 2008-02-05 23:30:22 UTC (rev 5843)
@@ -6,6 +6,7 @@
import java.util.Iterator;
import javax.faces.FactoryFinder;
+import javax.faces.application.ViewExpiredException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
@@ -77,9 +78,13 @@
viewRoot = viewHandler.restoreView(context, viewId);
if (null != viewRoot) {
processBindings(context, viewRoot);
+ } else {
+ // Error restore view. Session Expired ?
+ throw new ViewExpiredException("Error restore view "+viewId+", session expired?");
}
} else {
viewRoot = viewHandler.createView(context, viewId);
+ context.renderResponse();
}
context.setViewRoot(viewRoot);
}
Modified: trunk/extensions/portletbridge/portletbridge-impl/src/test/java/org/ajax4jsf/portlet/context/PortletExternalContextTest.java
===================================================================
--- trunk/extensions/portletbridge/portletbridge-impl/src/test/java/org/ajax4jsf/portlet/context/PortletExternalContextTest.java 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/extensions/portletbridge/portletbridge-impl/src/test/java/org/ajax4jsf/portlet/context/PortletExternalContextTest.java 2008-02-05 23:30:22 UTC (rev 5843)
@@ -69,6 +69,7 @@
* Test method for {@link org.ajax4jsf.portlet.context.PortletExternalContextImpl#getInitParameter(java.lang.String)}.
*/
public final void testGetInitParameterString() {
+ servletContext.addInitParameter(MockPortletContext.INIT_PARAMETER, MockPortletContext.PORTLET_INIT_VALUE);
assertNull(portalFacesContext.getExternalContext().getInitParameter("blabla"));
assertSame(MockPortletContext.PORTLET_INIT_VALUE, portalFacesContext.getExternalContext().getInitParameter(MockPortletContext.INIT_PARAMETER));
}
Modified: trunk/samples/seamPortletEar/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/pom.xml 2008-02-05 19:08:52 UTC (rev 5842)
+++ trunk/samples/seamPortletEar/pom.xml 2008-02-05 23:30:22 UTC (rev 5843)
@@ -14,7 +14,7 @@
<packaging>pom</packaging>
<name>seam EAR portlet project</name>
<properties>
- <seam>2.0.1.SNAPSHOT</seam>
+ <seam>2.1.0-SNAPSHOT</seam>
</properties>
<modules>
<module>seamBookingPortlet</module>
16 years, 3 months
JBoss Rich Faces SVN: r5842 - trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-05 14:08:52 -0500 (Tue, 05 Feb 2008)
New Revision: 5842
Modified:
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
Log:
Modified: trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
--- trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2008-02-05 19:08:00 UTC (rev 5841)
+++ trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2008-02-05 19:08:52 UTC (rev 5842)
@@ -65,10 +65,10 @@
private final static String CONTROL_ID_REMOVE_ALL = "removeAll";
- private final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
- private final static String DEFAULT_LABEL_COPY = "Copy";
- private final static String DEFAULT_LABEL_REMOVE = "Remove";
- private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
+ public final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
+ public final static String DEFAULT_LABEL_COPY = "Copy";
+ public final static String DEFAULT_LABEL_REMOVE = "Remove";
+ public final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
public final static String DISABLED_STYLE_PREF = "-disabled";
16 years, 3 months
JBoss Rich Faces SVN: r5841 - trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-05 14:08:00 -0500 (Tue, 05 Feb 2008)
New Revision: 5841
Modified:
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 18:34:36 UTC (rev 5840)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 19:08:00 UTC (rev 5841)
@@ -297,9 +297,9 @@
boolean enable;
for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
- if (helper.getDefaultText().equals(ListShuttleControlsHelper.CONTROL_ID_REMOVE_ALL)) {
+ if (helper.getDefaultText().equals(ListShuttleControlsHelper.DEFAULT_LABEL_REMOVE_ALL)) {
enable = isSelectedList;
- } else if (helper.getDefaultText().equals(ListShuttleControlsHelper.CONTROL_ID_COPY_ALL)) {
+ } else if (helper.getDefaultText().equals(ListShuttleControlsHelper.DEFAULT_LABEL_COPY_ALL)) {
enable = isAvailableList;
} else {
if (helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF)) {
16 years, 3 months
JBoss Rich Faces SVN: r5840 - trunk/sandbox/samples/pickList-sample/src/main/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-05 13:34:36 -0500 (Tue, 05 Feb 2008)
New Revision: 5840
Modified:
trunk/sandbox/samples/pickList-sample/src/main/java/org/richfaces/Bean.java
Log:
Modified: trunk/sandbox/samples/pickList-sample/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/pickList-sample/src/main/java/org/richfaces/Bean.java 2008-02-05 18:33:50 UTC (rev 5839)
+++ trunk/sandbox/samples/pickList-sample/src/main/java/org/richfaces/Bean.java 2008-02-05 18:34:36 UTC (rev 5840)
@@ -1,75 +1,42 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - 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;
import java.util.ArrayList;
-
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
-public class Bean
-{
- private ArrayList testList = new ArrayList();
+public class Bean {
+private ArrayList testList = new ArrayList();
private String selectedInfo;
- public Bean()
- {
- testList.add(new SelectItem("polecat", "Value-polecat"));
- testList.add(new SelectItem("suricate", "Value-suricate"));
- testList.add(new SelectItem("marshotter", "Value-marshotter"));
+ public Bean() {
+ testList.add(new SelectItem("polecat", "polecat"));
+ testList.add(new SelectItem("suricate", "suricate"));
+ testList.add(new SelectItem("marshotter", "marshotter"));
}
- public void selectionChanged(ValueChangeEvent evt)
- {
- String[] selectedValues = (String[]) evt.getNewValue();
-
- if (selectedValues.length == 0)
- {
+ public void selectionChanged(ValueChangeEvent evt) {
+
+ String[] selectedValues = (String[]) evt.getNewValue();
+ if (selectedValues.length == 0) {
selectedInfo = "No selected values";
- }
- else
- {
-
+ } else {
StringBuffer sb = new StringBuffer("Selected values: ");
-
- for (int i = 0; i < selectedValues.length; i++)
- {
- if (i > 0)
+ for (int i = 0; i < selectedValues.length; i++) {
+ if (i > 0) {
sb.append(", ");
+ }
sb.append(selectedValues[i]);
}
-
selectedInfo = sb.toString();
}
}
- public ArrayList getTestList()
- {
+ public ArrayList getTestList() {
return testList;
}
- public String getSelectedInfo()
- {
+ public String getSelectedInfo() {
return selectedInfo;
}
16 years, 3 months
JBoss Rich Faces SVN: r5839 - in trunk/sandbox/ui/pickList/src/main: java/org/richfaces/picklist/util and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-05 13:33:50 -0500 (Tue, 05 Feb 2008)
New Revision: 5839
Removed:
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
Modified:
trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
clean classes
Modified: trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml
===================================================================
--- trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml 2008-02-05 18:05:00 UTC (rev 5838)
+++ trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml 2008-02-05 18:33:50 UTC (rev 5839)
@@ -65,6 +65,36 @@
</property>
<property>
+ <name>showButtonLabels</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>"true"</defaultvalue>
+ </property>
+
+ <property>
+ <name>copyAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <property>
+ <name>copyControlLabel</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <property>
+ <name>removeControlLabel</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <property>
+ <name>removeAllControlLabel</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <property>
<name>value</name>
<classname>java.lang.String</classname>
</property>
Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java 2008-02-05 18:05:00 UTC (rev 5838)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/picklist/util/PickListUtils.java 2008-02-05 18:33:50 UTC (rev 5839)
@@ -8,6 +8,7 @@
import java.util.List;
import java.util.Set;
+import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectMany;
@@ -15,7 +16,6 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.el.ValueBinding;
import javax.faces.model.SelectItem;
import org.ajax4jsf.util.SelectUtils;
@@ -37,10 +37,10 @@
if (converter != null) return converter;
//Try to find out by value binding
- ValueBinding vb = component.getValueBinding("value");
- if (vb == null) return null;
+ ValueExpression ve = component.getValueExpression("value");
+ if (ve == null) return null;
- Class valueType = vb.getType(context);
+ Class valueType = ve.getType(context.getELContext());
if (valueType == null) return null;
if (List.class.isAssignableFrom(valueType)) {
Deleted: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2008-02-05 18:05:00 UTC (rev 5838)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2008-02-05 18:33:50 UTC (rev 5839)
@@ -1,147 +0,0 @@
-package org.richfaces.renderkit;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.component.UIListShuttle;
-import org.richfaces.component.UIOrderingBaseComponent;
-import org.richfaces.renderkit.html.images.ListShuttleIconCopy;
-import org.richfaces.renderkit.html.images.ListShuttleIconCopyAll;
-import org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled;
-import org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled;
-import org.richfaces.renderkit.html.images.ListShuttleIconRemove;
-import org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll;
-import org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled;
-import org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled;
-
-public class PickListControlsHelper {
-
- private final static String FACET_COPY_ALL = "copyAllControl";
-
- private final static String FACET_REMOVE_ALL = "removeAllControl";
-
- private final static String FACET_COPY = "copyControl";
-
- private final static String FACET_REMOVE = "removeControl";
-
- private final static String FACET_DIS_COPY_ALL = FACET_COPY_ALL + "Disabled";
-
- private final static String FACET_DIS_REMOVE_ALL = FACET_REMOVE_ALL + "Disabled";
-
- private final static String FACET_DIS_COPY = FACET_COPY + "Disabled";
-
- private final static String FACET_DIS_REMOVE = FACET_REMOVE + "Disabled";
-
- public final static String FACET_CAPTION = "caption";
-
- private final static String ATTRIBUTE_CE_ONCOPYALLCLICK = "oncopyallclick";
-
- private final static String ATTRIBUTE_CE_ONREMOVECLICK = "onremoveclick";
-
- private final static String ATTRIBUTE_CE_ONCOPYCLICK = "oncopyclick";
-
- private final static String ATTRIBUTE_CE_ONREMOVEALLCLICK = "onremoveallclick";
-
- public final static String ATTRIBUTE_SOURCE_CAPTION_LABEL = "sourceCaptionLabel";
-
- public final static String ATTRIBUTE_TARGET_CAPTION_LABEL = "targetCaptionLabel";
-
- private final static String ATTRIBUTE_CLASS_COPY_ALL_CONTROL = FACET_COPY_ALL + "Class";
-
- private final static String ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL = FACET_REMOVE_ALL + "Class";
-
- private final static String ATTRIBUTE_CLASS_REMOVE_CONTROL = FACET_REMOVE + "Class";
-
- private final static String ATTRIBUTE_CLASS_COPY_CONTROL = FACET_COPY + "Class";
-
- private final static String ATTRIBUTE_CLASS_DISABLED_CONTROL = "disabledControlClass";
-
- private final static String DIS_CONTROL_ID_PREFIX = "dis";
-
- private final static String CONTROL_ID_COPY_ALL = "copyAll";
-
- private final static String CONTROL_ID_COPY = "copy";
-
- private final static String CONTROL_ID_REMOVE = "remove";
-
- private final static String CONTROL_ID_REMOVE_ALL = "removeAll";
-
- public final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
- private final static String DEFAULT_LABEL_COPY = "Copy";
- private final static String DEFAULT_LABEL_REMOVE = "Remove";
- public final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
-
- protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
- new OrderingComponentRendererBase.ControlsHelper("copyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAll.class.getName(), FACET_COPY_ALL,
- "-copyall", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, "",
- CONTROL_ID_COPY_ALL, ATTRIBUTE_CE_ONCOPYALLCLICK, true, "copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("disabledCopyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAllDisabled.class.getName(), FACET_DIS_COPY_ALL,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false, "copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("copy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopy.class.getName(), FACET_COPY,
- "-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "",
- CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,false, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("disabledCopy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(), FACET_DIS_COPY,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, true, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("remove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemove.class.getName(), FACET_REMOVE,
- "-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
- CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, false, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("disabledRemove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, true, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("removeAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAll.class.getName(), FACET_REMOVE_ALL,
- "-removeall", ATTRIBUTE_CLASS_REMOVE_ALL_CONTROL, "",
- CONTROL_ID_REMOVE_ALL, ATTRIBUTE_CE_ONREMOVEALLCLICK, true, "removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- },
- new OrderingComponentRendererBase.ControlsHelper("disabledRemoveAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAllDisabled.class.getName(), FACET_DIS_REMOVE_ALL,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false, "removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
-
- public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
- return true;
- }
-
- }
- };
-}
Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 18:05:00 UTC (rev 5838)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 18:33:50 UTC (rev 5839)
@@ -3,9 +3,8 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashSet;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -18,7 +17,6 @@
import javax.faces.component.UISelectMany;
import javax.faces.component.UISelectOne;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
@@ -34,32 +32,25 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.util.SelectUtils;
import org.apache.commons.collections.CollectionUtils;
-import org.richfaces.component.UIListShuttle;
-import org.richfaces.component.UIOrderingBaseComponent;
import org.richfaces.component.UIPickList;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.picklist.util.PickListUtils;
-import org.richfaces.renderkit.OrderingComponentRendererBase.SelectionState;
public class PickListRenderer extends HeaderResourcesRendererBase {
- private static final String AVAILABLE_SUFFIX = "_AVAILABLE";
- private static final String SELECTED_SUFFIX = "_SELECTED";
private static final String HIDDEN_SUFFIX = "valueKeeper";
- private static final String FUNCTION_ADD_TO_SELECTED = "myfaces_picklist_addToSelected";
- private static final String FUNCTION_REMOVE_FROM_SELECTED = "myfaces_picklist_removeFromSelected";
protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = ListShuttleControlsHelper.HELPERS;
protected final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonLabels";
private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "ListShuttle";
private boolean isSelectedList;
private boolean isAvailableList;
- protected List selectItemsForSelectedList(FacesContext facesContext,UIComponent uiComponent, List selectItemList, Converter converter, Set lookupSet) {
- List selectItemForSelectedValues = new ArrayList(lookupSet.size());
- for (Iterator i = selectItemList.iterator(); i.hasNext();) {
- SelectItem selectItem = (SelectItem) i.next();
+ protected List <SelectItem> selectItemsForSelectedList(FacesContext facesContext,UIComponent uiComponent, List <SelectItem> selectItemList, Converter converter, Set <SelectItem> lookupSet) {
+ List <SelectItem> selectItemForSelectedValues = new ArrayList<SelectItem>(lookupSet.size());
+ for (Iterator <SelectItem> i = selectItemList.iterator(); i.hasNext();) {
+ SelectItem selectItem = i.next();
String itemStrValue = PickListUtils.getConvertedStringValue(facesContext, uiComponent,converter, selectItem.getValue());
- for (Iterator i2 = lookupSet.iterator(); i2.hasNext();) {
+ for (Iterator <SelectItem> i2 = lookupSet.iterator(); i2.hasNext();) {
Object value = i2.next();
if (value.equals(itemStrValue)) {
selectItemForSelectedValues.add(selectItem);
@@ -69,8 +60,9 @@
return selectItemForSelectedValues;
}
- protected List selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List selectItemList, List selectItemsForSelectedList, Converter converter) {
- return new ArrayList(CollectionUtils.subtract(selectItemList, selectItemsForSelectedList));
+ protected List selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List <SelectItem> selectItemList, List <SelectItem> selectItemsForSelectedList, Converter converter) {
+ Collection collection = CollectionUtils.subtract(selectItemList, selectItemsForSelectedList);
+ return new ArrayList <SelectItem>(collection);
}
protected List getSelectItemsList(FacesContext context,UIComponent component) {
@@ -81,14 +73,12 @@
public PickListRenderer() {
super();
-
this.bundleName = MESSAGE_BUNDLE_NAME;
}
public void decode(FacesContext context, UIComponent component) {
UIPickList picklist = (UIPickList)component;
-
if (!(picklist instanceof EditableValueHolder)) {
throw new IllegalArgumentException("Component " + picklist.getClientId(context) + " is not an EditableValueHolder");
}
@@ -100,42 +90,19 @@
return;
}
- /*String[] valuesInline = getSubmittedValues(context, component);
- if (valuesInline == null || (valuesInline[0] == null) || "".equals(valuesInline[0].trim())) {
- ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
- } else {
- String[] reqValues = valuesInline[0].split(",");
- ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
- }*/
if (paramValuesMap.containsKey(hiddenClientId)) {
String[] valuesInline = (String[]) paramValuesMap.get(hiddenClientId);
-
- if (valuesInline[0].trim().equals("")) {
- ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
- } else {
- String[] reqValues = valuesInline[0].split(",");
- ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
- }
+ if (valuesInline[0].trim().equals("")) {
+ ((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
+ } else {
+ String[] reqValues = valuesInline[0].split(",");
+ ((EditableValueHolder) picklist).setSubmittedValue(reqValues);
+ }
} else {
((EditableValueHolder) picklist).setSubmittedValue(new String[] {});
}
}
- private String[] getSubmittedValues(FacesContext context, UIComponent component) {
- UIListShuttle listShuttle = (UIListShuttle) component;
-
- String clientId = listShuttle.getBaseClientId(context);
- ExternalContext externalContext = context.getExternalContext();
- Map requestParameterMap = externalContext.getRequestParameterMap();
-
- String[] strings = null;
-
- if (requestParameterMap.containsKey(clientId)) {
- strings = (String[]) externalContext.getRequestParameterValuesMap().get(clientId);
- }
- return strings;
- }
-
private boolean isDisabledOrReadOnly(UIPickList picklist) {
return picklist.isDisplayValueOnly() || isTrue(picklist.getAttributes().get("disabled"));
}
@@ -162,97 +129,66 @@
}
private void encodeRows(FacesContext context, UIComponent component, boolean source) throws IOException {
- List <SelectItem> selectItemsList = SelectUtils.getSelectItems(context,component);
+ List selectItemsList = SelectUtils.getSelectItems(context,component);
Converter converter = PickListUtils.findUISelectManyConverterFailsafe(context, component);
Set lookupSet = PickListUtils.getSubmittedOrSelectedValuesAsSet(true, component, context, converter);
List selectItemsForSelectedValues = selectItemsForSelectedList(context, component, selectItemsList, converter, lookupSet); //TODO: optimaze
List selectItemsForAvailableList = selectItemsForAvailableList(context, component, selectItemsList, selectItemsForSelectedValues, converter);
- isSelectedList = !selectItemsForSelectedValues.isEmpty();
- isAvailableList = !selectItemsForAvailableList.isEmpty();
+
List selectItemList = null;
if (source) {
- selectItemList = selectItemsForAvailableList;
+ selectItemList = selectItemsForAvailableList;
} else {
- selectItemList = selectItemsForSelectedValues;
+ selectItemList = selectItemsForSelectedValues;
}
int i = 0;
for (Iterator it = selectItemList.iterator(); it.hasNext();) {
- i++;
- SelectItem selectItem = (SelectItem) it.next();
- if (selectItem instanceof SelectItemGroup) {
- //TODO
- } else {
- String itemStrValue = PickListUtils.getConvertedStringValue(context, component, converter, selectItem.getValue());
-
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.TR_ELEMENT, component);
- String clientId = component.getClientId(context);
- String id = clientId + ":" + i;
- writer.writeAttribute("id", id, null);
-
- StringBuffer rowClassName = new StringBuffer();
- StringBuffer cellClassName = new StringBuffer();
- if (source) {
- rowClassName.append("rich-picklist-source-row");
- cellClassName.append("rich-picklist-source-cell");
- } else {
- rowClassName.append("rich-picklist-target-row");
- cellClassName.append("rich-picklist-target-cell");
- }
-
- /*
- * String rowClass = holder.getRowClass();
- if (rowClass != null) {
- rowClassName.append(' ');
- rowClassName.append(rowClass);
- }
- */
-
- /*
- * boolean active = itemState.isActive();
- boolean selected = itemState.isSelected();
- selectionState.addState(selected);
- if (selected) {
- if (source) {
- rowClassName.append(" rich-shuttle-source-row-selected");
- cellClassName.append(" rich-shuttle-source-cell-selected");
- } else {
- rowClassName.append(" rich-shuttle-target-row-selected");
- cellClassName.append(" rich-shuttle-target-cell-selected");
- }
- }
- */
- writer.writeAttribute("class", rowClassName.toString(), null);
-
- writer.startElement(HTML.td_ELEM, component);
- Object width = component.getAttributes().get("width");
- writer.writeAttribute(HTML.class_ATTRIBUTE, cellClassName, null);
- if (width != null) {
- writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
- }
- /*
- * String columnClass = holder.getColumnClass(colCounter);
- if (columnClass != null) {
- writer.writeAttribute("class", cellClassName.toString().concat(" " + columnClass), null);
- } else {
- writer.writeAttribute("class", cellClassName.toString(), null);
- }
- */
- encodeSpacer(context, component, writer);
-
- boolean escape = isTrue(component.getAttributes().get("escape"));
- if (escape) {
- writer.writeText(selectItem.getLabel(), null);
- } else {
- writer.write(selectItem.getLabel());
- }
-
- encodeItemValue(context, component, writer, id, itemStrValue, lookupSet, i);
-
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
- }
+ i++;
+ SelectItem selectItem = (SelectItem)it.next();
+ if (selectItem instanceof SelectItemGroup) {
+ //TODO
+ } else {
+ String itemStrValue = PickListUtils.getConvertedStringValue(context, component, converter, selectItem.getValue());
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.TR_ELEMENT, component);
+ String clientId = component.getClientId(context);
+ String id = clientId + ":" + i;
+ writer.writeAttribute("id", id, null);
+
+ StringBuffer rowClassName = new StringBuffer();
+ StringBuffer cellClassName = new StringBuffer();
+ if (source) {
+ rowClassName.append("rich-picklist-source-row");
+ cellClassName.append("rich-picklist-source-cell");
+ } else {
+ rowClassName.append("rich-picklist-target-row");
+ cellClassName.append("rich-picklist-target-cell");
+ }
+
+ writer.writeAttribute("class", rowClassName.toString(), null);
+ writer.startElement(HTML.td_ELEM, component);
+ Object width = component.getAttributes().get("width");
+ writer.writeAttribute(HTML.class_ATTRIBUTE, cellClassName, null);
+
+ if (width != null) {
+ writer.writeAttribute("style", "width: " + HtmlUtil.qualifySize(width.toString()), null);
+ }
+
+ encodeSpacer(context, component, writer);
+
+ boolean escape = isTrue(component.getAttributes().get("escape"));
+ if (escape) {
+ writer.writeText(selectItem.getLabel(), null);
+ } else {
+ writer.write(selectItem.getLabel());
+ }
+
+ encodeItemValue(context, component, writer, id, itemStrValue, lookupSet, i);
+ writer.endElement(HTML.td_ELEM);
+ writer.endElement(HTML.TR_ELEMENT);
+ }
}
}
@@ -266,30 +202,16 @@
private void encodeItemValue(FacesContext context, UIComponent component,
ResponseWriter writer, String id,
- String itemStrValue, Set lookupSet, int rowKey) throws IOException { //rowKey = i
+ String itemStrValue, Set<SelectItem> lookupSet, int rowKey) throws IOException { //rowKey = i
writer.startElement(HTML.INPUT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
writer.writeAttribute(HTML.NAME_ATTRIBUTE, id, null);
StringBuffer value = new StringBuffer();
- //if (lookupSet.contains(itemStrValue)) {
- //value.append('s');
- //}
-
- /*if (active) {
- value.append('a');
- }*/
-
- //value.append(rowKey);
- //value.append(':');
- //value.append(shuttleRendererTableHolder.getConverter().getAsString(context, table, table.getRowData()));
- value.append(itemStrValue); //??
-
- writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
-
- writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
-
- writer.endElement(HTML.INPUT_ELEM);
+ value.append(itemStrValue);
+ writer.writeAttribute(HTML.value_ATTRIBUTE, value.toString(), null);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, id + "StateInput", null);
+ writer.endElement(HTML.INPUT_ELEM);
}
protected void encodeSpacer(FacesContext context, UIComponent component,
@@ -310,14 +232,13 @@
private void encodeHiddenField(FacesContext context, UIComponent component,
String hiddenFieldCliendId, Set lookupSet, ResponseWriter writer) throws IOException {
-
writer.startElement(HTML.INPUT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, "hidden", "type");
writer.writeAttribute(HTML.id_ATTRIBUTE, hiddenFieldCliendId, "id");
writer.writeAttribute("name", hiddenFieldCliendId, null);
-
StringBuffer sb = new StringBuffer();
int n = 0;
+
for (Iterator i = lookupSet.iterator(); i.hasNext();) {
if (n > 0) {
sb.append(",");
@@ -332,7 +253,7 @@
}
- protected Class<? extends UIComponent> getComponentClass() {
+ protected Class <? extends UIComponent> getComponentClass() {
return UIPickList.class;
}
@@ -342,12 +263,10 @@
if (event != null) {
event = event.trim();
-
if (event.length() != 0) {
JSFunctionDefinition function = new JSFunctionDefinition();
function.addParameter("event");
function.addToBody(event);
-
result = function;
}
}
@@ -364,7 +283,6 @@
}
protected List getClassesAsList(FacesContext context, UIComponent component, String attr) {
-
String value = (String) ((UIComponent) component).getAttributes().get(attr);
if (value != null && (value.length() != 0)) {
return Arrays.asList(value.split(","));
@@ -372,19 +290,16 @@
return null;
}
- public void encodePickListControlsFacets(FacesContext context, UIComponent component)
- throws IOException {
- String clientId = component.getClientId(context);
-
- ResponseWriter writer = context.getResponseWriter();
-
- int divider = SHUTTLE_HELPERS.length / 2;
- boolean enable;
+ public void encodePickListControlsFacets(FacesContext context, UIComponent component) throws IOException {
+ String clientId = component.getClientId(context);
+ ResponseWriter writer = context.getResponseWriter();
+ int divider = SHUTTLE_HELPERS.length / 2;
+ boolean enable;
for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
- OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
- if (helper.getDefaultText().equals(PickListControlsHelper.DEFAULT_LABEL_REMOVE_ALL)) {
+ OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
+ if (helper.getDefaultText().equals(ListShuttleControlsHelper.CONTROL_ID_REMOVE_ALL)) {
enable = isSelectedList;
- } else if (helper.getDefaultText().equals(PickListControlsHelper.DEFAULT_LABEL_COPY_ALL)) {
+ } else if (helper.getDefaultText().equals(ListShuttleControlsHelper.CONTROL_ID_COPY_ALL)) {
enable = isAvailableList;
} else {
if (helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF)) {
@@ -396,7 +311,7 @@
encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enable,
"rich-list-picklist-button", " rich-picklist-control");
}
- }
+ }
protected void encodeControlFacet(FacesContext context,
UIComponent component, OrderingComponentRendererBase.ControlsHelper helper,
@@ -416,16 +331,13 @@
try {
bundle = ResourceBundle.getBundle(bundleName, locale, contextClassLoader);
} catch (MissingResourceException e) {
-
}
}
Map attributes = component.getAttributes();
UIComponent facet = component.getFacet(helper.getFacetName());
boolean useFacet = (facet != null && facet.isRendered());
-
- renderDefaultControl(context, component, writer, useFacet,
- helper, clientId, bundle ,enabled, baseStyle, baseControlStyle);
+ renderDefaultControl(context, component, writer, useFacet, helper, clientId, bundle ,enabled, baseStyle, baseControlStyle);
}
protected void renderDefaultControl(FacesContext context,
@@ -436,17 +348,16 @@
UIComponent facet = orderingList.getFacet(helper.getFacetName());
String customEvent = null;
Map attributes = orderingList.getAttributes();
+
if (helper.customEvent != null) {
customEvent = (String) attributes.get(helper.customEvent);
}
- String styleFromAttribute = (String) attributes
- .get(helper.styleFromAttribute);
-
+ String styleFromAttribute = (String) attributes.get(helper.styleFromAttribute);
String baseStyleLight = baseStyle.concat("-light");
String baseStylePress = baseStyle.concat("-press");
-
String currentStyle = baseControlStyle + helper.getStyleClassName();
+
if (styleFromAttribute != null) {
currentStyle = styleFromAttribute.concat(currentStyle);
}
@@ -456,16 +367,19 @@
writer.writeAttribute(HTML.id_ATTRIBUTE, controlId, null); //FIXME:
writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
String style = null;
+
if (enabled) {
style = "display:block;";
} else {
style = "display:none;";
}
+
writer.writeAttribute(HTML.style_ATTRIBUTE, style, null);
+
if (!useFacet) {
-
writer.startElement(HTML.DIV_ELEM, orderingList);
writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + helper.getButtonStyleClass(), null);
+
if (helper.enable) {
writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='" + baseStyleLight + "'", null);
writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='" + baseStylePress + "'", null);
@@ -477,6 +391,7 @@
writer.writeAttribute(HTML.id_ATTRIBUTE, controlId + "link", null); //FIXME:
writer.writeAttribute(HTML.HREF_ATTR, "#", null);
writer.writeAttribute(HTML.onclick_ATTRIBUTE, "return false;", null);
+
if (!helper.enable) {
writer.writeAttribute(HTML.DISABLED_ATTR, "disabled", null);
writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-a-disabled", null);
@@ -489,7 +404,6 @@
writer.startElement(HTML.DIV_ELEM, orderingList);
writer.writeAttribute(HTML.class_ATTRIBUTE, baseStyle + "-content", null);
-
}
if (customEvent != null) {
@@ -503,44 +417,40 @@
writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),
- null);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
- helper.getImageURI()).getUri(context, null), null);
-
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),null);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(helper.getImageURI()).getUri(context, null), null);
writer.endElement(HTML.IMG_ELEMENT);
+ //TODO check properties!!!
+// writer.write(helper.getDefaultText());
if (getUtils().isBooleanAttribute(orderingList, SHOW_LABELS_ATTRIBUTE_NAME)) {
+
String label = (String) attributes.get(helper.getLabelAttributeName());
-
if (label == null && bundle != null) {
try {
label = bundle.getString(helper.getBundlePropertyName());
} catch (MissingResourceException e) {
-
}
}
- if (label == null) {
+ if (label == null || label.equals("")) {
label = helper.getDefaultText();
}
- writer.writeText(label, null);
+ writer.write(label);
}
}
- // writer.writeAttribute(HTML.id_ATTRIBUTE, clientId +
- // helper.getIdSuffix(), null);
-
- // writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
if (!useFacet) {
writer.endElement(HTML.DIV_ELEM);
+
if (!helper.enable) {
writer.endElement(HTML.a_ELEMENT);
}
+
writer.endElement(HTML.a_ELEMENT);
writer.endElement(HTML.DIV_ELEM);
}
writer.endElement(HTML.DIV_ELEM);
-}
+ }
}
16 years, 3 months
JBoss Rich Faces SVN: r5837 - in trunk: framework/impl/src/main/javascript/ajaxjsf and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-02-05 13:04:57 -0500 (Tue, 05 Feb 2008)
New Revision: 5837
Removed:
trunk/framework/impl/src/test/resources/bindedtest.skin.properties
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa.js
trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa_ieemu_xpath.js
trunk/samples/seamPortletEar/ear/pom.xml
trunk/samples/tomahawkCompability/pom.xml
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml
Log:
Update Sarissa library to version 0.9.9
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-02-05 18:04:57 UTC (rev 5837)
@@ -425,6 +425,9 @@
return;
}
}
+ if (!headParsed && "head".equalsIgnoreCase(element.rawname)) {
+ insertResources();
+ }
super.endElement(element, augs);
}
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-02-05 18:04:57 UTC (rev 5837)
@@ -904,7 +904,7 @@
return;
}
LOG.debug("replace all page content with response");
- var isIE = _SARISSA_IS_IE;
+ var isIE = Sarissa._SARISSA_IS_IE;
// maksimkaszynski
//Prevent "Permission denied in IE7"
//Reset calling principal
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa.js 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa.js 2008-02-05 18:04:57 UTC (rev 5837)
@@ -1,12 +1,11 @@
/**
* ====================================================================
- * About
+ * About Sarissa: http://dev.abiss.gr/sarissa
* ====================================================================
* Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs.
* The library supports Gecko based browsers like Mozilla and Firefox,
- * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera
- * @version ${project.version}
- * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net
+ * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and Opera
+ * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net
* ====================================================================
* Licence
* ====================================================================
@@ -17,6 +16,7 @@
* In case your copy of Sarissa does not include the license texts, you may find
* them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and
* <a href="http://www.apache.org">http://www.apache.org</a>.
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
@@ -30,45 +30,72 @@
* <p>Sarissa is a utility class. Provides "static" methods for DOMDocument,
* DOM Node serialization to XML strings and other utility goodies.</p>
* @constructor
+ * @static
*/
-function Sarissa(){};
-Sarissa.VERSION = "${project.version}";
+function Sarissa(){}
+Sarissa.VERSION = "0.9.9";
Sarissa.PARSED_OK = "Document contains no parsing errors";
Sarissa.PARSED_EMPTY = "Document is empty";
Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error";
Sarissa.IS_ENABLED_TRANSFORM_NODE = false;
-var _sarissa_iNsCounter = 0;
-var _SARISSA_IEPREFIX4XSLPARAM = "";
-var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
-var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
-var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
-var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE;
-var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1));
-var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
+Sarissa.REMOTE_CALL_FLAG = "gr.abiss.sarissa.REMOTE_CALL_FLAG";
+/** @private */
+Sarissa._sarissa_iNsCounter = 0;
+/** @private */
+Sarissa._SARISSA_IEPREFIX4XSLPARAM = "";
+/** @private */
+Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true;
+/** @private */
+Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT = Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument;
+/** @private */
+Sarissa._SARISSA_HAS_DOM_FEATURE = Sarissa._SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature;
+/** @private */
+Sarissa._SARISSA_IS_MOZ = Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT && Sarissa._SARISSA_HAS_DOM_FEATURE;
+/** @private */
+Sarissa._SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1;
+/** @private */
+Sarissa._SARISSA_IS_SAFARI_OLD = Sarissa._SARISSA_IS_SAFARI && (parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1], 10) < 420);
+/** @private */
+Sarissa._SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
+/** @private */
+Sarissa._SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1;
if(!window.Node || !Node.ELEMENT_NODE){
Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12};
-};
+}
+//This breaks for(x in o) loops in the old Safari
+if(Sarissa._SARISSA_IS_SAFARI_OLD){
+ HTMLHtmlElement = document.createElement("html").constructor;
+ Node = HTMLElement = {};
+ HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__;
+ HTMLDocument = Document = document.constructor;
+ var x = new DOMParser();
+ XMLDocument = x.constructor;
+ Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor;
+ x = null;
+}
if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; }
// IE initialization
-if(_SARISSA_IS_IE){
+if(Sarissa._SARISSA_IS_IE){
// for XSLT parameter names, prefix needed by IE
- _SARISSA_IEPREFIX4XSLPARAM = "xsl:";
+ Sarissa._SARISSA_IEPREFIX4XSLPARAM = "xsl:";
// used to store the most recent ProgID available out of the above
var _SARISSA_DOM_PROGID = "";
var _SARISSA_XMLHTTP_PROGID = "";
var _SARISSA_DOM_XMLWRITER = "";
/**
- * Called when the Sarissa_xx.js file is parsed, to pick most recent
+ * Called when the sarissa.js file is parsed, to pick most recent
* ProgIDs for IE, then gets destroyed.
+ * @memberOf Sarissa
* @private
* @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object
* @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled
*/
Sarissa.pickRecentProgID = function (idList){
// found progID flag
- var bFound = false;
+ var bFound = false, e;
+ var o2Store;
for(var i=0; i < idList.length && !bFound; i++){
try{
var oDoc = new ActiveXObject(idList[i]);
@@ -76,11 +103,12 @@
bFound = true;
}catch (objException){
// trap; try next progID
- };
- };
+ e = objException;
+ }
+ }
if (!bFound) {
- throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")";
- };
+ throw "Could not retrieve a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")";
+ }
idList = null;
return o2Store;
};
@@ -97,10 +125,10 @@
XMLHttpRequest = function() {
if(!_SARISSA_XMLHTTP_PROGID){
_SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
- };
+ }
return new ActiveXObject(_SARISSA_XMLHTTP_PROGID);
};
- };
+ }
// we dont need this anymore
//============================================
// Factory methods (IE)
@@ -109,7 +137,7 @@
Sarissa.getDomDocument = function(sUri, sName){
if(!_SARISSA_DOM_PROGID){
_SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]);
- };
+ }
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
// if a root tag name was provided, we need to load it in the DOM object
if (sName){
@@ -121,22 +149,22 @@
prefix = sName.substring(0, sName.indexOf(":"));
sName = sName.substring(sName.indexOf(":")+1);
}else{
- prefix = "a" + (_sarissa_iNsCounter++);
- };
- };
+ prefix = "a" + (Sarissa._sarissa_iNsCounter++);
+ }
+ }
// use namespaces if a namespace URI exists
if(sUri){
oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />");
} else {
oDoc.loadXML('<' + sName + " />");
- };
- };
+ }
+ }
return oDoc;
};
// see non-IE version
Sarissa.getParseErrorText = function (oDoc) {
var parseErrorText = Sarissa.PARSED_OK;
- if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){
+ if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode !== 0){
parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
"\nLocation: " + oDoc.parseError.url +
"\nLine Number " + oDoc.parseError.line + ", Column " +
@@ -145,28 +173,28 @@
"\n";
for(var i = 0; i < oDoc.parseError.linepos;i++){
parseErrorText += "-";
- };
+ }
parseErrorText += "^\n";
}
- else if(oDoc.documentElement == null){
+ else if(oDoc.documentElement === null){
parseErrorText = Sarissa.PARSED_EMPTY;
- };
+ }
return parseErrorText;
};
// see non-IE version
Sarissa.setXpathNamespaces = function(oDoc, sNsSet) {
oDoc.setProperty("SelectionLanguage", "XPath");
oDoc.setProperty("SelectionNamespaces", sNsSet);
- };
+ };
/**
- * Basic implementation of Mozilla's XSLTProcessor for IE.
+ * An implementation of Mozilla's XSLTProcessor for IE.
* Reuses the same XSLT stylesheet for multiple transforms
* @constructor
*/
XSLTProcessor = function(){
if(!_SARISSA_XSLTEMPLATE_PROGID){
_SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]);
- };
+ }
this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID);
this.processor = null;
};
@@ -178,29 +206,39 @@
XSLTProcessor.prototype.importStylesheet = function(xslDoc){
if(!_SARISSA_THREADEDDOM_PROGID){
_SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]);
- };
+ }
xslDoc.setProperty("SelectionLanguage", "XPath");
xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
// convert stylesheet to free threaded
var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
// make included/imported stylesheets work if exist and xsl was originally loaded from url
- if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){
+ try{
+ converted.resolveExternals = true;
+ converted.setProperty("AllowDocumentFunction", true);
+ }
+ catch(e){
+ // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later.
+ }
+ if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") !== null){
converted.async = false;
- if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") {
- converted.setProperty("AllowDocumentFunction", true);
- converted.resolveExternals = true;
- }
converted.load(xslDoc.url);
- } else {
+ }
+ else {
converted.loadXML(xslDoc.xml);
- };
+ }
converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
var output = converted.selectSingleNode("//xsl:output");
- this.outputMethod = output ? output.getAttribute("method") : "html";
+ //this.outputMethod = output ? output.getAttribute("method") : "html";
+ if(output) {
+ this.outputMethod = output.getAttribute("method");
+ }
+ else {
+ delete this.outputMethod;
+ }
this.template.stylesheet = converted;
this.processor = this.template.createProcessor();
// for getParameter and clearParameters
- this.paramsSet = new Array();
+ this.paramsSet = [];
};
/**
@@ -210,9 +248,10 @@
*/
XSLTProcessor.prototype.transformToDocument = function(sourceDoc){
// fix for bug 1549749
+ var outDoc;
if(_SARISSA_THREADEDDOM_PROGID){
this.processor.input=sourceDoc;
- var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);
+ outDoc=new ActiveXObject(_SARISSA_DOM_PROGID);
this.processor.output=outDoc;
this.processor.transform();
return outDoc;
@@ -220,15 +259,15 @@
else{
if(!_SARISSA_DOM_XMLWRITER){
_SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]);
- };
+ }
this.processor.input = sourceDoc;
- var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER);
+ outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER);
this.processor.output = outDoc;
this.processor.transform();
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
oDoc.loadXML(outDoc.output+"");
return oDoc;
- };
+ }
};
/**
@@ -243,10 +282,11 @@
this.processor.transform();
var s = this.processor.output;
var f = ownerDoc.createDocumentFragment();
+ var container;
if (this.outputMethod == 'text') {
f.appendChild(ownerDoc.createTextNode(s));
} else if (ownerDoc.body && ownerDoc.body.innerHTML) {
- var container = ownerDoc.createElement('div');
+ container = ownerDoc.createElement('div');
container.innerHTML = s;
while (container.hasChildNodes()) {
f.appendChild(container.firstChild);
@@ -259,7 +299,7 @@
}
var xml = ''.concat('<my>', s, '</my>');
oDoc.loadXML(xml);
- var container = oDoc.documentElement;
+ container = oDoc.documentElement;
while (container.hasChildNodes()) {
f.appendChild(container.firstChild);
}
@@ -273,21 +313,22 @@
* @argument name The parameter base name
* @argument value The new parameter value
*/
- XSLTProcessor.prototype.setParameter = function(nsURI, name, value){
- // make value a zero length string if null to allow clearing
- value = value ? value : "";
- // nsURI is optional but cannot be null
- if(nsURI){
- this.processor.addParameter(name, value, nsURI);
- }else{
- this.processor.addParameter(name, value);
- };
- // update updated params for getParameter
- if(!this.paramsSet[""+nsURI]){
- this.paramsSet[""+nsURI] = new Array();
- };
- this.paramsSet[""+nsURI][name] = value;
- };
+ XSLTProcessor.prototype.setParameter = function(nsURI, name, value){
+ // make value a zero length string if null to allow clearing
+ value = value ? value : "";
+ // nsURI is optional but cannot be null
+ if(nsURI){
+ this.processor.addParameter(name, value, nsURI);
+ }else{
+ this.processor.addParameter(name, value);
+ }
+ // update updated params for getParameter
+ nsURI = "" + (nsURI || "");
+ if(!this.paramsSet[nsURI]){
+ this.paramsSet[nsURI] = [];
+ }
+ this.paramsSet[nsURI][name] = value;
+ };
/**
* Gets a parameter if previously set by setParameter. Returns null
* otherwise
@@ -296,30 +337,31 @@
* @return The parameter value if reviously set by setParameter, null otherwise
*/
XSLTProcessor.prototype.getParameter = function(nsURI, name){
- nsURI = "" + nsURI;
+ nsURI = "" + (nsURI || "");
if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){
return this.paramsSet[nsURI][name];
}else{
return null;
- };
+ }
};
+
/**
* Clear parameters (set them to default values as defined in the stylesheet itself)
*/
XSLTProcessor.prototype.clearParameters = function(){
for(var nsURI in this.paramsSet){
for(var name in this.paramsSet[nsURI]){
- if(nsURI){
+ if(nsURI!==""){
this.processor.addParameter(name, "", nsURI);
}else{
this.processor.addParameter(name, "");
- };
- };
- };
- this.paramsSet = new Array();
+ }
+ }
+ }
+ this.paramsSet = [];
};
}else{ /* end IE initialization, try to deal with real browsers now ;-) */
- if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){
+ if(Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT){
/**
* <p>Ensures the document was loaded correctly, otherwise sets the
* parseError to -1 to indicate something went wrong. Internal use</p>
@@ -338,6 +380,7 @@
/**
* <p>Sets the readyState property of the given DOM Document object.
* Internal use.</p>
+ * @memberOf Sarissa
* @private
* @argument oDoc the DOM Document object to fire the
* readystatechange event
@@ -346,9 +389,11 @@
Sarissa.__setReadyState__ = function(oDoc, iReadyState){
oDoc.readyState = iReadyState;
oDoc.readystate = iReadyState;
- if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function")
+ if (oDoc.onreadystatechange !== null && typeof oDoc.onreadystatechange == "function") {
oDoc.onreadystatechange();
+ }
};
+
Sarissa.getDomDocument = function(sUri, sName){
var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null);
if(!oDoc.onreadystatechange){
@@ -357,7 +402,7 @@
* <p>Emulate IE's onreadystatechange attribute</p>
*/
oDoc.onreadystatechange = null;
- };
+ }
if(!oDoc.readyState){
/**
* <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p>
@@ -367,17 +412,18 @@
* <li>4 == COMPLETED</li></ul>
*/
oDoc.readyState = 0;
- };
+ }
oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false);
return oDoc;
};
if(window.XMLDocument){
// do nothing
}// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS
- else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){
- //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good
+ else if(Sarissa._SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){
+ //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good
/**
* <p>Factory method to obtain a new DOM Document object</p>
+ * @memberOf Sarissa
* @argument sUri the namespace of the root node (if any)
* @argument sUri the local name of the root node (if any)
* @returns a new DOM Document
@@ -393,17 +439,17 @@
// looks like safari does not create the root element for some unknown reason
if(oDoc && (sUri || sName) && !oDoc.documentElement){
oDoc.appendChild(oDoc.createElementNS(sUri, sName));
- };
+ }
return oDoc;
};
- };
- };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT)
-};
+ }
+ }//if(Sarissa._SARISSA_HAS_DOM_CREATE_DOCUMENT)
+}
//==========================================
// Common stuff
//==========================================
if(!window.DOMParser){
- if(_SARISSA_IS_SAFARI){
+ if(Sarissa._SARISSA_IS_SAFARI){
/*
* DOMParser is a utility class, used to construct DOMDocuments from XML strings
* @constructor
@@ -428,10 +474,10 @@
doc.loadXML(sXml);
return doc;
};
- };
-};
+ }
+}
-if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){
+if((typeof(document.importNode) == "undefined") && Sarissa._SARISSA_IS_IE){
try{
/**
* Implementation of importNode for the context window document in IE.
@@ -443,7 +489,7 @@
document.importNode = function(oNode, bChildren){
var tmp;
if (oNode.nodeName=='#text') {
- return document.createTextElement(oNode.data);
+ return document.createTextNode(oNode.data);
}
else {
if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){
@@ -457,24 +503,24 @@
}
else{
tmp = document.createElement("div");
- };
+ }
if(bChildren){
tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML;
}else{
tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML;
- };
+ }
return tmp.getElementsByTagName("*")[0];
- };
-
+ }
};
- }catch(e){ };
-};
+ }catch(e){ }
+}
if(!Sarissa.getParseErrorText){
/**
* <p>Returns a human readable description of the parsing error. Usefull
* for debugging. Tip: append the returned error string in a <pre>
* element if you want to render it.</p>
* <p>Many thanks to Christian Stocker for the initial patch.</p>
+ * @memberOf Sarissa
* @argument oDoc The target DOM document
* @returns The parsing error description of the target Document in
* human readable form (preformated text)
@@ -489,12 +535,18 @@
} else if(oDoc.getElementsByTagName("parsererror").length > 0){
var parsererror = oDoc.getElementsByTagName("parsererror")[0];
parseErrorText = Sarissa.getText(parsererror, true)+"\n";
- } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){
+ } else if(oDoc.parseError && oDoc.parseError.errorCode !== 0){
parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR;
- };
+ }
return parseErrorText;
};
-};
+}
+/**
+ * Get a string with the concatenated values of all string nodes under the given node
+ * @memberOf Sarissa
+ * @argument oNode the given DOM node
+ * @argument deep whether to recursively scan the children nodes of the given node for text as well. Default is <code>false</code>
+ */
Sarissa.getText = function(oNode, deep){
var s = "";
var nodes = oNode.childNodes;
@@ -503,18 +555,13 @@
var nodeType = node.nodeType;
if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){
s += node.data;
- } else if(deep == true
- && (nodeType == Node.ELEMENT_NODE
- || nodeType == Node.DOCUMENT_NODE
- || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){
+ } else if(deep === true && (nodeType == Node.ELEMENT_NODE || nodeType == Node.DOCUMENT_NODE || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){
s += Sarissa.getText(node, true);
- };
- };
+ }
+ }
return s;
};
-if(!window.XMLSerializer
- && Sarissa.getDomDocument
- && Sarissa.getDomDocument("","foo", null).xml){
+if(!window.XMLSerializer && Sarissa.getDomDocument && Sarissa.getDomDocument("","foo", null).xml){
/**
* Utility class to serialize DOM Node objects to XML strings
* @constructor
@@ -527,56 +574,65 @@
XMLSerializer.prototype.serializeToString = function(oNode) {
return oNode.xml;
};
-};
+}
/**
- * strips tags from a markup string
+ * Strips tags from the given markup string
+ * @memberOf Sarissa
*/
Sarissa.stripTags = function (s) {
return s.replace(/<[^>]+>/g,"");
};
/**
* <p>Deletes all child nodes of the given node</p>
+ * @memberOf Sarissa
* @argument oNode the Node to empty
*/
Sarissa.clearChildNodes = function(oNode) {
// need to check for firstChild due to opera 8 bug with hasChildNodes
while(oNode.firstChild) {
oNode.removeChild(oNode.firstChild);
- };
+ }
};
/**
* <p> Copies the childNodes of nodeFrom to nodeTo</p>
* <p> <b>Note:</b> The second object's original content is deleted before
* the copy operation, unless you supply a true third parameter</p>
+ * @memberOf Sarissa
* @argument nodeFrom the Node to copy the childNodes from
* @argument nodeTo the Node to copy the childNodes to
* @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false
*/
Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
+ if(Sarissa._SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ??
+ nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node
+ }
+
if((!nodeFrom) || (!nodeTo)){
throw "Both source and destination nodes must be provided";
- };
+ }
if(!bPreserveExisting){
Sarissa.clearChildNodes(nodeTo);
- };
+ }
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
var nodes = nodeFrom.childNodes;
+ var i;
if(typeof(ownerDoc.importNode) != "undefined") {
- for(var i=0;i < nodes.length;i++) {
+ for(i=0;i < nodes.length;i++) {
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
- };
+ }
} else {
- for(var i=0;i < nodes.length;i++) {
+ for(i=0;i < nodes.length;i++) {
nodeTo.appendChild(nodes[i].cloneNode(true));
- };
- };
+ }
+ }
};
/**
* <p> Moves the childNodes of nodeFrom to nodeTo</p>
* <p> <b>Note:</b> The second object's original content is deleted before
* the move operation, unless you supply a true third parameter</p>
+ * @memberOf Sarissa
* @argument nodeFrom the Node to copy the childNodes from
* @argument nodeTo the Node to copy the childNodes to
* @argument bPreserveExisting whether to preserve the original content of nodeTo, default is
@@ -584,81 +640,271 @@
Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
if((!nodeFrom) || (!nodeTo)){
throw "Both source and destination nodes must be provided";
- };
+ }
if(!bPreserveExisting){
Sarissa.clearChildNodes(nodeTo);
- };
+ }
var nodes = nodeFrom.childNodes;
// if within the same doc, just move, else copy and delete
if(nodeFrom.ownerDocument == nodeTo.ownerDocument){
while(nodeFrom.firstChild){
nodeTo.appendChild(nodeFrom.firstChild);
- };
+ }
} else {
var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
+ var i;
if(typeof(ownerDoc.importNode) != "undefined") {
- for(var i=0;i < nodes.length;i++) {
+ for(i=0;i < nodes.length;i++) {
nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));
- };
+ }
}else{
- for(var i=0;i < nodes.length;i++) {
+ for(i=0;i < nodes.length;i++) {
nodeTo.appendChild(nodes[i].cloneNode(true));
- };
- };
+ }
+ }
Sarissa.clearChildNodes(nodeFrom);
- };
+ }
};
/**
- * <p>Serialize any object to an XML string. All properties are serialized using the property name
+ * <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name
* as the XML element name. Array elements are rendered as <code>array-item</code> elements,
* using their index/key as the value of the <code>key</code> attribute.</p>
+ * @memberOf Sarissa
* @argument anyObject the object to serialize
* @argument objectName a name for that object
- * @return the XML serializationj of the given object as a string
+ * @return the XML serialization of the given object as a string
*/
Sarissa.xmlize = function(anyObject, objectName, indentSpace){
indentSpace = indentSpace?indentSpace:'';
var s = indentSpace + '<' + objectName + '>';
var isLeaf = false;
- if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String
- || anyObject instanceof Boolean || anyObject instanceof Date){
+ if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String || anyObject instanceof Boolean || anyObject instanceof Date){
s += Sarissa.escape(""+anyObject);
isLeaf = true;
}else{
s += "\n";
- var itemKey = '';
var isArrayItem = anyObject instanceof Array;
for(var name in anyObject){
s += Sarissa.xmlize(anyObject[name], (isArrayItem?"array-item key=\""+name+"\"":name), indentSpace + " ");
- };
+ }
s += indentSpace;
- };
- return s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n");
+ }
+ return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"));
};
/**
* Escape the given string chacters that correspond to the five predefined XML entities
+ * @memberOf Sarissa
* @param sXml the string to escape
*/
Sarissa.escape = function(sXml){
- return sXml.replace(/&/g, "&")
- .replace(/</g, "<")
- .replace(/>/g, ">")
- .replace(/"/g, """)
- .replace(/'/g, "'");
+ return sXml.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
};
/**
* Unescape the given string. This turns the occurences of the predefined XML
* entities to become the characters they represent correspond to the five predefined XML entities
+ * @memberOf Sarissa
* @param sXml the string to unescape
*/
Sarissa.unescape = function(sXml){
- return sXml.replace(/'/g,"'")
- .replace(/"/g,"\"")
- .replace(/>/g,">")
- .replace(/</g,"<")
- .replace(/&/g,"&");
+ return sXml.replace(/'/g,"'").replace(/"/g,"\"").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");
};
+
+/** @private */
+Sarissa.updateCursor = function(oTargetElement, sValue) {
+ if(oTargetElement && oTargetElement.style && oTargetElement.style.cursor !== undefined ){
+ oTargetElement.style.cursor = sValue;
+ }
+};
+
+/**
+ * Asynchronously update an element with response of a GET request on the given URL. Passing a configured XSLT
+ * processor will result in transforming and updating oNode before using it to update oTargetElement.
+ * You can also pass a callback function to be executed when the update is finished. The function will be called as
+ * <code>functionName(oNode, oTargetElement);</code>
+ * @memberOf Sarissa
+ * @param sFromUrl the URL to make the request to
+ * @param oTargetElement the element to update
+ * @param xsltproc (optional) the transformer to use on the returned
+ * content before updating the target element with it
+ * @param callback (optional) a Function object to execute once the update is finished successfuly, called as <code>callback(oNode, oTargetElement)</code>
+ * @param skipCache (optional) whether to skip any cache
+ */
+Sarissa.updateContentFromURI = function(sFromUrl, oTargetElement, xsltproc, callback, skipCache) {
+ try{
+ Sarissa.updateCursor(oTargetElement, "wait");
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", sFromUrl, true);
+ sarissa_dhtml_loadHandler = function() {
+ if (xmlhttp.readyState == 4) {
+ Sarissa.updateContentFromNode(xmlhttp.responseXML, oTargetElement, xsltproc, callback);
+ }
+ };
+ xmlhttp.onreadystatechange = sarissa_dhtml_loadHandler;
+ if (skipCache) {
+ var oldage = "Sat, 1 Jan 2000 00:00:00 GMT";
+ xmlhttp.setRequestHeader("If-Modified-Since", oldage);
+ }
+ xmlhttp.send("");
+ }
+ catch(e){
+ Sarissa.updateCursor(oTargetElement, "auto");
+ throw e;
+ }
+};
+
+/**
+ * Update an element's content with the given DOM node. Passing a configured XSLT
+ * processor will result in transforming and updating oNode before using it to update oTargetElement.
+ * You can also pass a callback function to be executed when the update is finished. The function will be called as
+ * <code>functionName(oNode, oTargetElement);</code>
+ * @memberOf Sarissa
+ * @param oNode the URL to make the request to
+ * @param oTargetElement the element to update
+ * @param xsltproc (optional) the transformer to use on the given
+ * DOM node before updating the target element with it
+ * @param callback (optional) a Function object to execute once the update is finished successfuly, called as <code>callback(oNode, oTargetElement)</code>
+ */
+Sarissa.updateContentFromNode = function(oNode, oTargetElement, xsltproc, callback) {
+ try {
+ Sarissa.updateCursor(oTargetElement, "wait");
+ Sarissa.clearChildNodes(oTargetElement);
+ // check for parsing errors
+ var ownerDoc = oNode.nodeType == Node.DOCUMENT_NODE?oNode:oNode.ownerDocument;
+ if(ownerDoc.parseError && ownerDoc.parseError !== 0) {
+ var pre = document.createElement("pre");
+ pre.appendChild(document.createTextNode(Sarissa.getParseErrorText(ownerDoc)));
+ oTargetElement.appendChild(pre);
+ }
+ else {
+ // transform if appropriate
+ if(xsltproc) {
+ oNode = xsltproc.transformToDocument(oNode);
+ }
+ // be smart, maybe the user wants to display the source instead
+ if(oTargetElement.tagName.toLowerCase() == "textarea" || oTargetElement.tagName.toLowerCase() == "input") {
+ oTargetElement.value = new XMLSerializer().serializeToString(oNode);
+ }
+ else {
+ // ok that was not smart; it was paranoid. Keep up the good work by trying to use DOM instead of innerHTML
+ if(oNode.nodeType == Node.DOCUMENT_NODE || oNode.ownerDocument.documentElement == oNode) {
+ oTargetElement.innerHTML = new XMLSerializer().serializeToString(oNode);
+ }
+ else{
+ oTargetElement.appendChild(oTargetElement.ownerDocument.importNode(oNode, true));
+ }
+ }
+ }
+ if (callback) {
+ callback(oNode, oTargetElement);
+ }
+ }
+ catch(e) {
+ throw e;
+ }
+ finally{
+ Sarissa.updateCursor(oTargetElement, "auto");
+ }
+};
+
+
+/**
+ * Creates an HTTP URL query string from the given HTML form data
+ * @memberOf Sarissa
+ */
+Sarissa.formToQueryString = function(oForm){
+ var qs = "";
+ for(var i = 0;i < oForm.elements.length;i++) {
+ var oField = oForm.elements[i];
+ var sFieldName = oField.getAttribute("name") ? oField.getAttribute("name") : oField.getAttribute("id");
+ // ensure we got a proper name/id and that the field is not disabled
+ if(sFieldName &&
+ ((!oField.disabled) || oField.type == "hidden")) {
+ switch(oField.type) {
+ case "hidden":
+ case "text":
+ case "textarea":
+ case "password":
+ qs += sFieldName + "=" + encodeURIComponent(oField.value) + "&";
+ break;
+ case "select-one":
+ qs += sFieldName + "=" + encodeURIComponent(oField.options[oField.selectedIndex].value) + "&";
+ break;
+ case "select-multiple":
+ for (var j = 0; j < oField.length; j++) {
+ var optElem = oField.options[j];
+ if (optElem.selected === true) {
+ qs += sFieldName + "[]" + "=" + encodeURIComponent(optElem.value) + "&";
+ }
+ }
+ break;
+ case "checkbox":
+ case "radio":
+ if(oField.checked) {
+ qs += sFieldName + "=" + encodeURIComponent(oField.value) + "&";
+ }
+ break;
+ }
+ }
+ }
+ // return after removing last '&'
+ return qs.substr(0, qs.length - 1);
+};
+
+
+/**
+ * Asynchronously update an element with response of an XMLHttpRequest-based emulation of a form submission. <p>The form <code>action</code> and
+ * <code>method</code> attributess will be followed. Passing a configured XSLT processor will result in
+ * transforming and updating the server response before using it to update the target element.
+ * You can also pass a callback function to be executed when the update is finished. The function will be called as
+ * <code>functionName(oNode, oTargetElement);</code></p>
+ * <p>Here is an example of using this in a form element:</p>
+ * <pre name="code" class="xml"><form action="/my/form/handler" method="post"
+ * onbeforesubmit="return Sarissa.updateContentFromForm(this, document.getElementById('targetId'));"><pre>
+ * <p>If JavaScript is supported, the form will not be submitted. Instead, Sarissa will
+ * scan the form and make an appropriate AJAX request, also adding a parameter
+ * to signal to the server that this is an AJAX call. The parameter is
+ * constructed as <code>Sarissa.REMOTE_CALL_FLAG = "=true"</code> so you can change the name in your webpage
+ * simply by assigning another value to Sarissa.REMOTE_CALL_FLAG. If JavaScript is not supported
+ * the form will be submitted normally.
+ * @memberOf Sarissa
+ * @param oForm the form submition to emulate
+ * @param oTargetElement the element to update
+ * @param xsltproc (optional) the transformer to use on the returned
+ * content before updating the target element with it
+ * @param callback (optional) a Function object to execute once the update is finished successfuly, called as <code>callback(oNode, oTargetElement)</code>
+ * @param skipCache (optional) whether to skip any cache
+ */
+Sarissa.updateContentFromForm = function(oForm, oTargetElement, xsltproc, callback) {
+ try{
+ Sarissa.updateCursor(oTargetElement, "wait");
+ // build parameters from form fields
+ var params = Sarissa.formToQueryString(oForm) + "&" + Sarissa.REMOTE_CALL_FLAG + "=true";
+ var xmlhttp = new XMLHttpRequest();
+ if(oForm.getAttribute("method") && oForm.getAttribute("method").toLowerCase() == "get") {
+ xmlhttp.open("GET", oForm.getAttribute("action")+"?"+params, true);
+ }
+ else{
+ xmlhttp.open('POST', oForm.getAttribute("action"), true);
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.setRequestHeader("Content-length", params.length);
+ xmlhttp.setRequestHeader("Connection", "close");
+ }
+ sarissa_dhtml_loadHandler = function() {
+ if (xmlhttp.readyState == 4) {
+ Sarissa.updateContentFromNode(xmlhttp.responseXML, oTargetElement, xsltproc, callback);
+ }
+ };
+ xmlhttp.onreadystatechange = sarissa_dhtml_loadHandler;
+ xmlhttp.send("");
+ }
+ catch(e){
+ Sarissa.updateCursor(oTargetElement, "auto");
+ throw e;
+ }
+ return false;
+};
+
// EOF
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa_ieemu_xpath.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa_ieemu_xpath.js 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/sarissa_ieemu_xpath.js 2008-02-05 18:04:57 UTC (rev 5837)
@@ -3,8 +3,8 @@
* About
* ====================================================================
* Sarissa cross browser XML library - IE XPath Emulation
- * @version ${project.version}
- * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net
+ * @version 0.9.9
+ * @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net
*
* This script emulates Internet Explorer's selectNodes and selectSingleNode
* for Mozilla. Associating namespace prefixes with URIs for your XPath queries
@@ -12,7 +12,6 @@
* USers may also map a namespace prefix to a default (unprefixed) namespace in the
* source document with Sarissa.setXpathNamespaces
*
- *
* ====================================================================
* Licence
* ====================================================================
@@ -33,7 +32,7 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-if(_SARISSA_HAS_DOM_FEATURE && document.implementation.hasFeature("XPath", "3.0")){
+if(Sarissa._SARISSA_HAS_DOM_FEATURE && document.implementation.hasFeature("XPath", "3.0")){
/**
* <p>SarissaNodeList behaves as a NodeList but is only used as a result to <code>selectNodes</code>,
* so it also has some properties IEs proprietery object features.</p>
@@ -41,7 +40,7 @@
* @constructor
* @argument i the (initial) list size
*/
- function SarissaNodeList(i){
+ SarissaNodeList = function (i){
this.length = i;
};
/** <p>Set an Array as the prototype object</p> */
@@ -197,4 +196,4 @@
throw "Method selectNodes is only supported by XML Elements";
};
Sarissa.IS_ENABLED_SELECT_NODES = true;
-};
+};
\ No newline at end of file
Deleted: trunk/framework/impl/src/test/resources/bindedtest.skin.properties
===================================================================
--- trunk/framework/impl/src/test/resources/bindedtest.skin.properties 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/framework/impl/src/test/resources/bindedtest.skin.properties 2008-02-05 18:04:57 UTC (rev 5837)
@@ -1,4 +0,0 @@
-render.kit=TEST
-string.property=bindedstring
-int.property=10
-bind.property=\#{test.bean}
Modified: trunk/samples/seamPortletEar/ear/pom.xml
===================================================================
--- trunk/samples/seamPortletEar/ear/pom.xml 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/samples/seamPortletEar/ear/pom.xml 2008-02-05 18:04:57 UTC (rev 5837)
@@ -60,6 +60,13 @@
</includeInApplicationXml>
<bundleDir>/</bundleDir>
</jarModule>
+ <webModule>
+ <groupId>org.richfaces.samples.seamPortletEar</groupId>
+ <artifactId>seamBookingPortlet</artifactId>
+ <contextRoot>
+ /portalBookingDemo
+ </contextRoot>
+ </webModule>
</modules>
<artifactTypeMappings>
<artifactTypeMapping type="jar" mapping="ejb" />
Modified: trunk/samples/tomahawkCompability/pom.xml
===================================================================
--- trunk/samples/tomahawkCompability/pom.xml 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/samples/tomahawkCompability/pom.xml 2008-02-05 18:04:57 UTC (rev 5837)
@@ -3,7 +3,7 @@
<parent>
<artifactId>samples</artifactId>
<groupId>org.richfaces</groupId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.samples</groupId>
Modified: trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml 2008-02-05 17:57:49 UTC (rev 5836)
+++ trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml 2008-02-05 18:04:57 UTC (rev 5837)
@@ -1,6 +1,9 @@
-<?xml version="1.0"?>
-<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
- "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<?xml version="1.0"?>
+
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd" >
+
<faces-config>
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
16 years, 3 months