本文整理汇总了Java中com.google.gwt.user.client.ui.MenuBar.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java MenuBar.setVisible方法的具体用法?Java MenuBar.setVisible怎么用?Java MenuBar.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.MenuBar
的用法示例。
在下文中一共展示了MenuBar.setVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MenuPopup
import com.google.gwt.user.client.ui.MenuBar; //导入方法依赖的package包/类
public MenuPopup(List<MenuPopupItem> items) {
super(false, Type.MENU);
MenuBar popupMenuBar = new MenuBar(true);
for (final MenuPopupItem item : items) {
popupMenuBar.addItem(new MenuItem(item.getText(), true, new ScheduledCommand() {
@Override
public void execute() {
item.execute();
hide();
}
}));
}
popupMenuBar.setVisible(true);
add(popupMenuBar);
}
示例2: PlaceholderContextMenuWidget
import com.google.gwt.user.client.ui.MenuBar; //导入方法依赖的package包/类
public PlaceholderContextMenuWidget(Command bringToFrontCommand, Command bringForwardCommand, Command sendBackwardCommand,
Command sendToBackCommand, Command propertiesCommand, Command deleteCommand) {
super(true, false);
MenuBar popupMenuBar = new MenuBar(true);
MenuItem propertiesItem = new MenuItem("Properties", true, propertiesCommand);
MenuItem deleteItem = new MenuItem("Delete", true, deleteCommand);
MenuItem bringToFrontItem = new MenuItem("Bring to Front", true, bringToFrontCommand);
MenuItem bringForwardItem = new MenuItem("Bring Forward", true, bringForwardCommand);
MenuItem sendBackwardItem = new MenuItem("Send Backward", true, sendBackwardCommand);
MenuItem sendToBackItem = new MenuItem("Send to Back", true, sendToBackCommand);
popupMenuBar.addItem(propertiesItem);
popupMenuBar.addItem(deleteItem);
popupMenuBar.addSeparator();
popupMenuBar.addItem(bringToFrontItem);
popupMenuBar.addItem(bringForwardItem);
popupMenuBar.addItem(sendBackwardItem);
popupMenuBar.addItem(sendToBackItem);
popupMenuBar.setVisible(true);
add(popupMenuBar);
sinkEvents(Event.ONCONTEXTMENU);
}
示例3: setMenu
import com.google.gwt.user.client.ui.MenuBar; //导入方法依赖的package包/类
public boolean setMenu(final PopupPanel popup) {
List<Operation> operations = getOperations();
if (operations.isEmpty()) return false;
boolean first = true;
MenuBar menu = new MenuBarWithAccessKeys();
for (final Operation op: operations) {
if (!op.isApplicable()) continue;
if (op.hasSeparator() && !first)
menu.addSeparator();
first = false;
MenuItem item = new MenuItem(op.getName(), true, new Command() {
@Override
public void execute() {
popup.hide();
op.execute();
}
});
if (op instanceof AriaOperation)
Roles.getMenuitemRole().setAriaLabelProperty(item.getElement(), ((AriaOperation)op).getAriaLabel());
else
Roles.getMenuitemRole().setAriaLabelProperty(item.getElement(), UniTimeHeaderPanel.stripAccessKey(op.getName()));
menu.addItem(item);
}
if (first) return false;
menu.setVisible(true);
popup.add(menu);
return true;
}
示例4: NetworkTypeSelectWidget
import com.google.gwt.user.client.ui.MenuBar; //导入方法依赖的package包/类
public NetworkTypeSelectWidget() {
super("Add");
MenuBar popupMenuBar = new MenuBar(true);
for (final NetworkType networkType: NetworkType.values()) {
MenuItem item = new MenuItem(networkType.getDefaultName(), true,
new Command() {
@Override
public void execute() {
Window.open(networkType.getRequestUrl(), "_blank", "");
menuPanel.hide();
}
});
popupMenuBar.addItem(item);
}
// MenuItem foursquareItem = new MenuItem(NetworkType.foursquare.getDefaultName(), true,
// new Command() {
//
// @Override
// public void execute() {
// Window.open(NetworkType.foursquare.getRequestUrl(), "_blank", "");
// menuPanel.hide();
// }
// });
// MenuItem twitterItem = new MenuItem(RiseUtils.capitalizeFirstLetter(NetworkType.twitter.getDefaultName()), true,
// new Command() {
//
// @Override
// public void execute() {
// Window.open(NetworkType.twitter.getRequestUrl(), "_blank", "");
// menuPanel.hide();
// }
// });
//
// popupMenuBar.addItem(foursquareItem);
// popupMenuBar.addItem(twitterItem);
popupMenuBar.setVisible(true);
menuPanel.add(popupMenuBar);
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
int x = event.getClientX() + Window.getScrollLeft() + 1;
int y = event.getClientY() + Window.getScrollTop() + 1;
menuPanel.setPopupPosition(x, y);
menuPanel.show();
}
});
}