Author: amarkhel
Date: 2010-07-08 05:45:35 -0400 (Thu, 08 Jul 2010)
New Revision: 17769
Added:
root/ui-sandbox/panels2/branches/
root/ui-sandbox/panels2/tags/
root/ui-sandbox/panels2/trunk/
root/ui-sandbox/panels2/trunk/bom/
root/ui-sandbox/panels2/trunk/bom/pom.xml
root/ui-sandbox/panels2/trunk/create-component.bat
root/ui-sandbox/panels2/trunk/parent/
root/ui-sandbox/panels2/trunk/parent/pom.xml
root/ui-sandbox/panels2/trunk/pom.xml
root/ui-sandbox/panels2/trunk/readme.txt
root/ui-sandbox/panels2/trunk/ui/
root/ui-sandbox/panels2/trunk/ui/pom.xml
root/ui-sandbox/panels2/trunk/ui/src/
root/ui-sandbox/panels2/trunk/ui/src/main/
root/ui-sandbox/panels2/trunk/ui/src/main/java/
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
root/ui-sandbox/panels2/trunk/ui/src/main/resources/
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/MANIFEST.MF
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/panel.ecss
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/faces-config.xml
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/bg_header.png
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/close_act.gif
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/edit.gif
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js
root/ui-sandbox/panels2/trunk/ui/src/main/templates/
root/ui-sandbox/panels2/trunk/ui/src/main/templates/panel.template.xml
root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml
root/ui-sandbox/panels2/trunk/ui/src/test/
root/ui-sandbox/panels2/trunk/ui/src/test/java/
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java
root/ui-sandbox/panels2/trunk/ui/src/test/resources/
root/ui-sandbox/panels2/trunk/ui/src/test/resources/panelTest.xhtml
Log:
Added: root/ui-sandbox/panels2/trunk/bom/pom.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/bom/pom.xml (rev 0)
+++ root/ui-sandbox/panels2/trunk/bom/pom.xml 2010-07-08 09:45:35 UTC (rev 17769)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+
http://www.fsf.org.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces UI Components: panels bom</name>
+ <packaging>pom</packaging>
+
+ <properties>
+
<org.richfaces.core.version>4.0.0-SNAPSHOT</org.richfaces.core.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-bom</artifactId>
+ <version>${org.richfaces.core.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+<groupId>org.richfaces.cdk</groupId>
+ <artifactId>commons</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-ui</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>richfaces-ui-panels-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/pa...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root...
+ <
url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels2/trunk/create-component.bat
===================================================================
--- root/ui-sandbox/panels2/trunk/create-component.bat (rev 0)
+++ root/ui-sandbox/panels2/trunk/create-component.bat 2010-07-08 09:45:35 UTC (rev
17769)
@@ -0,0 +1 @@
+mvn archetype:generate -DarchetypeGroupId=org.richfaces.archetypes
-DarchetypeArtifactId=richfaces-component -Dcategory=panels -Dname=%1
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/parent/pom.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/parent/pom.xml (rev 0)
+++ root/ui-sandbox/panels2/trunk/parent/pom.xml 2010-07-08 09:45:35 UTC (rev 17769)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+
http://www.fsf.org.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces UI Components: panels parent</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <richfaces.checkstyle.version>1</richfaces.checkstyle.version>
+
<org.richfaces.cdk.version>4.0.0-SNAPSHOT</org.richfaces.cdk.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-bom</artifactId>
+ <version>${project.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ <version>${org.richfaces.cdk.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>${org.richfaces.cdk.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-build-checkstyle</artifactId>
+ <version>${richfaces.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <configuration>
+ <fail>false</fail>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <
uri>http://richfaces.org/panels</uri>
+ <shortName>panels</shortName>
+ <displayName>panels components
tags</displayName>
+ </taglib>
+ </library>
+ </configuration>
+ <executions>
+ <execution>
+ <id>cdk-generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <javadocVersion>1.5</javadocVersion>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/pa...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root...
+ <
url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
Added: root/ui-sandbox/panels2/trunk/pom.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/pom.xml (rev 0)
+++ root/ui-sandbox/panels2/trunk/pom.xml 2010-07-08 09:45:35 UTC (rev 17769)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+
http://www.fsf.org.
+--><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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>panels-aggregator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Richfaces UI Components: panels Aggregator</name>
+
+ <modules>
+ <module>bom</module>
+ <module>parent</module>
+
+ <module>ui</module>
+
+ <!--<module>old-togglePanel</module>-->
+ <!--<module>old-tabPanel</module>-->
+
+ <!--<module>dist</module>-->
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The dist requires clean install for prepare -->
+ <preparationGoals>clean install</preparationGoals>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The dist requires clean install for prepare -->
+ <preparationGoals>clean install</preparationGoals>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <configuration>
+ <fail>false</fail>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/pa...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root...
+ <
url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/readme.txt
===================================================================
Added: root/ui-sandbox/panels2/trunk/ui/pom.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/pom.xml (rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/pom.xml 2010-07-08 09:45:35 UTC (rev 17769)
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+
http://www.fsf.org.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.ui.panels</groupId>
+ <artifactId>richfaces-ui-panels-ui</artifactId>
+ <name>Richfaces UI Components: togglePanel ui</name>
+ <packaging>jar</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-bom</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- runtime -->
+<!-- <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>togglePanel-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>-->
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <!-- todo remove this dependency or move to test scope -->
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSF with dependencies -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- tests -->
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <!-- todo api? -->
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-test-stage</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>htmlunit-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-jsf</groupId>
+ <artifactId>jsf-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>${org.richfaces.cdk.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-build-checkstyle</artifactId>
+ <version>${richfaces.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <configuration>
+ <fail>false</fail>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <
uri>http://richfaces.org/panels</uri>
+ <shortName>panels</shortName>
+ <displayName>panels components
tags</displayName>
+ </taglib>
+ </library>
+ </configuration>
+ <executions>
+ <execution>
+ <id>cdk-generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <javadocVersion>1.5</javadocVersion>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/ui/pa...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root...
+ <
url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Added:
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,41 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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 class UIPanel extends UIComponentBase
+{
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @Override
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return "org.richfaces.Panel";
+ }
+}
Added:
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java
===================================================================
---
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,328 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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 java.util.HashMap;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.json.JSONException;
+import org.richfaces.json.JSONMap;
+
+/**
+ * JSF component class
+ *
+ */
+public class UIPopupPanel extends UIComponentBase{
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PopupPanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PopupPanel";
+
+ private Map<String, Object> visualOptions;
+
+ protected enum PropertyKeys {
+ selectBehaviour, width, height, zIndex, minHeight, minWidth, maxHeight, maxWidth,
top, left, moveable, autosized, modal, domElementAttachment, controlsClass, show,
headerClass, keepVisualState, label, overlapEmbedObjects, resizeable, shadowDepth,
shadowOpacity, trimOverlayedElements, style, styleClass, visualOptions, scrollerClass
+ }
+
+ public int getZIndex() {
+ return (Integer) getStateHelper().eval(PropertyKeys.zIndex, 100);
+ }
+
+ public void setZIndex(int zIndex) {
+ getStateHelper().put(PropertyKeys.zIndex, zIndex);
+ }
+
+ public int getHeight() {
+ return (Integer) getStateHelper().eval(PropertyKeys.height);
+ }
+
+ public void setHeight(int height) {
+ getStateHelper().put(PropertyKeys.height, height);
+ }
+
+ public int getWidth() {
+ return (Integer) getStateHelper().eval(PropertyKeys.width);
+ }
+
+ public void setWidth(int width) {
+ getStateHelper().put(PropertyKeys.width, width);
+ }
+
+ public int getMinHeight() {
+ return (Integer) getStateHelper().eval(PropertyKeys.minHeight, 10);
+ }
+
+ public void setMinHeight(int minheight) {
+ getStateHelper().put(PropertyKeys.minHeight, minheight);
+ }
+
+ public int getMinWidth() {
+ return (Integer) getStateHelper().eval(PropertyKeys.minWidth, 10);
+ }
+
+ public void setMinWidth(int minWidth) {
+ getStateHelper().put(PropertyKeys.minWidth, minWidth);
+ }
+
+ public int getMaxHeight() {
+ return (Integer) getStateHelper().eval(PropertyKeys.maxHeight);
+ }
+
+ public void setMaxHeight(int maxheight) {
+ getStateHelper().put(PropertyKeys.maxHeight, maxheight);
+ }
+
+ public int getMaxWidth() {
+ return (Integer) getStateHelper().eval(PropertyKeys.maxWidth);
+ }
+
+ public void setMaxWidth(int maxWidth) {
+ getStateHelper().put(PropertyKeys.maxWidth, maxWidth);
+ }
+
+ public String getSelectBehaviour() {
+ return (String) getStateHelper().eval(PropertyKeys.selectBehaviour);
+ }
+
+ public void setSelectBehaviour(String selectBehaviour) {
+ getStateHelper().put(PropertyKeys.selectBehaviour, selectBehaviour);
+ }
+
+ public String getTop() {
+ return (String) getStateHelper().eval(PropertyKeys.top);
+ }
+
+ public void setTop(String top) {
+ getStateHelper().put(PropertyKeys.top, top);
+ }
+
+ public String getLeft() {
+ return (String) getStateHelper().eval(PropertyKeys.left);
+ }
+
+ public void setLeft(String left) {
+ getStateHelper().put(PropertyKeys.left, left);
+ }
+
+ public Boolean isShow() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.show);
+ }
+
+ public void setShow(Boolean show) {
+ getStateHelper().put(PropertyKeys.show, show);
+ }
+
+ public Boolean isMoveable() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.moveable);
+ }
+
+ public void setModeable(Boolean moveable) {
+ getStateHelper().put(PropertyKeys.moveable, moveable);
+ }
+
+ public Boolean isAutosized() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.autosized);
+ }
+
+ public void setAutosized(Boolean autosized) {
+ getStateHelper().put(PropertyKeys.autosized, autosized);
+ }
+
+ public Boolean isModal() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.modal, true);
+ }
+
+ public void setModal(Boolean modal) {
+ getStateHelper().put(PropertyKeys.modal, modal);
+ }
+
+ public Boolean isKeepVisualState() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.keepVisualState);
+ }
+
+ public void setKeepVisualState(Boolean keepVisualState) {
+ getStateHelper().put(PropertyKeys.keepVisualState, keepVisualState);
+ }
+
+ public Boolean isOverlapEmbedObjects() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.overlapEmbedObjects);
+ }
+
+ public void setOverlapEmbedObjects(Boolean overlapEmbedObjects) {
+ getStateHelper().put(PropertyKeys.overlapEmbedObjects, overlapEmbedObjects);
+ }
+
+ public Boolean isResizeable() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.resizeable, true);
+ }
+
+ public void setResizeable(Boolean resizeable) {
+ getStateHelper().put(PropertyKeys.resizeable, resizeable);
+ }
+
+ public Boolean isTrimOverlayedElements() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.trimOverlayedElements);
+ }
+
+ public void setTrimOverlayedElements(Boolean trimOverlayedElements) {
+ getStateHelper().put(PropertyKeys.trimOverlayedElements, trimOverlayedElements);
+ }
+
+ public String getDomElementAttachment() {
+ return (String) getStateHelper().eval(PropertyKeys.domElementAttachment);
+ }
+
+ public void setDomElementAttachment(String domElementAttachment) {
+ getStateHelper().put(PropertyKeys.domElementAttachment, domElementAttachment);
+ }
+
+ public String getControlsClass() {
+ return (String) getStateHelper().eval(PropertyKeys.controlsClass);
+ }
+
+ public void setControlsClass(String controlsClass) {
+ getStateHelper().put(PropertyKeys.controlsClass, controlsClass);
+ }
+
+ public String getLabel() {
+ return (String) getStateHelper().eval(PropertyKeys.label);
+ }
+
+ public void setLabel(String label) {
+ getStateHelper().put(PropertyKeys.label, label);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getScrollerClass() {
+ return (String) getStateHelper().eval(PropertyKeys.scrollerClass);
+ }
+
+ public void setScrollerClass(String scrollerClass) {
+ getStateHelper().put(PropertyKeys.scrollerClass, scrollerClass);
+ }
+
+ public String getShadowDepth() {
+ return (String) getStateHelper().eval(PropertyKeys.shadowDepth);
+ }
+
+ public void setShadowDepth(String shadowDepth) {
+ getStateHelper().put(PropertyKeys.shadowDepth, shadowDepth);
+ }
+
+ public String getShadowOpacity() {
+ return (String) getStateHelper().eval(PropertyKeys.shadowOpacity);
+ }
+
+ public void setShadowOpacity(String shadowOpacity) {
+ getStateHelper().put(PropertyKeys.shadowOpacity, shadowOpacity);
+ }
+
+ public String getShadowStyle() {
+ String shadow = getShadowDepth();
+ String shadowStyle ="";
+ if (shadow != null) {
+ shadowStyle = "top: " + shadow + "px; left: " + shadow +
"px;";
+ }
+
+ String opacity = getShadowOpacity();
+ String filterOpacity;
+
+ if (opacity != null) {
+ try {
+ Double op = Double.valueOf(opacity);
+ filterOpacity = Integer.toString(op.intValue() * 10);
+ opacity = Double.toString(op.doubleValue() / 10);
+ } catch (Exception e) {
+ // illegal opacity
+ return "";
+ }
+ shadowStyle += " opacity:" + opacity
+ + "; filter:alpha(opacity=" + filterOpacity +
");";
+ }
+ return shadowStyle;
+ }
+
+ public Object getVisualOptions() {
+ if (null != this.visualOptions) {
+ return this.visualOptions;
+ }
+
+ ValueExpression ve = getValueExpression("visualOptions");
+ if (null != ve) {
+ try {
+ Object value = ve.getValue(getFacesContext().getELContext());
+ this.visualOptions = prepareVisualOptions(value);
+ return this.visualOptions;
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ }
+
+ if (null == this.visualOptions) {
+ this.visualOptions = new HashMap<String, Object>();
+ }
+ return this.visualOptions;
+ }
+ public void setVisualOptions(Object visualOptions) {
+ this.visualOptions = prepareVisualOptions(visualOptions);
+ }
+
+ private Map<String, Object> prepareVisualOptions(Object value) {
+ if (null == value) {
+ return new HashMap<String, Object>();
+ } else if (value instanceof Map) {
+ return (Map<String, Object>) value;
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (!s.startsWith("{")) {
+ s = "{" + s + "}";
+ }
+ try {
+ return new HashMap<String, Object>(new JSONMap(s));
+ } catch (JSONException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ throw new FacesException("Attribute visualOptions of component [" +
+ this.getClientId(getFacesContext()) + "] must be instance of Map or String, but
its type is " +
+ value.getClass().getSimpleName());
+ }
+ }
+
+ @Override
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+}
Added:
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java
===================================================================
---
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.renderkit.RendererBase;
+import org.richfaces.component.UIPanel;
+
+/**
+ * @author amarkhel
+ * @since Jun 14, 2010
+ */
+@ResourceDependency(name = "css/panel.ecss")
+public class PanelBaseRenderer extends RendererBase {
+
+ public PanelBaseRenderer() {
+ }
+
+ public void renderHeaderFacet(FacesContext context, UIComponent component) throws
IOException {
+ UIComponent headerFacet = component.getFacet("header");
+ headerFacet.encodeAll(context);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIPanel.class;
+ }
+}
Added:
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
---
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,264 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.richfaces.component.UIPopupPanel;
+@ResourceDependencies( {
+ @ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"script/popupPanel.js"),
+ @ResourceDependency(name = "script/popupPanelBorders.ecss")
+
+})
+public class PopupPanelBaseRenderer extends RendererBase{
+
+ private static final String CONTROLS_FACET = "controls";
+ private static final String HEADER_FACET = "header";
+ private static final int sizeA = 10;
+
+ public String getShadowStyle(FacesContext context, UIComponent component) {
+ UIPopupPanel panel = (UIPopupPanel)component;
+ return panel.getShadowStyle();
+ }
+ public void renderHeaderFacet(FacesContext context, UIComponent component) throws
IOException {
+ renderFacet(context, component, HEADER_FACET);
+ }
+
+ public void renderControlsFacet(FacesContext context, UIComponent component) throws
IOException {
+ renderFacet(context, component, CONTROLS_FACET);
+ }
+
+ private void renderFacet(FacesContext context, UIComponent component, String facet)
throws IOException{
+ UIComponent headerFacet = component.getFacet(facet);
+ headerFacet.encodeAll(context);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void doDecode(FacesContext context, UIComponent component) {
+ super.doDecode(context, component);
+
+ /*UIPopupPanel panel = (UIPopupPanel)component;
+ ExternalContext exCtx = context.getExternalContext();
+ Map<String, String> rqMap = exCtx.getRequestParameterMap();
+ Object panelOpenState = rqMap.get(panel.getClientId(context) +
"OpenedState");
+
+ if (panel.isKeepVisualState()) {
+ if (null != panelOpenState) {
+ // Bug
https://jira.jboss.org/jira/browse/RF-2466
+ // Incorrect old:
+ // panel.setShowWhenRendered(Boolean.parseBoolean((String) clnId));
+ // ShowWhenRendered can be settled separately with modal panel
"showWhenRendered" attribute
+ // so we should combine ShowWhenRendered || KeepVisualState &&
(OpenedState==TRUE) against rewriting
+ boolean show = panel.isShow() || Boolean.parseBoolean((String)
panelOpenState);
+ panel.setShow(show);
+
+ Map<String, Object> visualOptions = (Map<String, Object>)
panel.getVisualOptions();
+ Iterator<Entry<String, String>> it = rqMap.entrySet().iterator();
+ while ( it.hasNext()) {
+ Map.Entry<String, String> entry = it.next();
+ int suffixPos = entry.getKey().toString().indexOf(STATE_OPTION_SUFFIX);
+ if (-1 != suffixPos) {
+ String key = entry.getKey().toString().substring(suffixPos +
STATE_OPTION_SUFFIX.length());
+ visualOptions.put(key, entry.getValue());
+ }
+ }
+ }*/
+ //}
+ }
+
+ protected Class getComponentClass() {
+ return UIPopupPanel.class;
+ }
+
+ private static final Set<String> ALLOWED_ATTACHMENT_OPTIONS = new
HashSet<String>();
+ static {
+ ALLOWED_ATTACHMENT_OPTIONS.add("body");
+ ALLOWED_ATTACHMENT_OPTIONS.add("parent");
+ ALLOWED_ATTACHMENT_OPTIONS.add("form");
+ }
+
+ //TODO nick - add messages
+ public void checkOptions(FacesContext context, UIComponent component) {
+ UIPopupPanel panel = (UIPopupPanel)component;
+ if (panel.isAutosized() && panel.isResizeable()) {
+ throw new IllegalArgumentException("Autosized modal panel can't be
resizeable.");
+ }
+
+ String domElementAttachment = panel.getDomElementAttachment();
+ if (domElementAttachment != null && domElementAttachment.trim().length() != 0)
{
+ if (!ALLOWED_ATTACHMENT_OPTIONS.contains(domElementAttachment)) {
+ throw new IllegalArgumentException("Value '" + domElementAttachment +
"' of domElementAttachment attribute is illegal. " +
+ "Allowed values are: " + ALLOWED_ATTACHMENT_OPTIONS);
+ }
+ }
+
+ if (panel.getMinHeight() != -1) {
+ if (panel.getMinHeight() < sizeA) {
+ throw new IllegalArgumentException();
+ }
+
+// if (panel.getHeight() < panel.getMinHeight()) {
+// panel.setHeight(panel.getMinHeight());
+// }
+ }
+
+ if (panel.getMinWidth() != -1) {
+ if (panel.getMinWidth() < sizeA) {
+ throw new IllegalArgumentException();
+ }
+
+// if (panel.getWidth() < panel.getMinWidth()) {
+// panel.setWidth(panel.getMinWidth());
+// }
+ }
+ }
+
+// protected String buildOptions(FacesContext context, UIModalPanel panel) {
+// return getOptions(context, panel, getUtils());
+// }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public String buildShowScript(FacesContext context, UIComponent component) {
+ UIPopupPanel panel = (UIPopupPanel)component;
+ StringBuilder result = new StringBuilder();
+
+ // Bug
https://jira.jboss.org/jira/browse/RF-2466
+ // We are already processed KeepVisualState and current open state in
+ // doDecode, so no need to check panel.isKeepVisualState() here.
+ if (/*panel.isKeepVisualState() || */panel.isShow()) {
+ result.append("Richfaces.showModalPanel('" + panel.getClientId(context)
+ "', {");
+
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>)
panel.getVisualOptions()).entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+
+ result.append(entry.getKey() + ": '" + entry.getValue() +
"'");
+ if (it.hasNext()) {
+ result.append(", ");
+ }
+ }
+
+ result.append("});");
+ }
+ return result.toString();
+ }
+
+ public String buildScript(FacesContext context, UIComponent component) throws
IOException {
+ UIPopupPanel panel = (UIPopupPanel)component;
+ StringBuilder result = new StringBuilder();
+ result.append("new ModalPanel('");
+ result.append(panel.getClientId());
+ result.append("',{");
+ result.append("width:");
+ result.append(panel.getWidth());
+ result.append(",");
+ result.append("height:");
+ result.append(panel.getHeight());
+ result.append(",");
+ result.append("minWidth:");
+ result.append(panel.getMinWidth());
+ result.append(",");
+ result.append("minHeight:");
+ result.append(panel.getMinHeight());
+ result.append(",");
+ result.append("maxWidth:");
+ result.append(panel.getMaxWidth());
+ result.append(",");
+ result.append("maxHeight:");
+ result.append(panel.getMaxHeight());
+ result.append(",");
+ result.append("resizable:");
+ result.append(panel.isResizeable());
+ result.append(",");
+ result.append("moveable:");
+ result.append(panel.isMoveable());
+ result.append(",");
+ result.append("left:");
+ result.append(panel.getLeft());
+ result.append(",");
+ result.append("top:");
+ result.append(panel.getTop());
+ result.append(",");
+ result.append("zIndex:");
+ result.append(panel.getZIndex());
+ result.append(",");
+ result.append(writeEventHandlerFunction(context, panel,"onresize"));
+ result.append(writeEventHandlerFunction(context, panel,"onmove"));
+ result.append(writeEventHandlerFunction(context, panel,"onshow"));
+ result.append(writeEventHandlerFunction(context, panel,"onhide"));
+ result.append(writeEventHandlerFunction(context, panel,"onbeforeshow"));
+ result.append(writeEventHandlerFunction(context, panel,"onbeforehide"));
+ result.append("domElementAttachment:");
+ result.append(panel.getDomElementAttachment());
+ result.append(",");
+ result.append("keepVisualState:");
+ result.append(panel.isKeepVisualState());
+ result.append(",");
+ result.append("show:");
+ result.append(panel.isShow());
+ result.append(",");
+ result.append("selectBehaviour:");
+ result.append(panel.getSelectBehaviour());
+ result.append(",");
+ result.append("autosized:");
+ result.append(panel.isAutosized());
+ result.append(",");
+ result.append("overlapEmbedObjects:");
+ result.append(panel.isOverlapEmbedObjects());
+ result.append(",");
+ writeVisualOptions(context, panel);
+ result.append("}');");
+ return result.toString();
+ }
+
+ public String writeEventHandlerFunction(FacesContext context, UIComponent component,
String eventName) throws IOException{
+ String event = (String) component.getAttributes().get(eventName);
+
+ if (event != null) {
+ event = event.trim();
+
+ if (event.length() != 0) {
+ JSFunctionDefinition function = new JSFunctionDefinition();
+
+ function.addParameter("event");
+ function.addToBody(event);
+
+ return function.toScript();
+ }
+ }
+
+ return "";
+ }
+
+ private String writeVisualOptions(FacesContext context, UIPopupPanel panel)
+ throws IOException {
+ StringBuffer result = new StringBuffer();
+
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>)
panel.getVisualOptions()).entrySet().iterator();
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+
+ result.append(entry.getKey() + ": '" + entry.getValue() +
"'");
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ }
+ return result.toString();
+ }
+}
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/MANIFEST.MF
(rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/MANIFEST.MF 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/panel.ecss
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/panel.ecss
(rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/panel.ecss 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,29 @@
+.rf-panel{
+ background-color:'#{richSkin.generalBackgroundColor}';
+ color:'#{richSkin.panelBorderColor}';
+ border-width:1px;
+ border-style:solid;
+ padding:1px;
+}
+
+.rf-panel-header{
+ background-color:'#{richSkin.headerBackgroundColor}';
+ border-color:'#{richSkin.headerBackgroundColor}';
+ font-size:'#{richSkin.headerSizeFont}';
+ color:'#{richSkin.headerTextColor}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ padding:2px;
+ border-width:1px;
+ border-style:solid;
+ background-position:top left;
+ background-repeat:repeat-x;
+ background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+}
+
+.rf-panel-body{
+ font-size:'#{richSkin.generalSizeFont}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ padding:10px;
+}
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,172 @@
+.mp-button {
+ outline-style: none;
+ position: absolute;
+ border: 10px solid red;
+ position: absolute;
+ clip: rect(0px 0px 1px 1px);
+ height: 10px;
+ width: 10px;
+ left: 0px;
+ top: 0px;
+ z-index: -300;
+}
+
+.mp_shade {
+ position : fixed;
+ width : 100%;
+ height : 100%;
+ top:0px;
+ left : 0px;
+ background : black;
+ filter : alpha(opacity=50); opacity:0.5;
+}
+.mp_iframe {
+ position : absolute;
+ width : 100%;
+ height : 100%;
+ top:0px;
+ left : 0px;
+ filter : alpha(opacity=0);
+}
+.mp_shadow {
+ background-image:"url(#{resource['images/bg_shadow.png']})";
+ position : fixed;
+ top : 50%;
+ left : 50%;
+ width : 620px /*visible modal panel width plus 20px*/;
+ height : 420px /*visible modal panel height plus 20px*/;
+ background : none;
+ margin-top : -208px /*half of width minus 2px*/;
+ margin-left : -308px /*half of height minus 2px*/;
+}
+.mp_container {
+ position : fixed;
+ top : 50%;
+ left : 50%;
+ width : 600px /*visible modal panel width*/;
+ height : 400px /*visible modal panel height*/;
+ margin-top : -200px /*half of height*/;
+ margin-left : -300px /*half of width*/;
+ border : '1px solid #{richSkin.panelBorderColor}';
+ background : '#{richSkin.generalBackgroundColor}';
+}
+.mp_header {
+ background :
"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+ repeat-x : 'top left #{richSkin.headerBackgroundColor};;
+ height : 30px /*header height*/;
+ position : relative;
+ padding-right : 60px;
+ padding-left : 10px;
+ cursor : move;
+}
+.mp_header_content {
+ overflow : hidden;
+ width : 100%;
+ white-space : nowrap;
+ padding-top : 8px;
+ text-overflow: ellipsis;
+ font-weight : '#{richSkin.headerWeightFont}';
+ color : '#{richSkin.headerTextColor}';
+ font-family : '#{richSkin.headerFamilyFont}';
+ font-size : '#{richSkin.headerSizeFont}';
+}
+.mp_header_controls {
+ background : "url(#{resource['images/close_act.gif']}) no-repeat
center";
+ width : 16px;
+ height : 16px;
+ position : absolute;
+ top : 8px;
+ right : 8px;
+ white-space : nowrap;
+ cursor : default
+}
+.mp_header_icon {
+ background : "url(#{resource['images/edit.gif']}) no-repeat center";
+ width : 16px;
+ height : 16px;
+ margin-right : 5px;
+ vertical-align : middle;
+ display : inline-block;
+ text-align : middle;
+}
+.mp_content_scroller {
+ width : 600px /*visible modal panel width*/;
+ height : 370px /*visible modal panel height minus header height*/;
+ position : relative;
+ top : 0px;
+ left : 0px;
+ !overflow : auto;
+ !overflow-x : hidden;
+}
+.mp_content {
+ position : relative;
+ padding : 10px;
+ color : '#{richSkin.generalTextColor}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
+}
+.mp_handler {
+ background : red;
+ filter : alpha(opacity=0);
+ opacity:0;
+ position : absolute;
+ margin : -4px;
+}
+.mp_handler_left {
+ width : 7px;
+ height : 100%;
+ top : 0px;
+ left : 0px;
+ cursor : w-resize;
+}
+
+.mp_handler_right {
+ width : 7px;
+ height : 100%;
+ top : 0px;
+ right : 0px;
+ cursor : w-resize;
+}
+.mp_handler_top {
+ width : 100%;
+ height : 7px;
+ top : 0px;
+ left : 0px;
+ cursor : n-resize;
+}
+.mp_handler_bottom {
+ width : 100%;
+ height : 7px;
+ bottom : 0px;
+ left : 0px;
+ cursor : n-resize;
+}
+
+.mp_handler_top_left {
+ width : 10px;
+ height : 10px;
+ top : 0px;
+ left : 0px;
+ cursor : nw-resize;
+}
+.mp_handler_top_right {
+ width : 10px;
+ height : 10px;
+ top : 0px;
+ right : 0px;
+ cursor : ne-resize;
+}
+.mp_handler_bottom_left {
+ width : 10px;
+ height : 10px;
+ bottom : 0px;
+ left : 0px;
+ cursor : ne-resize;
+}
+.mp_handler_bottom_right {
+ width : 10px;
+ height : 10px;
+ bottom : 0px;
+ right : 0px;
+ cursor : nw-resize;
+}
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/faces-config.xml
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/faces-config.xml 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
+<faces-config version="2.0" metadata-complete="false"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:cdk="http://richfaces.org/cdk/extensions"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<component>
+ <component-type>org.richfaces.Panel</component-type>
+ <component-class>org.richfaces.component.UIPanel</component-class>
+ </component>
+ <render-kit>
+ <render-kit-id>HTML_BASIC</render-kit-id>
+ <renderer>
+ <component-family>org.richfaces.Panel</component-family>
+ <renderer-type>org.richfaces.PanelRenderer</renderer-type>
+
<renderer-class>org.richfaces.renderkit.html.PanelRenderer</renderer-class>
+ </renderer>
+ </render-kit>
+ <faces-config-extension>
+ <cdk:taglib>
+ <cdk:shortName>panels</cdk:shortName>
+ <
cdk:uri>http://richfaces.org/panels</cdk:uri>
+ </cdk:taglib>
+ </faces-config-extension>
+</faces-config>
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/bg_header.png
===================================================================
(Binary files differ)
Property changes on:
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/bg_header.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/close_act.gif
===================================================================
(Binary files differ)
Property changes on:
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/close_act.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/edit.gif
===================================================================
(Binary files differ)
Property changes on:
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/images/edit.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/panels.taglib.xml
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/panels.taglib.xml 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<facelet-taglib
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0" id="a4j">
+ <
namespace>http://richfaces.org/panels</namespace>
+ <tag>
+ <tag-name>panel</tag-name>
+ <component>
+ <component-type>org.richfaces.Panel</component-type>
+ <renderer-type>org.richfaces.PanelRenderer</renderer-type>
+ </component>
+ </tag>
+</facelet-taglib>
Added: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,1087 @@
+/*if (!window.DW) {
+ window.DW = {};
+}
+
+if (!window.Richfaces) {
+ window.Richfaces = {};
+}
+
+function discardElement(element) {
+ var garbageBin = document.getElementById('IELeakGarbageBin');
+ if (!garbageBin) {
+ garbageBin = document.createElement('DIV');
+ garbageBin.id = 'IELeakGarbageBin';
+ garbageBin.style.display = 'none';
+ document.body.appendChild(garbageBin);
+ }
+
+ window.RichFaces.Memory.clean(element);
+ // move the element to the garbage bin
+ garbageBin.appendChild(element);
+ garbageBin.innerHTML = '';
+}*/
+
+Selection = {};
+Selection.eventHandler=function(event){Event.stop(event);};
+Selection.eventHandler = Selection.eventHandler.bindAsEventListener(Selection);
+Selection.disableSelection = function (element)
+{
+ if (typeof element.onselectstart!="undefined") //IE
+ {
+ Event.observe(element, 'selectstart', this.eventHandler);
+ }
+ else if (typeof element.style.MozUserSelect!="undefined") //Firefox
+ {
+ element.style.MozUserSelect="none";
+ }
+ else //All other (ie: Opera)
+ {
+ Event.observe(element, 'mousedown', this.eventHandler);
+ }
+}
+
+Selection.enableSelection = function (element)
+{
+ if (typeof element.onselectstart!="undefined") //IE
+ {
+ Event.stopObserving(element, 'selectstart', this.eventHandler);
+ }
+ else if (typeof element.style.MozUserSelect!="undefined") //Firefox
+ {
+ element.style.MozUserSelect="";
+ }
+ else //All other (ie: Opera)
+ {
+ Event.stopObserving(element, 'mousedown', this.eventHandler);
+ }
+}
+
+ModalPanel = Class.create();
+
+ModalPanel.panels = new Array();
+ModalPanel.activePanels = new Array();
+
+function getSizeElement() {
+ /*var element;
+ if (RichFaces.navigatorType() != RichFaces.OPERA &&
document.compatMode=='CSS1Compat') {
+ element = document.documentElement;
+ } else {
+ element = document.body;
+ }*/
+
+ return document.body;
+}
+
+ModalPanel.getMinimumSize = function(size) {
+ return Math.max(size, 2*ModalPanel.Sizer.INITIAL_MIN + 2);
+};
+
+ModalPanel.prototype = {
+ initialize: function(id, options) {
+ this["rich:destructor"] = "destroy";
+
+ this.markerId = $(id);
+
+ this.id = $(id + "Container");
+
+ this.options = options;
+
+ this.baseZIndex = this.options.zindex ? this.options.zindex : 100;
+
+ this.minWidth = ModalPanel.getMinimumSize(this.options.minWidth);
+ this.minHeight = ModalPanel.getMinimumSize(this.options.minHeight);
+
+ this.div = id + "Div";
+ this.cursorDiv = id + "CursorDiv";
+ this.cdiv = id + "CDiv";
+ this.contentDiv = id + "ContentDiv";
+ this.contentTable = id + "ContentTable";
+ this.shadowDiv = id + "ShadowDiv";
+
+ this.borders = new Array();
+
+ if (this.options.resizeable) {
+ this.borders.push(new ModalPanel.Border(id + "ResizerN", this,
"N-resize", ModalPanel.Sizer.N));
+ this.borders.push(new ModalPanel.Border(id + "ResizerE", this,
"E-resize", ModalPanel.Sizer.E));
+ this.borders.push(new ModalPanel.Border(id + "ResizerS", this,
"S-resize", ModalPanel.Sizer.S));
+ this.borders.push(new ModalPanel.Border(id + "ResizerW", this,
"W-resize", ModalPanel.Sizer.W));
+
+ this.borders.push(new ModalPanel.Border(id + "ResizerNWU", this,
"NW-resize", ModalPanel.Sizer.NWU));
+ this.borders.push(new ModalPanel.Border(id + "ResizerNEU", this,
"NE-resize", ModalPanel.Sizer.NEU));
+ this.borders.push(new ModalPanel.Border(id + "ResizerNEL", this,
"NE-resize", ModalPanel.Sizer.NEL));
+ this.borders.push(new ModalPanel.Border(id + "ResizerSEU", this,
"SE-resize", ModalPanel.Sizer.SEU));
+ this.borders.push(new ModalPanel.Border(id + "ResizerSEL", this,
"SE-resize", ModalPanel.Sizer.SEL));
+ this.borders.push(new ModalPanel.Border(id + "ResizerSWL", this,
"SW-resize", ModalPanel.Sizer.SWL));
+ this.borders.push(new ModalPanel.Border(id + "ResizerSWU", this,
"SW-resize", ModalPanel.Sizer.SWU));
+ this.borders.push(new ModalPanel.Border(id + "ResizerNWL", this,
"NW-resize", ModalPanel.Sizer.NWL));
+ }
+
+ if (this.options.moveable && $(id + "Header")) {
+ this.header = new ModalPanel.Border(id + "Header", this, "move",
ModalPanel.Header);
+ }
+
+ this.markerId.component = this;
+
+ var eDiv = $(this.div);
+ if (eDiv.style.setExpression)
+ /*if (ModalPanel.disableSelects *//* IE 6 */ /*|| Richfaces.getComputedStyle(eDiv,
"position") != "fixed" /* IE again, not in strict mode*//*)*/
+
+ /*{
+ eDiv.style.position = "absolute";
+
+ var eCursorDiv = $(this.cursorDiv);
+ eCursorDiv.style.position = "absolute";
+
+ //that is to apply filter
+ eDiv.style.zoom = "1";
+ eCursorDiv.style.zoom = "1";
+
+ var eCdiv = $(this.cdiv);
+ eCdiv.style.position = "absolute";
+ eCdiv.parentNode.style.position = "absolute";
+
+ eCdiv.mpUseExpr = true;
+ }*/
+
+ ModalPanel.panels.push(this);
+
+ this.eventFirstOnfocus = this.firstOnfocus.bindAsEventListener(this);
+ this.eventLastOnfocus = this.lastOnfocus.bindAsEventListener(this);
+
+ this.firstHref = id + "FirstHref";
+ this.lastHref = id + "LastHref";
+
+ this.selectBehavior = options.selectBehavior;
+ },
+
+ _saveInputValues: function(element) {
+ /* Fix for RF-3856 - Checkboxes in modal panel does not hold their states after modal
was closed and opened again */
+ if (Prototype.Browser.IE /* reproducible for checkbox/radio in IE6, radio in IE 7/8
beta 2 */) {
+ var inputs = element.getElementsByTagName('input');
+ if (inputs) {
+ for (var i = 0; i < inputs.length; i++) {
+ var input = inputs[i];
+ if (input.type == 'checkbox' || input.type == 'radio') {
+ input.defaultChecked = input.checked;
+ }
+ }
+ }
+ }
+ },
+
+ width: function() {
+ return this.getSizedElement().clientWidth;
+ },
+
+ height: function() {
+ return this.getSizedElement().clientHeight;
+ },
+
+ getSizedElement: function() {
+ if (!this._sizedElement) {
+ this._sizedElement = $(this.cdiv);
+ }
+
+ return this._sizedElement;
+ },
+
+ getContentElement: function() {
+ if (!this._contentElement) {
+ this._contentElement = this.options.autosized ? $(this.contentTable) :
$(this.contentDiv);
+ }
+
+ return this._contentElement;
+ },
+
+ destroy: function() {
+
+ if (this.observerSize) {
+ window.clearInterval(this.observerSize);
+ this.observerSize = null;
+ }
+
+ this._contentElement = null;
+ this._sizedElement = null;
+
+ ModalPanel.panels = ModalPanel.panels.without(this);
+
+ this.enableSelects();
+
+ ModalPanel.activePanels = ModalPanel.activePanels.without(this);
+
+ this.parent = null;
+ this.firstOutside = null;
+ this.lastOutside = null;
+ if (this.header) {
+ this.header.destroy();
+ this.header=null;
+ }
+
+ for (var k = 0; k < this.borders.length; k++ ) {
+ this.borders[k].destroy();
+ }
+ this.borders = null;
+
+ setTimeout(function() {
+ if (this.domReattached) {
+ var element = this.id;
+ var parent = element.parentNode;
+ if (parent) {
+ parent.removeChild(element);
+ discardElement(element);
+ }
+ }
+ }.bind(this), 0);
+
+ this.markerId.component = null;
+ this.markerId = null;
+ },
+
+ initIframe : function() {
+ if (this.contentWindow) {
+ Element.setStyle(this.contentWindow.document.body, { "margin" : "0px
0px 0px 0px" });
+ } else {
+ //TODO opera etc.
+
+ }
+
+ if("transparent" == Element.getStyle(document.body,
"background-color")) {
+ this.style.filter = "alpha(opacity=0)";
+ this.style.opacity = "0";
+ }
+
+ //this.style.opacity = "0.5";
+ //this.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=50)';
+ //var iframeBodyStyle = this.contentWindow.document.body.style;
+ //iframeBodyStyle.backgroundColor = "#d0d0d0";
+ //iframeBodyStyle.filter = "alpha(opacity=50)";
+ //iframeBodyStyle.opacity = "0.5";
+ //iframeBodyStyle.zIndex = "99";
+ },
+
+ enableSelect: function(elt) {
+ if (elt._mdwProcessed) {
+ elt._mdwProcessed = undefined;
+
+ if (elt._mdwDisabled) {
+ elt.disabled = false;
+ elt._mdwDisabled = undefined;
+ }
+
+ if (typeof elt._mdwHidden != "undefined") {
+ elt.style.visibility = elt._mdwHidden;
+ elt._mdwHidden = undefined;
+ }
+ }
+ },
+
+ disableSelect: function(elt) {
+ if (!elt._mdwProcessed) {
+ elt._mdwProcessed = true;
+
+ if ("hide" == this.selectBehavior) {
+ if (elt.style.visibility != "hidden") {
+ elt._mdwHidden = elt.style.visibility;
+ elt.style.visibility = "hidden";
+ }
+ } else {
+ if (!elt.disabled) {
+ elt.disabled = true;
+ elt._mdwDisabled = true;
+ }
+ }
+ }
+ },
+
+ enableInnerSelects: function() {
+ if (ModalPanel.disableSelects) {
+ var selects = this.id.getElementsByTagName("SELECT");
+ for (var k = 0; k < selects.length; k++) {
+ this.enableSelect(selects[k]);
+ }
+ }
+ },
+
+ disableInnerSelects: function() {
+ if (ModalPanel.disableSelects) {
+ var selects = this.id.getElementsByTagName("SELECT");
+ for (var k = 0; k < selects.length; k++) {
+ this.disableSelect(selects[k]);
+ }
+ }
+ },
+
+ enableSelects: function() {
+ if (!ModalPanel.disableSelects) {
+ return ;
+ }
+
+ var lastPanel = ModalPanel.activePanels[ModalPanel.activePanels.length - 1];
+ var newLastPanel = ModalPanel.activePanels[ModalPanel.activePanels.length - 2];
+
+ if (newLastPanel) {
+ if (lastPanel == this) {
+ //we've just closed top panel, re-enable next panel if any
+ newLastPanel.enableInnerSelects();
+ }
+ } else {
+ var selects = document.body.getElementsByTagName("SELECT");
+ for (var i = 0; i < selects.length; i++) {
+ this.enableSelect(selects[i]);
+ }
+ }
+ },
+
+ disableOuterSelects: function() {
+ if (!ModalPanel.disableSelects) {
+ return ;
+ }
+
+ var lastPanel = ModalPanel.activePanels.last();
+
+ if (lastPanel) {
+ //we need to disable only the last opened panel
+ lastPanel.disableInnerSelects();
+ this.enableInnerSelects();
+ } else {
+ //disable all outer
+ var selects = document.body.getElementsByTagName("SELECT");
+
+ var innerSelects = this.id.getElementsByTagName("SELECT");
+ var firstInnerSelect = innerSelects[0];
+ var lastInnerSelect = innerSelects[innerSelects.length - 1];
+
+ var selectsAreInner = false;
+
+ for (var i = 0; i < selects.length; i++) {
+ var select = selects[i];
+ if (select == firstInnerSelect) {
+ selectsAreInner = true;
+ }
+
+ if (!selectsAreInner) {
+ this.disableSelect(select);
+ }
+
+ if (select == lastInnerSelect) {
+ selectsAreInner = false;
+ }
+ }
+ }
+ },
+
+ setLeft: function(pos) {
+ var eCdiv = $(this.cdiv);
+ if (eCdiv.mpUseExpr) {
+ eCdiv.mpLeft = pos;
+ } else {
+ eCdiv.style.left = pos + "px";
+ }
+ },
+
+ setTop: function(pos) {
+ var eCdiv = $(this.cdiv);
+ if (eCdiv.mpUseExpr) {
+ eCdiv.mpTop = pos;
+ } else {
+ eCdiv.style.top = pos + "px";
+ }
+ },
+
+ firstOnfocus: function(event) {
+ var e = $(this.firstHref)
+ if (e && (ModalPanel.activePanels.last() == this)) {
+ e.focus();
+ }
+ },
+
+ lastOnfocus: function(event) {
+ var e = $(this.lastHref);
+ if (e && (ModalPanel.activePanels.last() == this)) {
+ e.focus();
+ }
+ },
+
+ formElements: "|a|input|select|button|textarea|",
+
+ processAllFocusElements: function(root, callback) {
+ var idx = -1;
+ var tagName;
+
+ if (root.focus && root.nodeType == 1 && (tagName = root.tagName)
&&
+ // Many not visible elements have focus method, we is had to avoid processing them.
+ (idx = this.formElements.indexOf(tagName.toLowerCase())) != -1 &&
+ this.formElements.charAt(idx - 1) === '|' &&
+ this.formElements.charAt(idx + tagName.length) === '|' &&
+ !root.disabled && root.type!="hidden") {
+ callback.call(this, root);
+ } else {
+ if (root != this.id) {
+ var child = root.firstChild;
+ while (child) {
+ if (!child.style || child.style.display != 'none') {
+ this.processAllFocusElements(child, callback);
+ }
+ child = child.nextSibling;
+ }
+ }
+ }
+ },
+
+ processTabindexes: function(input) {
+ if (!this.firstOutside && !(input.tagName.toLowerCase()=="select"
&& ModalPanel.disableSelects)) {
+ this.firstOutside = input;
+ }
+ this.lastOutside = input;
+ if (input.tabIndex && !input.prevTabIndex) {
+ input.prevTabIndex = input.tabIndex;
+ }
+ input.tabIndex = undefined;
+ if (input.accesskey && !input.prevAccesskey) {
+ input.prevAccesskey = input.accesskey;
+ }
+ input.accesskey = undefined;
+ },
+
+ restoreTabindexes: function(input) {
+ if (input.prevTabIndex) {
+ input.tabIndex = input.prevTabIndex;
+ input.prevTabIndex = undefined;
+ }
+ if (input.prevAccesskey) {
+ input.accesskey = input.prevAccesskey;
+ input.prevAccesskey = undefined;
+ }
+ },
+
+ preventFocus: function() {
+ this.processAllFocusElements(document, this.processTabindexes);
+
+ if (this.firstOutside) {
+ Event.observe(this.firstOutside, "focus", this.eventFirstOnfocus);
+ }
+ if (this.lastOutside && this.lastOutside != this.firstOutside) {
+ Event.observe(this.lastOutside, "focus", this.eventLastOnfocus);
+ }
+ },
+
+ restoreFocus: function() {
+ this.processAllFocusElements(document, this.restoreTabindexes);
+
+ if (this.firstOutside) {
+ Event.stopObserving(this.firstOutside, "focus", this.eventFirstOnfocus);
+ this.firstOutside = null;
+ }
+ if (this.lastOutside) {
+ Event.stopObserving(this.lastOutside, "focus", this.eventLastOnfocus);
+ this.lastOutside = null;
+ }
+ },
+
+ show: function(event, opts) {
+ if(!this.shown && this.invokeEvent("beforeshow",event,null,element))
{
+
+ var element = this.id;
+
+ this.preventFocus();
+
+ if (!this.domReattached) {
+ this.parent = element.parentNode;
+
+ var domElementAttachment;
+ if (opts) {
+ domElementAttachment = opts.domElementAttachment;
+ }
+
+ if (!domElementAttachment) {
+ domElementAttachment = this.options.domElementAttachment;
+ }
+
+ var newParent;
+ if ('parent' == domElementAttachment) {
+ newParent = this.parent;
+ } else if ('form' == domElementAttachment) {
+ newParent = this._findForm(element) || document.body;
+ } else {
+ //default - body
+ newParent = document.body;
+ }
+
+ if (newParent != this.parent) {
+ this._saveInputValues(element);
+ newParent.insertBefore(element, null);
+ this.domReattached = true;
+ } else {
+ Element.show(this.parent);
+ }
+ }
+
+ var eCdiv = $(this.cdiv);
+ var forms = eCdiv.getElementsByTagName("form");
+
+ if (this.options.keepVisualState && forms) {
+ this.formOnsubmit = this.setStateInput.bindAsEventListener(this);
+ for (var i = 0; i < forms.length; i++) {
+ Event.observe(forms[i], "submit", this.formOnsubmit);
+ }
+ }
+
+ var eIframe;
+ if ((ModalPanel.disableSelects || this.options.overlapEmbedObjects) &&
!this.iframe) {
+ this.iframe = this.id.id + "IFrame";
+ new Insertion.Top(eCdiv,
+ "<iframe src=\"javascript:''\"
frameborder=\"0\" scrolling=\"no\" id=\"" + this.iframe +
"\" " +
+ "class=\"rich-mpnl-iframe\" style=\"width: 1px; height:
1px;\">" +
+ "</iframe>");
+
+ eIframe = $(this.iframe);
+
+ //alert("IFrame:" + eIframe + "created!");
+
+ //eIframe.onload = this.initIframe.bind(eIframe);
+ Event.observe(eIframe, 'load',
this.initIframe.bindAsEventListener(eIframe));
+ }
+
+ var options = {};
+ this.userOptions = {};
+
+ if (!eCdiv.mpSet) {
+ Object.extend(options, this.options);
+ }
+
+ if (opts) {
+ Object.extend(options, opts);
+ Object.extend(this.userOptions, opts);
+ }
+
+ this.currentMinHeight = ModalPanel.getMinimumSize((options.minHeight ||
options.minHeight == 0) ? options.minHeight : this.minHeight);
+ this.currentMinWidth = ModalPanel.getMinimumSize((options.minWidth || options.minWidth
== 0) ? options.minWidth : this.minWidth);
+
+ var eContentElt = this.getContentElement();
+
+ if (!this.options.autosized) {
+ if (options.width && options.width == -1)
+ options.width = 300;
+ if (options.height && options.height == -1)
+ options.height = 200;
+ }
+
+ if (options.width && options.width != -1) {
+ if (this.currentMinWidth > options.width) {
+ options.width = this.currentMinWidth;
+ }
+
+ eContentElt.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
+ }
+
+ if (options.height && options.height != -1) {
+ if (this.currentMinHeight > options.height) {
+ options.height = this.currentMinHeight;
+ }
+
+ eContentElt.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
+ }
+
+ eCdiv.mpSet = true;
+
+ //Element.setStyle(this.dialogWindow.document.body, { "margin" : "0px
0px 0px 0px" });
+ //if("transparent" == Element.getStyle(document.body,
"background-color")) {
+ // eIframe.allowTransparency = true;
+ //}
+
+ this.disableOuterSelects();
+ ModalPanel.activePanels = ModalPanel.activePanels.without(this);
+ ModalPanel.activePanels.push(this);
+
+ //this.shape.init(eCdiv, this.options);
+
+ var eDiv = $(this.div);
+ if (eDiv.style.position == "absolute")
+ {
+ var we = "getSizeElement().clientWidth + \"px\"";
+ var he = "getSizeElement().clientHeight + \"px\"";
+ eDiv.style.setExpression("width", we);
+ eDiv.style.setExpression("height", he);
+
+ var eCursorDiv = $(this.cursorDiv);
+ eCursorDiv.style.setExpression("width", we);
+ eCursorDiv.style.setExpression("height", he);
+
+ var le = "-Position.cumulativeOffset(this.parentNode)[0] +
getSizeElement().scrollLeft + \"px\"";
+ var te = "-Position.cumulativeOffset(this.parentNode)[1] +
getSizeElement().scrollTop + \"px\"";
+
+ eDiv.style.setExpression("left", le);
+ eDiv.style.setExpression("top", te);
+
+ eCursorDiv.style.setExpression("left", le);
+ eCursorDiv.style.setExpression("top", te);
+
+ var leftExpr = "(this.mpLeft || 0) +
-Position.cumulativeOffset(this.parentNode)[0] + getSizeElement().scrollLeft +
\"px\"";
+ var topExpr = "(this.mpTop || 0) +
-Position.cumulativeOffset(this.parentNode)[1] + getSizeElement().scrollTop +
\"px\"";
+
+ eCdiv.style.setExpression("left", leftExpr);
+ eCdiv.style.setExpression("top", topExpr);
+
+
+ /* That's how we output debug info - DOM inspector rulez */
+ /*
+ document.body.setExpression("_clientLeft",
"getSizeElement().clientLeft");
+ document.body.setExpression("_clientTop",
"getSizeElement().clientTop");
+ document.body.setExpression("_scrollLeft",
"getSizeElement().scrollLeft");
+ document.body.setExpression("_scrollTop",
"getSizeElement().scrollTop");
+ */
+ /* */
+ }
+
+ element.style.visibility = "hidden";
+ Element.show(element);
+ this.correctShadowSize();
+
+ if (options.left) {
+ var _left;
+ if (options.left != "auto") {
+ _left = parseInt(options.left, 10);
+ } else {
+ var cw = getSizeElement().clientWidth;
+ var _width = this.width(); //Richfaces.getComputedStyleSize(eContentElt,
"width");
+ if (cw >= _width) {
+ _left = (cw - _width) / 2;
+ } else {
+ _left = 0;
+ }
+ }
+
+ this.setLeft(Math.round(_left));
+ }
+
+ if (options.top) {
+ var _top;
+ if (options.top != "auto") {
+ _top = parseInt(options.top, 10);
+ } else {
+ var cw = getSizeElement().clientHeight;
+ var _height = this.height(); //Richfaces.getComputedStyleSize(eContentElt,
"height");
+ if (cw >= _height) {
+ _top = (cw - _height) / 2;
+ } else {
+ _top = 0;
+ }
+ }
+
+ this.setTop(Math.round(_top));
+ }
+
+ if (this.options.autosized) {
+ this.observerSize =
+ window.setInterval(this.correctShadowSize.bindAsEventListener(this), 500);
+ }
+
+ this.doResizeOrMove(ModalPanel.Sizer.Diff.EMPTY);
+
+ for (var k = 0; k < this.borders.length; k++ ) {
+ this.borders[k].doPosition();
+ }
+
+ if (this.header) {
+ this.header.doPosition();
+ }
+
+ Element.hide(eCdiv);
+ element.style.visibility = "";
+
+ this.lastOnfocus();
+
+ Element.show(eCdiv);
+
+ var event = {};
+ event.parameters = opts || {};
+ this.shown = true;
+ this.invokeEvent("show",event,null,element);
+ }
+ },
+
+ startDrag: function(border) {
+ for (var k = 0; k < this.borders.length; k++ ) {
+ this.borders[k].hide();
+ }
+ Selection.disableSelection(document.body);
+ },
+
+ endDrag: function(border) {
+ for (var k = 0; k < this.borders.length; k++ ) {
+ this.borders[k].show();
+ this.borders[k].doPosition();
+ }
+ Selection.enableSelection(document.body);
+ },
+
+ hide: function(event, opts) {
+ if (this.shown && this.invokeEvent("beforehide",event,null,element))
{
+
+ this.currentMinHeight = undefined;
+ this.currentMinWidth = undefined;
+
+ this.restoreFocus();
+
+ this.enableSelects();
+
+ ModalPanel.activePanels = ModalPanel.activePanels.without(this);
+
+ var eDiv = $(this.div);
+ var eCdiv = $(this.cdiv);
+
+ if (eDiv.style.position == "absolute") {
+ eDiv.style.removeExpression("width");
+ eDiv.style.removeExpression("height");
+
+ eDiv.style.removeExpression("left");
+ eDiv.style.removeExpression("top");
+
+ var eCursorDiv = $(this.cursorDiv);
+ eCursorDiv.style.removeExpression("width");
+ eCursorDiv.style.removeExpression("height");
+
+ eCursorDiv.style.removeExpression("left");
+ eCursorDiv.style.removeExpression("top");
+
+ eCdiv.style.removeExpression("left");
+ eCdiv.style.removeExpression("top");
+ }
+
+ var element = $(this.id);
+ Element.hide(element);
+
+ if (this.parent) {
+ if (this.domReattached) {
+ this._saveInputValues(element);
+
+ this.parent.appendChild(element);
+
+ this.domReattached = false;
+ } else {
+ Element.hide(this.parent);
+ }
+ }
+
+ var event = {};
+ event.parameters = opts || {};
+ if (this.options && this.options.onhide) {
+ this.options.onhide(event);
+ }
+
+ var forms = eCdiv.getElementsByTagName("form");
+ if (this.options.keepVisualState && forms) {
+ for (var i = 0; i < forms.length; i++) {
+ Event.stopObserving(forms[i], "submit", this.formOnsubmit);
+ }
+ }
+
+ this.shown = false;
+
+ if (this.observerSize) {
+ window.clearInterval(this.observerSize);
+ this.observerSize = null;
+ }
+
+ if (ModalPanel.activePanels.length > 0) {
+ ModalPanel.activePanels.last().preventFocus();
+ }
+ }
+ },
+
+ _getStyle: function(elt, name) {
+ return parseInt(elt.style[name].replace("px", ""), 10);
+ },
+
+ doResizeOrMove: function(diff) {
+ var vetoes = {};
+ var cssHash = {};
+ var cssHashWH = {};
+
+ var vetoeChange = false;
+ var newSize;
+
+ var eContentElt = this.getContentElement();
+
+ newSize = this._getStyle(eContentElt,
"width");//Richfaces.getComputedStyleSize(eContentDiv, "width");
+
+ var oldSize = newSize;
+ newSize += diff.deltaWidth || 0;
+
+ if (newSize >= this.currentMinWidth || this.options.autosized) {
+ if (diff.deltaWidth) {
+ cssHashWH.width = newSize + 'px';
+ }
+ } else {
+ if (diff.deltaWidth) {
+ cssHashWH.width = this.currentMinWidth + 'px';
+
+ vetoes.vx = oldSize - this.currentMinWidth;
+ }
+
+ vetoes.x = true;
+ }
+
+ if (vetoes.vx && diff.deltaX) {
+ diff.deltaX = -vetoes.vx;
+ }
+
+ var eCdiv = $(this.cdiv);
+
+ if (diff.deltaX && (vetoes.vx || !vetoes.x)) {
+ if (vetoes.vx) {
+ diff.deltaX = vetoes.vx;
+ }
+ var newPos;
+
+ newPos = this._getStyle(eCdiv,
"left");//Richfaces.getComputedStyleSize(eCdiv, "left");
+ newPos += diff.deltaX;
+ cssHash.left = newPos + 'px';
+ }
+
+ newSize = this._getStyle(eContentElt,
"height")//;Richfaces.getComputedStyleSize(eContentDiv, "height");
+
+ var oldSize = newSize;
+ newSize += diff.deltaHeight || 0;
+
+ if (newSize >= this.currentMinHeight || this.options.autosized) {
+ if (diff.deltaHeight) {
+ cssHashWH.height = newSize + 'px';
+ }
+ } else {
+ if (diff.deltaHeight) {
+ cssHashWH.height = this.currentMinHeight + 'px';
+
+ vetoes.vy = oldSize - this.currentMinHeight;
+ }
+
+ vetoes.y = true;
+ }
+
+ if (vetoes.vy && diff.deltaY) {
+ diff.deltaY = -vetoes.vy;
+ }
+
+ if (diff.deltaY && (vetoes.vy || !vetoes.y)) {
+ if (vetoes.vy) {
+ diff.deltaY = vetoes.vy;
+ }
+
+ var newPos;
+ if (eCdiv.mpUseExpr) {
+ newPos = eCdiv.mpTop || 0;
+ newPos += diff.deltaY;
+
+ eCdiv.mpTop = newPos;
+ cssHash.top = newPos + 'px';
+ } else {
+ newPos = this._getStyle(eCdiv,
"top");//Richfaces.getComputedStyleSize(eCdiv, "top");
+ newPos += diff.deltaY;
+ cssHash.top = newPos + 'px';
+ }
+ }
+
+ Element.setStyle(eContentElt, cssHashWH);
+
+ Element.setStyle(eCdiv, cssHash);
+
+ this.correctShadowSize();
+
+ Object.extend(this.userOptions, cssHash);
+ Object.extend(this.userOptions, cssHashWH);
+
+ var w = this.width();
+ var h = this.height();
+
+ this.reductionData = null;
+
+ if (w <= 2*ModalPanel.Sizer.INITIAL_MAX) {
+ this.reductionData = {};
+ this.reductionData.w = w;
+ }
+
+ if (h <= 2*ModalPanel.Sizer.INITIAL_MAX) {
+ if (!this.reductionData) {
+ this.reductionData = {};
+ }
+
+ this.reductionData.h = h;
+ }
+
+ if (this.header) {
+ this.header.doPosition();
+ }
+
+ return vetoes;
+ },
+
+ _findForm: function(elt) {
+ var target = elt;
+ while (target) {
+ if (!target.tagName /* document node doesn't have tagName */
+ || target.tagName.toLowerCase() != "form") {
+
+ target = target.parentNode;
+ } else {
+ break;
+ }
+ }
+
+ return target;
+ },
+
+ setStateInput: function(e) {
+ var target = Event.element(e);
+ if (e && target) {
+ // Concret input but not entire form is a target element for onsubmit in FF
+ target = this._findForm(target);
+
+ var input = document.createElement("input");
+ input.type = "hidden";
+ input.id = this.markerId.id + "OpenedState";
+ input.name = this.markerId.id + "OpenedState";
+ input.value = this.shown ? "true" : "false";
+ target.appendChild(input);
+
+ var keys = $H(this.userOptions).keys();
+ if (keys) {
+ for (var i = 0; i < keys.length; i++) {
+ input = document.createElement("input");
+ input.type = "hidden";
+ input.id = this.id.id + "StateOption_" + keys[i];
+ input.name = this.id.id + "StateOption_" + keys[i];
+ input.value = this.userOptions[keys[i]];
+ target.appendChild(input);
+
+ }
+ }
+
+ return true;
+ }
+ },
+
+ correctShadowSize: function() {
+ var eShadowDiv = $(this.shadowDiv);
+ if (!eShadowDiv) {
+ return;
+ }
+ var eIframe = $(this.iframe);
+
+ var dx = 0;
+ var dy = 0;
+ if (!Richfaces.browser.isIE)
+ {
+ dx = eShadowDiv.offsetWidth-eShadowDiv.clientWidth;
+ dy = eShadowDiv.offsetHeight-eShadowDiv.clientHeight;
+ }
+ var w = this.width();
+ var h = this.height();
+ eShadowDiv.style.width = (w-dx)+"px";
+ eShadowDiv.style.height = (h-dy)+"px";
+
+ if (eIframe) {
+ eIframe.style.width = w+"px";
+ eIframe.style.height = h+"px";
+ }
+ },
+
+ invokeEvent: function(eventName, event, value, element) {
+
+ var eventFunction = this.options['on'+eventName];
+ var result;
+
+ if (eventFunction) {
+ var eventObj;
+ if (event) {
+ eventObj = event;
+ }
+ else if(document.createEventObject) {
+ eventObj = document.createEventObject();
+ }
+ else if( document.createEvent ) {
+ eventObj = document.createEvent('Events');
+ eventObj.initEvent( eventName, true, false );
+ }
+
+ eventObj.rich = {component:this};
+ eventObj.rich.value = value;
+
+ try {
+ result = eventFunction.call(element, eventObj);
+ }
+ catch (e) { LOG.warn("Exception: "+e.Message + "\n[on"+eventName +
"]"); }
+ }
+
+ if (result!=false) {
+ result = true;
+ }
+ return result;
+ }
+}
+
+Richfaces.findModalPanel = function (id) {
+ if (id) {
+ var prefId = (id.charAt(0) == ':' ? id : ':' + id);
+
+ for (var i = 0; i < ModalPanel.panels.length; i++ ) {
+ var pnl = ModalPanel.panels[i];
+ if (pnl && pnl.markerId) {
+ var pnlId = pnl.markerId.id;
+
+ if (pnlId) {
+ //try to match ids
+ if (pnlId.length >= prefId.length) {
+ var substr = pnlId.substring(pnlId.length - prefId.length, pnlId.length);
+ if (substr == prefId) {
+ return pnl.markerId;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Richfaces.showModalPanel = function (id, opts, event) {
+
+ var invoke =
+ (Richfaces.browser.isIE || Richfaces.browser.isSafari) ?
+ function(f) {
+ if (document.readyState != "complete") {
+ var args = arguments;
+ var dis = this;
+ window.setTimeout(
+ function() {
+ args.callee.apply(dis,args );
+ }, 50);
+ } else {
+ f();
+ }
+ } :
+ function(f) {
+ f();
+ };
+
+ var panel = $(id);
+ if (!panel) {
+ panel = Richfaces.findModalPanel(id);
+ }
+ invoke(function() {
+ panel.component.show(event, opts);
+ });
+};
+
+Richfaces.hideModalPanel = function (id, opts, event) {
+ var panel = $(id);
+ if (!panel) {
+ panel = Richfaces.findModalPanel(id);
+ }
+ panel.component.hide(event, opts);
+};
+
+/*Richfaces.hideTopModalPanel = function(event, opts) {
+ var mp = ModalPanel.activePanels.last();
+ if (mp) {
+ mp.hide(event, opts);
+ }
+}*/
Added:
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js
===================================================================
---
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,356 @@
+ModalPanel.Border = Class.create();
+
+ModalPanel.Border.prototype = {
+ initialize: function(id, modalPanel, cursor, sizer) {
+ this.id = id;
+ var element = $(id);
+ element.style.cursor = cursor;
+
+ this.boundStartDrag = this.startDrag.bindAsEventListener(this, new Date());
+ Event.observe(this.id, 'mousedown', this.boundStartDrag);
+
+ this.modalPanel = modalPanel;
+ this.sizer = sizer;
+
+ this.boundDoDrag = this.doDrag.bindAsEventListener(this);
+ this.boundEndDrag = this.endDrag.bindAsEventListener(this);
+ },
+
+ destroy: function()
+ {
+ if (this.doingDrag)
+ {
+ Event.stopObserving(document, 'mousemove', this.boundDoDrag);
+ Event.stopObserving(document, 'mouseup', this.boundEndDrag);
+ }
+
+ Event.stopObserving(this.id, 'mousedown', this.boundStartDrag);
+ this.modalPanel=null;
+ },
+
+ show: function() {
+ Element.show(this.id);
+ },
+
+ hide: function() {
+ Element.hide(this.id);
+ },
+
+ startDrag: function(event) {
+ this.doingDrag = true;
+
+ this.dragX = event.clientX;
+ this.dragY = event.clientY;
+
+ Event.observe(document, 'mousemove', this.boundDoDrag);
+ Event.observe(document, 'mouseup', this.boundEndDrag);
+
+ var eCursorDiv = $(this.modalPanel.cursorDiv);
+ eCursorDiv.style.cursor = $(this.id).style.cursor;
+ eCursorDiv.style.zIndex = 10;
+
+ this.modalPanel.startDrag(this);
+
+ this.onselectStartHandler = document.onselectstart;
+ document.onselectstart = function() { return false; }
+ },
+
+ doDrag: function(event) {
+ if (!this.doingDrag) {
+ return ;
+ }
+
+ var evtX = event.clientX;
+ var evtY = event.clientY;
+
+ var winSize = Richfaces.getWindowSize();
+
+ //window.status = "" + evtX + " " + evtY;
+
+ if (evtX < 0) {
+ evtX = 0;
+ } else if (evtX >= winSize.width) {
+ evtX = winSize.width - 1;
+ }
+
+ if (evtY < 0) {
+ evtY = 0;
+ } else if (evtY >= winSize.height) {
+ evtY = winSize.height - 1;
+ }
+
+ var dx = evtX - this.dragX;
+ var dy = evtY - this.dragY;
+
+ if (dx != 0 || dy != 0) {
+
+ var id = this.id;
+
+ var diff = this.sizer.doDiff(dx, dy);
+ var doResize;
+
+ var element = $(this.modalPanel.cdiv);
+
+ if (diff.deltaWidth || diff.deltaHeight) {
+ doResize = this.modalPanel.invokeEvent("resize",event,null,element);
+ } else if (diff.deltaX || diff.deltaY) {
+ doResize = this.modalPanel.invokeEvent("move",event,null,element);
+ }
+
+ var vetoes;
+
+ if (doResize) {
+ vetoes = this.modalPanel.doResizeOrMove(diff);
+ }
+
+ if(vetoes){
+ if (!vetoes.x) {
+ this.dragX = evtX;
+ } else {
+ if (!diff.deltaX) {
+ this.dragX -= vetoes.vx || 0;
+ } else {
+ this.dragX += vetoes.vx || 0;
+ }
+ }
+
+ if (!vetoes.y) {
+ this.dragY = evtY;
+ } else {
+ if (!diff.deltaY) {
+ this.dragY -= vetoes.vy || 0;
+ } else {
+ this.dragY += vetoes.vy || 0;
+ }
+ }
+ }
+ }
+ },
+
+ endDrag: function(event) {
+ this.doingDrag = undefined;
+
+ Event.stopObserving(document, 'mousemove', this.boundDoDrag);
+ Event.stopObserving(document, 'mouseup', this.boundEndDrag);
+
+ this.modalPanel.endDrag(this);
+
+ this.modalPanel.doResizeOrMove(ModalPanel.Sizer.Diff.EMPTY);
+ $(this.modalPanel.cursorDiv).style.zIndex = -200;
+
+ document.onselectstart = this.onselectStartHandler;
+ this.onselectStartHandler = null;
+
+ var id = this.id;
+ },
+
+ doPosition: function() {
+ this.sizer.doPosition(this.modalPanel, $(this.id));
+ }
+};
+
+ModalPanel.Sizer = Class.create();
+
+ModalPanel.Sizer.INITIAL_MIN = 4;
+ModalPanel.Sizer.INITIAL_MAX = 40;
+
+ModalPanel.Sizer.Diff = Class.create();
+ModalPanel.Sizer.Diff.prototype = {
+ initialize: function(dX, dY, dWidth, dHeight) {
+ this.deltaX = dX;
+ this.deltaY = dY;
+
+ this.deltaWidth = dWidth;
+ this.deltaHeight = dHeight;
+ }
+}
+
+ModalPanel.Sizer.Diff.EMPTY = new ModalPanel.Sizer.Diff(0, 0, 0, 0);
+
+ModalPanel.Sizer.prototype = {
+ initialize: function() {
+
+ },
+
+ doSetupSize: function (modalPanel, elt) {
+ var width = 0;
+ var height = 0;
+
+ var reductionData = modalPanel.reductionData;
+
+ if (reductionData) {
+ if (reductionData.w) {
+ width = reductionData.w / 2;
+ }
+
+ if (reductionData.h) {
+ height = reductionData.h / 2;
+ }
+ }
+
+ if (width > 0) {
+ if (elt.clientWidth > width) {
+ if (!elt.reducedWidth) {
+ elt.reducedWidth = elt.style.width;
+ }
+ elt.style.width = width + 'px';
+ } else if (width < ModalPanel.Sizer.INITIAL_MAX && /* TODO fix the dirty
code */elt.reducedWidth == ModalPanel.Sizer.INITIAL_MAX + 'px') {
+ elt.style.width = width + 'px';
+ }
+ } else {
+ if (elt.reducedWidth) {
+ elt.style.width = elt.reducedWidth;
+ elt.reducedWidth = undefined;
+ }
+ }
+
+ if (height > 0) {
+ if (elt.clientHeight > height) {
+ if (!elt.reducedHeight) {
+ elt.reducedHeight = elt.style.height;
+ }
+ elt.style.height = height + 'px';
+ } else if (height < ModalPanel.Sizer.INITIAL_MAX && /* TODO fix the dirty
code */elt.reducedHeight == ModalPanel.Sizer.INITIAL_MAX + 'px') {
+ elt.style.height = height + 'px';
+ }
+ } else {
+ if (elt.reducedHeight) {
+ elt.style.height = elt.reducedHeight;
+ elt.reducedHeight = undefined;
+ }
+ }
+ },
+
+ doSetupPosition: function (modalPanel, elt, left, top) {
+ elt.style.left = left + 'px';
+ elt.style.top = top + 'px';
+ },
+
+ doPosition: function (modalPanel, elt) {
+
+ },
+
+ doDiff: function (dx, dy) {
+
+ }
+}
+
+ModalPanel.Sizer.NWU = Object.extend(new ModalPanel.Sizer(), {
+ doPosition: function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, 0, 0);
+ },
+
+ doDiff: function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(dx, dy, -dx, -dy);
+ }
+});
+
+ModalPanel.Sizer.N = new ModalPanel.Sizer();
+ModalPanel.Sizer.N.doPosition = function (modalPanel, elt) {
+ elt.style.width = modalPanel.width() + 'px';
+ this.doSetupPosition(modalPanel, elt, 0, 0);
+};
+ModalPanel.Sizer.N.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, dy, 0, -dy);
+};
+
+ModalPanel.Sizer.NEU = new ModalPanel.Sizer();
+ModalPanel.Sizer.NEU.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, modalPanel.width() - elt.clientWidth, 0);
+};
+ModalPanel.Sizer.NEU.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, dy, dx, -dy);
+};
+
+ModalPanel.Sizer.NEL = new ModalPanel.Sizer();
+ModalPanel.Sizer.NEL.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, modalPanel.width() - elt.clientWidth, 0);
+};
+ModalPanel.Sizer.NEL.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, dy, dx, -dy);
+};
+
+ModalPanel.Sizer.E = new ModalPanel.Sizer();
+ModalPanel.Sizer.E.doPosition = function (modalPanel, elt) {
+ elt.style.height = modalPanel.height() + 'px';
+ this.doSetupPosition(modalPanel, elt, modalPanel.width() - elt.clientWidth, 0);
+};
+ModalPanel.Sizer.E.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, 0, dx, 0);
+};
+
+ModalPanel.Sizer.SEU = new ModalPanel.Sizer();
+ModalPanel.Sizer.SEU.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, modalPanel.width() - elt.clientWidth,
+ modalPanel.height() - elt.clientHeight);
+};
+ModalPanel.Sizer.SEU.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, 0, dx, dy);
+};
+
+ModalPanel.Sizer.SEL = new ModalPanel.Sizer();
+ModalPanel.Sizer.SEL.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, modalPanel.width() - elt.clientWidth,
+ modalPanel.height() - elt.clientHeight);
+};
+ModalPanel.Sizer.SEL.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, 0, dx, dy);
+};
+
+ModalPanel.Sizer.S = new ModalPanel.Sizer();
+ModalPanel.Sizer.S.doPosition = function (modalPanel, elt) {
+ elt.style.width = modalPanel.width() + 'px';
+ this.doSetupPosition(modalPanel, elt, 0, modalPanel.height() - elt.clientHeight);
+};
+ModalPanel.Sizer.S.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(0, 0, 0, dy);
+};
+
+ModalPanel.Sizer.SWL = new ModalPanel.Sizer();
+ModalPanel.Sizer.SWL.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, 0, modalPanel.height() - elt.clientHeight);
+};
+ModalPanel.Sizer.SWL.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(dx, 0, -dx, dy);
+};
+
+ModalPanel.Sizer.SWU = new ModalPanel.Sizer();
+ModalPanel.Sizer.SWU.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, 0, modalPanel.height() - elt.clientHeight);
+};
+ModalPanel.Sizer.SWU.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(dx, 0, -dx, dy);
+};
+
+ModalPanel.Sizer.W = new ModalPanel.Sizer();
+ModalPanel.Sizer.W.doPosition = function (modalPanel, elt) {
+ elt.style.height = modalPanel.height() + 'px';
+ this.doSetupPosition(modalPanel, elt, 0, 0);
+};
+ModalPanel.Sizer.W.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(dx, 0, -dx, 0);
+};
+
+ModalPanel.Sizer.NWL = new ModalPanel.Sizer();
+ModalPanel.Sizer.NWL.doPosition = function (modalPanel, elt) {
+ this.doSetupSize(modalPanel, elt);
+ this.doSetupPosition(modalPanel, elt, 0, 0);
+};
+ModalPanel.Sizer.NWL.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(dx, dy, -dx, -dy);
+};
+
+ModalPanel.Header = new ModalPanel.Sizer();
+ModalPanel.Header.doPosition = function (modalPanel, elt) {
+
+};
+ModalPanel.Header.doDiff = function(dx, dy) {
+ return new ModalPanel.Sizer.Diff(dx, dy, 0, 0);
+};
Added: root/ui-sandbox/panels2/trunk/ui/src/main/templates/panel.template.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/templates/panel.template.xml
(rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/templates/panel.template.xml 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
+
xmlns:cdk="http://richfaces.org/cdk/core"
+
xmlns:c="http://richfaces.org/cdk/jstl/core"
+
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.PanelRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.PanelBaseRenderer</cdk:superclass>
+ <cdk:component-family>org.richfaces.Panel</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.PanelRenderer</cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <div cdk:passThruWithExclusions="id,value,styleClass,class"
id="#{clientId}" class="rf-panel
#{component.attributes['styleClass']}">
+ <c:choose>
+ <c:when test="#{component.getFacet('header') != null and
component.getFacet('header').rendered}">
+ <div id="#{clientId}_header" class="rf-panel-header
#{component.attributes['headerClass']}">
+ <!-- <cc:renderFacet name="header" />-->
+ <cdk:call expression="renderHeaderFacet(facesContext, component)"
/>
+ </div>
+ </c:when>
+ <c:when test="#{component.attributes['header']!= null and not
component.attributes['header'].equals('')}">
+ <div id="#{clientId}_header" class="rf-panel-header
#{component.attributes['headerClass']}">
+ #{component.attributes['header']}
+ </div>
+ </c:when>
+ <c:otherwise>
+ </c:otherwise>
+ </c:choose>
+ <div id="#{clientId}_body" class="rf-panel-body
#{component.attributes['bodyClass']}">
+ <cdk:call expression="renderChildren(facesContext, component)" />
+ </div>
+ </div>
+
+ </cc:implementation>
+</cdk:root>
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml
(rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
+
xmlns:cdk="http://richfaces.org/cdk/core"
+
xmlns:c="http://richfaces.org/cdk/jstl/core"
+
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.PopupPanelRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.PopupPanelBaseRenderer</cdk:superclass>
+ <cdk:component-family>org.richfaces.PopupPanel</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.PopupPanelRenderer</cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:call expression="checkOptions(facesContext, component)" />
+ <input autocomplete="off" type="hidden"
id="#{clientId}OpenedState" name="#{clientId}OpenedState" />
+ <c:if test="#{component.attributes['modal']}">
+ <div onclick="#{component.attributes['onmaskclick']}"
+ ondblclick="#{component.attributes['onmaskdblclick']}"
+ oncontextmenu="#{component.attributes['onmaskcontextmenu']}"
+ onmouseup="#{component.attributes['onmaskmouseup']}"
+ onmousedown="#{component.attributes['onmaskmousedown']}"
+ onmousemove="#{component.attributes['onmaskmousemove']}"
+ onmouseover="#{component.attributes['onmaskmouseover']}"
+ onmouseout="#{component.attributes['onmaskmouseout']}"
class="mp_shade"/>
+
+</c:if>
+<cdk:object type="java.lang.String" name="shadowStyle"
value="#{getShadowStyle(facesContext,component)}" />
+ <button class="rich-mpnl-button"
id="#{clientId}FirstHref"></button>
+ <img style="#{shadowStyle}" width="0" height="0"
class="mp_shadow"/>
+ <div id="#{clientId}_container"
cdk:passThruWithExclusions="id,style,class,styleClass" class="mp_container
#{component.attributes['styleClass']}">
+ <div id="#{clientId}_header" class="mp_header
#{component.attributes['headerClass']}" >
+ <c:if test="#{component.getFacet('header')!=null and
component.getFacet('header').rendered}">
+ <div id="#{clientId}_header_content"
class="mp_header_content">
+ <cdk:call expression="renderHeaderFacet(facesContext, component)"/>
+ </div>
+ </c:if>
+ <c:else>
+ <div id="#{clientId}_header_content"
class="mp_header_content">
+ <div id="#{clientId}_header_icon"
class="mp_header_icon"></div>Modal panel header name
+ </div>
+ </c:else>
+ <c:if test="#{component.getFacet('controls')!=null and
component.getFacet('controls').rendered}">
+ <div id="#{clientId}_header_controls" class="mp_header_controls
#{component.attributes['controlsClass']}">
+ <cdk:call expression="renderControlsFacet(facesContext,
component)"/>
+ </div>
+ </c:if>
+ </div>
+ <div id="#{clientId}_content_scroller" class="mp_content_scroller
#{component.attributes['scrollerClass']}">
+ <div id="#{clientId}_content" class="mp_content"
style="#{component.attributes['style']}">
+ <cdk:call expression="renderChildren(facesContext, component)"/>
+ </div>
+ </div>
+ <c:if test="#{component.attributes['resizeable']}">
+ <div id="#{clientId}_handler_left" class="mp_handler
mp_handler_left"></div>
+ <div id="#{clientId}_handler_right" class="mp_handler
mp_handler_right"></div>
+ <div id="#{clientId}_handler_top" class="mp_handler
mp_handler_top"></div>
+
+ <div id="#{clientId}_handler_bottom" class="mp_handler
mp_handler_bottom"></div>
+ <div id="#{clientId}_handler_top_left" class="mp_handler
mp_handler_top_left"></div>
+ <div id="#{clientId}_handler_top_right" class="mp_handler
mp_handler_top_right"></div>
+ <div id="#{clientId}_handler_bottom_left" class="mp_handler
mp_handler_bottom_left"></div>
+ <div id="#{clientId}_handler_bottom_right" class="mp_handler
mp_handler_bottom_right"></div>
+ </c:if>
+ <button class="rich-mpnl-button"
id="#{clientId}LastHref"></button>
+ </div>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(facesContext, component)"/>
+ </script>
+ <script type="text/javascript">
+ <cdk:call expression="buildShowScript(facesContext, component);"/>
+ </script>
+
+
+
+
+
+
+ </cc:implementation>
+</cdk:root>
\ No newline at end of file
Added:
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java
===================================================================
---
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java
(rev 0)
+++
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PanelRendererTest.java 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+
+import org.jboss.test.faces.FacesEnvironment.FacesRequest;
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.component.UIPanel;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * @author Andrey Markhel
+ *
+ */
+public class PanelRendererTest {
+
+ private HtmlUnitEnvironment environment;
+
+ @Before
+ public void setUp() {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File("src/test/resources"));
+ environment.start();
+ }
+
+ @After
+ public void tearDown() {
+ environment.release();
+ environment = null;
+ }
+
+ private FacesRequest startFacesRequest() throws IOException {
+ FacesRequest facesRequest =
environment.createFacesRequest("http://localhost/panelTest.jsf");
+ facesRequest.withViewId("/panelTest.jsf");
+ facesRequest.start();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ViewHandler vh = facesContext.getApplication().getViewHandler();
+ ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext,
facesContext.getViewRoot()
+ .getViewId());
+ vdl.buildView(facesContext, facesContext.getViewRoot());
+ return facesRequest;
+ }
+ /**
+ * Test method for {@link
org.richfaces.renderkit.ExtendedDataTableRenderer#getComponentClass()}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testGetComponentClass() throws IOException {
+ FacesRequest facesRequest = startFacesRequest();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIPanel component = (UIPanel)
facesContext.getViewRoot().findComponent("panelWithFacet");
+ PanelRenderer renderer = (PanelRenderer) FacesContext.getCurrentInstance()
+ .getRenderKit().getRenderer(component.getFamily(),
component.getRendererType());
+ assertEquals(UIPanel.class, renderer.getComponentClass());
+ facesRequest.release();
+ }
+
+ /**
+ * Test method for
+ * {@link
org.richfaces.renderkit.ExtendedDataTableRenderer#doEncodeBegin(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)}.
+ *
+ * @throws IOException
+ */
+ /*@Test
+ public final void testDoEncode() throws IOException {
+ HtmlPage page = environment.getPage("/panelTest.jsf");
+ HtmlElement panelWithFacet = page.getElementById("panelWithFacet");
+ assertEquals("rf-panel panel",
panelWithFacet.getAttribute("class"));
+ assertEquals("Write your own custom rich components with built-in AJAX
support",
panelWithFacet.getElementById("panelWithFacet_header").getTextContent().trim());
+ assertEquals("The CDK includes",
panelWithFacet.getElementById("panelWithFacet_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement simplePanel = page.getElementById("simplePanel");
+ assertEquals("rf-panel ",
simplePanel.getAttribute("class"));
+ try{
+ simplePanel.getElementById("simplePanel_header");
+ }catch(Exception e){
+ assertTrue(true);
+ }
+ assertEquals("RichFaces is a l", simplePanel
+ .getElementById("simplePanel_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement simplePanelBody = page.getElementById("simplePanel_body");
+ assertEquals("rf-panel-body rich-laguna-panel-no-header",
simplePanelBody.getAttribute("class"));
+ HtmlElement simplePanel2 =
page.getElementById("simplePanelWithTextHeader");
+ assertEquals("rf-panel ",
simplePanel2.getAttribute("class"));
+
assertNotNull(simplePanel2.getElementById("simplePanelWithTextHeader_header"));
+ assertEquals("rich-laguna-panel-no-header",
simplePanel2.getElementById("simplePanelWithTextHeader_header").getTextContent().trim());
+ assertEquals("RichFaces is a l", simplePanel2
+ .getElementById("simplePanelWithTextHeader_body")
+ .getTextContent().trim().substring(0, 16));
+
+ HtmlElement nestedPanelContainer =
page.getElementById("nestedPanelContainer");
+ assertEquals("rf-panel ",
nestedPanelContainer.getAttribute("class"));
+
assertNotNull(nestedPanelContainer.getElementById("nestedPanelContainer_header"));
+ assertEquals("||||",
nestedPanelContainer.getElementById("nestedPanelContainer_header").getTextContent().trim());
+ HtmlElement nestedPanelContainerHeader =
page.getElementById("nestedPanelContainer_header");
+ assertEquals("rf-panel-header outpanelHeader",
nestedPanelContainerHeader.getAttribute("class"));
+ assertEquals("Benefits of Usin", nestedPanelContainer
+ .getElementById("nestedPanelContainer_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement nestedPanel1 =
nestedPanelContainer.getElementById("nestedPanel1");
+ assertEquals("rf-panel ",
nestedPanel1.getAttribute("class"));
+ HtmlElement nestedPanel1Body =
page.getElementById("nestedPanel1_body");
+ assertEquals("rf-panel-body inpanelBody",
nestedPanel1Body.getAttribute("class"));
+ assertNotNull(nestedPanel1.getElementById("nestedPanel1_header"));
+ assertEquals("For Application Developers",
nestedPanel1.getElementById("nestedPanel1_header").getTextContent().trim());
+ assertEquals("Production quali", nestedPanel1
+ .getElementById("nestedPanel1_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement nestedPanel2 =
nestedPanelContainer.getElementById("nestedPanel2");
+ assertEquals("rf-panel ",
nestedPanel2.getAttribute("class"));
+ HtmlElement nestedPanel2Body =
page.getElementById("nestedPanel2_body");
+ assertEquals("rf-panel-body inpanelBody",
nestedPanel2Body.getAttribute("class"));
+ assertNotNull(nestedPanel2.getElementById("nestedPanel2_header"));
+ assertEquals("For Component Developers",
nestedPanel2.getElementById("nestedPanel2_header").getTextContent().trim());
+ assertEquals("Ajax4jsf is Open", nestedPanel2
+ .getElementById("nestedPanel2_body")
+ .getTextContent().trim().substring(0, 16));
+ }*/
+
+}
Added: root/ui-sandbox/panels2/trunk/ui/src/test/resources/panelTest.xhtml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/test/resources/panelTest.xhtml
(rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/test/resources/panelTest.xhtml 2010-07-08
09:45:35 UTC (rev 17769)
@@ -0,0 +1,98 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:panel="http://richfaces.org/panels"
+
xmlns:rich="http://richfaces.org/rich">
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+-->
+ <h:head>
+ <title>Richfaces ExtendedDataTable Test</title>
+ </h:head>
+
+ <h:body>
+ <panel:panel styleClass="panel" id="panelWithFacet">
+ <f:facet name="header">
+ Write your own custom rich components with built-in AJAX support
+ </f:facet>
+ The CDK includes a code-generation facility and a
+ templating facility using a JSP-like syntax. These capabilities help
+ to avoid a routine process of a component creation. The component factory
+ works like a well-oiled machine allowing the creation of first-class
+ rich components with built-in Ajax functionality even more easily than
+ the creation of simpler components by means of the traditional coding
+ approach.
+ </panel:panel>
+ <panel:panel id="simplePanel"
bodyClass="rich-laguna-panel-no-header">
+ RichFaces is a library for adding rich user interface features to JSF
+ applications. It extends the Ajax4jsf framework to include a large
+ (and growing) set of powerful rich AJAX-enabled components that come
+ with extensive skins support.
+ </panel:panel>
+ <panel:panel id="simplePanelWithTextHeader"
header="rich-laguna-panel-no-header">
+ RichFaces is a library for adding rich user interface features to JSF
+ applications. It extends the Ajax4jsf framework to include a large
+ (and growing) set of powerful rich AJAX-enabled components that come
+ with extensive skins support.
+ </panel:panel>
+ <panel:panel id="nestedPanelContainer" style="padding:0"
headerClass="outpanelHeader">
+ <f:facet name="header">
+ ||||
+ </f:facet>
+ <h2 align="center"><h:outputText value="Benefits of Using
Ajax4jsf" /></h2>
+ <h:panelGrid columns="2" columnClasses="gridContent">
+ <panel:panel id="nestedPanel1"
bodyClass="inpanelBody">
+ <f:facet name="header">
+ For Application Developers
+ </f:facet>
+ <ul>
+ <li>Production quality Open Source</li>
+ <li>Does Open Source and has an Open Architecture</li>
+ <li>Compatible with any JSF Implementation - MyFaces, JSF1.1,
JSF1.2</li>
+ <li>Allows to Ajaxify JSF application without writing
Javascript</li>
+ <li>Works with standard and third party components</li>
+ <li>Adds the Ajax capability to existing non-Ajax
components</li>
+ </ul>
+ </panel:panel>
+ <panel:panel id="nestedPanel2"
bodyClass="inpanelBody">
+ <f:facet name="header" >
+ For Component Developers
+ </f:facet>
+ <ul>
+ <li>Ajax4jsf is Open Source and has an Open
Architecture</li>
+ <li>Gives an API to create components with built-in Ajax
support</li>
+ <li>Has a Component Development Kit for rapid
development</li>
+ <li>Allows to skin the look-n-feel using both CSS and set of
skin-parameters</li>
+ <li>Automatically generates the unit test-cases for developing
components</li>
+ <li>Allows to pack javascript code, images, css inside the
final jar</li>
+ </ul>
+ </panel:panel>
+ </h:panelGrid>
+ </panel:panel>
+ </h:body>
+</html>