KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: SeparatorCG.java,v 1.12 2005/05/26 13:18:10 neurolabs 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
17 import org.wings.SComponent;
18 import org.wings.SConstants;
19 import org.wings.SSeparator;
20 import org.wings.io.Device;
21
22 import java.io.IOException JavaDoc;
23
24 public class SeparatorCG extends AbstractComponentCG implements
25         org.wings.plaf.SeparatorCG {
26
27
28     public void writeContent(final Device device,
29                              final SComponent _c)
30             throws IOException JavaDoc {
31         final SSeparator component = (SSeparator) _c;
32
33         device.print("<hr");
34         Utils.optAttribute(device, "class", component.getStyle());
35         Utils.optAttribute(device, "width", component.getWidth());
36         Utils.optAttribute(device, "size", component.getSize());
37
38         switch (component.getAlignment()) {
39             case SConstants.RIGHT_ALIGN:
40                 device.print(" align=\"right\"");
41                 break;
42             case SConstants.CENTER_ALIGN:
43                 device.print(" align=\"center\"");
44                 break;
45             case SConstants.BLOCK_ALIGN:
46                 device.print(" align=\"justify\"");
47                 break;
48         }
49         ;
50         if (!component.getShade()) {
51             device.print(" noshade=\"true\"");
52         }
53         device.print("/>\n");
54     }
55 }
56
Popular Tags