You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cl...@apache.org on 2009/08/12 22:02:16 UTC
svn commit: r803686 [1/2] - in /sling/trunk/contrib/explorers: ./ gwt/
gwt/src/ gwt/src/main/ gwt/src/main/java/ gwt/src/main/java/org/
gwt/src/main/java/org/apache/ gwt/src/main/java/org/apache/sling/
gwt/src/main/java/org/apache/sling/explorer/ gwt/s...
Author: clombart
Date: Wed Aug 12 20:02:15 2009
New Revision: 803686
URL: http://svn.apache.org/viewvc?rev=803686&view=rev
Log:
Commit the prototype for the GWT Sling explorer (SLING-990)
Added:
sling/trunk/contrib/explorers/
sling/trunk/contrib/explorers/gwt/
sling/trunk/contrib/explorers/gwt/LICENSE
sling/trunk/contrib/explorers/gwt/NOTICE
sling/trunk/contrib/explorers/gwt/README.txt
sling/trunk/contrib/explorers/gwt/pom.xml
sling/trunk/contrib/explorers/gwt/src/
sling/trunk/contrib/explorers/gwt/src/main/
sling/trunk/contrib/explorers/gwt/src/main/java/
sling/trunk/contrib/explorers/gwt/src/main/java/org/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerConstants.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerImages.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerPageTemplate.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/SlingExplorerApplication.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/SessionInfo.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/Sling.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/ExplorerGrid.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/resource/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/resource/ResourceGrids.java
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/resource/
sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/resource/ResourceTree.java
sling/trunk/contrib/explorers/gwt/src/main/resources/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/chrome/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/chrome/explorer.css
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/images/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/images/icons/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/index.html
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/children.json.esp (with props)
sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/tree-node.json.esp (with props)
sling/trunk/contrib/explorers/gwt/src/main/resources/org/
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Explorer.gwt.xml
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Sling.png (with props)
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/client/
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/client/ExplorerConstants.properties
sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/client/ExplorerConstants_fr.properties
Added: sling/trunk/contrib/explorers/gwt/LICENSE
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/LICENSE?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/LICENSE (added)
+++ sling/trunk/contrib/explorers/gwt/LICENSE Wed Aug 12 20:02:15 2009
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Added: sling/trunk/contrib/explorers/gwt/NOTICE
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/NOTICE?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/NOTICE (added)
+++ sling/trunk/contrib/explorers/gwt/NOTICE Wed Aug 12 20:02:15 2009
@@ -0,0 +1,8 @@
+Apache Sling Threads
+Copyright 2008-2009 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed
+by Day Software (http://www.day.com/).
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
Added: sling/trunk/contrib/explorers/gwt/README.txt
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/README.txt?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/README.txt (added)
+++ sling/trunk/contrib/explorers/gwt/README.txt Wed Aug 12 20:02:15 2009
@@ -0,0 +1,62 @@
+Apache Sling Explorer
+
+This bundle provides the Sling Explorer Application to manage all sling resources.
+
+Disclaimer
+==========
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
+
+Getting Started
+===============
+
+1/ GWT
+
+We are using Google Web Toolkit for building this web app (see on http://code.google.com/intl/fr-FR/webtoolkit/).
+For testing the application, it is not necessary to redeploy all the time the application . You can test it directly
+from the project directory thanks to the GWT hosted mode and the mountByFS Sling option.
+
+Before executing the following maven commands, check if the Sling Bundle "Filesystem Resource Provider" is installed.
+If this bundle is not installed, this is not possible to test the application from the project folder without redeployment.
+
+
+
+2/ Using Maven
+
+This application uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven (http://maven.apache.org/)
+2.0.7 or later. We recommend to use the latest Maven version.
+
+You can use the following maven commands :
+
+ 1/ mvn install -P dev : Initialize the local Sling server. This command will mount your project folder into the Sling local repository.
+ You have to call this command only once time. After that, you are ready to test & dedug the application from your project folder.
+
+ 2/ mvn gwt:run : run the application in the hosted mode.
+
+ 3/ mvn gwt:debug : start the application in hosted/debug mode. By default, you can start the debugger from your IDE on the port 8888.
+
+ 4/ mvn gwt:compile : compile the GWT application.
+
+ 5/ mvn package : build the OSGI bundle
+
+
+After installing the GWT application on the Sling server, you can also access to it from http://localhost:8080/apps/explorer/index.html but it is faster to use the GWT hosted mode.
+
+
+See the Maven 2 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+ svn checkout http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/explorers/gwt
+
+See the Subversion documentation for other source control features.
+
Added: sling/trunk/contrib/explorers/gwt/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/pom.xml?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/pom.xml (added)
+++ sling/trunk/contrib/explorers/gwt/pom.xml Wed Aug 12 20:02:15 2009
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>sling</artifactId>
+ <version>6-incubator-SNAPSHOT</version>
+ <relativePath>../../../../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.sling.extensions.gwt.explorer</artifactId>
+ <version>6-incubator-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>Apache Sling Explorer</name>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/explorers/gwt</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/explorers/gwt</developerConnection>
+ <url>http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/explorer/gwt</url>
+ </scm>
+
+ <properties>
+ <gwt.version>1.6.4</gwt.version>
+ <gwt.port>8080</gwt.port>
+ <gwt.debugport>8888</gwt.debugport>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-servlet</artifactId>
+ <version>${gwt.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwt.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwt.version}</version>
+ <classifier>${platform}</classifier>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+
+ <plugins>
+ <!-- Apache Felix SCR Plugin: automatically extracts SCR-descriptors
+ from the source and generates the required bundle metadata -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Sling-Initial-Content>
+ SLING-INF/content/apps/explorer;overwrite:=true;uninstall=true;path:=/apps/explorer,
+ SLING-INF/content/apps/sling/servlet/default/explorer;overwrite:=true;uninstall=true;path:=/apps/sling/servlet/default/explorer
+ </Sling-Initial-Content>
+ </instructions>
+ </configuration>
+ </plugin>
+ <!-- Configue GWT -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>1.1</version>
+
+ <configuration>
+ <gwtVersion>${gwt.version}</gwtVersion>
+ <noServer>true</noServer>
+ <port>${gwt.port}</port>
+ <module>org.apache.sling.explorer.Explorer</module>
+
+ <!-- The following parameters are used when the GWT application is running in the hosted mode-->
+ <runTarget>apps/explorer/index.html</runTarget>
+ <extraJvmArgs>-Xmx512m -Xss1024k</extraJvmArgs>
+ <webappDirectory>${basedir}/src/main/resources/SLING-INF/content/apps/explorer</webappDirectory>
+ <hostedWebapp>${project.build.directory}/hostedWebapp</hostedWebapp>
+ <debugSuspend>false</debugSuspend>
+ <debugPort>${gwt.debugport}</debugPort>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- When running in the hosted mode, we have to copy the static resources -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <copydir src="${basedir}/src/main/resources/SLING-INF/content/apps/explorer"
+ dest="${project.build.directory}/hostedWebapp"
+ excludes="**/org.apache.sling.explorer.Explorer/*" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>windows</id>
+ <properties>
+ <platform>windows</platform>
+ </properties>
+ <activation>
+ <os>
+ <family>windows</family>
+ </os>
+ </activation>
+ </profile>
+ <profile>
+ <id>mac</id>
+ <properties>
+ <platform>mac</platform>
+ </properties>
+ <activation>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ </profile>
+ <profile>
+ <id>linux</id>
+ <properties>
+ <platform>linux</platform>
+ </properties>
+ <activation>
+ <os>
+ <name>linux</name>
+ </os>
+ </activation>
+ </profile>
+ <profile>
+ <id>dev</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>maven-sling-plugin</artifactId>
+ <version>2.0.3-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>install-bundle</id>
+ <goals>
+ <goal>validate</goal>
+ <goal>install</goal>
+ </goals>
+ <configuration>
+ <mountByFS>true</mountByFS>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <repositories>
+ <repository>
+ <id>Codehaus</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>Codehaus Snapshots</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
\ No newline at end of file
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerConstants.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerConstants.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerConstants.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerConstants.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.explorer.client;
+
+import com.google.gwt.i18n.client.Constants;
+
+
+public interface ExplorerConstants extends Constants {
+
+
+ public static final String CONTENT_ROOT = "/";
+ public static final String JSON_TREE_REQUEST_EXTENSION = ".explorer.tree-node.json";
+
+ public static final String JSON_CHILDREN_REQUEST_EXTENSION = ".explorer.children.json";
+ public static final String PROPERTY = "property";
+ public static final String RESOURCE = "resource";
+
+ public static final String SLING_HOMEPAGE = "http://incubator.apache.org/sling";
+ public static final String SLING_DOCUMENTATION = SLING_HOMEPAGE + "/documentation";
+
+
+ /**
+ * Descriptions to translate
+ * (see the ExplorerConstants.properties & associted files)
+ *
+ */
+ String mainTitle();
+
+ String mainSubTitle();
+
+ String slingHomePage();
+
+ String rootItemDescription();
+
+ String propertiesDescripton();
+
+ String subResourcesDescription();
+
+
+
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerImages.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerImages.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerImages.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerImages.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.explorer.client;
+
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.google.gwt.user.client.ui.ImageBundle;
+
+/**
+ * The images used throughout the Showcase.
+ */
+public interface ExplorerImages extends ImageBundle {
+
+
+ @Resource("org/apache/sling/explorer/Sling.png")
+ AbstractImagePrototype explorerLogo();
+
+
+
+}
\ No newline at end of file
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerPageTemplate.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerPageTemplate.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerPageTemplate.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/ExplorerPageTemplate.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.explorer.client;
+
+
+import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
+import com.google.gwt.user.client.ui.HTMLTable.RowFormatter;
+
+/**
+ * Page template composed of a Top Panel & a main panel
+ * The Top panel can contain logo, title & links
+ *
+ * The main panel can contain any kind of panels or widgets
+ *
+ */
+public class ExplorerPageTemplate extends Composite {
+
+
+ /**
+ * The base style name.
+ */
+ public static final String DEFAULT_STYLE_NAME = "Application";
+
+ /**
+ * The panel that contains the menu and content.
+ */
+ private HorizontalPanel mainPanel;
+
+
+ /**
+ * The panel that holds the main links.
+ */
+ private HorizontalPanel linksPanel;
+
+
+ /**
+ * The panel that contains the title widget and links.
+ */
+ private FlexTable topPanel;
+
+ /**
+ * Constructor.
+ */
+ public ExplorerPageTemplate()
+ {
+
+ // Setup the main layout widget
+ FlowPanel layout = new FlowPanel();
+ initWidget(layout);
+
+ // Setup the top panel with the title and links
+ createTopPanel();
+ layout.add(topPanel);
+
+ // Add the main menu
+ mainPanel = new HorizontalPanel();
+ mainPanel.setSize("100%","100%");
+
+ mainPanel.setSpacing(0);
+ mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+ layout.add(mainPanel);
+
+
+ }
+
+ /**
+ * Add a link to the top of the page.
+ *
+ * @param link the widget to add to the mainLinks
+ */
+ public void addLink(Widget link) {
+ if (linksPanel.getWidgetCount() > 0) {
+ linksPanel.add(new HTML(" | "));
+ }
+ linksPanel.add(link);
+ }
+
+
+ /**
+ * @return the {@link Widget} used as the title
+ */
+ public Widget getTitleWidget() {
+ return topPanel.getWidget(0, 0);
+ }
+
+
+ /**
+ * Set the {@link Widget} to display in the content area.
+ *
+ * @param content the content widget
+ */
+ public void setMainWidget(Widget content)
+ {
+ mainPanel.add(content);
+ }
+
+
+ /**
+ * Set the {@link Widget} to use as the title bar.
+ *
+ * @param title the title widget
+ */
+ public void setTitleWidget(Widget title) {
+ topPanel.setWidget(1, 0, title);
+
+ }
+
+
+ /**
+ * Create the panel at the top of the page that contains the title and links.
+ */
+ private void createTopPanel() {
+ boolean isRTL = LocaleInfo.getCurrentLocale().isRTL();
+ topPanel = new FlexTable();
+ topPanel.setCellPadding(0);
+ topPanel.setCellSpacing(0);
+ topPanel.setStyleName(DEFAULT_STYLE_NAME + "-top");
+ FlexCellFormatter formatter = topPanel.getFlexCellFormatter();
+
+ // Setup the links cell
+ linksPanel = new HorizontalPanel();
+ topPanel.setWidget(0, 0, linksPanel);
+ formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-links");
+ if (isRTL) {
+ formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
+ } else {
+ formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
+ }
+ formatter.setColSpan(0, 0, 2);
+
+ // Setup the title cell
+ setTitleWidget(null);
+ formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-title");
+
+ formatter.setStyleName(1, 1, DEFAULT_STYLE_NAME + "-options");
+ if (isRTL) {
+ formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT);
+ } else {
+ formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT);
+ }
+
+ RowFormatter rowFormatter = topPanel.getRowFormatter();
+
+ // Align the content to the top
+ topPanel.getRowFormatter().setVerticalAlign(0,
+ HasVerticalAlignment.ALIGN_TOP);
+ topPanel.getRowFormatter().setVerticalAlign(1,
+ HasVerticalAlignment.ALIGN_TOP);
+ }
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/SlingExplorerApplication.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/SlingExplorerApplication.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/SlingExplorerApplication.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/SlingExplorerApplication.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.explorer.client;
+
+import org.apache.sling.explorer.client.widgets.grid.resource.ResourceGrids;
+import org.apache.sling.explorer.client.widgets.tree.resource.ResourceTree;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+import com.google.gwt.user.client.ui.DisclosurePanel;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.HorizontalSplitPanel;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Entry point classes for the Sling Explorer application
+ */
+public class SlingExplorerApplication implements EntryPoint {
+
+ public static final ExplorerImages images = (ExplorerImages) GWT.create(ExplorerImages.class);
+
+ ExplorerConstants constants = (ExplorerConstants) GWT.create(ExplorerConstants.class);
+
+ private ExplorerPageTemplate explorerPage = new ExplorerPageTemplate();
+
+ private ResourceTree resourceTree;
+ private ResourceGrids resourceGrid;
+
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad() {
+
+
+
+
+ // Create the Sling explorer page
+ setupTitlePanel(constants);
+ setupMainLinks(constants);
+
+ //init explorer widgets
+ resourceGrid = new ResourceGrids();
+ resourceTree = new ResourceTree(resourceGrid);
+
+ RootPanel.get().add(explorerPage);
+ explorerPage.setMainWidget(createExplorerPanel());
+
+ // Populate the root level of the explorer tree
+ resourceTree.populate();
+
+ }
+
+
+ private Widget createExplorerPanel() {
+
+ HorizontalSplitPanel explorerPanel = new HorizontalSplitPanel();
+ explorerPanel.setSize("100%", "100%");
+ explorerPanel.setSplitPosition("20%");
+
+
+ DisclosurePanel propertiesPanel = new DisclosurePanel(constants.propertiesDescripton(),true);
+ propertiesPanel.add(resourceGrid.getPropertyGrid());
+ propertiesPanel.setStyleName("application-DisclosurePanel");
+
+ DisclosurePanel nodeChildrenPanel = new DisclosurePanel(constants.subResourcesDescription(),true);
+ nodeChildrenPanel.add(resourceGrid.getResourceChildrenGrid());
+ nodeChildrenPanel.setStyleName("application-DisclosurePanel");
+
+ propertiesPanel.setAnimationEnabled(true);
+ nodeChildrenPanel.setAnimationEnabled(true);
+
+
+ FlexTable layout = new FlexTable();
+ layout.setCellSpacing(6);
+ layout.setWidget(0, 0, propertiesPanel);
+ layout.setWidget(1, 0, nodeChildrenPanel);
+
+
+ explorerPanel.setRightWidget(layout);
+ explorerPanel.setLeftWidget(resourceTree);
+
+ return explorerPanel;
+ }
+
+
+ /**
+ * Create the main links at the top of the application.
+ *
+ * @param constants the constants with text
+ */
+ private void setupMainLinks(ExplorerConstants constants) {
+ // Link to Sling Homepage
+ explorerPage.addLink(new HTML("<a href=\"" + ExplorerConstants.SLING_HOMEPAGE + "\">"
+ + constants.slingHomePage() + "</a>"));
+ }
+
+
+
+ /**
+ * Create the title bar at the top of the application.
+ *
+ * @param constants the constant values to use
+ */
+ private void setupTitlePanel(ExplorerConstants constants) {
+
+ // Get the title from the internationalized constants
+ String pageTitle = "<h1>" + constants.mainTitle() + "</h1><h2>"
+ + constants.mainSubTitle() + "</h2>";
+
+ // Add the title and some images to the title bar
+ HorizontalPanel titlePanel = new HorizontalPanel();
+ titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+ titlePanel.add(images.explorerLogo().createImage());
+ titlePanel.add(new HTML(pageTitle));
+ explorerPage.setTitleWidget(titlePanel);
+ }
+
+}
+
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/SessionInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/SessionInfo.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/SessionInfo.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/SessionInfo.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.explorer.client.sling;
+
+public class SessionInfo
+{
+ private String user = "Not Connected";
+ private String workspace = "Default";
+
+
+ public SessionInfo(String user, String workspace) {
+ this.user = user;
+ this.workspace = workspace;
+ }
+
+ public String getUser() {
+ return user;
+ }
+ public void setUser(String user) {
+ this.user = user;
+ }
+ public String getWorkspace() {
+ return workspace;
+ }
+ public void setWorkspace(String workspace) {
+ this.workspace = workspace;
+ }
+
+
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/Sling.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/Sling.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/Sling.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/sling/Sling.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.explorer.client.sling;
+
+
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONException;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.user.client.ui.HTML;
+
+public class Sling
+{
+ public static String SESSION_INFO_URL = "/system/sling/info.sessionInfo.json";
+ private static String USER_ID = "userID";
+ private static String WORKSPACE = "workspace";
+
+
+
+ public void retrieveSessionInfo(HTML sessionInfoUI)
+ {
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, SESSION_INFO_URL);
+
+ try {
+ builder.sendRequest(null, new JsonTreeRequestCallback(sessionInfoUI));
+ GWT.log("send request end", null);
+
+ } catch (RequestException e) {
+
+ GWT.log("Couldn't retrieve User Information", e);
+
+ }
+ }
+
+ /**
+ * This class is used as a request callback object for receiving the json
+ * structure provided by Sling. The json structure contains information on the current session
+ *
+ *
+ */
+ private class JsonTreeRequestCallback implements RequestCallback {
+
+ HTML sessionInfoUI;
+
+ public JsonTreeRequestCallback(HTML sessionInfoUI) {
+ this.sessionInfoUI = sessionInfoUI;
+ }
+
+ public void onError(Request request, Throwable exception) {
+ GWT.log("Couldn't retrieve session information", null);
+ }
+
+ public void onResponseReceived(Request request, Response response) {
+ if (200 == response.getStatusCode()) {
+ SessionInfo sessionInfo = getSessionInfo(response);
+ sessionInfoUI.setText("User : " + sessionInfo.getUser() + " | " + sessionInfo.getWorkspace());
+ } else {
+ GWT.log("Couldn't retrieve JSON for session information (" + response.getStatusText()
+ + ")", null);
+ }
+ }
+
+ private SessionInfo getSessionInfo(Response response) {
+
+ try {
+ // parse the response text into JSON
+ JSONValue jsonValue = JSONParser.parse(response.getText());
+ JSONObject jsonObject = jsonValue.isObject();
+
+ if (jsonObject != null) {
+ GWT.log("send request get value end", null);
+ return new SessionInfo(jsonObject.get(USER_ID).toString(), jsonObject.get(WORKSPACE).toString());
+
+ } else {
+ throw new JSONException(
+ "Invalid Json structure when retrieve the Sling nodes");
+ }
+ } catch (JSONException e) {
+ GWT.log("Could not parse JSON", e);
+ throw new JSONException("Invalid Json structure when retrieve the Sling nodes");
+
+ }
+ }
+
+
+ };
+
+
+
+
+
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/ExplorerGrid.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/ExplorerGrid.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/ExplorerGrid.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/ExplorerGrid.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.explorer.client.widgets.grid;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTMLTable;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ *
+ * Reusable Grid that can be used in the Sling Explorer
+ *
+ * Right now, the Grid is based on the GWT FlexTable widget
+ *
+ *
+ */
+public class ExplorerGrid extends FlexTable {
+
+
+ public ExplorerGrid() {
+ super();
+ setStyleName("application-FlexTable");
+ getRowFormatter().addStyleName(0, "application-FlexTable-ColumnLabel");
+
+ }
+
+
+ public void addRow(Integer rowIndex, Object[] cellObjects) {
+
+ HTMLTable.RowFormatter rf = getRowFormatter();
+ for (int cell = 0; cell < cellObjects.length; cell++) {
+ Widget widget = createCellWidget(cellObjects[cell]);
+ setWidget(rowIndex, cell, widget);
+
+ if (cell==0)
+ getCellFormatter().addStyleName(rowIndex, cell,"application-FlexTable-Cell-first");
+ else
+ getCellFormatter().addStyleName(rowIndex, cell,"application-FlexTable-Cell");
+
+
+ if ((rowIndex % 2) != 0) {
+ rf.addStyleName(rowIndex, "application-FlexTable-OddRow");
+ } else {
+ rf.addStyleName(rowIndex, "application-FlexTable-EvenRow");
+ }
+ }
+ }
+
+ public void AddHeader(Object[] cellObjects)
+ {
+ for (int cell = 0; cell < cellObjects.length; cell++) {
+ Widget widget = createCellWidget(cellObjects[cell]);
+ setWidget(0, cell, widget);
+ getCellFormatter().addStyleName(0, cell,"application-FlexTable-ColumnLabelCell");
+ }
+ }
+
+
+ private Widget createCellWidget(Object cellObject) {
+ Widget widget = null;
+
+ if (cellObject instanceof Widget)
+ widget = (Widget) cellObject;
+ else
+ widget = new Label(cellObject.toString());
+
+ return widget;
+ }
+
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/resource/ResourceGrids.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/resource/ResourceGrids.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/resource/ResourceGrids.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/grid/resource/ResourceGrids.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.explorer.client.widgets.grid.resource;
+
+
+import org.apache.sling.explorer.client.ExplorerConstants;
+import org.apache.sling.explorer.client.widgets.grid.ExplorerGrid;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONException;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.user.client.ui.FlexTable;
+
+/**
+ *
+ * A ResourcesGrids display information on a resources
+ * It is composed of 2 different Grids.
+ * One for the resource properties & another one for the resource children.
+ *
+ */
+public class ResourceGrids {
+
+
+ private ExplorerGrid propertyGrid = new ExplorerGrid();
+ private ExplorerGrid resourceGrid = new ExplorerGrid();
+
+ private ExplorerConstants constants;
+
+ public ResourceGrids()
+ {
+ super();
+ constants = (ExplorerConstants) GWT.create(ExplorerConstants.class);
+
+ // Add the Header to the property grid
+ Object[] cols = new Object[4];
+
+ // TODO : Change the hardcoded labels
+ cols[0] = "Name";
+ cols[1] = "Type";
+ cols[2] = "Value";
+ cols[3] = "Multi";
+
+ propertyGrid.AddHeader(cols);
+
+ // Add the Header to the Subnode grid
+ // TODO : Change the hardcoded labels
+ cols = new Object[2];
+ cols[0] = "Name";
+ cols[1] = "Type";
+ resourceGrid.AddHeader(cols);
+ }
+
+ private void removeAllRowsInGrids() {
+
+ int rowCount = propertyGrid.getRowCount();
+ // Loop from i=1 because we don't remove the grid label
+ for (int i=rowCount-1; i>0; i-- )
+ {
+ propertyGrid.removeRow(i);
+ }
+
+ rowCount = resourceGrid.getRowCount();
+ // Loop from i=1 because we don't remove the grid label
+ for (int i=rowCount-1; i>0; i-- )
+ {
+ resourceGrid.removeRow(i);
+ }
+
+ }
+
+ public void populate(String url) {
+
+
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url + ExplorerConstants.JSON_CHILDREN_REQUEST_EXTENSION);
+
+ try {
+ builder.sendRequest(null, new JsonGridCallback(this));
+ } catch (RequestException e) {
+ // TODO : add message box for the end-user
+ GWT.log("ResourceGrids - Couldn't retrieve JSON for url : " + url + ExplorerConstants.JSON_CHILDREN_REQUEST_EXTENSION, e);
+ }
+ }
+
+ public FlexTable getPropertyGrid() {
+ return propertyGrid;
+ }
+
+
+ public FlexTable getResourceChildrenGrid() {
+ return resourceGrid;
+ }
+
+
+ private class JsonGridCallback implements RequestCallback {
+ private ResourceGrids grid;
+
+
+ public JsonGridCallback(ResourceGrids grid) {
+ this.grid = grid;
+
+ }
+
+ public void onError(Request request, Throwable exception) {
+ GWT.log("ResourceGrids - on error for request : " + request.toString(), null);
+ }
+
+ public void onResponseReceived(Request request, Response response) {
+ if (200 == response.getStatusCode()) {
+ grid.removeAllRowsInGrids();
+ addProperties(response);
+
+ } else {
+ GWT.log("ResourceGrids - Couldn't retrieve JSON for request - status code :"
+ + response.getStatusCode() + " - "
+ + response.getText(), null);
+ }
+ }
+
+ private void addProperties(Response response) {
+ GWT.log(response.getText(), null);
+ try {
+ // parse the response text into JSON
+ JSONValue jsonValue = JSONParser.parse(response.getText());
+ JSONArray jsonArray = jsonValue.isArray();
+
+ if (jsonArray != null) {
+ for (int index = 0; index < jsonArray.size(); index++) {
+ addProperty(((JSONObject) jsonArray.get(index)), index);
+ }
+ } else {
+ throw new JSONException(
+ "Invalid Json structure when retrieve the Sling nodes");
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ GWT.log("ResourceGrids - Could not parse JSON", e);
+ }
+ }
+
+ private void addProperty(JSONObject jsonObject, int index) {
+
+ Item item = new Item(jsonObject.get("itemType").isString().stringValue(),
+ jsonObject.get("multi").isBoolean().booleanValue(),
+ jsonObject.get("name").isString().stringValue(),
+ jsonObject.get("type").isString().stringValue(),
+ jsonObject.get("value").isString().stringValue());
+
+ if (item.getItemType().equals(ExplorerConstants.PROPERTY))
+ addToPropertyGrid(propertyGrid, item);
+ else
+ addToChildrenResourceGrid(resourceGrid, item);
+
+ }
+
+ private void addToPropertyGrid( ExplorerGrid grid, Item item) {
+ Object[] cols = new Object[4];
+ cols[0] = item.getName();
+ cols[1] = item.getType();
+ cols[2] = item.getValue();
+ cols[3] = item.isMutli().toString();
+
+ grid.addRow(grid.getRowCount(), cols);
+ }
+
+ private void addToChildrenResourceGrid( ExplorerGrid grid, Item item) {
+
+ Object[] cols = new Object[2];
+ cols[0] = item.getName();
+ cols[1] = item.getType();
+
+ grid.addRow(grid.getRowCount(), cols);
+ }
+
+ };
+
+ /**
+ * User object used for the treeview items (resource children or resource properties).
+ *
+ */
+ private class Item {
+
+ private String name;
+ private String type;
+ private String value;
+ private Boolean mutli;
+ private String itemType;
+
+
+
+
+ public Item(String itemType, Boolean mutli, String name, String type,
+ String value) {
+ super();
+ this.itemType = itemType;
+ this.mutli = mutli;
+ this.name = name;
+ this.type = type;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+ public Boolean isMutli() {
+ return mutli;
+ }
+ public void setMutli(Boolean mutli) {
+ this.mutli = mutli;
+ }
+ public String getItemType() {
+ return itemType;
+ }
+ public void setItemType(String itemType) {
+ this.itemType = itemType;
+ }
+ }
+
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/resource/ResourceTree.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/resource/ResourceTree.java?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/resource/ResourceTree.java (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/java/org/apache/sling/explorer/client/widgets/tree/resource/ResourceTree.java Wed Aug 12 20:02:15 2009
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.explorer.client.widgets.tree.resource;
+
+
+
+import org.apache.sling.explorer.client.ExplorerConstants;
+import org.apache.sling.explorer.client.sling.SessionInfo;
+import org.apache.sling.explorer.client.widgets.grid.resource.ResourceGrids;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.logical.shared.OpenEvent;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.http.client.URL;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONException;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+
+public class ResourceTree extends Tree {
+
+ private TreeItem root;
+ private ResourceGrids properties;
+ private ExplorerConstants constants;
+
+ public ResourceTree(ResourceGrids properties) {
+ this();
+ this.properties = properties;
+ // Create the constants
+ constants = (ExplorerConstants) GWT.create(ExplorerConstants.class);
+ }
+
+ public ResourceTree() {
+ super();
+
+ // Add an open handler to have a lazy loading treeview
+ addOpenHandler(new OpenHandler<TreeItem>() {
+ public void onOpen(OpenEvent<TreeItem> event) {
+ TreeItem item = event.getTarget();
+ if (item.getState() && item.getChildCount() == 1) {
+
+ Node node = (Node) item.getUserObject();
+ loadChildren(item, node.getId() + ExplorerConstants.JSON_TREE_REQUEST_EXTENSION);
+
+ // Remove the temporary item when we finish loading
+ item.getChild(0).remove();
+
+ }
+
+
+ }
+ });
+
+ // Add a selection handler to refresh the property & resource grids
+ addSelectionHandler(new SelectionHandler<TreeItem> (){
+
+ public void onSelection(SelectionEvent<TreeItem> event) {
+ GWT.log("Selected item : " + event.getSelectedItem().getText(), null);
+ Node node = (Node) event.getSelectedItem().getUserObject();
+ if (properties != null)
+ properties.populate(node.id);
+
+ }
+
+
+ });
+
+
+ }
+
+ public void populate() {
+
+ root = new TreeItem(constants.rootItemDescription());
+
+// try {
+//
+// SessionInfo info = (SessionInfo) Class.forName("org.apache.sling.explorer.client.sling.SessionInfo").newInstance();
+//
+// root = new TreeItem(info.getUser());
+// }
+// catch(Exception ex) {
+// return;
+// }
+
+
+ addItem(root);
+
+ this.loadChildren(root, URL.encode(ExplorerConstants.CONTENT_ROOT + ExplorerConstants.JSON_TREE_REQUEST_EXTENSION));
+
+ if (properties != null)
+ properties.populate(ExplorerConstants.CONTENT_ROOT );
+
+
+ }
+
+ private void loadChildren(final TreeItem treeItem, final String url) {
+
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
+
+ try {
+ builder.sendRequest(null, new JsonTreeRequestCallback(treeItem));
+ } catch (RequestException e) {
+ // TODO : add message box for the end-user
+ GWT.log("ResourceTree - Couldn't retrieve JSON for url : " + url + ExplorerConstants.JSON_TREE_REQUEST_EXTENSION, e);
+ }
+
+ }
+
+ /**
+ * This class is used as a request callback object for receiving the json
+ * structure provided by Sling. The json structure contains the node
+ * children that we have to display in the tree
+ *
+ *
+ */
+ private class JsonTreeRequestCallback implements RequestCallback {
+ private TreeItem treeItem;
+
+ public JsonTreeRequestCallback(TreeItem treeItem) {
+ this.treeItem = treeItem;
+ }
+
+ public void onError(Request request, Throwable exception) {
+ GWT.log("ResourceTree - on error for request : " + request.toString(), null);
+ }
+
+ public void onResponseReceived(Request request, Response response) {
+ if (200 == response.getStatusCode()) {
+ addTreeItems(response);
+ if (treeItem.getText().equals(constants.rootItemDescription()))
+ treeItem.setState(true, true);
+ } else {
+ GWT.log("ResourceTree - Couldn't retrieve JSON for request : " + request.toString(), null);
+ }
+ }
+
+ private void addTreeItems(Response response) {
+ GWT.log(response.getText(), null);
+ try {
+ // parse the response text into JSON
+ JSONValue jsonValue = JSONParser.parse(response.getText());
+ JSONArray jsonArray = jsonValue.isArray();
+
+ if (jsonArray != null) {
+ for (int index = 0; index < jsonArray.size(); index++) {
+ addTreeItem(((JSONObject) jsonArray.get(index)), index);
+ }
+ } else {
+ throw new JSONException(
+ "Invalid Json structure when retrieve the Sling nodes");
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ GWT.log("ResourceTree - Could not parse JSON", e);
+ }
+ }
+
+ private void addTreeItem(JSONObject jsonObject, int index) {
+
+ Node node = new Node(jsonObject.get("id").isString().stringValue(),
+ jsonObject.get("leaf").isBoolean().booleanValue(),
+ jsonObject.get("text").isString().stringValue());
+ if (node.getText() != null) {
+ TreeItem item = new TreeItem();
+ item.setText(node.getText());
+ item.setUserObject(node);
+ if (!node.isLeaf())
+ item.addItem(""); // Temporarily add an item so we can expand this node
+
+ treeItem.addItem(item);
+
+ }
+ }
+
+ };
+
+ /**
+ * User object used for the treeview items. It contains information on the
+ * associated node
+ *
+ */
+ private class Node {
+
+ private String id;
+ private String text;
+ private boolean leaf;
+
+ public Node(String id, boolean leaf, String text) {
+ super();
+ this.id = id;
+ this.leaf = leaf;
+ this.text = text;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public boolean isLeaf() {
+ return leaf;
+ }
+
+ }
+
+
+
+}
Added: sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/chrome/explorer.css
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/chrome/explorer.css?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/chrome/explorer.css (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/css/chrome/explorer.css Wed Aug 12 20:02:15 2009
@@ -0,0 +1,200 @@
+/**
+ * Applied to the main layout of the page.
+ */
+
+.Application-Reference-chrome {
+ height: 5px;
+ width: 5px;
+ zoom: 1;
+}
+.Application-top {
+ width: 100%;
+ margin-bottom: 10px;
+ border-bottom: 3px solid #CDCDCD;
+ padding: 0px 0px 4px 0px;
+}
+
+.Application-title {
+ padding: 0px 0px 0px 10px;
+}
+
+
+.Application-title h1 {
+ color: #666;
+ margin: 0px;
+ padding: 0px 0px 0px 4px;
+ font-size: 22px;
+}
+.Application-title h2 {
+ color: #333;
+ margin: 0px;
+ padding: 0px 0px 0px 4px;
+ font-size: 16px;
+}
+.Application-links {
+ padding: 2px 13px 2px 0px;
+ background: #eee;
+}
+.Application-links .gwt-HTML{
+ font-size: 12px;
+}
+.Application-options {
+ padding: 6px 10px 0px 0px;
+}
+.Application-options .gwt-ListBox {
+ width: 150px;
+ font-size: 11px;
+ color: blue;
+ margin-left: 4px;
+}
+.Application-options td {
+ font-size: 12px;
+}
+.Application-options .gwt-ToggleButton {
+ width: 36px;
+ height: 16px;
+ margin: 3px 0px 0px 10px;
+ padding: 0px;
+}
+.Application-options .gwt-ToggleButton-down,
+.Application-options .gwt-ToggleButton-down-hovering {
+ cursor: default;
+}
+.Application-options .sc-ThemeButton-standard {
+ background: #d0e4f6;
+}
+.Application-options .sc-ThemeButton-chrome {
+ background: #ccc;
+}
+.Application-options .sc-ThemeButton-dark {
+ background: #3d3d3d;
+}
+.Application-menu {
+ width: 18em;
+ text-align: left;
+}
+
+/** DISCLOSURE PANEL */
+
+.application-DisclosurePanel .header,
+.application-DisclosurePanel .header a,
+.application-DisclosurePanel .header td {
+
+ color: #848484;
+ cursor: pointer;
+ cursor: hand;
+ /* border-bottom : 1px; */
+}
+
+
+.application-DisclosurePanel .content {
+margin-left:6px;
+
+}
+
+
+/** FLEXIBLE TABLE Used */
+
+.application-FlexTable {
+ /* border : 1px solid #BBBBBB;*/
+ border-top: thin solid #BBBBBB;
+ border-left: thin solid #BBBBBB;
+ border-right: thin solid #BBBBBB;
+ border-bottom: thin solid #BBBBBB;
+ border-spacing: 0px;
+ width : 700px;
+
+}
+
+
+
+.application-FlexTable-EvenRow {
+ background-color: #F2F2F2;
+
+}
+
+.application-FlexTable-OddRow {
+ background-color: #FFFFFF;
+}
+
+
+.application-FlexTable-ColumnLabel {
+ color: #2E2E2E;
+ background-color : #E6E6E6;
+ height:20px;
+
+
+}
+
+.application-FlexTable-ColumnLabelCell {
+
+ font-size: 12px;
+ border-width: 0 0 1px 0;
+ border-style: solid;
+ border-color: #BBBBBB;
+ margin: 0;
+ padding: 0;
+ text-align: center;
+
+
+
+}
+
+.application-FlexTable-Cell {
+ margin: 0;
+ font-size: 12px;
+
+ border-width: 0px 0px 0px 1px;
+ border-style: solid;
+ border-color: #BBBBBB;
+ padding: 5px;
+
+}
+
+.application-FlexTable-Cell-first {
+ margin: 0;
+ font-size: 12px;
+
+ border-width: 0px 0px 0px 0px;
+ border-style: solid;
+ border-color: #BBBBBB;
+ padding: 5px;
+
+}
+
+/**
+ * Applied to widgets in the content area.
+ */
+
+
+.Application-content-decorator {
+ margin-right: 8px;
+}
+
+.Application-content-title {
+ padding: 4px 0px 3px 6px;
+ text-align: left;
+ background: #530a0a url(../gwt/chrome/images/hborder.png) repeat-x 0px -2003px;
+ border-bottom: 2px solid #e3e3e3;
+}
+
+.Application-content-title .gwt-TabBarItem {
+ background: none;
+ padding: 0px;
+}
+
+.Application-content-title .gwt-TabBarItem .gwt-Label {
+ padding-right: 20px;
+ color: #888888;
+}
+
+.Application-content-title .gwt-TabBarItem-selected .gwt-Label {
+ color: black;
+}
+
+.Application-content-wrapper {
+ text-align: left;
+}
+
+
+
Added: sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/index.html
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/index.html?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/index.html (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/explorer/index.html Wed Aug 12 20:02:15 2009
@@ -0,0 +1,41 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Sling Explorer</title>
+ <link type="text/css" rel="stylesheet" href="css/chrome/explorer.css">
+ <script type="text/javascript" language="javascript" src="org.apache.sling.explorer.Explorer/org.apache.sling.explorer.Explorer.nocache.js"></script>
+
+ </head>
+
+ <!-- -->
+ <!-- The body can have arbitrary html, or -->
+ <!-- you can leave the body empty if you want -->
+ <!-- to create a completely dynamic UI. -->
+ <!-- -->
+ <body>
+
+ <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
+
+ </body>
+</html>
Added: sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/children.json.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/children.json.esp?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/children.json.esp (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/children.json.esp Wed Aug 12 20:02:15 2009
@@ -0,0 +1,254 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+
+[<%
+
+ /**
+ This script retrieve resource properties & resource children
+
+ TODO : the Sling explorer has to support a mechanism based on plugins to render resource info.
+ */
+
+
+ var streamProps = renderResourceProperties();
+ if (streamProps != "")
+ out.print(streamProps);
+
+ var streamChildren = renderResourceChildren();
+
+ if (streamChildren != "")
+ {
+ if (streamProps != null && streamProps != "")
+ out.print(",");
+
+ out.print(streamChildren);
+ }
+
+
+ /**
+ *
+ * This method get the resource properties and add them into the json stream
+ *
+ */
+ function renderResourceProperties()
+ {
+
+
+ // Check if the resource is a JCR node
+ var node = resource.adaptTo(Packages.javax.jcr.Node);
+ if (node) {
+ return renderJCRResourceProperties();
+ }
+
+ // Generic code for any kind of resource.
+ else {
+ return renderGenericResourceProperties();
+ }
+
+ }
+
+ function renderJCRResourceProperties()
+ {
+ var jsonOutput = renderCommonJCRProperties();
+
+ var properties = currentNode.properties
+ while(properties.hasNext())
+ {
+
+ var property = properties.nextProperty() ;
+
+
+ // Single value property
+ if ( ! property.getDefinition().isMultiple())
+ {
+ jsonOutput += ",";
+ jsonOutput += '{"name": "' + property.getName() +
+ '", "type" : "' + getType(property, false) +
+ '", "value" : "' + property.getValue().getString() +
+ '", "multi" : ' + false + ', "itemType" : "property" }';
+
+ }
+
+ // Multi value property
+ else
+ {
+
+ jsonOutput += ",";
+ //1. Retrieve the values
+ var values = property.getValues();
+ var jsonOuputValues = "[";
+
+ for (j=0; j<values.length;j=j+1)
+ {
+ if (j>0) jsonOuputValues += ",";
+ var value = values[j];
+ jsonOuputValues += "'"+ value.getString() + "'";
+ }
+
+ jsonOuputValues += "]";
+
+ //2. Build the Json ouput for a multi val. property
+ jsonOutput += '{"name": "' + property.getName() +
+ '", "type" : "' + getType(property, false) +
+ '", "value" : "' + jsonOuputValues +
+ '", "multi" : ' + true + ', "itemType" : "property" }';
+
+
+
+ }
+
+ }
+
+ return jsonOutput;
+
+ }
+
+ function renderCommonJCRProperties()
+ {
+ var jsonOutput = "";
+
+ // Add the property 'name'
+ jsonOutput += '{"name": "name", "type" : "Name"' +
+ ', "value" : "' + currentNode.name +
+ '", "multi" : ' + false + ', "itemType" : "property" }';
+
+ // Add the uuid
+
+ jsonOutput += ',{"name": "uuid", "type" : "String"' +
+ ', "value" : "' + currentNode.uuid +
+ '", "multi" : ' + false + ', "itemType" : "property" }';
+
+ return jsonOutput;
+
+ }
+
+ function renderGenericResourceProperties()
+ {
+ var jsonOutput = "";
+ var valueMap = Packages.org.apache.sling.api.resource.ResourceUtil.getValueMap(resource);
+ var propertyIterator = valueMap.keySet().iterator();
+
+ var i = 0;
+ while(propertyIterator.hasNext()) {
+
+ i++;
+ if (i > 1) {
+ jsonOutput += ",";
+ }
+ var propName = propertyIterator.next();
+
+ jsonOutput += '{"name": "' + propName +
+ '", "type" : "To be defined", "value" : "' + valueMap.get(propName) +
+ '", "multi" : false, "itemType" : "property" }';
+ }
+ return jsonOutput;
+ }
+ /**
+ *
+ * This method get the children (nodes) and add them into the json stream
+ *
+ */
+ function renderResourceChildren()
+ {
+ var resourceUtil = Packages.org.apache.sling.api.resource.ResourceUtil();
+ var jsonOutput = "";
+
+ var iterator = resource.resourceResolver.listChildren(resource);
+ var i = 0;
+ while(iterator.hasNext())
+ {
+ i++;
+ var child = iterator.next() ;
+ if (i > 1) {
+ jsonOutput += ",";
+ }
+
+ jsonOutput += '{"name": "' + resourceUtil.getName(child) +
+ '", "type" : "' + child.resourceType +
+ '", "value" : " ", "multi" : false, "itemType" : "resources" }';
+
+
+ }
+
+ return jsonOutput;
+ }
+
+
+
+ function getType(property, isMultiValue)
+ {
+
+ var type = property.getType();
+ var returnType = "";
+ if (type == 1)
+ {
+ returnType = "String"
+ }
+
+ if (type == 2)
+ {
+ returnType = "Binary"
+ }
+
+ if (type == 3)
+ {
+ returnType = "Date"
+ }
+
+ if (type == 4)
+ {
+ returnType = "Double"
+ }
+
+
+ if (type == 5)
+ {
+ returnType = "Long"
+ }
+
+
+ if (type == 6)
+ {
+ returnType = "Boolean"
+ }
+ if (type == 7)
+ {
+ returnType = "Name"
+ }
+
+ if (type == 8)
+ {
+ returnType = "Path"
+ }
+
+ if (type == 9)
+ {
+ returnType = "Reference"
+ }
+
+
+ if (isMultiValue)
+ {
+ returnType += "*"
+ }
+
+ return returnType;
+
+ }
+%>]
Propchange: sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/children.json.esp
------------------------------------------------------------------------------
svn:executable = *
Added: sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/tree-node.json.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/tree-node.json.esp?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/tree-node.json.esp (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/tree-node.json.esp Wed Aug 12 20:02:15 2009
@@ -0,0 +1,64 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%>
+[<%
+ var resourceUtil = Packages.org.apache.sling.api.resource.ResourceUtil;
+
+ var iterator = resource.resourceResolver.listChildren(resource);
+ var i = 0;
+ while(iterator.hasNext()) {
+
+ var child = iterator.next();
+
+ if ( ! isSystemNode(child.path))
+ {
+ i++;
+ if (i > 1) {
+ out.print(",");
+ }
+
+ var hasChidldren = resource.resourceResolver.listChildren(child).hasNext();
+ var jsonOutput = '{"id": "' + child.path +
+ '", "text" : "' + resourceUtil.getName(child) +
+ '", "leaf" : ' + ! hasChidldren + '}';
+
+ out.print(jsonOutput);
+ }
+ }
+
+ /*
+ * TODO : Implement a nice way to excludes nodes.
+ */
+ function isSystemNode(nodePath)
+ {
+ return false;
+ /*
+ if (nodePath == "/jcr:system" || nodePath == "/system")
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ */
+
+ }
+
+
+%>]
Propchange: sling/trunk/contrib/explorers/gwt/src/main/resources/SLING-INF/content/apps/sling/servlet/default/explorer/tree-node.json.esp
------------------------------------------------------------------------------
svn:executable = *
Added: sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Explorer.gwt.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Explorer.gwt.xml?rev=803686&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Explorer.gwt.xml (added)
+++ sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Explorer.gwt.xml Wed Aug 12 20:02:15 2009
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-source/core/src/gwt-module.dtd">
+
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<module>
+
+
+ <inherits name='com.google.gwt.user.User'/>
+ <inherits name="com.google.gwt.i18n.I18N"/>
+
+ <!-- inherits name='com.google.gwt.user.theme.standard.Standard'/ -->
+ <inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
+ <!-- inherits name='com.google.gwt.user.theme.dark.Dark'/ -->
+
+ <!-- Other module inherits -->
+ <inherits name="com.google.gwt.http.HTTP" />
+ <inherits name="com.google.gwt.json.JSON" />
+
+ <extend-property name="locale" values="fr"/>
+ <extend-property name="locale" values="en"/>
+
+ <!-- Specify the app entry point class. -->
+ <entry-point class='org.apache.sling.explorer.client.SlingExplorerApplication'/>
+
+
+</module>
Added: sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Sling.png
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Sling.png?rev=803686&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/contrib/explorers/gwt/src/main/resources/org/apache/sling/explorer/Sling.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream