[jboss-svn-commits] JBL Code SVN: r10625 - in labs/jbosslabs/trunk/portal-extensions: forge-portlets/src/java/org/jboss/forge/projects/downloads and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 29 16:08:21 EDT 2007


Author: szimano
Date: 2007-03-29 16:08:21 -0400 (Thu, 29 Mar 2007)
New Revision: 10625

Modified:
   labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/proxies/ReadOnlyProxy.java
   labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/Downloads.java
   labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/DownloadsConstants.java
   labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/.project
Log:
downloads maximized view

Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/proxies/ReadOnlyProxy.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/proxies/ReadOnlyProxy.java	2007-03-29 19:33:21 UTC (rev 10624)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/proxies/ReadOnlyProxy.java	2007-03-29 20:08:21 UTC (rev 10625)
@@ -1,24 +1,24 @@
- /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 
 package org.jboss.forge.common.projects.proxies;
 
@@ -41,51 +41,50 @@
 	private static final long serialVersionUID = -2580144304618202336L;
 
 	private Object obj;
-	private Map<String,Object> methodValues = new HashMap<String, Object>();
-	
-	
-    public static Object newInstance(Object obj) {
-    
-    		return java.lang.reflect.Proxy.newProxyInstance(
-    										obj.getClass().getClassLoader(),
-    										obj.getClass().getInterfaces(),
-    										new ReadOnlyProxy(obj));
-    }
 
-    private ReadOnlyProxy(Object obj) {
-    		
-    		this.obj = obj;
-    }
+	private Map<String, Object> methodValues = new HashMap<String, Object>();
 
-    public Object invoke(Object proxy, Method m, Object[] args)
-    		throws Throwable {
-    	
-    		String methodName = m.getName();
- 
-    		// Check "cache" (only getter results are stored there)	
-    		if (methodValues.containsKey(methodName) 
-    				&& ((args == null) || (args.length == 0))) {
-    		
-    			return methodValues.get(methodName);
-    		}
-    		
-    		// Kill setters
-    		if (ProxyUtils.isSetter(m)) {
-    			throw new IllegalOperationException(m);
-    		}
-    		
-    		// Obtain result
-    		Object result = ProxyUtils.invoke(obj, m, args);
-    		
-    		// For getters, store the result in "cache"
-    		if (ProxyUtils.isGetter(m)) {
+	public static Object newInstance(Object obj) {
 
-    			result = ProxyUtils.wrapReadOnly(result);
-    			
-    			methodValues.put(methodName, result);
-    		}
-    		
-        return result;
-    }
-	
+		return java.lang.reflect.Proxy.newProxyInstance(obj.getClass()
+				.getClassLoader(), obj.getClass().getInterfaces(),
+				new ReadOnlyProxy(obj));
+	}
+
+	private ReadOnlyProxy(Object obj) {
+
+		this.obj = obj;
+	}
+
+	public Object invoke(Object proxy, Method m, Object[] args)
+			throws Throwable {
+
+		String methodName = m.getName();
+
+		// Check "cache" (only getter results are stored there)
+		if (methodValues.containsKey(methodName)
+				&& ((args == null) || (args.length == 0))) {
+
+			return methodValues.get(methodName);
+		}
+
+		// Kill setters
+		if (ProxyUtils.isSetter(m)) {
+			throw new IllegalOperationException(m);
+		}
+
+		// Obtain result
+		Object result = ProxyUtils.invoke(obj, m, args);
+
+		// For getters, store the result in "cache"
+		if (ProxyUtils.isGetter(m) && ((args == null) || (args.length == 0))) {
+
+			result = ProxyUtils.wrapReadOnly(result);
+
+			methodValues.put(methodName, result);
+		}
+
+		return result;
+	}
+
 }

Modified: labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/Downloads.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/Downloads.java	2007-03-29 19:33:21 UTC (rev 10624)
+++ labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/Downloads.java	2007-03-29 20:08:21 UTC (rev 10625)
@@ -28,6 +28,7 @@
 import java.util.TreeSet;
 
 import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
 
 import org.jboss.forge.common.ForgeHelper;
 import org.jboss.forge.common.ejb3.LabsServices;
@@ -65,44 +66,53 @@
 
 			// Getting the selected category (null if no selected category)
 			String categoryId = request.getParameter("category");
-			
+
 			List<? extends File> files = null;
 			List<? extends Category> categories = null;
-			
+			String desc = null;
+			String name = null;
+
 			org.jboss.forge.common.projects.project.Downloads d = LabsServices
