Support 'id' attribute for menu items contributed by plugins
For menu items in the top menu that are contributed by plugins it is
now optionally possible to specify the 'id' attribute. Having the 'id'
attribute allows GWT UI plugins to manipulate the menu item. E.g. a
GWT plugin could open a dialog box when the user clicks on the menu
item:
RootPanel rootPanel = RootPanel.get(MENU_ID);
rootPanel.getElement().removeAttribute("href");
rootPanel.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
dialogBox.center();
dialogBox.show();
}
}, ClickEvent.getType());
Change-Id: Icbe2a5c5af9c126a6dd2373b768cae651e482200
This commit is contained in:
@@ -38,15 +38,21 @@ public interface TopMenu {
|
||||
public final String url;
|
||||
public final String name;
|
||||
public final String target;
|
||||
public final String id;
|
||||
|
||||
public MenuItem(String name, String url) {
|
||||
this(name, url, "_blank");
|
||||
}
|
||||
|
||||
public MenuItem(String name, String url, String target) {
|
||||
this(name, url, target, null);
|
||||
}
|
||||
|
||||
public MenuItem(String name, String url, String target, String id) {
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
this.target = target;
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user