private ContentPanel createMulti() { ContentPanel panel = new SamplePanel(); panel.setHeading("Multi Columns"); ToolBar toolBar = new ToolBar(); panel.setTopComponent(toolBar); ButtonGroup group = new ButtonGroup(2); group.setHeading("Clipboard"); Button btn = new Button("Cool", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); Menu menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); toolBar.add(group); group = new ButtonGroup(2); group.setHeading("Other Bugus Actions"); btn = new Button("Cool", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); toolBar.add(group); return panel; }
private void addActionMenu() { Button button = new Button("Action"); Menu menu = new Menu(); if (settings.containsKey(SettingType.twitterClientId) && !Utils.isEmptyString(settings.get(SettingType.twitterClientId)) && user != null) { menu.add( actionMenuItem( "Enable Facebook", AbstractImagePrototype.create(Icons.INSTANCE.connection()), Action.facebook)); } if (settings.containsKey(SettingType.facebookAPIKey) && !Utils.isEmptyString(settings.get(SettingType.facebookAPIKey))) { menu.add( actionMenuItem( "Enable Twitter", AbstractImagePrototype.create(Icons.INSTANCE.connection()), Action.twitter)); } menu.add( actionMenuItem( "Enable Instant Message (XMPP)", AbstractImagePrototype.create(Icons.INSTANCE.list_items()), Action.xmpp)); button.setMenu(menu); add(button); }
private void attachWidget(Button btn) { for (Iterator<UIGen> it = getField().getWidgets().iterator(); it.hasNext(); ) { UIGen ui = it.next(); // 如果是Menu物件就透過setMenu方法放到btn中 if (ui instanceof XMenu) { btn.setMenu((Menu) ui.build()); } } }
private void addFileMenu() { Button fileButton = new Button("File"); Menu fileMenu = new Menu(); fileMenu.add(newDataPoint()); fileMenu.add(newFolder()); fileMenu.add(uploadFile()); fileButton.setMenu(fileMenu); add(fileButton); }
private void addNavigateMenu() { Button button = new Button("Navigate"); Menu menu = new Menu(); menu.add( actionMenuItem( "Toggle Expansion", AbstractImagePrototype.create(Icons.INSTANCE.expand()), Action.expand)); button.setMenu(menu); add(button); }
private void addAdminMenu() { Button button = new Button("Admin"); Menu menu = new Menu(); menu.add( urlMenuItem( "Run System Maintenance Service", AbstractImagePrototype.create(Icons.INSTANCE.expand()), "http://" + com.google.gwt.user.client.Window.Location.getHostName() + "/cron/SystemMaint")); button.setMenu(menu); add(button); }
private ContentPanel createStandard() { ContentPanel panel = new SamplePanel(); panel.setHeading("Standard"); ToolBar toolBar = new ToolBar(); Button btn = new Button("Cool", IconHelper.createStyle("add16")); toolBar.add(btn); Menu menu = new Menu(); menu.add(new MenuItem("Ribbons are cool")); btn.setMenu(menu); toolBar.add(new SeparatorToolItem()); btn = new Button("Cut", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); toolBar.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); toolBar.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); toolBar.add(btn); menu = new Menu(); menu.add(new MenuItem("Ribbons are cool")); btn.setMenu(menu); toolBar.add(new SeparatorToolItem()); ToggleButton toggleBtn = new ToggleButton("Format"); toggleBtn.toggle(true); toolBar.add(toggleBtn); panel.setTopComponent(toolBar); return panel; }
private void addOptionsMenu() { Button button = new Button("Options"); Menu menu = new Menu(); CheckBox saveToNowCheckBox = new CheckBox(); menu.add(saveToNowCheckBox); saveToNowCheckBox.setBoxLabel("Save with Current Time"); saveToNowCheckBox.setValue(true); // autoSaveCheckBox.setBoxLabel("Auto-Save when a number is entered"); // autoSaveCheckBox.setValue(true); // menu.add(autoSaveCheckBox); button.setMenu(menu); add(button); }
public void _add() { int armStatus = ArmWrapper.FAILED; try { ArmWrapper.startTransaction( this, "com.base.myproject.client.ui.BaseMenuBar", "_add", new Object[] {}); Button item1 = new Button("Button w/ Menu"); item1.setIconStyle("icon-menu-show"); Menu menu = new Menu(); CheckMenuItem menuItem = new CheckMenuItem("I Like Cats"); menuItem.setChecked(true); menu.add(menuItem); menuItem = new CheckMenuItem("I Like Dogs"); menu.add(menuItem); item1.setMenu(menu); MenuItem menuitem2 = new MenuItem(); menuitem2.setText("menuitem2"); menuitem2.addSelectionListener( new SelectionListener() { @Override public void componentSelected(ComponentEvent ce) { // TODO Auto-generated method stub } public void handleEvent(BaseEvent be) { // TODO Auto-generated method stub // System.out.println("++"); HTML homeText = new HTML("Tab you have selected is Home."); // BaseTabPanel.getInstance().addTab("zgw2", homeText); // BaseTabPanel.getInstance().addTab("zgw3", new BasePanel()); BaseTabPanel.getInstance().addTab("zgw4", new TestBusi()); } }); menu.add(menuitem2); basemenubar.add(item1); armStatus = ArmWrapper.GOOD; // basemenubar.add(menuitem2); } finally { ArmWrapper.stopTransaction("com.base.myproject.client.ui.BaseMenuBar", "_add", armStatus); } }
private void addHelpMenu() { Button button = new Button("Help"); Menu menu = new Menu(); menu.add( urlMenuItem( "Forum", AbstractImagePrototype.create(Icons.INSTANCE.Help()), "http://groups.google.com/group/nimbits")); menu.add( urlMenuItem( "nimbits.com", AbstractImagePrototype.create(Icons.INSTANCE.Home()), "http://www.nimbits.com")); button.setMenu(menu); add(button); }
@Override public void onSuccess(final List<ConnectionRequest> result) { try { if (result.isEmpty()) { connectionRequest.setVisible(false); } else { final Menu scrollMenu = new Menu(); scrollMenu.setMaxHeight(MAX_HEIGHT); for (final ConnectionRequest r : result) { MenuItem m = acceptConnectionMenuItem(scrollMenu, r); scrollMenu.add(m); } connectionRequest.setMenu(scrollMenu); connectionCount = result.size(); connectionRequest.setText("Requests(" + connectionCount + ')'); } } catch (NimbitsException ex) { FeedbackHelper.showError(ex); } }
private ContentPanel createMixed() { ContentPanel panel = new SamplePanel(); panel.setHeading("Mix and match icon sizes"); ToolBar toolBar = new ToolBar(); panel.setTopComponent(toolBar); ButtonGroup group = new ButtonGroup(3); group.setHeading("Clipboard"); toolBar.add(group); Button btn = new Button("Paste", Resources.ICONS.add32()); btn.addStyleName("x-btn-as-arrow"); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); TableData data = new TableData(); data.setRowspan(3); group.add(btn, data); btn = new Button("Format", Resources.ICONS.add32()); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); Menu menu = new Menu(); menu.add(new MenuItem("Cool")); btn.setMenu(menu); group.add(btn, data); btn = new Button("Copy", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); group = new ButtonGroup(3); group.setHeading("Clipboard"); toolBar.add(group); btn = new Button("Paste", Resources.ICONS.add32()); btn.addStyleName("x-btn-as-arrow"); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); data = new TableData(); data.setRowspan(3); group.add(btn, data); btn = new Button("Format", Resources.ICONS.add32()); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); menu = new Menu(); menu.add(new MenuItem("Cool")); btn.setMenu(menu); group.add(btn, data); btn = new Button("Copy", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); return panel; }