/*
 * @author <a href="mailto:oliver.wehrens@aei.mpg.de">Oliver Wehrens</a>
 * @version $Id$
 */
package org.gridlab.gridsphere.layout;

import org.gridlab.gridsphere.portlet.PortletResponse;
import org.gridlab.gridsphere.portletcontainer.GridSphereEvent;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * The <code>PortletColumnLayout</code> is a concrete implementation of the <code>PortletFrameLayout</code>
 * that organizes portlets into a column.
 */
public class PortletColumnLayout extends PortletFrameLayout implements Cloneable {
    protected String width = new String();

    public PortletColumnLayout() {
    }

    /**
     * Gets the width in percent for the column.
     * @return with of the column
     */
    public String getWidth() {
        return width;
    }

    /**
     * Sets the width of a column
     * @param width of the column
     */
    public void setWidth(String width) {
        this.width = width;
    }

    /**
     * Renders the component
     */
    public void doRender(GridSphereEvent event) throws PortletLayoutException, IOException {
        PortletResponse res = event.getPortletResponse();
        PrintWriter out = res.getWriter();

        PortletComponent p = null;

        // starting of the gridtable
        out.println("<table width=\"100%\" cellspacing=\"2\" cellpadding=\"0\"> <!-- START COLUMN -->");
        out.println("<tbody>");
        for (int i=0;i<components.size();i++) {
            out.print("<tr><td valign=\"top\">");

            p = (PortletComponent) components.get(i);
            if (p.getVisible()) {
                p.doRender(event);
                //out.println("comp: "+i);
            }
            out.println("</td></tr>");
        }
        out.println("</tbody>");
        out.println("</table> <!-- END COLUMN -->");
    }

    public Object clone() throws CloneNotSupportedException {
        PortletColumnLayout g = (PortletColumnLayout)super.clone();
        g.width = this.width;
        return g;
    }

}
 



@@ -638,327 +638,8 @@
  %7D%0A%0A
-    /**%0A     * Gets the width in percent for the column.%0A     * @return with of the column%0A     */%0A    public String getWidth() %7B%0A        return width;%0A    %7D%0A%0A    /**%0A     * Sets the width of a column%0A     * @param width of the column%0A     */%0A    public void setWidth(String width) %7B%0A        this.width = width;%0A    %7D%0A%0A
     

change column layout to have tale/row/column