You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/11/11 15:21:59 UTC

svn commit: r834894 - in /labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website: CompoundableProducerImpl.aj templating/Template.java

Author: simoneg
Date: Wed Nov 11 14:21:59 2009
New Revision: 834894

URL: http://svn.apache.org/viewvc?rev=834894&view=rev
Log:
LABS-494: more classes on template base elements, one more div inside for correct padding/margins when using grid layouts

Modified:
    labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/CompoundableProducerImpl.aj
    labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/templating/Template.java

Modified: labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/CompoundableProducerImpl.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/CompoundableProducerImpl.aj?rev=834894&r1=834893&r2=834894&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/CompoundableProducerImpl.aj (original)
+++ labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/CompoundableProducerImpl.aj Wed Nov 11 14:21:59 2009
@@ -238,7 +238,7 @@
 	}
 	
 	protected void openWrapper(HtmlProducer prod, Writer out, CompoundType type) throws IOException {
-		out.write("<div class=\"" + Template.computeProducerClasses(prod) + type.name() + "\">");
+		out.write("<div class=\"" + Template.computePartialProducerClasses(prod) + type.name() + "\">");
 	}
 	
 	protected void closeWrapper(Writer out) throws IOException {

Modified: labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/templating/Template.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/templating/Template.java?rev=834894&r1=834893&r2=834894&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/templating/Template.java (original)
+++ labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/templating/Template.java Wed Nov 11 14:21:59 2009
@@ -17,12 +17,16 @@
 package org.apache.magma.website.templating;
 
 import org.apache.magma.basics.MagmaException;
+import org.apache.magma.basics.context.ContextElement;
+import org.apache.magma.basics.context.RunningContext;
+import org.apache.magma.basics.context.SubRunningContext;
 import org.apache.magma.website.CompoundType;
 import org.apache.magma.website.Head;
 import org.apache.magma.website.HtmlProducer;
 import org.apache.magma.website.Producer;
 import org.apache.magma.website.RootWebHandler;
 import org.apache.magma.website.WebHandler;
+import org.apache.magma.website.context.WebMethodContextElement;
 import org.apache.magma.website.utils.URLRewritingStream;
 
 import java.io.IOException;
@@ -205,11 +209,12 @@
 	}
 	
 	protected void closeWrapper(String zone, HtmlProducer producer, OutputStreamWriter osw) throws IOException {
-		osw.write("</div>");
+		osw.write("</div></div>");
 	}
 
 	protected void openWrapper(String zone, HtmlProducer producer, OutputStreamWriter osw) throws IOException {
-		osw.write("<div class=\"" + computeProducerClasses(producer) + " zonedElement\">");
+		osw.write("<div class=\"" + computeCompleteProducerClasses(producer) + " zonedElement\">");
+		osw.write("<div class=\"zonedElementInner\">");
 	}
 
 	protected TemplateData parseContent() {
@@ -245,8 +250,8 @@
 	public void setForceMain(boolean forceMain) {
 		this.forceMain = forceMain;
 	}
-	
-	public static String computeProducerClasses(Producer prod) {
+
+	public static String computePartialProducerClasses(Producer prod) {
 		String classes = "";
 		WebHandler handler = prod.getCreatingHandler();
 		if (handler != null) {
@@ -256,6 +261,20 @@
 		if (method != null) {
 			classes += method.getName() + " ";
 		}
+		return classes;		
+	}
+	
+	public static String computeCompleteProducerClasses(Producer prod) {
+		String classes = "";
+		SubRunningContext context = prod.getContext();
+		for (ContextElement ele : context) {
+			if (ele instanceof WebMethodContextElement) {
+				classes += ((WebMethodContextElement)ele).getHandlerInstance().getClass().getSimpleName();
+				classes += " " + ele.toString() + " ";
+			} else {
+				classes += ele.toString() + " ";
+			}
+		}
 		return classes;
 	}
 	



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org