KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > plaf > css > GridLayoutCG


1 /*
2  * $Id: GridLayoutCG.java,v 1.7 2005/06/03 13:16:16 blueshift Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.plaf.css;
15
16 import org.wings.SGridLayout;
17 import org.wings.SLayoutManager;
18 import org.wings.io.Device;
19
20 import java.io.IOException JavaDoc;
21 import java.util.List JavaDoc;
22
23 public class GridLayoutCG extends AbstractLayoutCG
24         {
25     /**
26      * @param d the device to write the code to
27      * @param l the layout manager
28      * @throws IOException
29      */

30     public void write(Device d, SLayoutManager l)
31             throws IOException JavaDoc {
32         final SGridLayout layout = (SGridLayout) l;
33         final List JavaDoc components = layout.getComponents();
34         final int rows = layout.getRows();
35
36         int cols = layout.getColumns();
37         if (cols <= 0)
38             cols = components.size() / rows;
39         final int border = layout.getBorder();
40
41         printLayouterTableHeader(d, "SGridLayout", layout.getHgap(), layout.getVgap(), border, layout);
42
43         printLayouterTableBody(d, cols, layout.getRenderFirstLineAsHeader(), layout.getHgap(), layout.getVgap(),border, components);
44
45         printLayouterTableFooter(d, "SGridLayout", layout);
46     }
47
48 }
49
Popular Tags