JBoss Rich Faces SVN: r585 - in trunk/sandbox: panel2 and 24 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-27 08:57:39 -0400 (Fri, 27 Apr 2007)
New Revision: 585
Added:
trunk/sandbox/panel2/
trunk/sandbox/panel2/pom.xml
trunk/sandbox/panel2/pom.xml.prev
trunk/sandbox/panel2/src/
trunk/sandbox/panel2/src/main/
trunk/sandbox/panel2/src/main/config/
trunk/sandbox/panel2/src/main/config/component/
trunk/sandbox/panel2/src/main/config/component/panel2.xml
trunk/sandbox/panel2/src/main/java/
trunk/sandbox/panel2/src/main/java/org/
trunk/sandbox/panel2/src/main/java/org/richfaces/
trunk/sandbox/panel2/src/main/java/org/richfaces/component/
trunk/sandbox/panel2/src/main/java/org/richfaces/component/UIPanel2.java
trunk/sandbox/panel2/src/main/resources/
trunk/sandbox/panel2/src/main/resources/org/
trunk/sandbox/panel2/src/main/resources/org/richfaces/
trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/
trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/html/
trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/html/css/
trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/html/css/panel2.xcss
trunk/sandbox/panel2/src/main/templates/
trunk/sandbox/panel2/src/main/templates/panel2.jspx
trunk/sandbox/panel2/src/test/
trunk/sandbox/panel2/src/test/java/
trunk/sandbox/panel2/src/test/java/org/
trunk/sandbox/panel2/src/test/java/org/richfaces/
trunk/sandbox/panel2/src/test/java/org/richfaces/component/
trunk/sandbox/panel2/src/test/java/org/richfaces/component/html/
trunk/sandbox/panel2/src/test/java/org/richfaces/component/html/HtmlPanel2Test.java
trunk/sandbox/panel2/src/test/java/org/richfaces/taglib/
trunk/sandbox/panel2/src/test/java/org/richfaces/taglib/Panel2TagTest.java
trunk/sandbox/panel2/src/test/resources/
trunk/sandbox/panel2/src/test/resources/WEB-INF/
trunk/sandbox/panel2/src/test/resources/WEB-INF/web.xml
Log:
New panel rendering
Added: trunk/sandbox/panel2/pom.xml
===================================================================
--- trunk/sandbox/panel2/pom.xml (rev 0)
+++ trunk/sandbox/panel2/pom.xml 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>richfaces-parent</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>panel2</artifactId>
+ <name>Panel2</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.ajax4jsf.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>panel2</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
+
Added: trunk/sandbox/panel2/pom.xml.prev
===================================================================
--- trunk/sandbox/panel2/pom.xml.prev (rev 0)
+++ trunk/sandbox/panel2/pom.xml.prev 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>richfaces-parent</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>panel</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.ajax4jsf.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>1.1.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>panel</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/sandbox/panel2/src/main/config/component/panel2.xml
===================================================================
--- trunk/sandbox/panel2/src/main/config/component/panel2.xml (rev 0)
+++ trunk/sandbox/panel2/src/main/config/component/panel2.xml 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.panel2</name>
+ <family>org.richfaces.panel2</family>
+ <classname>org.richfaces.component.html.HtmlPanel2</classname>
+ <superclass>org.richfaces.component.UIPanel2</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlPanel2ComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+ <description>
+ <![CDATA[A skinnable panel that is rendered as a bordered rectangle. The header is
+ added using a facet with the attribute, name="header".
+ ]]>
+ </description>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.Panel2Renderer</name>
+ <template>panel2.jspx</template>
+ </renderer>
+ <tag>
+ <name>panel2</name>
+ <classname>org.richfaces.taglib.Panel2Tag</classname>
+ <superclass>
+ org.ajax4jsf.framework.taglib.HtmlComponentTagBase
+ </superclass>
+ <test>
+ <classname>org.richfaces.taglib.HtmlPanel2TagTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+
+ </tag>
+ &ui_component_attributes;
+ &html_events;
+ &html_style_attributes;
+ <property>
+ <name>headerClass</name>
+ <classname>java.lang.String</classname>
+ <description>
+ A class that defines a style for a panel header
+ </description>
+ </property>
+ <property>
+ <name>bodyClass</name>
+ <classname>java.lang.String</classname>
+ <description>
+ A class that defines a style for a panel content
+ </description>
+ </property>
+ </component>
+</components>
Added: trunk/sandbox/panel2/src/main/java/org/richfaces/component/UIPanel2.java
===================================================================
--- trunk/sandbox/panel2/src/main/java/org/richfaces/component/UIPanel2.java (rev 0)
+++ trunk/sandbox/panel2/src/main/java/org/richfaces/component/UIPanel2.java 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,35 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIPanel2 extends UIComponentBase
+{
+ public boolean getRendersChildren() {
+ return true;
+ }
+}
Added: trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/html/css/panel2.xcss
===================================================================
--- trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/html/css/panel2.xcss (rev 0)
+++ trunk/sandbox/panel2/src/main/resources/org/richfaces/renderkit/html/css/panel2.xcss 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template xmlns:f='http:/jsf.exadel.com/template'
+ xmlns:u='http:/jsf.exadel.com/template/util'
+ xmlns="http://www.w3.org/1999/xhtml" >
+ <f:verbatim>
+<![CDATA[
+.dr-pnl{
+ width: 100%;
+}
+
+.dr-pnl1{
+ border-width: 1px;
+ border-style: solid;
+ padding : 1px;
+}
+
+.dr-pnl-h{
+ padding : 2px;
+ border-width: 1px;
+ border-style: solid;
+ background-position : top left;
+ background-repeat : repeat-x;
+}
+
+.dr-pnl-b{
+ padding : 10px;
+}
+]]>
+</f:verbatim>
+<u:selector name=".dr-pnl1">
+ <u:style name="background-color" skin="generalBackgroundColor" />
+ <u:style name="border-color" skin="panelBorderColor" />
+</u:selector>
+<u:selector name=".dr-pnl-h">
+ <u:style name="background-color" skin="headerBackgroundColor" />
+ <u:style name="border-color" skin="headerBackgroundColor" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+ <u:style name="background-image" >
+ <f:resource f:key="org.richfaces.renderkit.html.GradientA"/>
+ </u:style>
+
+</u:selector>
+<u:selector name=".dr-pnl-b">
+ <u:style name="font-size" skin="generalSizeFont" />
+ <u:style name="color" skin="generalTextColor" />
+ <u:style name="font-family" skin="generalFamilyFont" />
+</u:selector>
+</f:template>
Added: trunk/sandbox/panel2/src/main/templates/panel2.jspx
===================================================================
--- trunk/sandbox/panel2/src/main/templates/panel2.jspx (rev 0)
+++ trunk/sandbox/panel2/src/main/templates/panel2.jspx 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://jsf.exadel.com/template"
+ xmlns:vcp=" http://jsf.exadel.com/vcp"
+ xmlns:ui=" http://jsf.exadel.com/ui"
+ xmlns:x=" http://jsf.exadel.com/vcp"
+ xmlns:u="http://jsf.exadel.com/util"
+ xmlns:h="http://jsf.exadel.com/header"
+ baseclass="org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase"
+ class="org.richfaces.renderkit.html.Panel2Renderer">
+
+ <f:clientid var="clientId"/>
+ <h:styles>css/panel2.xcss</h:styles>
+ <div id="#{clientId}" x:passThruWithExclusions="id,value,styleClass,class" class="dr-pnl rich-panel #{component.attributes['styleClass']}">
+ <div class="dr-pnl1 rich-panel1">
+ <jsp:scriptlet>
+ <![CDATA[if(component.getFacet("header")!=null && component.getFacet("header").isRendered()) {]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}_header" class="dr-pnl-h rich-panel-header #{component.attributes['headerClass']}">
+ <u:insertFacet name="header" />
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}_body" class="dr-pnl-b rich-panel-body #{component.attributes['bodyClass']}">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ </div>
+ </div>
+ </div>
+</f:root>
Added: trunk/sandbox/panel2/src/test/java/org/richfaces/component/html/HtmlPanel2Test.java
===================================================================
--- trunk/sandbox/panel2/src/test/java/org/richfaces/component/html/HtmlPanel2Test.java (rev 0)
+++ trunk/sandbox/panel2/src/test/java/org/richfaces/component/html/HtmlPanel2Test.java 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,34 @@
+package org.richfaces.component.html;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import junit.framework.TestCase;
+
+public class HtmlPanel2Test extends AbstractAjax4JsfTestCase {
+
+ public HtmlPanel2Test(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSaveStateFacesContext() {
+ HtmlPanel2 panel = new HtmlPanel2();
+ panel.setBodyClass("panelBodyClass");
+ panel.setHeaderClass("headerClass");
+ Object state = panel.saveState(facesContext);
+ HtmlPanel2 newPanel = new HtmlPanel2();
+ newPanel.restoreState(facesContext, state);
+ assertEquals("panelBodyClass", newPanel.getBodyClass());
+ assertEquals("headerClass", newPanel.getHeaderClass());
+ }
+
+}
Added: trunk/sandbox/panel2/src/test/java/org/richfaces/taglib/Panel2TagTest.java
===================================================================
--- trunk/sandbox/panel2/src/test/java/org/richfaces/taglib/Panel2TagTest.java (rev 0)
+++ trunk/sandbox/panel2/src/test/java/org/richfaces/taglib/Panel2TagTest.java 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,96 @@
+/**
+ *
+ */
+package org.richfaces.taglib;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.faces.webapp.UIComponentTag;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpSession;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.VariableResolver;
+import javax.servlet.jsp.tagext.Tag;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlPanel2;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class Panel2TagTest extends AbstractAjax4JsfTestCase {
+
+ Panel2Tag panelTag;
+
+
+ /**
+ * @param name
+ */
+ public Panel2TagTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ panelTag = new Panel2Tag();
+ panelTag.setParent(new UIComponentTag(){
+
+ public String getComponentType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getRendererType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int doStartTag() throws JspException {
+ // TODO Auto-generated method stub
+ return Tag.EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException {
+ // TODO Auto-generated method stub
+ return Tag.EVAL_BODY_INCLUDE;
+ }
+
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ panelTag = null;
+ }
+
+ /**
+ * Test method for {@link org.richfaces.taglib.PanelTag#setProperties(javax.faces.component.UIComponent)}.
+ * @throws JspException
+ */
+ public void testSetPropertiesUIComponent() throws JspException {
+ HtmlPanel2 panel = new HtmlPanel2();
+ panelTag.setBodyClass("panel");
+ panelTag.setHeaderClass("headClass");
+ panelTag.setProperties(panel);
+ assertEquals("panel", panel.getBodyClass());
+ assertEquals("headClass", panel.getHeaderClass());
+ }
+
+}
Added: trunk/sandbox/panel2/src/test/resources/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/panel2/src/test/resources/WEB-INF/web.xml (rev 0)
+++ trunk/sandbox/panel2/src/test/resources/WEB-INF/web.xml 2007-04-27 12:57:39 UTC (rev 585)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>testcase</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+
+ <filter>
+ <description>Convert HTML to XML</description>
+ <display-name>Filter</display-name>
+ <filter-name>A4J</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ <init-param>
+ <param-name>publicid</param-name>
+ <param-value>-//W3C//DTD XHTML 1.0 Transitional//EN</param-value>
+ </init-param>
+ <init-param>
+ <param-name>systemid</param-name>
+ <param-value>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</param-value>
+ </init-param>
+ <init-param>
+ <param-name>namespace</param-name>
+ <param-value>http://www.w3.org/1999/xhtml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>forceparser</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>rewriteid</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>mime-type</param-name>
+ <param-value>text/xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>log4j-init-file</param-name>
+ <param-value>WEB-INF/log4j.xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>enable-cache</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>A4J</filter-name>
+ <url-pattern>*.jsf</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>A4J</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
17 years, 8 months
JBoss Rich Faces SVN: r584 - in trunk/sandbox: simpleTogglePanel2 and 24 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-27 08:50:58 -0400 (Fri, 27 Apr 2007)
New Revision: 584
Added:
trunk/sandbox/simpleTogglePanel2/
trunk/sandbox/simpleTogglePanel2/.svnignore
trunk/sandbox/simpleTogglePanel2/pom.xml
trunk/sandbox/simpleTogglePanel2/pom.xml.prev
trunk/sandbox/simpleTogglePanel2/src/
trunk/sandbox/simpleTogglePanel2/src/main/
trunk/sandbox/simpleTogglePanel2/src/main/config/
trunk/sandbox/simpleTogglePanel2/src/main/config/component/
trunk/sandbox/simpleTogglePanel2/src/main/config/component/README
trunk/sandbox/simpleTogglePanel2/src/main/config/component/simpleTogglePanel2.xml
trunk/sandbox/simpleTogglePanel2/src/main/java/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/README
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/UISimpleTogglePanel2.java
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/renderkit/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/renderkit/html/
trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanel2Renderer.java
trunk/sandbox/simpleTogglePanel2/src/main/resources/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/css/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/css/simpleTogglePanel2.xcss
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/scripts/
trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel2.js
trunk/sandbox/simpleTogglePanel2/src/main/templates/
trunk/sandbox/simpleTogglePanel2/src/main/templates/README
trunk/sandbox/simpleTogglePanel2/src/main/templates/simpleTogglePanel2.jspx
trunk/sandbox/simpleTogglePanel2/src/test/
trunk/sandbox/simpleTogglePanel2/src/test/java/
trunk/sandbox/simpleTogglePanel2/src/test/java/org/
trunk/sandbox/simpleTogglePanel2/src/test/java/org/richfaces/
trunk/sandbox/simpleTogglePanel2/src/test/java/org/richfaces/component/
trunk/sandbox/simpleTogglePanel2/src/test/java/org/richfaces/component/SimpleToggle2EventTest.java
Log:
Added: trunk/sandbox/simpleTogglePanel2/.svnignore
===================================================================
--- trunk/sandbox/simpleTogglePanel2/.svnignore (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/.svnignore 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,4 @@
+target
+.project
+.classpath
+.settings
Added: trunk/sandbox/simpleTogglePanel2/pom.xml
===================================================================
--- trunk/sandbox/simpleTogglePanel2/pom.xml (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/pom.xml 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,50 @@
+<?xml version="1.0"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>richfaces-parent</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>simpleTogglePanel2</artifactId>
+ <name>Toggle panel</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.ajax4jsf.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>simpleTogglePanel2</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/sandbox/simpleTogglePanel2/pom.xml.prev
===================================================================
--- trunk/sandbox/simpleTogglePanel2/pom.xml.prev (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/pom.xml.prev 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>richfaces-parent</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>simpleTogglePanel</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.ajax4jsf.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>1.1.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>simpleTogglePanel</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/sandbox/simpleTogglePanel2/src/main/config/component/README
===================================================================
Added: trunk/sandbox/simpleTogglePanel2/src/main/config/component/simpleTogglePanel2.xml
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/config/component/simpleTogglePanel2.xml (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/config/component/simpleTogglePanel2.xml 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.SimpleTogglePanel2</name>
+ <family>org.richfaces.SimpleTogglePanel2</family>
+ <classname>org.richfaces.component.html.HtmlSimpleTogglePanel2</classname>
+ <superclass>org.richfaces.component.UISimpleTogglePanel2</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlSimpleTogglePanel2ComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+ <description>
+ <![CDATA[Wrapper component with named facets. Every facet will be shown after activation
+ corresponding toggleControl(the other will be hidden).
+ ]]>
+ </description>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.SimpleTogglePanel2Renderer</name>
+ <template>simpleTogglePanel2.jspx</template>
+ </renderer>
+ <tag>
+ <name>simpleTogglePanel</name>
+ <classname>org.richfaces.taglib.SimpleTogglePanel2Tag</classname>
+ <superclass>
+ org.ajax4jsf.framework.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+
+ &ui_component_attributes;
+ &html_events;
+ &html_style_attributes;
+
+ &ui_command_attributes;
+ &ajax_component_attributes;
+ &html_event_handler_attributes;
+
+ <property>
+ <name>width</name>
+ <classname>java.lang.String</classname>
+ <description>Width of a simple toggle panel might be defined as pixels or in percents.
+ By default width is not defined
+ </description>
+ <defaultvalue><![CDATA["100%"]]></defaultvalue>
+ </property>
+
+ <property>
+ <name>height</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Height of a simple toggle panel content area might be defined as pixels or in percents.
+ By default height is not defined
+ </description>
+ </property>
+
+ <property>
+ <name>headerClass</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Class that defines the style for panel header
+ </description>
+ </property>
+
+ <property>
+ <name>bodyClass</name>
+ <classname>java.lang.String</classname>
+ <description>
+ A class that defines a style for a panel header
+ </description>
+ </property>
+
+ <property required="false">
+ <name>switchType</name>
+ <classname>java.lang.String</classname>
+ <description>
+ <![CDATA[Facets switch algorithm: "client", "server"(default), "ajax".]]>
+ </description>
+ </property>
+ <property required="false" el="true" elonly="true">
+ <name>label</name>
+ <classname>java.lang.String</classname>
+ <description>Marker to be rendered on a panel header
+
+ </description>
+ </property>
+
+ <property required="false">
+ <name>opened</name>
+ <classname>boolean</classname>
+ <description>
+ A false value for this attribute makes a panel closed as default
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+
+
+ </component>
+</components>
Added: trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/README
===================================================================
Added: trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/UISimpleTogglePanel2.java
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/UISimpleTogglePanel2.java (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/component/UISimpleTogglePanel2.java 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,78 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import org.ajax4jsf.framework.ajax.AjaxActionComponent;
+import org.ajax4jsf.framework.ajax.AjaxComponent;
+import org.ajax4jsf.framework.ajax.AjaxSource;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+
+import javax.faces.component.ActionSource;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+
+/**
+ * JSF component class
+ */
+public abstract class UISimpleTogglePanel2 extends AjaxActionComponent implements AjaxComponent, AjaxSource, ActionSource
+//public abstract class UISimpleTogglePanel extends UIInput implements AjaxComponent, AjaxSource, ActionSource
+{
+
+ public static final String COMPONENT_FAMILY = "javax.faces.Command";
+ public static final String SERVER_SWITCH_TYPE = "server";
+ public static final String CLIENT_SWITCH_TYPE = "client";
+ public static final String AJAX_SWITCH_TYPE = "ajax";
+ public static final boolean COLLAPSED = false;
+ public static final boolean EXPANDED = true;
+
+ //xxxx by nick - why properties here? just describe them in config and CDK generates
+ //valid fields & save/restore code
+ //for "public" (.tld etc.) properties you should create abstract getters/setters only
+
+ //xxxx by nick - according to JavaDocs http://webdownload.exadel.com/downloads/ajax4jsf/documentation/javaAPI/or...
+ //AjaxActionComponent already has immediate property
+
+
+ public abstract void setSwitchType(String switchType);
+
+ public abstract String getSwitchType();
+
+ public abstract void setOpened(boolean opened);
+
+ public abstract boolean isOpened();
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ //public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
+ // super.broadcast(facesEvent);
+ // FacesContext facesContext = FacesContext.getCurrentInstance();
+ // if (AjaxRendererUtils.isAjaxRequest(facesContext) && this.getSwitchType().equals(AJAX_SWITCH_TYPE)) {
+ // AjaxRendererUtils.addRegionByName(facesContext,
+ // this,
+ // this.getId());
+ // }
+ //}
+}
Added: trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/ISimpleToggle2Listener.java 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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
+ */
+
+/*
+ * Created on 11.07.2006
+ */
+package org.richfaces.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author igels
+ */
+
+//TODO by nick - denis - add addToggleListener method to component
+public interface ISimpleToggle2Listener extends FacesListener {
+
+ public void processToggle(SimpleToggle2Event event);
+
+}
\ No newline at end of file
Added: trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/event/SimpleToggle2Event.java 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,76 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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
+ */
+
+/*
+ * Created on 11.07.2006
+ */
+package org.richfaces.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author igels
+ */
+public class SimpleToggle2Event extends ActionEvent {
+
+ private static final long serialVersionUID = 5582624805941635421L;
+ private boolean _opened;
+
+ /**
+ * @param source
+ * @param opened
+ */
+ public SimpleToggle2Event(UIComponent source, boolean opened) {
+ super(source);
+ this._opened = opened;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ISimpleToggle2Listener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ ((ISimpleToggle2Listener) listener).processToggle(this);
+ }
+
+ /**
+ * @return Returns the _state.
+ */
+ public boolean isIsOpen() {
+ return _opened;
+ }
+
+ /**
+ *
+ * @param opened The state to set
+ */
+ public void setIsOpen(boolean opened) {
+ this._opened = opened;
+ }
+}
\ No newline at end of file
Added: trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanel2Renderer.java
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanel2Renderer.java (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanel2Renderer.java 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,184 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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
+ */
+
+/*
+ * Created on 04.07.2006
+ */
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+import org.richfaces.component.UISimpleTogglePanel2;
+import org.richfaces.event.SimpleToggle2Event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.PhaseId;
+import java.io.IOException;
+import java.util.Map;
+
+//public class SimpleTogglePanelRenderer extends AjaxCommandLinkRenderer {
+
+public class SimpleTogglePanel2Renderer extends org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase {
+ //XXXX by nick - denis - seems there is a lot of code common to org.richfaces.renderkit.html.ToggleControlRenderer. Please commonize!
+ //private InternetResource[] _scripts = {new PrototypeScript(), getResource("scripts/simpleTogglePanel.js") };
+
+ protected Class getComponentClass() {
+ return UISimpleTogglePanel2.class;
+ }
+
+ //XXXX by nick - denis - move scripts to template
+ //protected InternetResource[] getAdditionalScripts() {
+ // return _scripts;
+ //}
+
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void doDecode(FacesContext context, UIComponent component) {
+
+ super.doDecode(context, component);
+
+
+ ExternalContext exCtx = context.getExternalContext();
+
+ Map rqMap = exCtx.getRequestParameterMap();
+ Object clnId = rqMap.get(component.getClientId(context));
+ UISimpleTogglePanel2 panel = (UISimpleTogglePanel2) component;
+
+ if (clnId != null) {
+ // enqueue event here for this component or for component with Id
+ // taken fro forId attribute
+
+ String switchType = panel.getSwitchType();
+ if (!(UISimpleTogglePanel2.CLIENT_SWITCH_TYPE.equals(switchType))) {
+
+ //xxxx by nick - denis - use constants, please!
+ if ((panel.isOpened() == UISimpleTogglePanel2.EXPANDED)) {
+ panel.setOpened(UISimpleTogglePanel2.COLLAPSED);
+ } else {
+ //xxxx by nick - denis - use constants, please!
+ panel.setOpened(UISimpleTogglePanel2.EXPANDED);
+ }
+ SimpleToggle2Event event = new SimpleToggle2Event(panel, (panel.isOpened()));
+ if (panel.isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ event.queue();
+
+ } else {
+ if (panel.isOpened()!= new Boolean((String) clnId).booleanValue()){
+ SimpleToggle2Event event = new SimpleToggle2Event(panel, (panel.isOpened()));
+ if (panel.isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ event.queue();
+ }
+ panel.setOpened(new Boolean((String) clnId).booleanValue());
+ }
+
+
+
+ }
+
+
+ if (AjaxRendererUtils.isAjaxRequest(context) && panel.getSwitchType().equals(UISimpleTogglePanel2.AJAX_SWITCH_TYPE)) {
+ AjaxRendererUtils.addRegionByName(context,
+ panel,
+ panel.getId());
+ }
+
+
+ }
+
+ public String getdivdisplay(FacesContext context, UIComponent component) {
+
+ String Switch = Boolean.toString(((UISimpleTogglePanel2) component).isOpened());
+ if (Switch == null || Switch.equals(Boolean.toString(UISimpleTogglePanel2.EXPANDED)))
+ {
+ //xxxx by nick - denis - do not set "block" explicitly - that can break some elements, set "" for display. See Element.show() in prototype.js
+ return "";
+ }
+ return "none";
+ }
+
+ public String getOnClick(FacesContext context, UIComponent component) {
+ UISimpleTogglePanel2 tgComp = (UISimpleTogglePanel2) component;
+
+ String switchType = tgComp.getSwitchType();
+ StringBuffer onClick = new StringBuffer();
+ //String userOnClick = (String)component.getAttributes().get("onclick");
+ //if(userOnClick!=null) {
+ // onClick.append(userOnClick);
+ // if(!userOnClick.trim().endsWith(";")) {
+ // onClick.append("; ");
+ // }
+ //}
+
+
+ if (UISimpleTogglePanel2.CLIENT_SWITCH_TYPE.equals(switchType)) {
+ // Client
+ String panelId = tgComp.getClientId(context);
+ onClick.append("SimpleTogglePanelManager.toggleOnClient('")
+ .append(panelId)
+ .append("');");
+ } else if (UISimpleTogglePanel2.AJAX_SWITCH_TYPE.equals(switchType)) {
+ // Ajax
+ // writer.writeAttribute(HTML.onclick_ATTRIBUTE,AjaxRendererUtils.buildOnClick(tab,context),"ajaxOnclick");
+ onClick.append(AjaxRendererUtils.buildOnClick(component, context));
+ //return super.getOnClick(context, component);
+ } else {
+ // Server
+
+
+ onClick.append("SimpleTogglePanelManager.toggleOnServer('")
+ .append(component.getClientId(context))
+ .append("'")
+
+
+ .append(");");
+ //.append(tgComp.getSwitch()==null?"'0'":"'" + tgComp.getSwitch() + "'")
+ //.append("")
+ }
+ return onClick.toString();
+ }
+
+ protected String getValueAsString(FacesContext context, UISimpleTogglePanel2 Panel) {
+ return getUtils().getValueAsString(context, Panel);
+ }
+
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ // TODO Auto-generated method stub
+ UISimpleTogglePanel2 comp = (UISimpleTogglePanel2) component;
+ //xxxx by nick - denis - use constants, please!
+ if (!(((comp.getSwitchType() == null) || (comp.getSwitchType().equals(UISimpleTogglePanel2.CLIENT_SWITCH_TYPE) != true)) && (comp.isOpened() == UISimpleTogglePanel2.COLLAPSED)))
+ {
+ super.encodeChildren(context, component);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/css/simpleTogglePanel2.xcss
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/css/simpleTogglePanel2.xcss (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/css/simpleTogglePanel2.xcss 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template xmlns:f='http:/jsf.exadel.com/template'
+ xmlns:u='http:/jsf.exadel.com/template/util'
+ xmlns="http://www.w3.org/1999/xhtml" >
+
+<f:verbatim><![CDATA[
+.dr-stglpnl{
+ border : 1px solid #678FC5;
+ background-color : #BFD0E9;
+ padding : 1px;
+ background-position : top right;
+ background-repeat : no-repeat;
+}
+
+
+.dr-stglpnl-h{
+ border-width: 1px;
+ border-style: solid;
+ background-color : #224986;
+ font-size : 11px;
+ color : #ffffff;
+ cursor: pointer;
+ font-weight : bold;
+ font-family : verdana;
+ padding : 2px;
+ background-image : url(coll_panel_bg.gif);
+ background-position : top left;
+ background-repeat : repeat-x;
+}
+
+
+.dr-stglpnl-b{
+ font-size : 11px;
+ color : #000000;
+ font-family : verdana;
+ padding : 10px;
+ text-align : left;
+ vertical-align : top;
+}
+]]>
+
+</f:verbatim>
+
+<u:selector name=".dr-stglpnl">
+ <u:style name="background-color" skin="generalBackgroundColor" />
+ <u:style name="border-color" skin="panelBorderColor" />
+</u:selector>
+<u:selector name=".dr-stglpnl-h">
+ <u:style name="background-color" skin="headerBackgroundColor" />
+ <u:style name="border-color" skin="headerBackgroundColor" />
+ <u:style name="font-size" skin="headerSizeFont" />
+ <u:style name="color" skin="headerTextColor" />
+ <u:style name="font-weight" skin="headerWeightFont" />
+ <u:style name="font-family" skin="headerFamilyFont" />
+</u:selector>
+<u:selector name=".dr-stglpnl-b">
+ <u:style name="background-color" skin="generalBackgroundColor" />
+ <u:style name="font-size" skin="generalSizeFont" />
+ <u:style name="color" skin="panelTextColor" />
+ <u:style name="font-family" skin="generalFamilyFont" />
+</u:selector>
+<u:selector name=".dr-stglpnl-h">
+ <u:style name="background-image" >
+ <f:resource f:key="org.richfaces.renderkit.html.GradientA"/>
+ </u:style>
+</u:selector>
+
+</f:template>
Added: trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel2.js
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel2.js (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel2.js 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,105 @@
+
+SimpleTogglePanel = Class.create();
+
+SimpleTogglePanel.prototype = {
+ initialize: function(panelId, status, openSign, closeSign) {
+
+ this.panelId = panelId;
+ this.panelId_head = panelId+"_header";
+ this.status = status;
+ if (!this.status){
+ this.status="true";
+ }
+
+ this.openSign = openSign;
+ if (!this.openSign) {
+ this.openSign = "»";
+ }
+
+ this.closeSign = closeSign;
+ if (!this.closeSign) {
+ this.closeSign = "«";
+ }
+
+ //this.divs = divs;
+ //this.currentId = initialStateId;
+ //this.toggleToState();
+// this.windowOnLoad();
+ this.timer = setTimeout(this.windowOnLoad.bind(this), 100);
+
+ },
+
+ windowOnLoad: function(){
+ if (RichFaces.navigatorType() == "MSIE"){
+ //var body = $(this.panelId+"_body");
+ //if (body && body.style.display!="none") body.firstChild.style.width=body.clientWidth;
+/* if ($(this.panelId_head).clientWidth<$(this.panelId).clientWidth){
+ $(this.panelId_head).style.width=$(this.panelId).clientWidth-2+"px";
+ }*/
+ }
+ },
+
+ toggleToState: function() {
+ var body = $(this.panelId+"_body");
+ if (this.status=="false"){
+ Element.show(body);
+ this.status="true";
+ $(this.panelId+"_switch").innerHTML = this.closeSign;
+ this.timer = setTimeout(this.windowOnLoad.bind(this), 100);
+// body.firstChild.style.width=body.clientWidth;
+ }
+
+ else{
+ Element.hide(body);
+ body.firstChild.style.width="100%";
+ this.status="false";
+ $(this.panelId+"_switch").innerHTML = this.openSign;
+
+ }
+ if (RichFaces.navigatorType() == "MSIE"){
+/* if ($(this.panelId_head).clientWidth<$(this.panelId).clientWidth){
+ $(this.panelId_head).style.width=$(this.panelId).clientWidth-2+"px";
+ }*/
+ }
+ $(this.panelId+"_input").value=this.status;
+ }
+}
+
+SimpleTogglePanelManager = Class.create();
+
+SimpleTogglePanelManager.panels = $H($A({}));
+
+SimpleTogglePanelManager.add = function(value) {
+ var tmp = new Object();
+ tmp[value.panelId] = value;
+ this.panels=this.panels.merge(tmp);
+}
+
+SimpleTogglePanelManager.toggleOnServer = function (clientId) {
+ var parentForm = A4J.findForm($(clientId + "_header"));
+ if(!parentForm || !parentForm.appendChild /* findForm returns surrogate form object */) return;
+
+ var fInput = parentForm[clientId];
+ if(!fInput) {
+ fInput = document.createElement("input");
+ fInput.type = "hidden";
+ fInput.name = clientId;
+ parentForm.appendChild(fInput);
+ }
+
+ if (this.panels[clientId].status==0){
+ this.panels[clientId].status=1;
+ }
+ else{
+ this.panels[clientId].status=0;
+ }
+
+ fInput.value = this.panels[clientId].status;
+ parentForm.submit();
+ return false;
+}
+
+SimpleTogglePanelManager.toggleOnClient = function (panelId) {
+ this.panels[panelId].toggleToState();
+ return false;
+}
Added: trunk/sandbox/simpleTogglePanel2/src/main/templates/README
===================================================================
Added: trunk/sandbox/simpleTogglePanel2/src/main/templates/simpleTogglePanel2.jspx
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/main/templates/simpleTogglePanel2.jspx (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/main/templates/simpleTogglePanel2.jspx 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root xmlns:f="http://jsf.exadel.com/template"
+ xmlns:vcp=" http://jsf.exadel.com/vcp"
+ xmlns:ui=" http://jsf.exadel.com/ui"
+ xmlns:x=" http://jsf.exadel.com/vcp"
+ xmlns:u="http://jsf.exadel.com/util"
+ xmlns:h="http://jsf.exadel.com/header"
+ baseclass="org.richfaces.renderkit.html.SimpleTogglePanel2Renderer"
+ class="org.richfaces.renderkit.html.SimpleTogglePanel2Template"
+ >
+
+ <f:clientid var="clientId"/>
+ <h:styles>css/simpleTogglePanel2.xcss</h:styles>
+<h:scripts>
+new org.ajax4jsf.framework.resource.PrototypeScript(),
+new org.ajax4jsf.framework.ajax.AjaxScript(),
+new org.ajax4jsf.framework.ajax.ImageCacheScript(),
+/org/ajax4jsf/renderkit/html/scripts/form.js,
+/org/richfaces/renderkit/html/scripts/browser_info.js,
+scripts/simpleTogglePanel2.js
+</h:scripts>
+
+ <div id="#{clientId}" x:passThruWithExclusions="id,value"
+ style="width: #{component.attributes['width']};">
+ <div class="dr-stglpnl rich-stglpanel #{component.attributes['styleClass']}"
+ style="#{component.attributes['style']};">
+ <script type="text/javascript">
+ SimpleTogglePanelManager.add(new SimpleTogglePanel("#{clientId}", "#{component.attributes['opened']}"
+ <jsp:scriptlet><![CDATA[
+ if(component.getFacet("openMarker")!=null && component.getFacet("openMarker").isRendered()) {
+ ]]></jsp:scriptlet>
+ , "<u:insertFacet name='openMarker'/>"
+ <jsp:scriptlet><![CDATA[
+ } else {
+ ]]></jsp:scriptlet>
+ , null
+ <jsp:scriptlet><![CDATA[
+ }
+ ]]></jsp:scriptlet>
+ <jsp:scriptlet><![CDATA[
+ if(component.getFacet("closeMarker")!=null && component.getFacet("closeMarker").isRendered()) {
+ ]]></jsp:scriptlet>
+ , "<u:insertFacet name='closeMarker'/>"
+ <jsp:scriptlet><![CDATA[
+ } else {
+ ]]></jsp:scriptlet>
+ , null
+ <jsp:scriptlet><![CDATA[
+ }
+ ]]></jsp:scriptlet>
+ ));
+ </script>
+
+ <f:call name="utils.encodeBeginFormIfNessesary"/>
+ <div id="#{clientId}_header"
+ class="dr-stglpnl-h rich-stglpanel-header #{component.attributes['headerClass']}"
+ style="position : relative;"
+ onclick="#{this:getOnClick(context,component)}">
+
+ #{component.attributes['label']} <jsp:scriptlet><![CDATA[writer.write(" ");]]></jsp:scriptlet>
+ <div id="#{clientId}_switch"
+ style="position : absolute; top: 0px; right: 5px;">
+ <jsp:scriptlet><![CDATA[
+ if(component.isOpened()){
+ if(component.getFacet("closeMarker")!=null && component.getFacet("closeMarker").isRendered()) {
+ ]]></jsp:scriptlet>
+ <u:insertFacet name="closeMarker" />
+ <jsp:scriptlet><![CDATA[
+ } else {
+ writer.write("«");
+ }
+ } else {
+ if(component.getFacet("openMarker")!=null && component.getFacet("openMarker").isRendered()) {
+ ]]></jsp:scriptlet>
+ <u:insertFacet name="openMarker" />
+ <jsp:scriptlet><![CDATA[
+ } else {
+ writer.write("»");
+ }
+ }
+ ]]></jsp:scriptlet>
+ </div>
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[if((component.getSwitchType()!=null) && (component.getSwitchType().equals(component.CLIENT_SWITCH_TYPE)==true)){]]>
+ </jsp:scriptlet>
+
+ <div style="display: none;">
+ <input type="hidden" id="#{clientId}_input" name="#{clientId}"
+ value="#{component.attributes['opened']}"/>
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+ <f:call name="utils.encodeEndFormIfNessesary"/>
+
+ <div id="#{clientId}_body"
+ style="display : #{this:getdivdisplay(context, component)};
+ overflow: auto; height: #{component.attributes['height']};"
+ class="dr-stglpnl-b rich-stglpanel-body #{component.attributes['bodyClass']}">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ </div>
+ </div>
+ </div>
+</f:root>
Added: trunk/sandbox/simpleTogglePanel2/src/test/java/org/richfaces/component/SimpleToggle2EventTest.java
===================================================================
--- trunk/sandbox/simpleTogglePanel2/src/test/java/org/richfaces/component/SimpleToggle2EventTest.java (rev 0)
+++ trunk/sandbox/simpleTogglePanel2/src/test/java/org/richfaces/component/SimpleToggle2EventTest.java 2007-04-27 12:50:58 UTC (rev 584)
@@ -0,0 +1,90 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.component;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.event.ISimpleToggle2Listener;
+import org.richfaces.event.SimpleToggle2Event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * Unit test for SuggestionEvent.
+ */
+public class SimpleToggle2EventTest extends AbstractAjax4JsfTestCase {
+
+ private SimpleToggle2Event event;
+ private UISimpleTogglePanel2 stp;
+ private boolean result;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public SimpleToggle2EventTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ stp = (UISimpleTogglePanel2)application.createComponent("org.richfaces.SimpleTogglePanel2");
+ stp.setId("simpleTogglePanel1");
+ result = false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ event = null;
+ stp = null;
+ }
+
+ public void testEvent() throws Exception {
+ event = new SimpleToggle2Event(stp, false);
+ assertFalse(event.isIsOpen());
+ event.setIsOpen(true);
+ assertTrue(event.isIsOpen());
+
+ assertFalse(event.isAppropriateListener(new TestFacesListener()));
+ assertTrue(event.isAppropriateListener(new TestSimpleToggleListener()));
+
+ event.processListener(new TestSimpleToggleListener());
+ assertTrue(result);
+ }
+
+ class TestFacesListener implements FacesListener {
+
+ }
+
+ class TestSimpleToggleListener implements ISimpleToggle2Listener {
+ public void processToggle(SimpleToggle2Event event) {
+ result = true;
+ }
+ }
+}
17 years, 8 months
JBoss Rich Faces SVN: r583 - in trunk/richfaces/suggestionbox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-27 08:37:05 -0400 (Fri, 27 Apr 2007)
New Revision: 583
Modified:
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
http://jira.jboss.com/jira/browse/RF-119 fixed
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-04-26 23:17:00 UTC (rev 582)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-04-27 12:37:05 UTC (rev 583)
@@ -192,7 +192,7 @@
}
writer.writeAttribute("class", clazz, "popupClass");
- StringBuffer style = new StringBuffer("display:none; z-index: 200;");
+ StringBuffer style = new StringBuffer("display:none; z-index: 201;");
style.append(getSizeForStyle(component, "width", null, false));
style.append(getSizeForStyle(component, "height", null, false));
@@ -222,7 +222,7 @@
writer.writeAttribute("id", component.getClientId(context)
+ "_iframe", null);
writer.writeAttribute(
- "style", "position:absolute;display:none;z-index:0;", null);
+ "style", "position:absolute;display:none;z-index:200;", null);
writer.endElement("iframe");
} else {
suggestionBox.setSubmitted(false);
Modified: trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2007-04-26 23:17:00 UTC (rev 582)
+++ trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2007-04-27 12:37:05 UTC (rev 583)
@@ -508,23 +508,23 @@
this.content = content;
this.containerId = containerId;
this.actionUrl = actionUrl;
-
+
this.input = $(element);
this.oldValue = $(element).value;
if (onsubmit && onsubmit != 'null'){
this.onsubmitFunction = new Function(onsubmit).bind(this.input);
}
-
+
return this;
},
getUpdatedChoices: function(event) {
this.options.parameters[this.options.param] = this.getToken();
-
+
if (this.onsubmitFunction && ! this.onsubmitFunction()) {
return;
}
- if (this.oldValue != this.input.value && this.input.value.length > 0) {
+ if (this.oldValue != this.input.value && this.input.value.length > 0) {
A4J.AJAX.Submit(this.containerId, this.actionUrl, event, this.options);
}
this.oldValue = this.input.value;
@@ -595,9 +595,9 @@
if (options.iframeId) {
var iframe = $(options.iframeId);
Position.clone(this.target, iframe);
- Element.setStyle(this.target, {zIndex: 100});
+ Element.setStyle(this.target, {zIndex: 201});
- Element.setStyle(iframe, {zIndex: 0});
+ Element.setStyle(iframe, {zIndex: 200});
iframe.style.position = "absolute";
iframe.style.top = this.target.style.top;
iframe.style.left = this.target.style.left;
17 years, 8 months
JBoss Rich Faces SVN: r582 - trunk/richfaces-samples/tree-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-26 19:17:00 -0400 (Thu, 26 Apr 2007)
New Revision: 582
Modified:
trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
Log:
Test case updated
Modified: trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-26 20:16:36 UTC (rev 581)
+++ trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-26 23:17:00 UTC (rev 582)
@@ -17,8 +17,8 @@
cursor: crosshair;
}
- .border {
- border: 1px dotted navy;
+ .colored {
+ background-color: #FEFEDE;
}
</style>
@@ -83,7 +83,7 @@
<dnd:dndParam name="treeParam" value="Tree Parameter" />
<dnd:dndParam name="accept" value="accept" />
- <rich:treeNode type="input" dropListener="#{bean.processDrop}" oncollapse="Element.removeClassName(event['treeItem'].getElement(), 'border')" onexpand="Element.addClassName(event['treeItem'].getElement(), 'border')">
+ <rich:treeNode type="input" dropListener="#{bean.processDrop}" oncollapse="Element.removeClassName(event['treeItem'].getElement(), 'colored')" onexpand="Element.addClassName(event['treeItem'].getElement(), 'colored')">
<h:outputText value="#{data} : " />
<h:inputText value="#{data.name}" required="true" styleClass="inputs">
</h:inputText>
17 years, 8 months
JBoss Rich Faces SVN: r581 - trunk/richfaces-samples/tree-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-26 16:16:36 -0400 (Thu, 26 Apr 2007)
New Revision: 581
Modified:
trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
Log:
Test case updated
Modified: trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-26 20:09:27 UTC (rev 580)
+++ trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-26 20:16:36 UTC (rev 581)
@@ -16,6 +16,10 @@
color : #00FFFF;
cursor: crosshair;
}
+
+ .border {
+ border: 1px dotted navy;
+ }
</style>
</head>
@@ -79,7 +83,7 @@
<dnd:dndParam name="treeParam" value="Tree Parameter" />
<dnd:dndParam name="accept" value="accept" />
- <rich:treeNode type="input" dropListener="#{bean.processDrop}" oncollapse="alert('collapse')" onexpand="alert('expand')">
+ <rich:treeNode type="input" dropListener="#{bean.processDrop}" oncollapse="Element.removeClassName(event['treeItem'].getElement(), 'border')" onexpand="Element.addClassName(event['treeItem'].getElement(), 'border')">
<h:outputText value="#{data} : " />
<h:inputText value="#{data.name}" required="true" styleClass="inputs">
</h:inputText>
17 years, 8 months
JBoss Rich Faces SVN: r580 - in trunk: richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-26 16:09:27 -0400 (Thu, 26 Apr 2007)
New Revision: 580
Added:
trunk/richfaces/tree/src/main/config/component/commonTreeClientListeners.ent
Modified:
trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
trunk/richfaces/tree/src/main/config/component/tree.xml
trunk/richfaces/tree/src/main/config/component/treeNode.xml
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
trunk/richfaces/tree/src/main/templates/htmlTree.jspx
trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx
Log:
http://jira.jboss.com/jira/browse/RF-102 fixed
Selection prevention implemented for onselected event handlers that returned false
onselected, onexpand, oncollapse events handling added to treeNode
Test case updated
Added: trunk/richfaces/tree/src/main/config/component/commonTreeClientListeners.ent
===================================================================
--- trunk/richfaces/tree/src/main/config/component/commonTreeClientListeners.ent (rev 0)
+++ trunk/richfaces/tree/src/main/config/component/commonTreeClientListeners.ent 2007-04-26 20:09:27 UTC (rev 580)
@@ -0,0 +1,15 @@
+ <property>
+ <name>onselected</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: script expression to invoke on node selection</description>
+ </property>
+ <property>
+ <name>onexpand</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: script expression to invoke on node expansion</description>
+ </property>
+ <property>
+ <name>oncollapse</name>
+ <classname>java.lang.String</classname>
+ <description>HTML: script expression to invoke on node collapsion</description>
+ </property>
Modified: trunk/richfaces/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/richfaces/tree/src/main/config/component/tree.xml 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/config/component/tree.xml 2007-04-26 20:09:27 UTC (rev 580)
@@ -3,6 +3,7 @@
[
<!ENTITY attributes SYSTEM "commonTreeAttributes.ent">
<!ENTITY listeners SYSTEM "commonTreeListeners.ent">
+<!ENTITY commonTreeClientListeners SYSTEM "commonTreeClientListeners.ent">
]
>
@@ -109,22 +110,8 @@
<classname>java.lang.String</classname>
<description>Attribute contains a name providing an access to data defined with value.</description>
</property>
+ &commonTreeClientListeners;
<property>
- <name>onselected</name>
- <classname>java.lang.String</classname>
- <description>An action to be fired when selecting a node</description>
- </property>
- <property>
- <name>onexpand</name>
- <classname>java.lang.String</classname>
- <description>An action to be fired when expanding a node</description>
- </property>
- <property>
- <name>oncollapse</name>
- <classname>java.lang.String</classname>
- <description>An action to be fired when collapsing a node</description>
- </property>
- <property>
<name>showConnectingLines</name>
<classname>boolean</classname>
<description>If true, connecting lines are show</description>
Modified: trunk/richfaces/tree/src/main/config/component/treeNode.xml
===================================================================
--- trunk/richfaces/tree/src/main/config/component/treeNode.xml 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/config/component/treeNode.xml 2007-04-26 20:09:27 UTC (rev 580)
@@ -3,6 +3,7 @@
[
<!ENTITY attributes SYSTEM "commonTreeAttributes.ent">
<!ENTITY listeners SYSTEM "commonTreeListeners.ent">
+<!ENTITY commonTreeClientListeners SYSTEM "commonTreeClientListeners.ent">
]
>
@@ -97,6 +98,8 @@
<classname>java.lang.String</classname>
<description>An icon for component leaves.</description>
</property>
+ &commonTreeClientListeners;
+
<property hidden="true">
<name>dragValue</name>
</property>
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js 2007-04-26 20:09:27 UTC (rev 580)
@@ -79,6 +79,22 @@
this.tree.addItem(child);
},
+ fireExpansionEvent: function() {
+ var props = new Object();
+ props[Richfaces.TreeExpandEvent] = true;
+ props["expandedNode"] = this.id;
+ props["treeItem"] = this;
+ Richfaces.createEvent("click", this.tree.element, null, props).fire();
+ },
+
+ fireCollapsionEvent: function() {
+ var props = new Object();
+ props[Richfaces.TreeCollapseEvent] = true;
+ props["collapsedNode"] = this.id;
+ props["treeItem"] = this;
+ Richfaces.createEvent("click", this.tree.element, null, props).fire();
+ },
+
toggleCollapsion: function() {
if (this.hasChilds()) Element.toggle(this.elements.row);
@@ -96,10 +112,8 @@
Element.removeClassName(this.elements.icon, Tree.CLASS_ITEM_EXPANDED);
Element.addClassName(this.elements.icon, Tree.CLASS_ITEM_COLLAPSED);
}
- var props = new Object();
- props[Richfaces.TreeCollapseEvent] = true;
- props["collapsedNode"] = this.id;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
+
+ this.fireCollapsionEvent();
} else {
this.elements.handleImgExpanded.style.display="";
this.elements.handleImgCollapsed.style.display="none";
@@ -107,14 +121,16 @@
Element.removeClassName(this.elements.icon, Tree.CLASS_ITEM_COLLAPSED);
Element.addClassName(this.elements.icon, Tree.CLASS_ITEM_EXPANDED);
}
- var props = new Object();
- props[Richfaces.TreeExpandEvent] = true;
- props["expandedNode"] = this.id;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
+
+ this.fireExpansionEvent();
}
},
+ getRichAttribute: function(name) {
+ return Richfaces.getNSAttribute(name, this.elements.icon);
+ },
+
collapse: function() {
if (!this.isCollapsed() && this.switchType!="client") {
this.elements.handle.onclick();
@@ -128,10 +144,8 @@
Element.addClassName(this.elements.icon, Tree.CLASS_ITEM_COLLAPSED);
}
}
- var props = new Object();
- props[Richfaces.TreeCollapseEvent] = true;
- props["collapsedNode"] = this.id;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
+
+ this.fireCollapsionEvent();
},
expand: function() {
@@ -147,10 +161,8 @@
Element.addClassName(this.elements.icon, Tree.CLASS_ITEM_EXPANDED);
}
}
- var props = new Object();
- props[Richfaces.TreeExpandEvent] = true;
- props["expandedNode"] = this.id;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
+
+ this.fireExpansionEvent();
},
isCollapsed: function() {
@@ -194,31 +206,7 @@
},
toggleSelection: function(e) {
- this.tree.deselectAll();
-
- /*
- var attr = this.elements.text.attributes;
- var s = "";
- for (var i = 0; i < attr.length; i++) {
- s += attr[i].nodeName + ": " + attr[i].nodeValue + "; ";
- }
-
- alert(s);
- */
-
- var sClass = Richfaces.getNSAttribute("selectedclass", this.elements.text);
- if (sClass) {
-
- var classNames = sClass.split(' ')
- for (var i = 0; i < classNames.length; i++) {
- Element.addClassName(this.elements.text, classNames[i]);
- }
- this.tree.input.value = this.id;
- this.tree.selectionManager.activeItem = this;
-
- if (this.tree.options.onSelection) this.tree.options.onSelection(this.id);
- this.tree.showNode(this.elements.text.parentNode);
-
+ if (e && !e[Richfaces.TreeSelectEvent] && !Richfaces.eventIsSynthetic(e)) {
if (e && e.type == "mousedown" /* can be keydown */) {
if(Event.isLeftClick(e)) {
var src = Event.element(e);
@@ -230,24 +218,60 @@
src.tagName=='TEXTAREA')) return;
Event.stop(e);
+ } else {
+ //do not process non-left clicks
+ return ;
+ }
+ }
+
+ var props = new Object();
+ props[Richfaces.TreeSelectEvent] = true;
+ props["originatingEventType"] = e.type;
+ props["treeItem"] = this;
+ props["selectedNode"] = this.id;
+ var evt = Richfaces.createEvent("click", this.tree.element, null, props);
+ evt.fire();
+
+ return !evt.event["cancelSelection"];
+ } else {
+ this.tree.deselectAll();
+ /*
+ var attr = this.elements.text.attributes;
+ var s = "";
+ for (var i = 0; i < attr.length; i++) {
+ s += attr[i].nodeName + ": " + attr[i].nodeValue + "; ";
+ }
+
+ alert(s);
+ */
+
+ var sClass = Richfaces.getNSAttribute("selectedclass", this.elements.text);
+ if (sClass) {
+
+ var classNames = sClass.split(' ')
+ for (var i = 0; i < classNames.length; i++) {
+ Element.addClassName(this.elements.text, classNames[i]);
+ }
+ this.tree.input.value = this.id;
+ this.tree.selectionManager.activeItem = this;
+
+ if (this.tree.options.onSelection) this.tree.options.onSelection(this.id);
+ this.tree.showNode(this.elements.text.parentNode);
+
+ if (e && e["originatingEventType"] == "mousedown" /* can be keydown */) {
Event.observe(this.elements.icon, "mousemove", this.listenDragBound);
Event.observe(this.elements.text, "mousemove", this.listenDragBound);
-
+
Event.observe(this.elements.icon, "mouseup", this.stopListenDragBound);
Event.observe(this.elements.text, "mouseup", this.stopListenDragBound);
}
}
+
+ return true;
}
},
- fireSelectEvent: function() {
- var props = new Object();
- props[Richfaces.TreeSelectEvent] = true;
- props["selectedNode"] = this.id;
- Richfaces.createEvent("click", this.tree.element, null, props).fire();
- },
-
isSelected: function() {
return Element.hasClassName(this.elements.text, Tree.CLASS_ITEM_SELECTED);
},
@@ -293,10 +317,6 @@
},
stopListenDrag: function(e) {
- if (e) {
- this.fireSelectEvent();
- }
-
Event.stopObserving(this.elements.icon, "mousemove", this.listenDragBound);
Event.stopObserving(this.elements.text, "mousemove", this.listenDragBound);
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-selection.js 2007-04-26 20:09:27 UTC (rev 580)
@@ -86,8 +86,23 @@
case Event.KEY_UP:
if (this.inFocus) {
if (!event.ctrlKey && !event.shiftKey && !event.altKey) {
- this.activeItem = this.getPreviousItemForSelection();
- this.activeItem.toggleSelection(event);
+
+ var item = this.activeItem;
+ do {
+ var newItem = this.getPreviousItemForSelection(item);
+
+ if (newItem && newItem != item) {
+ item = newItem;
+
+ if (item.toggleSelection(event)) {
+ this.activeItem = item;
+ item = null;
+ }
+ } else {
+ item = null;
+ }
+ } while (item);
+
}
noDefault = true;
}
@@ -95,8 +110,24 @@
case Event.KEY_DOWN:
if (this.inFocus) {
if (!event.ctrlKey && !event.shiftKey && !event.altKey) {
- this.activeItem = this.getNextItemForSelection();
- this.activeItem.toggleSelection(event);
+
+ var item = this.activeItem;
+ do {
+ var newItem = this.getNextItemForSelection(item);
+
+ if (newItem && newItem != item) {
+ item = newItem;
+
+ if (item.toggleSelection(event)) {
+ this.activeItem = item;
+ item = null;
+ }
+
+ } else {
+ item = null;
+ }
+ } while (item);
+
}
noDefault = true;
}
@@ -126,31 +157,31 @@
}
},
- getNextItemForSelection: function() {
- if (!this.activeItem.isCollapsed() && this.activeItem.hasChilds()) {
- return this.activeItem.childs.first();
+ getNextItemForSelection: function(item) {
+ if (!item.isCollapsed() && item.hasChilds()) {
+ return item.childs.first();
} else {
- var next = this.activeItem.next();
- if (next != this.activeItem) {
+ var next = item.next();
+ if (next != item) {
return next;
} else {
- var next = this.activeItem.parent.next();
- if (next != this.activeItem.parent) {
+ var next = item.parent.next();
+ if (next != item.parent) {
return next;
} else {
- return this.activeItem;
+ return item;
}
}
}
},
- getPreviousItemForSelection: function() {
- var prev = this.activeItem.previous();
- if (prev == this.activeItem) {
+ getPreviousItemForSelection: function(item) {
+ var prev = item.previous();
+ if (prev == item) {
if (prev.parent == this.tree) {
- prev = this.activeItem;
+ prev = item;
} else {
- prev = this.activeItem.parent;
+ prev = item.parent;
}
} else if (!prev.isCollapsed() && prev.hasChilds()) {
prev = prev.childs.last();
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-04-26 20:09:27 UTC (rev 580)
@@ -27,7 +27,7 @@
this.id = id;
this.switchType = switchType;
this.dragIndicatorId = dragIndicatorId;
- this.onselect = new Function('event', events.onselect);
+ this.onselect = new Function('event', (events.onselect ? events.onselect : "") + "; return true;");
this.onexpand = new Function('event', events.onexpand);
this.oncollapse = new Function('event', events.oncollapse);
this.onAjaxSelect = onAjaxSelect;
@@ -49,19 +49,49 @@
Event.observe(this.element, "click", function(event) {
if (Richfaces.eventIsSynthetic(event)) {
+ var treeItem = event["treeItem"];
+
if (event[Richfaces.TreeSelectEvent]){
Event.stop(event);
- this.onselect(event);
+ var itemOnSelect = treeItem.getRichAttribute("onselected");
+ itemOnSelect = new Function('event', (itemOnSelect ? itemOnSelect : "") + "; return true;");
+
+ var selectResult = itemOnSelect(event);
+ if (!selectResult) {
+ event["cancelSelection"] = true;
+ return ;
+ }
+
+ selectResult = this.onselect(event);
+ if (!selectResult) {
+ event["cancelSelection"] = true;
+ return ;
+ }
+
+ treeItem.toggleSelection(event);
+
var attr = Richfaces.getNSAttribute("ajaxselectedlistener", $(event.selectedNode + Tree.ID_DEVIDER + Tree.ID_ICON));
if (attr) {
this.onAjaxSelect(event);
}
} else if (event[Richfaces.TreeExpandEvent]){
Event.stop(event);
+
+ var handler = treeItem.getRichAttribute("onexpand");
+ if (handler) {
+ new Function('event', handler).call(Event.element(event), event);
+ }
+
this.onexpand(event);
} else if (event[Richfaces.TreeCollapseEvent]){
Event.stop(event);
+
+ var handler = treeItem.getRichAttribute("oncollapse");
+ if (handler) {
+ new Function('event', handler).call(Event.element(event), event);
+ }
+
this.oncollapse(event);
}
}
Modified: trunk/richfaces/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/richfaces/tree/src/main/templates/htmlTree.jspx 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/templates/htmlTree.jspx 2007-04-26 20:09:27 UTC (rev 580)
@@ -16,6 +16,7 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
/org/ajax4jsf/framework/ajax/scripts/AJAX.js,
+ /org/richfaces/renderkit/html/scripts/utils.js,
/org/ajax4jsf/renderkit/html/scripts/form.js,
/org/richfaces/renderkit/html/scripts/events.js,
/org/richfaces/renderkit/html/scripts/tree.js,
Modified: trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx
===================================================================
--- trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces/tree/src/main/templates/htmlTreeNode.jspx 2007-04-26 20:09:27 UTC (rev 580)
@@ -69,6 +69,9 @@
rich:draggableoptions="#{this:getDraggableScriptOptions(context, component)}"
rich:dropzoneoptions="#{this:getDropzoneScriptOptions(context, component)}"
rich:oncontextmenu="#{component.attributes['oncontextmenu']}"
+ rich:onselected="#{component.attributes['onselected']}"
+ rich:onexpand="#{component.attributes['onexpand']}"
+ rich:oncollapse="#{component.attributes['oncollapse']}"
class="dr-tree-h-ic #{lineFirst}" id="#{clientId}:icon">
<jsp:scriptlet>
<![CDATA[
Modified: trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-26 20:04:02 UTC (rev 579)
+++ trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-26 20:09:27 UTC (rev 580)
@@ -59,7 +59,7 @@
nodeFace="#{data.name != 'param-value' ? 'input' : 'text'}"
changeExpandListener="#{bean.onExpand}"
nodeSelectListener="#{bean.onSelect}" binding="#{bean.tree}"
- onselected="window.status='selectedNode: '+event.selectedNode"
+ onselected="window.status='selectedNode: '+event.selectedNode;"
onexpand="window.status='expandedNode: '+event.expandedNode"
oncollapse="window.status='collapsedNode: '+event.collapsedNode"
ajaxSubmitSelection="true" reRender="outputText, selectOneListbox"
@@ -79,7 +79,7 @@
<dnd:dndParam name="treeParam" value="Tree Parameter" />
<dnd:dndParam name="accept" value="accept" />
- <rich:treeNode type="input" dropListener="#{bean.processDrop}">
+ <rich:treeNode type="input" dropListener="#{bean.processDrop}" oncollapse="alert('collapse')" onexpand="alert('expand')">
<h:outputText value="#{data} : " />
<h:inputText value="#{data.name}" required="true" styleClass="inputs">
</h:inputText>
@@ -87,7 +87,7 @@
<dnd:dndParam name="nodeParam" value="Node Parameter" />
</rich:treeNode>
- <rich:treeNode type="text" nodeClass="customNode" acceptedTypes="file2">
+ <rich:treeNode type="text" nodeClass="customNode" acceptedTypes="file2" onselected="return false;">
<h:outputText value="#{data}" />
</rich:treeNode>
</rich:tree>
17 years, 8 months
JBoss Rich Faces SVN: r579 - in trunk/richfaces-samples/richfaces-demo/src/main: webapp/richfaces/dataTableScroller and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-04-26 16:04:02 -0400 (Thu, 26 Apr 2007)
New Revision: 579
Modified:
trunk/richfaces-samples/richfaces-demo/src/main/java/org/richfaces/demo/dnd/DndBean.java
trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/usage.xhtml
trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/gmap/usage.xhtml
trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/modalPanel/usage.xhtml
Log:
demo changes
Modified: trunk/richfaces-samples/richfaces-demo/src/main/java/org/richfaces/demo/dnd/DndBean.java
===================================================================
--- trunk/richfaces-samples/richfaces-demo/src/main/java/org/richfaces/demo/dnd/DndBean.java 2007-04-26 17:19:56 UTC (rev 578)
+++ trunk/richfaces-samples/richfaces-demo/src/main/java/org/richfaces/demo/dnd/DndBean.java 2007-04-26 20:04:02 UTC (rev 579)
@@ -64,13 +64,15 @@
frameworks.add(new Framework("ajaxCFC", "CF"));
frameworks.add(new Framework("AJAXEngine", "DNET"));
frameworks.add(new Framework("AjaxAC", "PHP"));
- frameworks.add(new Framework("AJAXEngine", "DNET"));
frameworks.add(new Framework("MonoRail", "DNET"));
frameworks.add(new Framework("wddxAjax", "CF"));
frameworks.add(new Framework("AJAX AGENT", "PHP"));
frameworks.add(new Framework("FastPage", "DNET"));
frameworks.add(new Framework("JSMX", "CF"));
- frameworks.add(new Framework("AJAXEngine", "DNET"));
+ frameworks.add(new Framework("PAJAJ", "PHP"));
+ frameworks.add(new Framework("Symfony", "PHP"));
+ frameworks.add(new Framework("PowerWEB", "DNET"));
+
containerPHP = new ArrayList();
containerCF = new ArrayList();
containerDNET = new ArrayList();
Modified: trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/usage.xhtml
===================================================================
--- trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/usage.xhtml 2007-04-26 17:19:56 UTC (rev 578)
+++ trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/dataTableScroller/usage.xhtml 2007-04-26 20:04:02 UTC (rev 579)
@@ -18,7 +18,7 @@
<div class="sample-container">
<h:form>
- <rich:datascroller for="carList" maxPages="20" />
+ <rich:datascroller align="left" for="carList" maxPages="20" />
<rich:spacer height="30" />
<rich:dataTable width="483" id="carList" rows="10" columnClasses="col"
value="#{dataTableScrollerBean.allCars}" var="category">
Modified: trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/gmap/usage.xhtml
===================================================================
--- trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/gmap/usage.xhtml 2007-04-26 17:19:56 UTC (rev 578)
+++ trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/gmap/usage.xhtml 2007-04-26 20:04:02 UTC (rev 579)
@@ -28,7 +28,7 @@
</p>
<h:panelGrid columns="2">
- <rich:gmap gmapVar="map" zoom="#{gmBean.zoom}" style="width:400px;height:400px" gmapKey="#{gmBean.gmapkey}" />
+ <rich:gmap gmapVar="map" zoom="#{gmBean.zoom}" style="width:400px;height:400px" gmapKey="#{gmBean.gmapkey}" />
<h:panelGroup>
<rich:tabPanel switchType="ajax" width="350" height="400">
Modified: trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/modalPanel/usage.xhtml
===================================================================
--- trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/modalPanel/usage.xhtml 2007-04-26 17:19:56 UTC (rev 578)
+++ trunk/richfaces-samples/richfaces-demo/src/main/webapp/richfaces/modalPanel/usage.xhtml 2007-04-26 20:04:02 UTC (rev 579)
@@ -7,8 +7,15 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<ui:composition template="/templates/component-sample.xhtml">
<ui:define name="sample">
+<script>
+ function getRightTop(ref) {
+ var position = new Object();
+ position.top = 0; //ref.offsetTop;
+ position.left =0; // ref.offsetLeft+ref.clientWidth+6;
+ return position;
+ }
+</script>
-
<p>RichFaces Modal Panel is a container that blocks the operation on the base page when the modal
panel is shown.</p>
<p>You can show the modal panel using the folowing javascript function: Richfaces.hideModalPanel(id, params).
@@ -16,8 +23,8 @@
Richfaces.showModalPanel('mp',{width:450, top:200})</a></p>
<div class="sample-container">
+ <button onclick="var pos=getRightTop(this);alert(pos.left);Richfaces.showModalPanel('mp',{top:pos.top, left:pos.left})">Show on the Right</button>
-
<rich:modalPanel id="mp" minHeight="200" minWidth="450"
height="200" width="500" zindex="2000">
<f:facet name="header">
17 years, 8 months
JBoss Rich Faces SVN: r578 - in trunk: richfaces-samples/tabPanelDemo/src/main/webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-26 13:19:56 -0400 (Thu, 26 Apr 2007)
New Revision: 578
Modified:
trunk/richfaces-samples/tabPanelDemo/src/main/webapp/pages/index.jsp
trunk/richfaces/tabPanel/src/main/templates/tab.jspx
Log:
http://jira.jboss.com/jira/browse/RF-123 fixed
Test case added
Modified: trunk/richfaces/tabPanel/src/main/templates/tab.jspx
===================================================================
--- trunk/richfaces/tabPanel/src/main/templates/tab.jspx 2007-04-26 16:08:06 UTC (rev 577)
+++ trunk/richfaces/tabPanel/src/main/templates/tab.jspx 2007-04-26 17:19:56 UTC (rev 578)
@@ -18,7 +18,10 @@
<table border="0" cellpadding="10" cellspacing="0" width="100%" class="dr-tbpnl-cntnt-pstn rich-tabpanel-content-position" style="position : relative; z-index: 1;">
<tr>
- <td class="dr-tbpnl-cntnt rich-tabpanel-content #{component.pane.attributes['contentClass']} #{component.attributes['styleClass']}" style="#{component.attributes['contentStyle']}; #{component.attributes['style']}">
+ <td class="dr-tbpnl-cntnt rich-tabpanel-content #{component.pane.attributes['contentClass']} #{component.attributes['styleClass']}"
+ style="#{component.attributes['contentStyle']}; #{component.attributes['style']}"
+ x:passThruWithExclusions="class,style,styleClass,id"
+ >
<vcp:body />
</td>
</tr>
Modified: trunk/richfaces-samples/tabPanelDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/tabPanelDemo/src/main/webapp/pages/index.jsp 2007-04-26 16:08:06 UTC (rev 577)
+++ trunk/richfaces-samples/tabPanelDemo/src/main/webapp/pages/index.jsp 2007-04-26 17:19:56 UTC (rev 578)
@@ -76,7 +76,7 @@
<tabs:tabPanel valueChangeListener="#{bean.valueChanged}" headerSpacing="5px" immediate="false" tabClass="tabClass" activeTabClass="italic" width="100%" switchType="client" binding="#{bean.tabPanel}" value="#{bean.currentTab}" id="tab_panel">
<f:valueChangeListener type="org.richfaces.TabChangeListener"/>
- <tabs:tab disabled="#{bean.disabledTabName == 'canon'}" name="canon" label="Canon" switchType="server">
+ <tabs:tab onclick="alert('\\'Canon\\' tab clicked');" disabled="#{bean.disabledTabName == 'canon'}" name="canon" label="Canon" switchType="server">
<h:graphicImage value="/pages/Canon_EOS_Digital_Rebel_XT.jpg" alt=""/>
<h:outputText value="Canon EOS Digital Rebel XT" />
<h:inputText required="true" value="#{bean.value1}"/>
17 years, 8 months
JBoss Rich Faces SVN: r577 - in trunk/richfaces/dataTable/src: main/java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-04-26 12:08:06 -0400 (Thu, 26 Apr 2007)
New Revision: 577
Modified:
trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/html/SubTableRenderer.java
trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java
Log:
fixed problems with dataTable...
Modified: trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2007-04-26 16:03:46 UTC (rev 576)
+++ trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2007-04-26 16:08:06 UTC (rev 577)
@@ -34,7 +34,6 @@
import org.apache.commons.collections.iterators.FilterIterator;
import org.richfaces.component.Column;
import org.richfaces.component.Row;
-import org.richfaces.component.UIColumnGroup;
import org.richfaces.component.UIDataTable;
/**
@@ -78,8 +77,10 @@
int columns) throws IOException {
ResponseWriter writer = context.getResponseWriter();
UIComponent header = table.getHeader();
- Iterator headers = columnFacets(table);
- if (header != null || headers.hasNext()) {
+ Iterator headers = columnFacets(table,"header");
+
+
+ if (header != null ||headers.hasNext()) {
writer.startElement("thead", table);
String headerClass = (String) table.getAttributes().get(
"headerClass");
@@ -91,20 +92,37 @@
headerClass, "td");
}
- if (headers.hasNext()) {
+ if (headers.hasNext()&&findFacet(table,"header")) {
writer.startElement("tr", table);
encodeStyleClass(writer, null,
"dr-table-subheader rich-table-subheader", null,
headerClass);
- encodeHeaderFacets(context, writer, headers,
+ encodeHeaderFacets(context, writer, headers,
"dr-table-subheadercell rich-table-subheadercell",
headerClass, "header", "td");
+
writer.endElement("tr");
}
writer.endElement("thead");
}
}
-
+
+ public boolean findFacet(UIDataTable table, String facetName)
+ {
+ Iterator iter = columnFacets(table,facetName);
+ boolean find = false;
+ while(iter.hasNext()){
+ UIComponent comp = (UIComponent) iter.next();
+ if(comp.getFacet(facetName)!=null)
+ {
+ find = true;
+ break;
+ }
+
+ }
+ return find;
+ }
+
protected void encodeHeaderFacets(FacesContext context,
ResponseWriter writer, Iterator headers, String skinCellClass,
String headerClass, String facetName, String element)
@@ -114,15 +132,17 @@
String classAttribute = facetName + "Class";
String columnHeaderClass = (String) column.getAttributes().get(
classAttribute);
+
writer.startElement(element, column);
encodeStyleClass(writer, null, skinCellClass, headerClass,
columnHeaderClass);
writer.writeAttribute("scope", "col", null);
getUtils().encodeAttribute(context, column, "colspan");
UIComponent facet = column.getFacet(facetName);
- if (facet != null && facet.isRendered()) {
+ if (facet != null) {
renderChild(context, facet);
}
+
writer.endElement(element);
}
}
@@ -131,20 +151,22 @@
int columns) throws IOException {
ResponseWriter writer = context.getResponseWriter();
UIComponent footer = table.getFooter();
- Iterator footers = columnFacets(table);
+ Iterator footers = columnFacets(table,"footer");
if (footer != null || footers.hasNext()) {
writer.startElement("tfoot", table);
String footerClass = (String) table.getAttributes().get(
"footerClass");
- if (footers.hasNext()) {
+ if (footers.hasNext()&&findFacet(table,"footer")) {
writer.startElement("tr", table);
encodeStyleClass(writer, null,
"dr-table-subfooter rich-table-subfooter", null,
footerClass);
+
encodeHeaderFacets(context, writer, footers,
"dr-table-subfootercell rich-table-subfootercell",
footerClass, "footer", "td");
+
writer.endElement("tr");
}
if (footer != null) {
@@ -264,18 +286,18 @@
*
* Changed by Alexej Kushunin
*/
- protected Iterator columnFacets(UIDataTable table){
+ protected Iterator columnFacets(UIDataTable table,final String name){
return new FilterIterator(table.columns(), new Predicate() {
public boolean evaluate(Object input) {
UIComponent component = (UIComponent) input;
- // accept only components which work with facets.
- if (component instanceof UIColumnGroup) {
- return false;
+ // accept only columns with corresponding facets.
+ if (component instanceof Column) {
+ return component.isRendered()&&(component.getFacet(name) != null);
}
else{
- return component.isRendered();}
- // && component.getFacet(name) != null;
+ return false;
+ }
}});
}
Modified: trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/html/SubTableRenderer.java
===================================================================
--- trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/html/SubTableRenderer.java 2007-04-26 16:03:46 UTC (rev 576)
+++ trunk/richfaces/dataTable/src/main/java/org/richfaces/renderkit/html/SubTableRenderer.java 2007-04-26 16:08:06 UTC (rev 577)
@@ -59,13 +59,14 @@
*/
private void encodeHeaderRow(ResponseWriter writer, FacesContext context, UIComponent component,String facetName) throws IOException {
UIDataTable dataTable = (UIDataTable) component;
- Iterator headers = columnFacets(dataTable);
+ Iterator headers = columnFacets(dataTable,facetName);
String headerClass = (String) component.getAttributes().get(
facetName+"Class");
- if (headers.hasNext()) {
+ if (headers.hasNext()&&findFacet(dataTable,facetName)) {
encodeRowStart(context,"dr-subtable-"+facetName+" rich-subtable-"+facetName ,headerClass, dataTable, writer);
encodeHeaderFacets(context, writer, headers, "dr-subtable-"+facetName+"cell rich-subtable-"+facetName+"cell", headerClass,
facetName, "td");
+
writer.endElement("tr");
}
}
Modified: trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java
===================================================================
--- trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java 2007-04-26 16:03:46 UTC (rev 576)
+++ trunk/richfaces/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java 2007-04-26 16:08:06 UTC (rev 577)
@@ -324,16 +324,16 @@
tr = (HtmlElement) trs.get(0);
assertNotNull(tr);
classAttr = tr.getAttributeValue("class");
-// System.out.println(classAttr);
- assertTrue(classAttr.contains("dr-table-subfooter rich-table-subfooter "));
+ System.out.println(classAttr);
+ assertTrue(classAttr.contains("dr-table-footer rich-table-footer "));
tds = tr.getHtmlElementsByTagName("td");
assertTrue(tds.size() > 0);
td = (HtmlElement) tds.get(0);
assertNotNull(td);
classAttr = td.getAttributeValue("class");
-// System.out.println(classAttr);
- assertTrue(classAttr.contains("dr-table-subfootercell rich-table-subfootercell "));
+ System.out.println(classAttr);
+ assertTrue(classAttr.contains("dr-table-footercell rich-table-footercell "));
Iterator fixedChildren = dataTable.fixedChildren();
assertNotNull(fixedChildren);
17 years, 8 months
JBoss Rich Faces SVN: r576 - trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-04-26 12:03:46 -0400 (Thu, 26 Apr 2007)
New Revision: 576
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
Log:
Modified: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-04-26 16:03:37 UTC (rev 575)
+++ trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-04-26 16:03:46 UTC (rev 576)
@@ -1,6 +1,23 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.framework.renderer.AjaxComponentRendererBase;
+import javax.faces.context.FacesContext;
-public abstract class ScrollableGridBaseRenderer extends AjaxComponentRendererBase{
+import org.richfaces.component.UIScrollableGrid;
+import org.richfaces.renderkit.CompositeRenderer;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+public abstract class ScrollableGridBaseRenderer extends CompositeRenderer {
+
+ protected String getJavaScriptVarName(FacesContext context, UIScrollableGrid grid) {
+ String id = grid.getBaseClientId(context);
+ return "Richfaces_ScrollableGrid_" + id.replaceAll("[^A-Za-z0-9_]", "_");
+ }
+
+ protected String getScriptContributions(FacesContext context, UIScrollableGrid grid) {
+ return super.getScriptContributions(getJavaScriptVarName(context, grid), context, grid);
+ }
}
17 years, 8 months