currentItem = currentMenu.addItem(itemHTML.toString(), cmd);
currentItem.setSeparator(item.hasAttribute("separator"));
currentItem.setEnabled(!item.hasAttribute("disabled"));
+ if (item.hasAttribute("style")) {
+ String itemStyle = item.getStringAttribute("style");
+ currentItem.addStyleName(itemStyle);
+ }
if (item.getChildCount() > 0) {
menuStack.push(currentMenu);
target.startTag("item");
target.addAttribute("id", item.getId());
+ if (item.getStyleName() != null) {
+ target.addAttribute("style", item.getStyleName());
+ }
+
if (item.isSeparator()) {
target.addAttribute("separator", true);
target.endTag("item");
/** Deserialize changes received from client. */
@Override
- public void changeVariables(Object source, Map variables) {
+ public void changeVariables(Object source, Map<String, Object> variables) {
Stack<MenuItem> items = new Stack<MenuItem>();
boolean found = false;
private boolean enabled = true;
private boolean visible = true;
private boolean isSeparator = false;
+ private String styleName;
/**
* Constructs a new menu item that can optionally have an icon and a
return isSeparator;
}
+ public void setStyleName(String styleName) {
+ this.styleName = styleName;
+ requestRepaint();
+ }
+
+ public String getStyleName() {
+ return styleName;
+ }
+
}// class MenuItem
}// class MenuBar