KickJava   Java API By Example, From Geeks To Geeks.

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


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