package cn.cerc.ui.vcl;

import cn.cerc.ui.core.HtmlWriter;
import cn.cerc.ui.parts.UIComponent;

public class UIRadioButton extends UIComponent {
    private String name = "";
    private String value = "";
    private boolean isSelected = false;
    private UILabel label;

    public UIRadioButton(UIComponent owner) {
        super(owner);
    }

    public UIRadioButton() {
        super();
    }

    @Override
    public void output(HtmlWriter html) {
        if (label != null) {
            label.output(html);
        }
        html.print("<input type='radio'");
        if (isSelected) {
            html.print(" checked=checked");
        }
        html.print(" name='%s' value='%s'", name, value);
        super.outputCss(html);
        html.println("/>");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public UILabel getLabel() {
        if (label == null) {
            label = new UILabel();
        }
        return label;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setIsSelected(boolean isSelected) {
        this.isSelected = isSelected;
    }

}

@@ -348,61 +348,8 @@
  %7D%0A%0A
-    public UIRadioButton() %7B%0A        super();%0A    %7D%0A%0A
     
@@ -358,16 +358,16 @@
 verride%0A
+
     publ
@@ -783,28 +783,37 @@
 %0A    public 
-void
+UIRadioButton
  setName(Str
@@ -846,24 +846,45 @@
 ame = name;%0A
+        return this;%0A
     %7D%0A%0A    p
@@ -945,28 +945,37 @@
 %0A    public 
-void
+UIRadioButton
  setValue(St
@@ -1008,32 +1008,53 @@
 .value = value;%0A
+        return this;%0A
     %7D%0A%0A    publi
@@ -1258,20 +1258,29 @@
  public 
-void
+UIRadioButton
  setIsSe
@@ -1342,21 +1342,42 @@
 isSelected;%0A
+        return this;%0A
     %7D%0A%0A%7D%0A

Update UIRadioButton.java