KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: SpacerCG.java,v 1.7 2005/06/07 12:55:59 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.SIcon;
19 import org.wings.SSpacer;
20 import org.wings.io.Device;
21 import org.wings.session.SessionManager;
22
23 import java.io.IOException JavaDoc;
24
25 public class SpacerCG extends AbstractComponentCG implements org.wings.plaf.SpacerCG {
26     /**
27      * The default invisible icon.
28      */

29     private static final SIcon BLIND_ICON = (SIcon) SessionManager.getSession()
30     .getCGManager().getObject("SpacerCG.blindIcon", SIcon.class);
31
32     public void writeContent(final Device device, final SComponent c) throws IOException JavaDoc {
33         final SSpacer component = (SSpacer) c;
34         int height = component.getPreferredSize().getIntHeight();
35         int width = component.getPreferredSize().getIntWidth();
36         device.print("<img");
37         Utils.optAttribute(device, "src", BLIND_ICON.getURL());
38         Utils.optAttribute(device, "width", width);
39         Utils.optAttribute(device, "height", height);
40         device.print(" alt=\"");
41         device.print(BLIND_ICON.getIconTitle());
42         device.print("\"/>");
43     }
44 }
45
Popular Tags