chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r966582 [3/3] - in /incubator/chemistry/opencmis-swingclient/trunk: ./ src/ src/main/ src/main/assembly/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/chemistry/ src/main/java/org/apache/chemistry/open...
Date Thu, 22 Jul 2010 11:19:11 GMT
Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,328 @@
+/*
+ * 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.swingclient.model;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.event.EventListenerList;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.Folder;
+import org.apache.chemistry.opencmis.client.api.ItemIterable;
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.client.api.OperationContext;
+import org.apache.chemistry.opencmis.client.api.QueryResult;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.client.api.Tree;
+import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+
+public class ClientModel {
+
+	private static final Set<String> PROPERTY_SET = new HashSet<String>();
+	static {
+		PROPERTY_SET.add(PropertyIds.OBJECT_ID);
+		PROPERTY_SET.add(PropertyIds.OBJECT_TYPE_ID);
+		PROPERTY_SET.add(PropertyIds.NAME);
+		PROPERTY_SET.add(PropertyIds.CONTENT_STREAM_MIME_TYPE);
+		PROPERTY_SET.add(PropertyIds.CONTENT_STREAM_LENGTH);
+		PROPERTY_SET.add(PropertyIds.CONTENT_STREAM_FILE_NAME);
+		PROPERTY_SET.add(PropertyIds.CREATED_BY);
+		PROPERTY_SET.add(PropertyIds.CREATION_DATE);
+		PROPERTY_SET.add(PropertyIds.LAST_MODIFIED_BY);
+		PROPERTY_SET.add(PropertyIds.LAST_MODIFICATION_DATE);
+	}
+
+	private static OperationContext FOLDER_OC = null;
+
+	private static final OperationContext OBJECT_OC = new OperationContextImpl(
+			Collections.singleton("*"), true, true, true,
+			IncludeRelationships.BOTH, Collections.singleton("*"), false, null,
+			true, 1000);
+
+	// object details must not be older than 60 seconds
+	private static final long OLD = 60 * 1000;
+
+	private ClientSession clientSession;
+
+	private Folder currentFolder = null;
+	private List<CmisObject> currentChildren = Collections.emptyList();
+	private CmisObject currentObject = null;
+
+	private EventListenerList listenerList = new EventListenerList();
+
+	public ClientModel() {
+
+	}
+
+	public void addFolderListener(FolderListener listener) {
+		listenerList.add(FolderListener.class, listener);
+	}
+
+	public void removeFolderListener(FolderListener listener) {
+		listenerList.remove(FolderListener.class, listener);
+	}
+
+	public void addObjectListener(ObjectListener listener) {
+		listenerList.add(ObjectListener.class, listener);
+	}
+
+	public void removeObjectListener(ObjectListener listener) {
+		listenerList.remove(ObjectListener.class, listener);
+	}
+
+	public synchronized void setClientSession(ClientSession clientSession) {
+		this.clientSession = clientSession;
+		FOLDER_OC = createFolderOperationContext();
+	}
+
+	public synchronized RepositoryInfo getRepositoryInfo() throws Exception {
+		Session session = clientSession.getSession();
+		return session.getRepositoryInfo();
+	}
+
+	public synchronized String getRepositoryName() {
+		try {
+			return getRepositoryInfo().getName();
+		} catch (Exception e) {
+			return "?";
+		}
+	}
+
+	public synchronized boolean supportsQuery() {
+		try {
+			RepositoryCapabilities cap = getRepositoryInfo().getCapabilities();
+			if (cap == null) {
+				return true;
+			}
+
+			return (cap.getQueryCapability() != null)
+					&& (cap.getQueryCapability() != CapabilityQuery.NONE);
+		} catch (Exception e) {
+			return false;
+		}
+	}
+
+	public synchronized void loadFolder(String folderId, boolean byPath)
+			throws Exception {
+		try {
+			Session session = clientSession.getSession();
+			CmisObject folderObject = null;
+
+			if (byPath) {
+				folderObject = session.getObjectByPath(folderId);
+			} else {
+				folderObject = session.getObject(session
+						.createObjectId(folderId));
+			}
+
+			if (!(folderObject instanceof Folder)) {
+				throw new Exception("Not a folder!");
+			}
+
+			List<CmisObject> children = new ArrayList<CmisObject>();
+			ItemIterable<CmisObject> iter = ((Folder) folderObject)
+					.getChildren(FOLDER_OC);
+			for (CmisObject child : iter) {
+				children.add(child);
+			}
+
+			setCurrentFolder((Folder) folderObject, children);
+		} catch (Exception ex) {
+			setCurrentFolder(null, new ArrayList<CmisObject>(0));
+			throw ex;
+		}
+	}
+
+	public synchronized void reloadFolder() throws Exception {
+		loadFolder(currentFolder.getId(), false);
+	}
+
+	public synchronized void loadObject(String objectId) throws Exception {
+		try {
+			Session session = clientSession.getSession();
+			CmisObject object = session.getObject(session
+					.createObjectId(objectId), OBJECT_OC);
+			object.refreshIfOld(OLD);
+
+			setObjectFolder(object);
+		} catch (Exception ex) {
+			setObjectFolder(null);
+			throw ex;
+		}
+	}
+
+	public synchronized ItemIterable<QueryResult> query(String q,
+			boolean searchAllVersions, int maxHits) throws Exception {
+		OperationContext queryContext = new OperationContextImpl(null, false,
+				false, false, IncludeRelationships.NONE, null, false, null,
+				false, maxHits);
+
+		Session session = clientSession.getSession();
+		return session.query(q, searchAllVersions, queryContext);
+	}
+
+	public synchronized List<Tree<ObjectType>> getTypeDescendants()
+			throws Exception {
+		Session session = clientSession.getSession();
+		return session.getTypeDescendants(null, -1, true);
+	}
+
+	public ContentStream createContentStream(String filename) throws Exception {
+		ContentStream content = null;
+		if ((filename != null) && (filename.length() > 0)) {
+			File file = new File(filename);
+			InputStream stream = new FileInputStream(file);
+
+			content = clientSession.getSession().getObjectFactory()
+					.createContentStream(file.getName(), file.length(),
+							MIMETypes.getMIMEType(file), stream);
+		}
+
+		return content;
+	}
+
+	public synchronized void createDocument(String name, String type,
+			String filename, VersioningState versioningState) throws Exception {
+		Map<String, Object> properties = new HashMap<String, Object>();
+		properties.put(PropertyIds.NAME, name);
+		properties.put(PropertyIds.OBJECT_TYPE_ID, type);
+
+		ContentStream content = createContentStream(filename);
+		clientSession.getSession().createDocument(properties, currentFolder,
+				content, versioningState, null, null, null);
+	}
+
+	public synchronized void createFolder(String name, String type)
+			throws Exception {
+		Map<String, Object> properties = new HashMap<String, Object>();
+		properties.put(PropertyIds.NAME, name);
+		properties.put(PropertyIds.OBJECT_TYPE_ID, type);
+
+		clientSession.getSession().createFolder(properties, currentFolder,
+				null, null, null);
+	}
+
+	public synchronized List<ObjectType> getCreateableTypes(String rootTypeId) {
+		List<ObjectType> result = new ArrayList<ObjectType>();
+
+		List<Tree<ObjectType>> types = clientSession.getSession()
+				.getTypeDescendants(rootTypeId, -1, false);
+		addType(types, result);
+
+		ObjectType rootType = clientSession.getSession().getTypeDefinition(
+				rootTypeId);
+		boolean isCreatable = (rootType.isCreatable() == null ? true : rootType
+				.isCreatable().booleanValue());
+		if (isCreatable) {
+			result.add(rootType);
+		}
+
+		Collections.sort(result, new Comparator<ObjectType>() {
+			public int compare(ObjectType ot1, ObjectType ot2) {
+				return ot1.getDisplayName().compareTo(ot2.getDisplayName());
+			}
+		});
+
+		return result;
+	}
+
+	private void addType(List<Tree<ObjectType>> types,
+			List<ObjectType> resultList) {
+		for (Tree<ObjectType> tt : types) {
+			if (tt.getItem() != null) {
+				boolean isCreatable = (tt.getItem().isCreatable() == null ? true
+						: tt.getItem().isCreatable().booleanValue());
+
+				if (isCreatable) {
+					resultList.add(tt.getItem());
+				}
+
+				addType(tt.getChildren(), resultList);
+			}
+		}
+	}
+
+	public synchronized Folder getCurrentFolder() {
+		return currentFolder;
+	}
+
+	public synchronized List<CmisObject> getCurrentChildren() {
+		return currentChildren;
+	}
+
+	private synchronized void setCurrentFolder(Folder folder,
+			List<CmisObject> children) {
+		currentFolder = folder;
+		currentChildren = children;
+
+		for (FolderListener fl : listenerList
+				.getListeners(FolderListener.class)) {
+			fl.folderLoaded(new ClientModelEvent(this));
+		}
+	}
+
+	public synchronized CmisObject getCurrentObject() {
+		return currentObject;
+	}
+
+	private synchronized void setObjectFolder(CmisObject object) {
+		currentObject = object;
+
+		for (ObjectListener ol : listenerList
+				.getListeners(ObjectListener.class)) {
+			ol.objectLoaded(new ClientModelEvent(this));
+		}
+	}
+
+	private synchronized OperationContext createFolderOperationContext() {
+		ObjectType type = clientSession.getSession().getTypeDefinition(
+				BaseTypeId.CMIS_DOCUMENT.value());
+
+		Set<String> filter = new HashSet<String>();
+		for (String propId : PROPERTY_SET) {
+			PropertyDefinition<?> propDef = type.getPropertyDefinitions().get(
+					propId);
+			if (propDef != null) {
+				filter.add(propDef.getQueryName());
+			}
+		}
+
+		return new OperationContextImpl(filter, false, true, false,
+				IncludeRelationships.NONE, null, false, null, false, 1000);
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModelEvent.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModelEvent.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModelEvent.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModelEvent.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.swingclient.model;
+
+import java.util.EventObject;
+
+public class ClientModelEvent extends EventObject {
+
+	private static final long serialVersionUID = 1L;
+
+	public ClientModelEvent(Object source) {
+		super(source);
+	}
+
+	public ClientModel getClientModel() {
+		if (getSource() instanceof ClientModel) {
+			return (ClientModel) getSource();
+		}
+
+		return null;
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientModelEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientSession.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientSession.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientSession.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientSession.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.swingclient.model;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.client.api.Repository;
+import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.enums.BindingType;
+
+public class ClientSession {
+
+	private List<Repository> repositories;
+	private Session session;
+
+	public ClientSession(String url, BindingType binding, String username,
+			String password) {
+		Map<String, String> parameters = new HashMap<String, String>();
+
+		if (binding == BindingType.WEBSERVICES) {
+			parameters.put(SessionParameter.BINDING_TYPE,
+					BindingType.WEBSERVICES.value());
+			parameters
+					.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, url);
+			parameters
+					.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, url);
+			parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, url);
+			parameters
+					.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, url);
+			parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, url);
+			parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE,
+					url);
+			parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE,
+					url);
+			parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, url);
+			parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, url);
+		} else {
+			parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB
+					.value());
+			parameters.put(SessionParameter.ATOMPUB_URL, url);
+		}
+		parameters.put(SessionParameter.USER, username);
+		parameters.put(SessionParameter.PASSWORD, password);
+
+		connect(parameters);
+	}
+
+	public ClientSession(Map<String, String> sessionParameters) {
+		if (sessionParameters == null) {
+			throw new IllegalArgumentException("Parameters must not be null!");
+		}
+
+		connect(sessionParameters);
+	}
+
+	private void connect(Map<String, String> sessionParameters) {
+		repositories = SessionFactoryImpl.newInstance().getRepositories(
+				sessionParameters);
+	}
+
+	public List<Repository> getRepositories() {
+		return repositories;
+	}
+
+	public Session createSession(int index) {
+		session = repositories.get(index).createSession();
+		return getSession();
+	}
+
+	public Session getSession() {
+		return session;
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ClientSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/FolderListener.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/FolderListener.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/FolderListener.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/FolderListener.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.swingclient.model;
+
+import java.util.EventListener;
+
+public interface FolderListener extends EventListener {
+
+	void folderLoaded(ClientModelEvent event);
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/FolderListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/MIMETypes.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/MIMETypes.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/MIMETypes.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/MIMETypes.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,253 @@
+/*
+ * 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.swingclient.model;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MIMETypes {
+
+	private static Map<String, String> EXT2MIME = new HashMap<String, String>();
+
+	static {
+		EXT2MIME.put("", "application/octet-stream");
+		EXT2MIME.put("ai", "application/postscript");
+		EXT2MIME.put("aif", "audio/x-aiff");
+		EXT2MIME.put("aifc", "audio/x-aiff");
+		EXT2MIME.put("aiff", "audio/x-aiff");
+		EXT2MIME.put("asf", "video/x-ms-asf");
+		EXT2MIME.put("asr", "video/x-ms-asf");
+		EXT2MIME.put("asx", "video/x-ms-asf");
+		EXT2MIME.put("au", "audio/basic");
+		EXT2MIME.put("avi", "video/x-msvideo");
+		EXT2MIME.put("axs", "application/olescript");
+		EXT2MIME.put("bas", "text/plain");
+		EXT2MIME.put("bmp", "image/bmp");
+		EXT2MIME.put("c", "text/plain");
+		EXT2MIME.put("cat", "application/vnd.ms-pkiseccat");
+		EXT2MIME.put("cdf", "application/x-cdf");
+		EXT2MIME.put("cer", "application/x-x509-ca-cert");
+		EXT2MIME.put("clp", "application/x-msclip");
+		EXT2MIME.put("cmx", "image/x-cmx");
+		EXT2MIME.put("cod", "image/cis-cod");
+		EXT2MIME.put("cpio", "application/x-cpio");
+		EXT2MIME.put("crd", "application/x-mscardfile");
+		EXT2MIME.put("crl", "application/pkix-crl");
+		EXT2MIME.put("crt", "application/x-x509-ca-cert");
+		EXT2MIME.put("csh", "application/x-csh");
+		EXT2MIME.put("css", "text/css");
+		EXT2MIME.put("dll", "application/x-msdownload");
+		EXT2MIME.put("doc", "application/msword");
+		EXT2MIME
+				.put("docx",
+						"application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+		EXT2MIME
+				.put("doct",
+						"application/vnd.openxmlformats-officedocument.wordprocessingml.template");
+		EXT2MIME.put("dot", "application/msword");
+		EXT2MIME.put("dvi", "application/x-dvi");
+		EXT2MIME.put("dxr", "application/x-director");
+		EXT2MIME.put("eps", "application/postscript");
+		EXT2MIME.put("etx", "text/x-setext");
+		EXT2MIME.put("evy", "application/envoy");
+		EXT2MIME.put("fif", "application/fractals");
+		EXT2MIME.put("flr", "x-world/x-vrml");
+		EXT2MIME.put("gif", "image/gif");
+		EXT2MIME.put("gtar", "application/x-gtar");
+		EXT2MIME.put("gz", "application/x-gzip");
+		EXT2MIME.put("h", "text/plain");
+		EXT2MIME.put("hdf", "application/x-hdf");
+		EXT2MIME.put("hlp", "application/winhlp");
+		EXT2MIME.put("hqx", "application/mac-binhex40");
+		EXT2MIME.put("hta", "application/hta");
+		EXT2MIME.put("htc", "text/x-component");
+		EXT2MIME.put("htm", "text/html");
+		EXT2MIME.put("html", "text/html");
+		EXT2MIME.put("htt", "text/webviewhtml");
+		EXT2MIME.put("ico", "image/x-icon");
+		EXT2MIME.put("ief", "image/ief");
+		EXT2MIME.put("iii", "application/x-iphone");
+		EXT2MIME.put("isp", "application/x-internet-signup");
+		EXT2MIME.put("jfif", "image/pipeg");
+		EXT2MIME.put("jpe", "image/jpeg");
+		EXT2MIME.put("jpeg", "image/jpeg");
+		EXT2MIME.put("jpg", "image/jpeg");
+		EXT2MIME.put("js", "application/x-javascript");
+		EXT2MIME.put("latex", "application/x-latex");
+		EXT2MIME.put("lsf", "video/x-la-asf");
+		EXT2MIME.put("lsx", "video/x-la-asf");
+		EXT2MIME.put("m3u", "audio/x-mpegurl");
+		EXT2MIME.put("man", "application/x-troff-man");
+		EXT2MIME.put("mdb", "application/x-msaccess");
+		EXT2MIME.put("me", "application/x-troff-me");
+		EXT2MIME.put("mhtv", "message/rfc822");
+		EXT2MIME.put("mhtml", "message/rfc822");
+		EXT2MIME.put("mid", "audio/mid");
+		EXT2MIME.put("mov", "video/quicktime");
+		EXT2MIME.put("movie", "video/x-sgi-movie");
+		EXT2MIME.put("mp2", "video/mpeg");
+		EXT2MIME.put("mp3", "audio/mpeg");
+		EXT2MIME.put("mpa", "video/mpeg");
+		EXT2MIME.put("mpe", "video/mpegv");
+		EXT2MIME.put("mpeg", "video/mpeg");
+		EXT2MIME.put("mpg", "video/mpegv");
+		EXT2MIME.put("mpp", "application/vnd.ms-project");
+		EXT2MIME.put("mpv2", "video/mpeg");
+		EXT2MIME.put("ms", "application/x-troff-ms");
+		EXT2MIME.put("mvb", "application/x-msmediaview");
+		EXT2MIME.put("nws", "message/rfc822");
+		EXT2MIME.put("oda", "application/oda");
+		EXT2MIME.put("p10", "application/pkcs10");
+		EXT2MIME.put("p12", "application/x-pkcs12v");
+		EXT2MIME.put("p7b", "application/x-pkcs7-certificates");
+		EXT2MIME.put("p7c", "application/x-pkcs7-mime");
+		EXT2MIME.put("p7m", "application/x-pkcs7-mime");
+		EXT2MIME.put("p7r", "application/x-pkcs7-certreqresp");
+		EXT2MIME.put("p7s", "application/x-pkcs7-signature");
+		EXT2MIME.put("pbm", "image/x-portable-bitmap");
+		EXT2MIME.put("pdf", "application/pdf");
+		EXT2MIME.put("pfx", "application/x-pkcs12");
+		EXT2MIME.put("pgm", "image/x-portable-graymap");
+		EXT2MIME.put("vpko", "application/ynd.ms-pkipko");
+		EXT2MIME.put("pma", "application/x-perfmon");
+		EXT2MIME.put("pmc", "application/x-perfmon");
+		EXT2MIME.put("pml", "application/x-perfmon");
+		EXT2MIME.put("pmr", "application/x-perfmon");
+		EXT2MIME.put("pmw", "application/x-perfmon");
+		EXT2MIME.put("png", "image/png");
+		EXT2MIME.put("pnm", "image/x-portable-anymap");
+		EXT2MIME.put("pot", "application/vnd.ms-powerpoint");
+		EXT2MIME.put("ppm", "image/x-portable-pixmap");
+		EXT2MIME.put("pps", "application/vnd.ms-powerpoint");
+		EXT2MIME.put("ppt", "application/vnd.ms-powerpoint");
+		EXT2MIME
+				.put("pptx",
+						"application/vnd.openxmlformats-officedocument.presentationml.presentation");
+		EXT2MIME
+				.put("ppsx",
+						"application/vnd.openxmlformats-officedocument.presentationml.slideshow");
+		EXT2MIME
+				.put("potx",
+						"application/vnd.openxmlformats-officedocument.presentationml.template");
+		EXT2MIME.put("prf", "application/pics-rules");
+		EXT2MIME.put("ps", "application/postscript");
+		EXT2MIME.put("pub", "application/x-mspublisher");
+		EXT2MIME.put("qt", "video/quicktime");
+		EXT2MIME.put("ra", "audio/x-pn-realaudio");
+		EXT2MIME.put("ram", "audio/x-pn-realaudio");
+		EXT2MIME.put("ras", "image/x-cmu-raster");
+		EXT2MIME.put("rgb", "image/x-rgb");
+		EXT2MIME.put("rmi", "audio/mid");
+		EXT2MIME.put("roff", "application/x-troff");
+		EXT2MIME.put("rtf", "application/rtf");
+		EXT2MIME.put("rtx", "text/richtext");
+		EXT2MIME.put("scd", "application/x-msschedule");
+		EXT2MIME.put("sct", "text/scriptlet");
+		EXT2MIME.put("sh", "application/x-sh");
+		EXT2MIME.put("shar", "application/x-shar");
+		EXT2MIME.put("sit", "application/x-stuffit");
+		EXT2MIME.put("snd", "audio/basic");
+		EXT2MIME.put("spc", "application/x-pkcs7-certificates");
+		EXT2MIME.put("spl", "application/futuresplash");
+		EXT2MIME.put("src", "application/x-wais-source");
+		EXT2MIME.put("sst", "application/vnd.ms-pkicertstore");
+		EXT2MIME.put("stl", "application/vnd.ms-pkistl");
+		EXT2MIME.put("stm", "text/html");
+		EXT2MIME.put("svg", "image/svg+xml");
+		EXT2MIME.put("swf", "application/x-shockwave-flash");
+		EXT2MIME.put("t", "application/x-troff");
+		EXT2MIME.put("tar", "application/x-tar");
+		EXT2MIME.put("tcl", "application/x-tcl");
+		EXT2MIME.put("tex", "application/x-tex");
+		EXT2MIME.put("texi", "application/x-texinfo");
+		EXT2MIME.put("texinfo", "application/x-texinfo");
+		EXT2MIME.put("tgz", "application/x-compressed");
+		EXT2MIME.put("tif", "image/tiff");
+		EXT2MIME.put("tiff", "image/tiff");
+		EXT2MIME.put("tr", "application/x-troff");
+		EXT2MIME.put("trm", "application/x-msterminal");
+		EXT2MIME.put("tsv", "text/tab-separated-values");
+		EXT2MIME.put("txt", "text/plain");
+		EXT2MIME.put("uls", "text/iuls");
+		EXT2MIME.put("ustar", "application/x-ustar");
+		EXT2MIME.put("vcf", "text/x-vcard");
+		EXT2MIME.put("vrml", "x-world/x-vrml");
+		EXT2MIME.put("wav", "audio/x-wav");
+		EXT2MIME.put("wcm", "application/vnd.ms-works");
+		EXT2MIME.put("wdb", "application/vnd.ms-works");
+		EXT2MIME.put("wmf", "application/x-msmetafile");
+		EXT2MIME.put("wps", "application/vnd.ms-works");
+		EXT2MIME.put("wri", "application/x-mswrite");
+		EXT2MIME.put("wrl", "x-world/x-vrml");
+		EXT2MIME.put("wrz", "x-world/x-vrml");
+		EXT2MIME.put("xaf", "x-world/x-vrml");
+		EXT2MIME.put("xbm", "image/x-xbitmap");
+		EXT2MIME.put("xla", "application/vnd.ms-excel");
+		EXT2MIME.put("xlc", "application/vnd.ms-excel");
+		EXT2MIME.put("xlm", "application/vnd.ms-excel");
+		EXT2MIME.put("xls", "application/vnd.ms-excel");
+		EXT2MIME
+				.put("xlsx",
+						"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		EXT2MIME.put("xlt", "application/vnd.ms-excel");
+		EXT2MIME
+				.put("xltx",
+						"application/vnd.openxmlformats-officedocument.spreadsheetml.template");
+		EXT2MIME.put("xlw", "application/vnd.ms-excel");
+		EXT2MIME.put("xml", "text/xml");
+		EXT2MIME.put("xof", "x-world/x-vrml");
+		EXT2MIME.put("xpm", "image/x-xpixmap");
+		EXT2MIME.put("xwd", "image/x-xwindowdump");
+		EXT2MIME.put("z", "application/x-compress");
+		EXT2MIME.put("zip", "application/zip");
+	}
+
+	/**
+	 * Returns the MIME type for file extension.
+	 */
+	public static String getMIMEType(String ext) {
+		if (ext == null) {
+			return EXT2MIME.get("");
+		}
+
+		int x = ext.lastIndexOf('.');
+		if (x > -1) {
+			ext = ext.substring(x + 1);
+		}
+
+		String mime = EXT2MIME.get(ext.toLowerCase());
+		if (mime == null) {
+			mime = EXT2MIME.get("");
+		}
+
+		return mime;
+	}
+
+	/**
+	 * Returns the MIME type for a file.
+	 */
+	public static String getMIMEType(File file) {
+		if (file == null) {
+			return getMIMEType("");
+		}
+
+		return getMIMEType(file.getName());
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/MIMETypes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ObjectListener.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ObjectListener.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ObjectListener.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ObjectListener.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.swingclient.model;
+
+import java.util.EventListener;
+
+public interface ObjectListener extends EventListener {
+
+	void objectLoaded(ClientModelEvent event);
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/model/ObjectListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/ActionPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/ActionPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/ActionPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/ActionPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,153 @@
+/*
+ * 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.swingclient.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.swingclient.ClientHelper;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public abstract class ActionPanel extends JPanel implements ActionListener {
+
+	private static final long serialVersionUID = 1L;
+
+	private ClientModel model;
+	private CmisObject object;
+
+	private JPanel centerPanel;
+
+	public ActionPanel(String title, String buttonLabel, ClientModel model) {
+		super();
+		this.model = model;
+		createGUI(title, buttonLabel);
+	}
+
+	public ClientModel getClientModel() {
+		return model;
+	}
+
+	public void setObject(CmisObject object) {
+		this.object = object;
+	}
+
+	public CmisObject getObject() {
+		return object;
+	}
+
+	protected void createGUI(String title, String buttonLabel) {
+		BorderLayout borderLayout = new BorderLayout();
+		borderLayout.setVgap(3);
+		setLayout(borderLayout);
+
+		setBackground(Color.WHITE);
+		setBorder(BorderFactory.createCompoundBorder(BorderFactory
+				.createEmptyBorder(5, 5, 5, 5), BorderFactory
+				.createCompoundBorder(BorderFactory.createLineBorder(
+						Color.GRAY, 2), BorderFactory.createEmptyBorder(5, 5,
+						5, 5))));
+
+		Font labelFont = UIManager.getFont("Label.font");
+		Font boldFont = labelFont.deriveFont(Font.BOLD,
+				labelFont.getSize2D() * 1.2f);
+
+		JLabel titleLabel = new JLabel(title);
+		titleLabel.setFont(boldFont);
+		add(titleLabel, BorderLayout.PAGE_START);
+
+		centerPanel = new JPanel();
+		centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS));
+		centerPanel.setBackground(Color.WHITE);
+		add(centerPanel, BorderLayout.CENTER);
+
+		createActionComponents();
+
+		JButton deleteButton = new JButton(buttonLabel);
+		deleteButton.addActionListener(this);
+		add(deleteButton, BorderLayout.PAGE_END);
+
+		setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
+	}
+
+	protected void addActionComponent(JComponent comp) {
+		comp.setAlignmentX(LEFT_ALIGNMENT);
+		centerPanel.add(comp);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		try {
+			setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+			doAction();
+			model.reloadFolder();
+		} catch (Exception ex) {
+			ClientHelper.showError(null, ex);
+		} finally {
+			setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+		}
+	}
+
+	protected abstract void createActionComponents();
+
+	public abstract boolean isAllowed();
+
+	public abstract void doAction() throws Exception;
+
+	protected JPanel createFilenamePanel(final JTextField filenameField) {
+		JPanel filePanel = new JPanel(new BorderLayout());
+		filePanel.setBackground(Color.WHITE);
+
+		filePanel.add(new JLabel("File:"), BorderLayout.LINE_START);
+
+		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()) {
+						filenameField.setText(fileChooser.getSelectedFile()
+								.getAbsolutePath());
+					}
+				}
+			}
+		});
+		filePanel.add(browseButton, BorderLayout.LINE_END);
+
+		return filePanel;
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/ActionPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/CreateDialog.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/CreateDialog.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/CreateDialog.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/CreateDialog.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,108 @@
+/*
+ * 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.swingclient.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.chemistry.opencmis.client.api.ObjectType;
+import org.apache.chemistry.opencmis.swingclient.model.ClientModel;
+
+public abstract class CreateDialog extends JDialog {
+
+	private static final long serialVersionUID = 1L;
+
+	private ClientModel model;
+	private JPanel panel;
+
+	public CreateDialog(Frame owner, String title, ClientModel model) {
+		super(owner, title, true);
+		this.model = model;
+
+		setLayout(new BorderLayout());
+		panel = new JPanel(new GridBagLayout());
+		panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+		add(panel, BorderLayout.CENTER);
+	}
+
+	protected ClientModel getClientModel() {
+		return model;
+	}
+
+	protected void createRow(String label, JComponent comp, int row) {
+		JLabel textLabel = new JLabel(label);
+		textLabel.setLabelFor(comp);
+
+		GridBagConstraints c = new GridBagConstraints();
+		c.anchor = GridBagConstraints.LINE_START;
+		c.fill = GridBagConstraints.HORIZONTAL;
+		c.gridx = 0;
+		c.gridy = row;
+		panel.add(textLabel, c);
+		c.gridx = 1;
+		panel.add(comp, c);
+	}
+
+	public void showDialog() {
+		panel.invalidate();
+
+		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+		pack();
+		setLocationRelativeTo(null);
+		setVisible(true);
+	}
+
+	protected Object[] getTypes(String rootTypeId) {
+		List<ObjectType> types = model.getCreateableTypes(rootTypeId);
+
+		Object[] result = new Object[types.size()];
+
+		int i = 0;
+		for (final ObjectType type : types) {
+			result[i] = new ObjectTypeItem() {
+				public ObjectType getObjectType() {
+					return type;
+				}
+
+				@Override
+				public String toString() {
+					return type.getDisplayName() + " (" + type.getId() + ")";
+				}
+			};
+
+			i++;
+		}
+
+		return result;
+	}
+
+	public static interface ObjectTypeItem {
+		ObjectType getObjectType();
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/CreateDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/InfoPanel.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/InfoPanel.java?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/InfoPanel.java (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/InfoPanel.java Thu Jul 22 11:19:09 2010
@@ -0,0 +1,130 @@
+/*
+ * 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.swingclient.swing;
+
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.BorderFactory;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+
+public abstract class InfoPanel extends JPanel {
+
+	private static final long serialVersionUID = 1L;
+
+	private JPanel gridPanel;
+	private GridBagConstraints gbc;
+	private Font boldFont;
+
+	protected void setupGUI() {
+		setLayout(new FlowLayout(FlowLayout.LEFT));
+		setBackground(Color.WHITE);
+
+		gridPanel = new JPanel(new GridBagLayout());
+		gridPanel.setBackground(Color.WHITE);
+		add(gridPanel);
+
+		gbc = new GridBagConstraints();
+
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.gridy = 0;
+		gbc.insets = new Insets(3, 3, 3, 3);
+
+		Font labelFont = UIManager.getFont("Label.font");
+		boldFont = labelFont
+				.deriveFont(Font.BOLD, labelFont.getSize2D() * 1.2f);
+	}
+
+	protected JTextField addLine(String label) {
+		return addLine(label, false);
+	}
+
+	protected JTextField addLine(String label, boolean bold) {
+		JTextField textField = new JTextField();
+		textField.setEditable(false);
+		textField.setBorder(BorderFactory.createEmptyBorder());
+		if (bold) {
+			textField.setFont(boldFont);
+		}
+
+		JLabel textLable = new JLabel(label);
+		textLable.setLabelFor(textField);
+		if (bold) {
+			textLable.setFont(boldFont);
+		}
+
+		gbc.gridy++;
+
+		gbc.gridx = 0;
+		gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
+		gridPanel.add(textLable, gbc);
+
+		gbc.gridx = 1;
+		gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+		gridPanel.add(textField, gbc);
+
+		return textField;
+	}
+
+	protected JCheckBox addCheckBox(String label) {
+		JCheckBox checkBox = new JCheckBox();
+		checkBox.setEnabled(false);
+
+		JLabel textLable = new JLabel(label);
+		textLable.setLabelFor(checkBox);
+
+		gbc.gridy++;
+
+		gbc.gridx = 0;
+		gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
+		gridPanel.add(textLable, gbc);
+
+		gbc.gridx = 1;
+		gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+		gridPanel.add(checkBox, gbc);
+
+		return checkBox;
+	}
+
+	protected <T extends JComponent> T addComponent(String label, T comp) {
+		JLabel textLable = new JLabel(label);
+		textLable.setLabelFor(comp);
+
+		gbc.gridy++;
+
+		gbc.gridx = 0;
+		gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
+		gridPanel.add(textLable, gbc);
+
+		gbc.gridx = 1;
+		gbc.anchor = GridBagConstraints.BASELINE_LEADING;
+		gridPanel.add(comp, gbc);
+
+		return comp;
+	}
+}

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/java/org/apache/chemistry/opencmis/swingclient/swing/InfoPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/META-INF/README
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/META-INF/README?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/META-INF/README (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/META-INF/README Thu Jul 22 11:19:09 2010
@@ -0,0 +1,7 @@
+OpenCMIS Swing Client
+
+This is a simple Content Management Interoperability Services (CMIS) client based on Swing 
+and Apache Chemistry OpenCMIS (http://incubator.apache.org/chemistry/opencmis.html).
+
+This CMIS client is distributed under the Apache License, version 2.0.
+Please see the NOTICE and LICENSE files for details.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/META-INF/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/connect.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/connect.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/connect.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/document.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/document.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/document.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/folder.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/folder.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/folder.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/info.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/info.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/info.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/log.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/log.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/log.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/newdocument.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/newdocument.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/newdocument.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/newfolder.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/newfolder.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/newfolder.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/policy.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/policy.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/policy.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/query.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/query.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/query.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/relationship.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/relationship.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/relationship.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/repository-info.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/repository-info.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/repository-info.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/types.png
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/types.png?rev=966582&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/images/types.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/log4j.properties?rev=966582&view=auto
==============================================================================
--- incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/log4j.properties (added)
+++ incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/log4j.properties Thu Jul 22 11:19:09 2010
@@ -0,0 +1,20 @@
+# 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.
+
+log4j.rootLogger=info, logframe
+
+log4j.appender.logframe = org.apache.chemistry.opencmis.swingclient.ClientWriterAppender
+log4j.appender.logframe.layout = org.apache.log4j.EnhancedPatternLayout
+log4j.appender.logframe.layout.ConversionPattern = > %d{HH:mm:ss} %5.5p %40.40c: %m%n%throwable{15}
\ No newline at end of file

Propchange: incubator/chemistry/opencmis-swingclient/trunk/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message