You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/10/06 14:32:26 UTC
svn commit: r1005006 [1/5] - in /incubator/chemistry/opencmis/trunk: ./
chemistry-opencmis-workbench/
chemistry-opencmis-workbench/chemistry-opencmis-workbench/
chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/
chemistry-opencmis-workbench...
Author: fmui
Date: Wed Oct 6 12:32:23 2010
New Revision: 1005006
URL: http://svn.apache.org/viewvc?rev=1005006&view=rev
Log:
- moved CMIS Workbench code to trunk
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LogFrame.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/Workbench.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CancelCheckOutPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckInPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/CheckOutPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteContentStreamPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeletePanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/DeleteTreePanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/MovePanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/SetContentStreamPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ACLTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/AbstractDetailsTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/DetailsTabs.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ExtensionsPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PolicyTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/PropertyTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RelationshipTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/RenditionTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/VersionTable.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModelEvent.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientOperationContext.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/FolderListener.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/MIMETypes.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CollectionRenderer.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/CreateDialog.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/GregorianCalendarRenderer.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/jnlp/template.vm (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/META-INF/README (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/changelog.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/connect.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/console.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/document.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/folder.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/icon.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/info.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/log.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newdocument.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/newfolder.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/policy.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/query.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/relationship.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/repository-info.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/images/types.png (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/log4j.properties (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/CMIS.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/counttypes.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/getdescendants.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/query.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/script-library.properties (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/startup.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/template.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/upload.groovy
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat (with props)
incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh (with props)
incubator/chemistry/opencmis/trunk/src/main/assembly/workbench-assembly.xml (with props)
Modified:
incubator/chemistry/opencmis/trunk/pom.xml
incubator/chemistry/opencmis/trunk/src/main/assembly/dev-client-assembly.xml
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml Wed Oct 6 12:32:23 2010
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ 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.
+ -->
+
+<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.chemistry.opencmis</groupId>
+ <artifactId>chemistry-opencmis</artifactId>
+ <version>0.2.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>chemistry-opencmis-workbench</artifactId>
+ <name>OpenCMIS Workbench</name>
+ <packaging>jar</packaging>
+
+ <properties>
+ <parentBasedir>../../</parentBasedir>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compile.source>1.6</maven.compile.source>
+ <maven.compile.target>1.6</maven.compile.target>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-5</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <target>${maven.compile.target}</target>
+ <source>${maven.compile.source}</source>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <inherited>true</inherited>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <includePom>true</includePom>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <filtering>false</filtering>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <configuration>
+ <target>
+ <property name="version" value="${maven.version}"/>
+ <property name="timestamp" value="${maven.build.timestamp}"/>
+ <property name="basedir" value="${maven.basedir}"/>
+ <property name="targetdir" value="${project.build.directory}"/>
+ <property name="workbench.jar" value="${project.build.finalName}" />
+
+ <!-- build timestamp -->
+ <echo file="${basedir}/src/main/resources/META-INF/build-timestamp.txt">Version: ${version} / Build: ${timestamp}</echo>
+
+ <!-- start scripts -->
+ <mkdir dir="${targetdir}/start"/>
+ <copy todir="${targetdir}/start" overwrite="true">
+ <fileset dir="${basedir}/src/main/start"/>
+ </copy>
+ <replace dir="${targetdir}/start">
+ <replacefilter token="@workbench.jar@" value="${workbench.jar}.jar"/>
+ <replacefilter token="@version@" value="Version: ${version} / Build: ${timestamp}"/>
+ </replace>
+ <chmod dir="${targetdir}/start" perm="+x" includes="**/*.sh"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ <workspace>.</workspace>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ <manifest>
+ <mainClass>org.apache.chemistry.opencmis.workbench.Workbench</mainClass>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix></classpathPrefix>
+ </manifest>
+ <manifestEntries>
+ <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
+ <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo.webstart</groupId>
+ <artifactId>webstart-maven-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jnlp-inline</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <libPath>lib</libPath>
+ <jnlp>
+ <mainClass>org.apache.chemistry.opencmis.workbench.Workbench</mainClass>
+ </jnlp>
+ <pack200>true</pack200>
+ <gzip>true</gzip>
+
+ <sign>
+ <keystore>${project.build.directory}/keystore</keystore>
+ <keypass>password</keypass>
+ <storepass>password</storepass>
+ <alias>webstart</alias>
+
+ <validity>365</validity>
+ <dnameCn>OpenCMIS Development Team</dnameCn>
+ <dnameOu>Apache Chemistry OpenCMIS</dnameOu>
+ <dnameO>The Apache Software Foundation</dnameO>
+
+ <verify>true</verify>
+
+ <keystoreConfig>
+ <delete>true</delete>
+ <gen>true</gen>
+ </keystoreConfig>
+ </sign>
+
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.chemistry.opencmis</groupId>
+ <artifactId>chemistry-opencmis-client-impl</artifactId>
+ <version>0.2.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache</groupId>
+ <artifactId>apache-jar-resource-bundle</artifactId>
+ <version>1.4</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,207 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import java.awt.BorderLayout;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Collection;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumn;
+
+import org.apache.chemistry.opencmis.client.api.ChangeEvent;
+import org.apache.chemistry.opencmis.client.api.ChangeEvents;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.CollectionRenderer;
+import org.apache.chemistry.opencmis.workbench.swing.GregorianCalendarRenderer;
+
+public class ChangeLogFrame extends JFrame {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String WINDOW_TITLE = "CMIS Change Log";
+
+ private ClientModel model;
+
+ private JTextField changeLogTokenField;
+ private ChangeLogTable changeLogTable;
+
+ public ChangeLogFrame(ClientModel model) {
+ super();
+
+ this.model = model;
+ createGUI();
+ }
+
+ private void createGUI() {
+ setTitle(WINDOW_TITLE + " - " + model.getRepositoryName());
+ setPreferredSize(new Dimension(700, 700));
+ setMinimumSize(new Dimension(200, 60));
+
+ setLayout(new BorderLayout());
+
+ JPanel inputPanel = new JPanel(new BorderLayout());
+
+ inputPanel.add(new JLabel("Change Log Token:"), BorderLayout.LINE_START);
+
+ changeLogTokenField = new JTextField();
+ inputPanel.add(changeLogTokenField, BorderLayout.CENTER);
+
+ JButton loadButton = new JButton("Load");
+ loadButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ String changeLogToken = changeLogTokenField.getText();
+ if (changeLogToken.trim().length() == 0) {
+ changeLogToken = null;
+ }
+
+ ChangeEvents events = null;
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ events = model.getClientSession().getSession().getContentChanges(changeLogToken, true, 1000);
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ return;
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+
+ changeLogTable.setChangeEvents(events.getChangeEvents());
+ changeLogTokenField.setText(events.getlatestChangeLogToken() == null ? "" : events
+ .getlatestChangeLogToken());
+ }
+ });
+ inputPanel.add(loadButton, BorderLayout.LINE_END);
+
+ add(inputPanel, BorderLayout.PAGE_START);
+
+ changeLogTable = new ChangeLogTable();
+ add(new JScrollPane(changeLogTable), BorderLayout.CENTER);
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ pack();
+
+ setLocationRelativeTo(null);
+ setVisible(true);
+ }
+
+ static class ChangeLogTable extends JTable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String[] COLUMN_NAMES = { "Change Type", "Object Id", "Change Time", "Properties" };
+ private static final int[] COLUMN_WIDTHS = { 100, 200, 200, 400 };
+
+ private List<ChangeEvent> changeEvents;
+
+ public ChangeLogTable() {
+ setDefaultRenderer(GregorianCalendar.class, new GregorianCalendarRenderer());
+ setDefaultRenderer(Collection.class, new CollectionRenderer());
+ setModel(new ChangeLogTableModel(this));
+
+ setAutoResizeMode(AUTO_RESIZE_OFF);
+ setAutoCreateRowSorter(true);
+
+ for (int i = 0; i < COLUMN_WIDTHS.length; i++) {
+ TableColumn column = getColumnModel().getColumn(i);
+ column.setPreferredWidth(COLUMN_WIDTHS[i]);
+ }
+
+ setFillsViewportHeight(true);
+ }
+
+ public void setChangeEvents(List<ChangeEvent> changeEvents) {
+ this.changeEvents = changeEvents;
+ ((AbstractTableModel) getModel()).fireTableDataChanged();
+ }
+
+ public List<ChangeEvent> getChangeEvents() {
+ return changeEvents;
+ }
+
+ static class ChangeLogTableModel extends AbstractTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private ChangeLogTable table;
+
+ public ChangeLogTableModel(ChangeLogTable table) {
+ this.table = table;
+ }
+
+ public String getColumnName(int columnIndex) {
+ return COLUMN_NAMES[columnIndex];
+ }
+
+ public int getColumnCount() {
+ return COLUMN_NAMES.length;
+ }
+
+ public int getRowCount() {
+ if (table.getChangeEvents() == null) {
+ return 0;
+ }
+
+ return table.getChangeEvents().size();
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ ChangeEvent event = table.getChangeEvents().get(rowIndex);
+
+ switch (columnIndex) {
+ case 0:
+ return (event.getChangeType() == null ? "?" : event.getChangeType().value());
+ case 1:
+ return (event.getObjectId() == null ? "?" : event.getObjectId());
+ case 2:
+ return event.getChangeTime();
+ case 3:
+ return event.getProperties().entrySet();
+ }
+
+ return null;
+ }
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+ if (columnIndex == 2) {
+ return GregorianCalendar.class;
+ } else if (columnIndex == 3) {
+ return Collection.class;
+ }
+
+ return super.getColumnClass(columnIndex);
+ }
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ChangeLogFrame.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,433 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import groovy.ui.Console;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Desktop;
+import java.awt.Desktop.Action;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+
+import org.apache.chemistry.opencmis.workbench.details.DetailsTabs;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.model.ClientSession;
+
+public class ClientFrame extends JFrame {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String WINDOW_TITLE = "CMIS Workbench";
+
+ private static final int BUTTON_CONNECT = 0;
+ private static final int BUTTON_REPOSITORY_INFO = 1;
+ private static final int BUTTON_TYPES = 2;
+ private static final int BUTTON_QUERY = 3;
+ private static final int BUTTON_CHANGELOG = 4;
+ private static final int BUTTON_CONSOLE = 5;
+ private static final int BUTTON_CREATE_DOCUMENT = 6;
+ private static final int BUTTON_CREATE_FOLDER = 7;
+ private static final int BUTTON_LOG = 8;
+ private static final int BUTTON_INFO = 9;
+
+ private static final String GROOVY_SCRIPT_FOLDER = "/scripts/";
+ private static final String GROOVY_SCRIPT_LIBRARY = "script-library.properties";
+
+ private LoginDialog loginDialog;
+ private LogFrame logFrame;
+ private InfoDialog infoDialog;
+
+ private JToolBar toolBar;
+ private JButton[] toolbarButton;
+ private JPopupMenu toolbarConsolePopup;
+
+ private FolderPanel folderPanel;
+ private DetailsTabs detailsTabs;
+
+ private ClientModel model;
+
+ public ClientFrame() {
+ super();
+
+ model = new ClientModel();
+ createGUI();
+ showLoginForm();
+ }
+
+ private void createGUI() {
+ setTitle(WINDOW_TITLE);
+ setPreferredSize(new Dimension(1000, 600));
+ setMinimumSize(new Dimension(200, 60));
+
+ ImageIcon icon = ClientHelper.getIcon("icon.png");
+ if (icon != null) {
+ setIconImage(icon.getImage());
+ }
+
+ setLayout(new BorderLayout());
+
+ final ClientFrame thisFrame = this;
+ loginDialog = new LoginDialog(this);
+ logFrame = new LogFrame();
+ infoDialog = new InfoDialog(this);
+
+ Container pane = getContentPane();
+
+ toolBar = new JToolBar("CMIS Toolbar", JToolBar.HORIZONTAL);
+
+ toolbarButton = new JButton[10];
+
+ toolbarButton[BUTTON_CONNECT] = new JButton("Connection", ClientHelper.getIcon("connect.png"));
+ toolbarButton[BUTTON_CONNECT].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ showLoginForm();
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CONNECT]);
+
+ toolBar.addSeparator();
+
+ toolbarButton[BUTTON_REPOSITORY_INFO] = new JButton("Repository Info",
+ ClientHelper.getIcon("repository-info.png"));
+ toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
+ toolbarButton[BUTTON_REPOSITORY_INFO].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new RepositoryInfoFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_REPOSITORY_INFO]);
+
+ toolbarButton[BUTTON_TYPES] = new JButton("Types", ClientHelper.getIcon("types.png"));
+ toolbarButton[BUTTON_TYPES].setEnabled(false);
+ toolbarButton[BUTTON_TYPES].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new TypesFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_TYPES]);
+
+ toolbarButton[BUTTON_QUERY] = new JButton("Query", ClientHelper.getIcon("query.png"));
+ toolbarButton[BUTTON_QUERY].setEnabled(false);
+ toolbarButton[BUTTON_QUERY].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new QueryFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_QUERY]);
+
+ toolbarButton[BUTTON_CHANGELOG] = new JButton("Change Log", ClientHelper.getIcon("changelog.png"));
+ toolbarButton[BUTTON_CHANGELOG].setEnabled(false);
+ toolbarButton[BUTTON_CHANGELOG].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new ChangeLogFrame(model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CHANGELOG]);
+
+ toolbarButton[BUTTON_CONSOLE] = new JButton("Console", ClientHelper.getIcon("console.png"));
+ toolbarButton[BUTTON_CONSOLE].setEnabled(false);
+ toolbarButton[BUTTON_CONSOLE].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ toolbarConsolePopup.show(toolbarButton[BUTTON_CONSOLE], 0, toolbarButton[BUTTON_CONSOLE].getHeight());
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CONSOLE]);
+
+ toolbarConsolePopup = new JPopupMenu();
+ for (CmisScript s : readScriptLibrary()) {
+ JMenuItem menuItem = new JMenuItem(s.getName());
+ final String path = s.getPath();
+ menuItem.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ openConsole(path);
+ }
+ });
+ toolbarConsolePopup.add(menuItem);
+ }
+
+ toolBar.addSeparator();
+
+ toolbarButton[BUTTON_CREATE_DOCUMENT] = new JButton("Create Document", ClientHelper.getIcon("newdocument.png"));
+ toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_DOCUMENT].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new CreateDocumentDialog(thisFrame, model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CREATE_DOCUMENT]);
+
+ toolbarButton[BUTTON_CREATE_FOLDER] = new JButton("Create Folder", ClientHelper.getIcon("newfolder.png"));
+ toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_FOLDER].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ new CreateFolderDialog(thisFrame, model);
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_CREATE_FOLDER]);
+
+ toolBar.addSeparator();
+
+ toolbarButton[BUTTON_LOG] = new JButton("Log", ClientHelper.getIcon("log.png"));
+ toolbarButton[BUTTON_LOG].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ logFrame.showFrame();
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_LOG]);
+
+ toolbarButton[BUTTON_INFO] = new JButton("Info", ClientHelper.getIcon("info.png"));
+ toolbarButton[BUTTON_INFO].addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ infoDialog.showDialog();
+ }
+ });
+
+ toolBar.add(toolbarButton[BUTTON_INFO]);
+
+ pane.add(toolBar, BorderLayout.PAGE_START);
+
+ folderPanel = new FolderPanel(model);
+ detailsTabs = new DetailsTabs(model);
+
+ JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, folderPanel, new JScrollPane(detailsTabs));
+
+ pane.add(split, BorderLayout.CENTER);
+
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ pack();
+
+ split.setDividerLocation(500);
+
+ setLocationRelativeTo(null);
+ setVisible(true);
+ }
+
+ private void showLoginForm() {
+ loginDialog.showDialog();
+ if (!loginDialog.isCanceled()) {
+ ClientSession clientSession = loginDialog.getClientSession();
+
+ model.setClientSession(clientSession);
+
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ model.loadFolder(clientSession.getSession().getRepositoryInfo().getRootFolderId(), false);
+ model.loadObject(clientSession.getSession().getRepositoryInfo().getRootFolderId());
+
+ toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(true);
+ toolbarButton[BUTTON_TYPES].setEnabled(true);
+ toolbarButton[BUTTON_QUERY].setEnabled(model.supportsQuery());
+ toolbarButton[BUTTON_CHANGELOG].setEnabled(model.supportsChangeLog());
+ toolbarButton[BUTTON_CONSOLE].setEnabled(true);
+ toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(true);
+ toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(true);
+
+ setTitle(WINDOW_TITLE + " - " + clientSession.getSession().getRepositoryInfo().getName());
+ } catch (Exception ex) {
+ toolbarButton[BUTTON_REPOSITORY_INFO].setEnabled(false);
+ toolbarButton[BUTTON_TYPES].setEnabled(false);
+ toolbarButton[BUTTON_QUERY].setEnabled(false);
+ toolbarButton[BUTTON_CHANGELOG].setEnabled(false);
+ toolbarButton[BUTTON_CONSOLE].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_DOCUMENT].setEnabled(false);
+ toolbarButton[BUTTON_CREATE_FOLDER].setEnabled(false);
+
+ ClientHelper.showError(null, ex);
+
+ setTitle(WINDOW_TITLE);
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+ }
+
+ private void openConsole(String path) {
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ Console console = new Console(this.getClass().getClassLoader());
+ console.setVariable("session", model.getClientSession().getSession());
+ console.setVariable("binding", model.getClientSession().getSession().getBinding());
+
+ console.run();
+
+ JMenu cmisMenu = new JMenu("CMIS");
+ console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);
+
+ addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
+ "http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
+ addConsoleMenu(cmisMenu, "OpenCMIS Documentation", new URI(
+ "http://incubator.apache.org/chemistry/opencmis.html"));
+ addConsoleMenu(
+ cmisMenu,
+ "OpenCMIS Client API JavaDoc",
+ new URI(
+ "http://incubator.apache.org/chemistry/javadoc/org/apache/chemistry/opencmis/client/api/package-summary.html"));
+
+ console.getInputArea().setText(readScript(path));
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+ private void addConsoleMenu(JMenu menu, String title, final URI url) {
+ if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Action.BROWSE)) {
+ return;
+ }
+
+ JMenuItem menuItem = new JMenuItem(title);
+ menuItem.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ Desktop.getDesktop().browse(url);
+ } catch (IOException e1) {
+ }
+ }
+ });
+
+ menu.add(menuItem);
+ }
+
+ private List<CmisScript> readScriptLibrary() {
+ InputStream stream = this.getClass().getResourceAsStream(GROOVY_SCRIPT_FOLDER + GROOVY_SCRIPT_LIBRARY);
+ if (stream == null) {
+ return Collections.singletonList(new CmisScript("Groovy Console", null));
+ }
+
+ try {
+ Properties properties = new Properties();
+ properties.load(stream);
+ stream.close();
+
+ List<CmisScript> result = new ArrayList<CmisScript>();
+ for (String script : properties.stringPropertyNames()) {
+ result.add(new CmisScript(properties.getProperty(script), GROOVY_SCRIPT_FOLDER + script));
+ }
+ Collections.sort(result);
+
+ return result;
+ } catch (IOException e) {
+ return Collections.singletonList(new CmisScript("Groovy Console", null));
+ }
+ }
+
+ private String readScript(String path) throws Exception {
+ if (path == null) {
+ return "";
+ }
+
+ InputStream stream = this.getClass().getResourceAsStream(path);
+ if (stream == null) {
+ throw new Exception("Groovy script is missing!");
+ } else {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+ StringBuilder sb = new StringBuilder();
+ String s;
+ boolean header = true;
+
+ while ((s = reader.readLine()) != null) {
+ // remove header
+ if (header) {
+ String st = s.trim();
+ if (st.length() == 0) {
+ continue;
+ }
+
+ char c = st.charAt(0);
+ header = (c == '/') || (c == '*');
+ if (header) {
+ continue;
+ }
+ }
+
+ sb.append(s);
+ sb.append("\n");
+ }
+
+ reader.close();
+
+ return sb.toString();
+ }
+ }
+
+ static class CmisScript implements Comparable<CmisScript> {
+ private String name;
+ private String path;
+
+ public CmisScript(String name, String path) {
+ this.name = name;
+ this.path = path;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public int compareTo(CmisScript o) {
+ return name.compareToIgnoreCase(o.getName());
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientFrame.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,222 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import java.awt.Component;
+import java.awt.Desktop;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.GregorianCalendar;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ClientHelper {
+
+ private static Log log = LogFactory.getLog(ClientHelper.class);
+ private static int BUFFER_SIZE = 64 * 1024;
+
+ public static void showError(Component parent, Exception ex) {
+ if (log.isErrorEnabled()) {
+ log.error(ex.getClass().getSimpleName() + ": " + ex.getMessage(), ex);
+
+ if (ex instanceof CmisBaseException) {
+ CmisBaseException cex = (CmisBaseException) ex;
+
+ if (cex.getCode() != null) {
+ log.error("Error code: " + cex.getCode());
+ }
+
+ if (cex.getErrorContent() != null) {
+ log.error("Error content: " + cex.getErrorContent());
+ }
+ }
+ }
+
+ JOptionPane.showMessageDialog(parent, ex.getClass().getSimpleName() + "\n" + ex.getMessage(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+
+ public static ImageIcon getIcon(String name) {
+ URL imageURL = ClientHelper.class.getResource("/images/" + name);
+ if (imageURL != null) {
+ return new ImageIcon(imageURL);
+ }
+
+ return null;
+ }
+
+ public static String getDateString(GregorianCalendar cal) {
+ if (cal == null) {
+ return "";
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss ZZZ");
+ return sdf.format(cal.getTime());
+ }
+
+ public static void download(Component component, Document doc, String streamId) {
+ String filename = doc.getContentStreamFileName();
+
+ if (filename == null) {
+ return;
+ }
+
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setSelectedFile(new File(filename));
+
+ int chooseResult = fileChooser.showDialog(component, "Download");
+ if (chooseResult == JFileChooser.APPROVE_OPTION) {
+ try {
+ ContentStream content = doc.getContentStream(streamId);
+ if (content == null) {
+ throw new Exception("No content!");
+ }
+
+ storeStream(content.getStream(), fileChooser.getSelectedFile());
+ } catch (Exception e) {
+ showError(component, e);
+ }
+ }
+ }
+
+ public static void copy(Component component, File file) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setSelectedFile(new File(file.getName()));
+
+ int chooseResult = fileChooser.showDialog(component, "Download");
+ if (chooseResult == JFileChooser.APPROVE_OPTION) {
+ try {
+ storeStream(new FileInputStream(file), fileChooser.getSelectedFile());
+ } catch (Exception e) {
+ showError(component, e);
+ }
+ }
+ }
+
+ public static void open(Component component, Document doc, String streamId) {
+ if (!Desktop.isDesktopSupported()) {
+ download(component, doc, streamId);
+ return;
+ }
+
+ Desktop desktop = Desktop.getDesktop();
+
+ if (!desktop.isSupported(Desktop.Action.OPEN)) {
+ download(component, doc, streamId);
+ return;
+ }
+
+ File file = null;
+
+ try {
+ file = createTempFileFromDocument(doc, streamId);
+ } catch (Exception e) {
+ showError(component, e);
+ }
+
+ try {
+ desktop.open(file);
+ } catch (Exception e) {
+ if (e instanceof IOException) {
+ copy(component, file);
+ } else {
+ showError(component, e);
+ }
+ }
+ }
+
+ public static File createTempFile(String filename) {
+ String tempDir = System.getProperty("java.io.tmpdir");
+ File clientTempDir = new File(tempDir, "cmisworkbench");
+ if (!clientTempDir.exists()) {
+ clientTempDir.mkdirs();
+ }
+ clientTempDir.deleteOnExit();
+
+ File tempFile = new File(clientTempDir, filename);
+ tempFile.deleteOnExit();
+
+ return tempFile;
+ }
+
+ public static File createTempFileFromDocument(Document doc, String streamId) throws Exception {
+ ContentStream content = doc.getContentStream(streamId);
+ if (content == null) {
+ throw new Exception("No content!");
+ }
+
+ String filename = content.getFileName();
+ if ((filename == null) || (filename.length() == 0)) {
+ filename = doc.getContentStreamFileName();
+ }
+ if ((filename == null) || (filename.length() == 0)) {
+ filename = doc.getName();
+ }
+ if ((filename == null) || (filename.length() == 0)) {
+ filename = "document";
+ }
+
+ File tempFile = ClientHelper.createTempFile(filename);
+ storeStream(content.getStream(), tempFile);
+
+ return tempFile;
+ }
+
+ private static void storeStream(InputStream in, File file) throws IOException {
+ OutputStream out = null;
+ try {
+ out = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE);
+
+ byte[] buffer = new byte[BUFFER_SIZE];
+ int b;
+ while ((b = in.read(buffer)) > -1) {
+ out.write(buffer, 0, b);
+ }
+
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (Exception e) {
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+import org.apache.log4j.WriterAppender;
+import org.apache.log4j.spi.LoggingEvent;
+
+public class ClientWriterAppender extends WriterAppender {
+
+ private static JTextArea logTextArea = null;
+
+ public static void setTextArea(JTextArea textArea) {
+ logTextArea = textArea;
+ }
+
+ @Override
+ public void append(LoggingEvent loggingEvent) {
+ if (logTextArea == null) {
+ return;
+ }
+
+ final String message = layout.format(loggingEvent);
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ logTextArea.append(message);
+ }
+ });
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientWriterAppender.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,145 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import java.awt.BorderLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+
+public class CreateDocumentDialog extends CreateDialog {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField nameField;
+ private JComboBox typeBox;
+ private JTextField filenameField;
+ private JComboBox versioningStateBox;
+
+ public CreateDocumentDialog(Frame owner, ClientModel model) {
+ this(owner, model, null);
+ }
+
+ public CreateDocumentDialog(Frame owner, ClientModel model, File file) {
+ super(owner, "Create Document", model);
+ createGUI(file);
+ }
+
+ private void createGUI(File file) {
+ final CreateDocumentDialog thisDialog = this;
+
+ nameField = new JTextField(60);
+ createRow("Name:", nameField, 0);
+
+ typeBox = new JComboBox(getTypes(BaseTypeId.CMIS_DOCUMENT.value()));
+ typeBox.setSelectedIndex(0);
+ typeBox.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ DocumentTypeDefinition type = (DocumentTypeDefinition) ((ObjectTypeItem) typeBox.getSelectedItem())
+ .getObjectType();
+ if (type.isVersionable()) {
+ versioningStateBox.setSelectedItem(VersioningState.MAJOR);
+ } else {
+ versioningStateBox.setSelectedItem(VersioningState.NONE);
+ }
+ }
+ });
+
+ createRow("Type:", typeBox, 1);
+
+ JPanel filePanel = new JPanel(new BorderLayout());
+
+ filenameField = new JTextField(30);
+ filePanel.add(filenameField, BorderLayout.CENTER);
+
+ JButton browseButton = new JButton("Browse");
+ browseButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ JFileChooser fileChooser = new JFileChooser();
+ int chooseResult = fileChooser.showDialog(filenameField, "Select");
+ if (chooseResult == JFileChooser.APPROVE_OPTION) {
+ if (fileChooser.getSelectedFile().isFile()) {
+ setFile(fileChooser.getSelectedFile());
+ }
+ }
+ }
+ });
+ filePanel.add(browseButton, BorderLayout.LINE_END);
+
+ createRow("File:", filePanel, 2);
+
+ versioningStateBox = new JComboBox(new Object[] { VersioningState.NONE, VersioningState.MAJOR,
+ VersioningState.MINOR, VersioningState.CHECKEDOUT });
+ if (((DocumentTypeDefinition) ((ObjectTypeItem) typeBox.getSelectedItem()).getObjectType()).isVersionable()) {
+ versioningStateBox.setSelectedItem(VersioningState.MAJOR);
+ } else {
+ versioningStateBox.setSelectedItem(VersioningState.NONE);
+ }
+ createRow("Versioning State:", versioningStateBox, 3);
+
+ JButton createButton = new JButton("Create Document");
+ createButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ String name = nameField.getText();
+ String type = ((ObjectTypeItem) typeBox.getSelectedItem()).getObjectType().getId();
+ String filename = filenameField.getText();
+
+ try {
+ getClientModel().createDocument(name, type, filename,
+ (VersioningState) versioningStateBox.getSelectedItem());
+ getClientModel().reloadFolder();
+
+ thisDialog.setVisible(false);
+ thisDialog.dispose();
+ } catch (Exception e) {
+ ClientHelper.showError(null, e);
+ }
+ }
+ });
+ createRow("", createButton, 4);
+
+ if (file != null) {
+ setFile(file);
+ }
+
+ showDialog();
+ }
+
+ private void setFile(File file) {
+ filenameField.setText(file.getAbsolutePath());
+ if (nameField.getText().trim().length() == 0) {
+ nameField.setText(file.getName());
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateDocumentDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.CreateDialog;
+
+public class CreateFolderDialog extends CreateDialog {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField nameField;
+ private JComboBox typeBox;
+
+ public CreateFolderDialog(Frame owner, ClientModel model) {
+ super(owner, "Create Folder", model);
+ createGUI();
+ }
+
+ private void createGUI() {
+ final CreateFolderDialog thisDialog = this;
+
+ nameField = new JTextField(60);
+ createRow("Name:", nameField, 0);
+
+ typeBox = new JComboBox(getTypes(BaseTypeId.CMIS_FOLDER.value()));
+ typeBox.setSelectedIndex(0);
+ createRow("Type:", typeBox, 1);
+
+ JButton createButton = new JButton("Create Folder");
+ createButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ String name = nameField.getText();
+ String type = ((ObjectTypeItem) typeBox.getSelectedItem())
+ .getObjectType().getId();
+
+ try {
+ getClientModel().createFolder(name, type);
+ getClientModel().reloadFolder();
+
+ thisDialog.setVisible(false);
+ thisDialog.dispose();
+ } catch (Exception e) {
+ ClientHelper.showError(null, e);
+ }
+ }
+ });
+ createRow("", createButton, 3);
+
+ showDialog();
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/CreateFolderDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java?rev=1005006&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java Wed Oct 6 12:32:23 2010
@@ -0,0 +1,158 @@
+/*
+ * 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.chemistry.opencmis.workbench;
+
+import java.awt.BorderLayout;
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.model.ClientModelEvent;
+import org.apache.chemistry.opencmis.workbench.model.FolderListener;
+
+public class FolderPanel extends JPanel implements FolderListener {
+
+ private static final long serialVersionUID = 1L;
+
+ private ClientModel model;
+
+ private String parentId;
+
+ private JButton upButton;
+ private JTextField pathField;
+ private JButton goButton;
+ private FolderTable folderTable;
+
+ public FolderPanel(ClientModel model) {
+ super();
+
+ this.model = model;
+ model.addFolderListener(this);
+ createGUI();
+ }
+
+ public void folderLoaded(ClientModelEvent event) {
+ Folder currentFolder = event.getClientModel().getCurrentFolder();
+
+ if (currentFolder != null) {
+ String path = currentFolder.getPath();
+ pathField.setText(path);
+
+ Folder parent = currentFolder.getFolderParent();
+ if (parent == null) {
+ parentId = null;
+ upButton.setEnabled(false);
+ } else {
+ parentId = parent.getId();
+ upButton.setEnabled(true);
+ }
+ } else {
+ pathField.setText("???");
+ parentId = null;
+ upButton.setEnabled(false);
+ }
+ }
+
+ private void createGUI() {
+ setLayout(new BorderLayout());
+
+ JPanel panel = new JPanel();
+ // panel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 3));
+ panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
+ panel.setBorder(BorderFactory.createEmptyBorder(3, 0, 2, 0));
+
+ upButton = new JButton("up");
+ upButton.setEnabled(false);
+ upButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ model.loadFolder(parentId, false);
+ model.loadObject(model.getCurrentFolder().getId());
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ return;
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+ });
+ panel.add(upButton);
+
+ pathField = new JTextField("");
+ pathField.addKeyListener(new KeyListener() {
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ loadFolder();
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+ panel.add(pathField);
+
+ goButton = new JButton("go");
+ goButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ loadFolder();
+ }
+ });
+ panel.add(goButton);
+
+ add(panel, BorderLayout.PAGE_START);
+
+ folderTable = new FolderTable(model);
+ folderTable.setFillsViewportHeight(true);
+ model.addFolderListener(folderTable);
+
+ add(new JScrollPane(folderTable), BorderLayout.CENTER);
+ }
+
+ private void loadFolder() {
+ try {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ String id = pathField.getText().trim();
+ if (id.length() == 0) {
+ id = "/";
+ }
+ model.loadFolder(id, id.startsWith("/"));
+ model.loadObject(model.getCurrentFolder().getId());
+ } catch (Exception ex) {
+ ClientHelper.showError(null, ex);
+ return;
+ } finally {
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/FolderPanel.java
------------------------------------------------------------------------------
svn:eol-style = native