KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: RadioButtonCG.java,v 1.11 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 java.io.IOException JavaDoc;
18
19 import org.wings.SAbstractButton;
20 import org.wings.SIcon;
21 import org.wings.io.Device;
22
23 public class RadioButtonCG extends CheckBoxCG implements
24         org.wings.plaf.RadioButtonCG {
25     protected void installIcons(final SAbstractButton button) {
26         org.wings.plaf.CGManager manager = button.getSession().getCGManager();
27         button.setIcon((SIcon) manager.getObject("SRadioButton.icon", SIcon.class));
28         button.setSelectedIcon((SIcon) manager.getObject("SRadioButton.selectedIcon", SIcon.class));
29         button.setRolloverIcon((SIcon) manager.getObject("SRadioButton.rolloverIcon", SIcon.class));
30         button.setRolloverSelectedIcon((SIcon) manager.getObject("SRadioButton.rolloverSelectedIcon", SIcon.class));
31         button.setPressedIcon((SIcon) manager.getObject("SRadioButton.pressedIcon", SIcon.class));
32         button.setDisabledIcon((SIcon) manager.getObject("SRadioButton.disabledIcon", SIcon.class));
33         button.setDisabledSelectedIcon((SIcon) manager.getObject("SRadioButton.disabledSelectedIcon", SIcon.class));
34     }
35
36     protected void inputTypeCheckbox(Device device, SAbstractButton button) throws IOException JavaDoc {
37         device.print("<input type=\"hidden\" name=\"");
38         Utils.write(device, Utils.event(button));
39         device.print("\" value=\"");
40         Utils.write(device, button.getDeselectionParameter());
41         device.print("\"/>");
42
43         device.print("<input type=\"radio\" name=\"");
44         Utils.write(device, Utils.event(button));
45         device.print("\" value=\"");
46         Utils.write(device, button.getToggleSelectionParameter());
47         device.print("\"");
48
49         if (!button.isEnabled())
50             device.print(" disabled=\"true\"");
51         if (button.isFocusOwner())
52             Utils.optAttribute(device, "focus", button.getName());
53
54         if (button.isSelected())
55             device.print(" checked=\"true\"");
56
57         Utils.writeEvents(device, button);
58         device.print("/>");
59     }
60 }
61
Popular Tags