Author: simoneg
Date: Fri Nov 13 14:03:22 2009
New Revision: 835852

URL: http://svn.apache.org/viewvc?rev=835852&view=rev
Log:
LABS-494: all contents of a side in compounds are inside a specific div

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

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=835852&r1=835851&r2=835852&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
 Fri Nov 13 14:03:22 2009
@@ -111,6 +111,21 @@
                }
        }
        
+       private void compoundZone(CompoundableProducer prod, CompoundType side, 
Writer stream) throws IOException {
+               List<Producer> list = prod.findCompoundedOn(side);
+               if (!list.isEmpty()) {
+                       openWrapper(stream, side);
+                       for (Producer producer : list) {
+                               if (producer instanceof HtmlProducer) {
+                                       openWrapper((HtmlProducer) producer, 
stream, side);
+                                       
((HtmlProducer)producer).produce(stream);
+                                       closeWrapper(stream);
+                               }
+                       }
+                       closeWrapper(stream);
+               }
+       }
+       
        void around(HtmlProducer orig, Writer stream) throws IOException : 
execution(void HtmlProducer+.produce(Writer)) && args(stream) && this(orig) {
                if (!(orig instanceof CompoundableProducer)) {
                        proceed(orig, stream);
@@ -122,71 +137,15 @@
                        return;
                }
                prod.compounding = true;
-               List<Producer> list = prod.findCompoundedOn(CompoundType.HEAD);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.HEAD);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
-               list = prod.findCompoundedOn(CompoundType.BEFORE);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.BEFORE);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
+               compoundZone(prod, CompoundType.HEAD, stream);
+               compoundZone(prod, CompoundType.BEFORE, stream);
                proceed(orig, stream);
-               list = prod.findCompoundedOn(CompoundType.AFTER);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.AFTER);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
-               list = prod.findCompoundedOn(CompoundType.SIDEA);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.SIDEA);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
-               list = prod.findCompoundedOn(CompoundType.SIDEB);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.SIDEB);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
-               list = prod.findCompoundedOn(CompoundType.SIDEC);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.SIDEC);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
-               list = prod.findCompoundedOn(CompoundType.SIDED);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.SIDED);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
-               list = prod.findCompoundedOn(CompoundType.FOOT);
-               for (Producer producer : list) {
-                       if (producer instanceof HtmlProducer) {
-                               openWrapper((HtmlProducer) producer, stream, 
CompoundType.FOOT);
-                               ((HtmlProducer)producer).produce(stream);
-                               closeWrapper(stream);
-                       }
-               }
+               compoundZone(prod, CompoundType.AFTER, stream);
+               compoundZone(prod, CompoundType.SIDEA, stream);
+               compoundZone(prod, CompoundType.SIDEB, stream);
+               compoundZone(prod, CompoundType.SIDEC, stream);
+               compoundZone(prod, CompoundType.SIDED, stream);
+               compoundZone(prod, CompoundType.FOOT, stream);
                prod.compounding = false;               
        }
        
@@ -240,6 +199,11 @@
        protected void openWrapper(HtmlProducer prod, Writer out, CompoundType 
type) throws IOException {
                out.write("<div class=\"" + 
Template.computePartialProducerClasses(prod) + type.name() + "\">");
        }
+
+       protected void openWrapper(Writer out, CompoundType type) throws 
IOException {
+               out.write("<div class=\"CompoundZone " + type.name() + "\">");
+       }
+       
        
        protected void closeWrapper(Writer out) throws IOException {
                out.write("</div>");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to