Examples of MenuPopup


Examples of org.gwtoolbox.widget.client.menu.MenuPopup

        miscMenu.addItem("Radios", radiosMenu);


        // context menues

        final MenuPopup contextMenu = new MenuPopup(true);
        contextMenu.addItem("Item 1", new AlertCommand("'Item 1' was clicked"));
        contextMenu.addItem("Item 2", new AlertCommand("'Item 2' was clicked"));
        contextMenu.addItem("Item 3", new AlertCommand("'Item 3' was clicked"));

        Menu subMenu = new Menu(true);
        subMenu.addItem("Option 1", new AlertCommand("'Option 1' was clicked"));
        subMenu.addItem("option2", "Option 2", new AlertCommand("'Option 2' was clicked"));
        subMenu.addItem("Option 3", new AlertCommand("'Option 3' was clicked"));
        contextMenu.addSubMenu("Options", subMenu);

        BasicLabel label = new BasicLabel("Right-click Here");
        label.addContextMenuHandler(new com.google.gwt.event.dom.client.ContextMenuHandler() {
            public void onContextMenu(final ContextMenuEvent event) {
                contextMenu.setPopupPositionAndShow(new Popup.PositionCallback() {
                    public void setPosition(int offsetWidth, int offsetHeight) {
                        int x = event.getNativeEvent().getClientX();
                        int y = event.getNativeEvent().getClientY();
                        contextMenu.setPopupPosition(x, y);
                    }
                });
            }
        });
        main.add(label);
        label.setWidth("150px");
        label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        DOM.setStyleAttribute(label.getElement(), "cursor", "default");
        DOM.setStyleAttribute(label.getElement(), "border", "1px solid gray");
        DOM.setStyleAttribute(label.getElement(), "marginTop", "150px");

        final CheckBox checkBox = new CheckBox("Disable Option 2");
        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                MenuItemBase item = contextMenu.getMenu().getItem("Options.option2");
                item.setEnabled(!event.getValue());
            }
        });
        main.add(checkBox);
View Full Code Here

