8 Replies Latest reply on Jul 31, 2005 12:24 PM by scottlholmes

    DivDecorationRenderer.java

      So far we couldn't find a DIV only version that actually worked. There were always some issues with positioning the mode and state images. If you have a working way please let me know!

      You can write your own renderSet and point your portal or layout to it. It's easy.

      * If you want to set the renderSet for the entire portal:
      in any of your war files, place a WEB-INF/layout/portal-renderSet.xml file with content like:

      <?xml version="1.0" encoding="UTF-8"?>
      <portal-renderSet>
       <renderSet name="MyDivRenderer">
       <set content-type="text/html">
       <region-renderer>blah.DivRegionRenderer</region-renderer>
       <window-renderer>blah.DivWindowRenderer</window-renderer>
       <portlet-renderer>blah.DivPortletRenderer</portlet-renderer>
      <decoration-renderer>blah.DivDecorationRenderer</decoration-renderer>
       </set>
       </renderSet>
      </portal-renderSet>
      


      the four classes are implementations of the four interfaces:
      import org.jboss.portal.server.theme.render.RegionRenderer;
      import org.jboss.portal.server.theme.render.WindowRenderer;
      import org.jboss.portal.server.theme.render.DecorationRenderer;
      import org.jboss.portal.server.theme.render.PortletRenderer;

      take a look at the default implementations in the core module:
      core/src/main/org/jboss/portal/core/theme/render/impl/**Renderer

      * If you want to set the renderSet for a particular layout only:
      in your portal-layouts.xml do something like:
      <layouts>
       <renderSet>
       <set content-type="text/html">
      <region-renderer>blah.LayoutRegionRenderer</region-renderer>
      <window-renderer>blah.LayoutWindowRenderer</window-renderer>
      <portlet-renderer>blah.LayoutPortletRenderer</portlet-renderer>
      <decoration-renderer>blah.LayoutDecorationRenderer</decoration-renderer>
       </set>
       </renderSet>
       <layout>
       <name>HeaderNavFooter</name>
       <uri>/layouts/headerNavFooter.jsp</uri>
       <uri state="maximized">/layouts/maximized.jsp</uri>
       </layout>
      </layouts>
      



        • 1. Re: DivDecorationRenderer.java

          I'm getting kind of far on a new improved version of myLayout that does 3 columns with header and footer. This version will be tableless, standards based and more.

          I was saving the divrender for last but I'll try to get something working there.

          I can tell you already that the Maximize functionality isn't going to work in the side columns so the example portlets and portals will need some adjustment.

          • 2. Re: DivDecorationRenderer.java
            matw

            Ive thought about the maximise and minimise features and have some possible solutions.

            When you maximise a portlet, your renderer should create HTML markup inside the "COLUMN" (DIV tag which is defined in the layout jsp) where that portlet exists. What we can do (i hope, havent fully tested it) is use a javascript to check the div.innerHTML, and if it is empty then don't show the the empty div tags, and change the style the column to a width appropriate.

            Below is a sample javascript to hide the div with no contents..

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
            <html>
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            <title>Untitled Document</title>
            
            <script type="text/javascript">
             function hideDiv() {
             var div = document.getElementById("leftCol");
             if(div.innerHTML == "")
             div.style.display ='none';
             }
            </script>
            
            <style type="text/css" >
            
            div.blah {
             float:left;
             width: 33%;
             height: 30px;
             border-width: thin;
             border-color: #000000;
             border-style: solid;
            }
            
            </style>
            
            </head>
            
            <body onLoad="hideDiv()">
            
             <div class="blah" id="leftCol"></div>
             <div class="blah" id="middleCol">sdf</div>
             <div class="blah" id="rightCol">sdf</div>
            
            </body>
            </html>
            


            For the minimise, the renderer should not render the portlet body markup - depending on how you have positioned your divs.


            I have attempted to create the portlets using only divs which works, but i am having cross browser issues when i start placing div tags within div tags. I am very interested in seeing what you have come up with..

            cheers
            Mat

            • 3. Re: DivDecorationRenderer.java

              What I came up with is to kick the Maximize altogether. The reason for this is two-fold.

              One - there's no precident for maximize out there "in-the-wild". i.e. There's no web sites to my recollection that I've visited over the past five years that have maximize button. SO - this could be considered a "web-app" feature only in which case you don't necessarily want or need a non-table layout.

              Two - There's no way to do Maximize without resorting to Javascript. SO - Given that you've played around with this, I'm willing to take another look. Maximize could be very useful in-the-wild - one use case comes to mind - you have a portlet that serves up photo thumbnails, you max the portlet and then you get the full size photo.

              The tricky part for the Javascript idea is that it should degrade gracefully when Javascript is not enabled - in which case this will take a bit of work.

              (In general, the only reason for going through all this hassle is to produce web pages that adhere to best practices and a sort of an intellectualized concept of web design - there's alot of good reasons for not bothering. In my case, I don't have paying customers waiting for me so I can afford to take the time to do it well(?).

              http://www.polyphonicstudios.net/jbpLayouts/slh3Columns.css

              http://www.polyphonicstudios.net/jbpLayouts/slhThreeColumns.jsp.txt

              • 4. Re: DivDecorationRenderer.java
                matw

                I have to agree with you on the maximise feature being hard being a sort of un-necessary feature. That said though, the use of portlets is somewhat to give the user the feeling of being "in control" to some degree. I like the layout you posted, the thought of setting the header border styles to none did not occur to me, cheers. Have you written a pure div renderer to go with?

                cheers

                Mat

                • 5. Re: DivDecorationRenderer.java

                  No to pure div render.

                  I posted very pre-pre-alpha as a sort of preview because you seemed interested. Yesterday I made some significant changes that corrects some cross-browser problems.

                  The CSS is based on various techniques out there. I'll try to get something more formal posted on the forum for right now.

                  As far as maximize goes, I probably going to put that one hold. I've been playing around with the Admin CMS editor and I've run into a number of things I'm not comfortable with in the way TinyMCE is set to gen some code (or not gen). So I'm probably going to develop a theme for that as well as the pure div renderer - this weekend.

                  • 6. Re: DivDecorationRenderer.java

                    I meant wiki - something more formal posted on the wiki

                    • 7. Re: DivDecorationRenderer.java

                       

                      "scottlholmes" wrote:
                      As far as maximize goes, I probably going to put that one hold. I've been playing around with the Admin CMS editor and I've run into a number of things I'm not comfortable with in the way TinyMCE is set to gen some code (or not gen). So I'm probably going to develop a theme for that as well as the pure div renderer - this weekend.


                      What do you mean? Is the editor adding extra code, ala Frontpage?

                      • 8. Re: DivDecorationRenderer.java

                        No sorry, Roy - I probably should have been more specific.

                        In looking over your implementation, I noticed you were using the default valid elements which is a small subset of XHTML - some kind soul created a big ol list of all XHTML to use with the verify.

                        In pasting in my test document, I noticed that much of the markup was removed. I look at XHTML as a semantic markup language so I'm interested in things like definition lists and code elements - that sort of thing.

                        So in the end, I'm looking at customizing TinyMCE to be optimized for XHTML Basic 1.0 with almost no styling (because the portal style sheet takes care of that and I'm adament that the eu needs to concentrate on content and forget about format).