3 public class JMenuItem extends AbstractButton {
5 public final int btnType;
7 public static final int TYPE_SEPARATOR = 0;
8 public static final int TYPE_BUTTON = 1;
9 public static final int TYPE_CHECKBOX = 2;
10 public static final int TYPE_RADIO = 3;
11 public static final int TYPE_MENU = 4;
14 public JMenuItem(String text) {
17 btnType = (text == null ? 0 : 1);
20 public JMenuItem(String type, int i) {
26 public String toHTML() {
27 return htmlMenuOpener("li")
28 + (text == null ? "" : "<a>" + htmlLabel() + "</a>") + "</li>";
32 protected String getHtmlDisabled() {
33 return " class=\"ui-state-disabled\"";
36 private String htmlLabel() {
37 return (btnType == TYPE_BUTTON ? text
38 : "<label><input id=\"" + id + "-" + (btnType == TYPE_RADIO ? "r" : "c")
40 + (btnType == TYPE_RADIO ? "radio\" name=\"" + htmlName : "checkbox")
41 + "\" " + (selected ? "checked" : "") + " />"