-			.getProjectsService().getProjectDownloads(projectId);
-			
+					.getProjectsService().getProjectDownloads(projectId);
+
 			if (categoryId == null) {
 				files = d.getFiles().getFile();
 				categories = d.getCategories().getCategory();
-			}
-			else {
+				desc = d.getDescription();
+				name = d.getName();
+			} else {
 				String[] cats = categoryId.split("/");
-				
+
 				Category cat = d.getCategories().getCategory(cats[0]);
-				
+
 				if (cat == null) {
-					throw new Exception("No such category: "+categoryId);
+					throw new Exception("No such category: " + categoryId);
 				}
-				
+
 				for (int i = 1; i < cats.length; i++) {
 					cat = cat.getCategories().getCategory(cats[i]);
-					
+
 					if (cat == null) {
-						throw new Exception("No such category: "+categoryId);
+						throw new Exception("No such category: " + categoryId);
 					}
 				}
-				
-				files = cat.getFiles().getFile();
-				categories = cat.getCategories().getCategory();
-				
-				request.setAttribute(DownloadsConstants.DESCRIPTION, cat.getDescription());
-				request.setAttribute(DownloadsConstants.CATEGORYNAME, cat.getName());
+
+				if (cat.getFiles() != null)
+					files = cat.getFiles().getFile();
+
+				if (cat.getCategories() != null)
+					categories = cat.getCategories().getCategory();
+
+				desc = cat.getDescription();
+				name = cat.getName();
+
+				request.setAttribute(DownloadsConstants.CATEGORY, cat);
 			}
-			
+
+			request.setAttribute(DownloadsConstants.DESCRIPTION, desc);
+			request.setAttribute(DownloadsConstants.CATEGORYNAME, name);
 			request.setAttribute(DownloadsConstants.FILES, files);
 			request.setAttribute(DownloadsConstants.CATEGORIES, categories);
-			
 
 			// Setting the attributes
 			request.setAttribute(ProjectsHelper.PROJECT_ID, projectId);
@@ -117,11 +127,18 @@
 			}
 
 			// Displaying the JSP
-			PortletRequestDispatcher rd = getPortletContext()
-					.getRequestDispatcher(
-							ForgeHelper.createRepoAccessPath(portalName,
-									"prj-downloads/downloads.jsp"));
+			PortletRequestDispatcher rd = null;
 
+			if (request.getWindowState().equals(WindowState.NORMAL)) {
+				rd = getPortletContext().getRequestDispatcher(
+						ForgeHelper.createRepoAccessPath(portalName,
+								"prj-downloads/downloads.jsp"));
+			} else if (request.getWindowState().equals(WindowState.MAXIMIZED)) {
+				rd = getPortletContext().getRequestDispatcher(
+						ForgeHelper.createRepoAccessPath(portalName,
+								"prj-downloads/downloads-maximized.jsp"));
+			}
+
 			rd.include(request, response);
 		} catch (Exception e) {
 			e.printStackTrace();

Modified: labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/DownloadsConstants.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/DownloadsConstants.java	2007-03-29 19:33:21 UTC (rev 10624)
+++ labs/jbosslabs/trunk/portal-extensions/forge-portlets/src/java/org/jboss/forge/projects/downloads/DownloadsConstants.java	2007-03-29 20:08:21 UTC (rev 10625)
@@ -33,4 +33,5 @@
 	public static final String FILES = "FILES";
 	public static final String DESCRIPTION = "DESCRIPTION";
 	public static final String CATEGORYNAME = "CATEGORYNAME";
+	public static final String CATEGORY = "CATEGORY";
 }

Modified: labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/.project
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/.project	2007-03-29 19:33:21 UTC (rev 10624)
+++ labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/.project	2007-03-29 20:08:21 UTC (rev 10625)
@@ -1,44 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
 <projectDescription>
-	<name>wiki-backend</name>
-	<comment>
+  <name>wiki</name>
+  <comment>
   </comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.wst.common.project.facet.core.builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.wst.validation.validationbuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.exadel.verification.verifybuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
-		<nature>com.exadel.jsf.jsfnature</nature>
-		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
-	</natures>
-	<linkedResources>
-		<link>
-			<name>WEB-ROOT</name>
-			<type>2</type>
-			<location>/home/tomek/java/sandbox/portal-extensions/jbosswiki/forge-wiki/src/web</location>
-		</link>
-	</linkedResources>
-</projectDescription>
+  <projects>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments>
+      </arguments>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file




More information about the jboss-svn-commits mailing list