Examples of org.gwtoolbox.widget.client.menu.MenuPopup

                });
                columnsMenu.addItem(item);
            }
        }

        popup = new MenuPopup(true);
        popup.getMenu().addItem("sortAsc", "Sort Asc", new Command() {
            public void execute() {
                int columnIndex = menuPopupContext.getColumnIndex();
                sortByColumn(columnIndex, true);
            }
View Full Code Here

Examples of org.gwtoolbox.widget.client.menu.MenuPopup

            final MenuBuilder menuBuilder = tabSpec.getMenuBuilder();
            if (menuBuilder != null || showDefaultContextMenu) {

                ContextMenuHandler handler = new ContextMenuHandler() {
                    public void onContextMenu(final com.google.gwt.dom.client.Element element, final int x, final int y) {
                        final MenuPopup menu = new MenuPopup(true);

                        if (showDefaultContextMenu) {
                            if (!isSelected()) {
                                menu.addItem("Select", new Command() {
                                    public void execute() {
                                        select();
                                    }
                                }).setEnabled(enabled);
                            }
                            if (closeButtonElement != null) {
                                menu.addItem("Close", new Command() {
                                    public void execute() {
                                        handleOnClose();
                                    }
                                }).setEnabled(enabled);
                            }
                            menu.addItem("Close Others", new Command() {
                                public void execute() {
                                    handleCloseOthers();
                                }
                            }).setEnabled(enabled);
                        }

                        if (menuBuilder != null) {
                            if (showDefaultContextMenu) {
                                menu.addSeparator();
                            }
                            menuBuilder.build(menu.getMenu());
                        }
                        menu.setPopupPositionAndShow(new Popup.PositionCallback() {
                            public void setPosition(int offsetWidth, int offsetHeight) {
                                menu.setPopupPosition(element.getAbsoluteLeft() + x, element.getAbsoluteTop() + y);
                            }
                        });
                    }
                };
                addContextMenuListener(tabElement, handler);
View Full Code Here

Examples of org.gwtoolbox.widget.client.menu.MenuPopup

        this(new SimpleButton(caption), verticalMenu);
    }

    public SimpleMenuButton(final ButtonBase button, boolean verticalMenu) {
        button.setEnabled(false);
        popup = new MenuPopup(verticalMenu);
        popup.getMenu().addAddHandler(new AddHandler<MenuItemBase>() {
            public void onAdd(AddEvent<MenuItemBase> menuItemBaseAddEvent) {
                button.setEnabled(true);
            }
        });
View Full Code Here

Examples of org.gwtoolbox.widget.client.menu.MenuPopup

            }
            final MenuBuilder menuBuilder = tabSpec.getMenuBuilder();
            if (menuBuilder != null) {
                addContextMenuListener(tabElement, new ContextMenuHandler() {
                    public void onContextMenu(final com.google.gwt.dom.client.Element element, final int x, final int y) {
                        final MenuPopup menu = new MenuPopup(true);
                        menuBuilder.build(menu.getMenu());
                        menu.setPopupPositionAndShow(new Popup.PositionCallback() {
                        public void setPosition(int offsetWidth, int offsetHeight) {
                            menu.setPopupPosition(element.getAbsoluteLeft() + x, element.getAbsoluteTop() + y);
                        }
                    });
                    }
                });
            }
View Full Code Here

Examples of org.zkoss.zul.Menupopup

  @Override
  protected MenuFactoryDto createMenuComponent(Component parent, boolean open) {
    final DefaultDropDownMenu menu = new DefaultDropDownMenu();
    parent.appendChild(menu);

    final Menupopup menupopup = new Menupopup();
    menu.appendChild(menupopup);

    return new MenuFactoryDto(menupopup, menu);
  }
View Full Code Here

Examples of org.zkoss.zul.Menupopup

  private void createMenubar() {
    Menubar menubar=(Menubar)getFellow("menubar");
    Menu actionsMenu=new Menu("Actions");
    menubar.appendChild(actionsMenu);
    Menupopup popup=new Menupopup();
    actionsMenu.appendChild(popup);
    Menuitem createItem =new Menuitem("Create");
    createItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("create");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    Menuitem showItem =new Menuitem("Show");
    showItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("show");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    Menuitem editItem=new Menuitem("Edit");
    editItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("edit");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    Menuitem deleteItem=new Menuitem("Delete");
    deleteItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("delete");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    popup.appendChild(createItem);
    popup.appendChild(showItem);
    popup.appendChild(editItem);
    popup.appendChild(deleteItem);
    appendChild(menubar);
   
   
  }
View Full Code Here

Examples of org.zkoss.zul.Menupopup

  private void createMenubar() {
    Menubar menubar=(Menubar)getFellow("menubar");
    Menu actionsMenu=new Menu("Actions");
    menubar.appendChild(actionsMenu);
    Menupopup popup=new Menupopup();
    actionsMenu.appendChild(popup);
    Menuitem createItem =new Menuitem("Create");
    createItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("create");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    Menuitem showItem =new Menuitem("Show");
    showItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("show");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    Menuitem editItem=new Menuitem("Edit");
    editItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("edit");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    Menuitem deleteItem=new Menuitem("Delete");
    deleteItem.addEventListener("onClick", new EventListener(){
      public void onEvent(Event event) throws Exception {
        Map<String, ArrayList<String>> map=new HashMap<String, ArrayList<String>>();
        ArrayList<String> options=new ArrayList<String>();
        options.add("delete");
        map.put("options", options);
        openDetails(map);
       
      }
    });
    popup.appendChild(createItem);
    popup.appendChild(showItem);
    popup.appendChild(editItem);
    popup.appendChild(deleteItem);
    appendChild(menubar);
   
   
  }
View Full Code Here

Examples of org.zkoss.zul.Menupopup

    public Menupopup create() {
        return create(true);
    }

    private Menupopup create(boolean setContext) {
        Menupopup result = new Menupopup();
        result.addEventListener("onOpen", new EventListener() {

            @Override
            public void onEvent(Event event) {
                OpenEvent openEvent = (OpenEvent) event;
                referenced = (T) openEvent.getReference();
            }
        });
        for (final Item item : items) {
            if (!item.name.equals("separator")) {
                Menuitem menuItem = item.createMenuItem();
                menuItem.addEventListener("onClick", new EventListener() {
                    @Override
                    public void onEvent(Event event) {
                        ItemAction<T> action = item.action;
                        action.onEvent(referenced, event);
                    }
                });
                result.appendChild(menuItem);
            } else {
                Menuseparator separator = new Menuseparator();
                result.appendChild(separator);
            }
        }
        insertInRootComponent(result);
        if (setContext) {
            for (T element : elements) {
View Full Code Here

Examples of org.zkoss.zul.Menupopup

                        public void onEvent(Div choosen, Event event) {
                            schedule(loadLine);
                        }
                    });

            Menupopup result = menuBuilder.createWithoutSettingContext();
            contextMenus.put(div, result);
            return result;

        }
        return contextMenus.get(div);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.