Package com.extjs.gxt.ui.client.widget.menu

Examples of com.extjs.gxt.ui.client.widget.menu.MenuItem


        this.actionItems = actionItems;
    }

    public void addItem(GWTJahiaToolbarItem gwtToolbarItem) {
        if (gwtToolbarItem instanceof GWTJahiaToolbarMenu) {
            MenuItem subMenu = new MenuItem();
            if (gwtToolbarItem.getIcon() != null) {
                subMenu.setIcon(ToolbarIconProvider.getInstance().getIcon(gwtToolbarItem.getIcon()));
            }
            subMenu.setText(gwtToolbarItem.getTitle());

            GWTJahiaToolbarMenu gwtToolbarMenu = (GWTJahiaToolbarMenu) gwtToolbarItem;

            ActionToolbarMenu menu = new ActionToolbarMenu(linker);
            menu.setActionItems(actionItems);
            for (GWTJahiaToolbarItem subItem : gwtToolbarMenu.getGwtToolbarItems()) {
                menu.addItem(subItem);
            }
            subMenu.setSubMenu(menu);

            add(subMenu);
        } else {
            final ActionItem actionItem = gwtToolbarItem.getActionItem();
            actionItems.add(actionItem);
View Full Code Here


          icon = GXT.IMAGES.grid_filter_equal();
          eq = field;
          break;
      }

      MenuItem menuItem = new MenuItem();
      menuItem.setCanActivate(false);
      menuItem.setHideOnClick(false);
      menuItem.setIcon(icon);

      menuItem.setWidget(field);

      add(menuItem);
    }
  }
View Full Code Here

    }
    this.store = store;
  }

  protected Filter getMenuFilter(MenuEvent me) {
    MenuItem item = (MenuItem) me.getItem();
    ColumnConfig config = grid.getColumnModel().getColumn((Integer) item.getData("index"));
    return getFilter(config.getDataIndex());
  }
View Full Code Here

  @Override
  protected Menu createContextMenu(final int colIndex) {
    Menu menu = super.createContextMenu(colIndex);

    if (menu != null && enableGroupingMenu && cm.isGroupable(colIndex)) {
      MenuItem groupBy = new MenuItem(GXT.MESSAGES.groupingView_groupByText());
      groupBy.setIcon(getImages().getGroupBy());
      groupBy.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          onGroupByClick(ce, colIndex);
        }
View Full Code Here

          public void handleEvent(MenuEvent be) {
            be.getContainer().setData("tab", null);
          }
        });

        closeContextMenu.add(new MenuItem(messages.getCloseText(), new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            TabItem item = (TabItem) ce.getContainer().getData("tab");
            close(item);
          }
        }));
        closeContextMenu.add(new MenuItem(messages.getCloseOtherText(), new SelectionListener<MenuEvent>() {

          @Override
          public void componentSelected(MenuEvent ce) {
            TabItem item = (TabItem) ce.getContainer().getData("tab");
            List<TabItem> items = new ArrayList<TabItem>();
View Full Code Here

  }

  protected abstract Loader<?> getLoader(Store<ModelData> store);

  protected Filter getMenuFilter(MenuEvent me) {
    MenuItem item = (MenuItem) me.getItem();
    ColumnConfig config = grid.getColumnModel().getColumn((Integer) item.getData("index"));
    return getFilter(config.getDataIndex());
  }
View Full Code Here

  public void leftClicked(final XAxisItem item, final List <XAxisItem> roots, final String viewId, final String axisId,
      final boolean column, int x, int y) {
    Menu contextMenu = new Menu();
    contextMenu.setWidth(140);
   
    MenuItem hideElement = new MenuItem();
    String name = item.getName();
    if (name == null) {
      name = constants.element();
    }
    if (name.length() > 15) {
      name = name.substring(0, 12) + "...";
    }
    hideElement.setText(messages.hideElement(name));
    hideElement.setIconStyle("icon-filter-remove");
    hideElement.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        if (item.depth != 0 || isHideAllowed(item, roots, false)) {
          hideElement(item, null, viewId, axisId, column, false);
        } else {
          MessageBox.info(constants.information(),
              constants.hideForbiddenLastElement(), null);
        }
      }
    });
    contextMenu.add(hideElement);
   
    MenuItem hideLevel = new MenuItem();
    hideLevel.setText(constants.hideLevel());
    hideLevel.setIconStyle("icon-filter-remove-level");
    hideLevel.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        if (item.depth == 0) {
          if (isHideAllowed(item, roots, true)) {
            hideElement(item, roots, viewId, axisId, column, true);
          } else {
            MessageBox.info(constants.information(),
                constants.hideForbidden(), null);           
          }
        } else {
          hideElement(item, null, viewId, axisId, column, true);
        }
      }
    });
    contextMenu.add(hideLevel);

    XAxisHierarchy hierarchy = view.getAxisHierarchy(item.getHierarchyId());
    boolean enabled = hierarchy != null && hierarchy.getVisibleElements() != null && hierarchy.getVisibleElements().length > 0;
    MenuItem showAllElements = new MenuItem();
    showAllElements.setText(constants.showAllElements());
    showAllElements.setIconStyle("icon-filter");
    showAllElements.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        XAxisHierarchy hierarchy = view.getAxisHierarchy(item.getHierarchyId());
        final String oldPaths = hierarchy.getProperty("filterPaths");

        // get old settings:
        final XAlias oldAlias = hierarchy.getActiveAlias();
        final XSubset oldSubset = hierarchy.getActiveSubset();
        final XElement oldSelectedElement = hierarchy.getSelectedElement();           
        ArrayList <XElementNode> visEls = new ArrayList<XElementNode>();
        final XElementNode [] currentVisible = hierarchy.getVisibleElements();
        hierarchy.setOldVisibleElements(currentVisible);       
        hierarchy.setVisibleElements(null);
        willUpdateHierarchy(
            hierarchy, oldSubset, oldAlias, currentVisible, oldPaths, oldSelectedElement);
      }
    });
    contextMenu.add(showAllElements);
    showAllElements.setEnabled(enabled);
   
    contextMenu.showAt(x, y);
  }
View Full Code Here

//        });
//      }
//    });
   
    Menu menu = new Menu();
    editViewProperties = new MenuItem(constants.editViewProperties());
    editViewProperties.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        XUser user = ((Workbench)Registry.get(Workbench.ID)).getUser();
        final String sessionId = user.getSessionId();
        XView targetView = null;
        XObject xObj = null;
        TreeItem item = null;
        TreeNode node = null;
        if (treeBinder != null && treeBinder.getTree() != null) {
          TreeItem selection = treeBinder.getTree().getSelectedItem();
          if (selection != null) {
            item = selection;
            node = (TreeNode) selection.getModel();
            xObj = browserModel.getWrappedXObject(node);
            if (xObj instanceof XFolderElement) {
              XObject source = ((XFolderElement) xObj).getSourceObject();
              if (source != null && source instanceof XView) {
                targetView = (XView) source;
              }
            }
          }
        }
        if (targetView != null) {
          final XView viewToModify = targetView;
          final XObject xObject = xObj;
          final TreeItem selectedItem = item;
          final TreeNode nodeOfView = node;
//          int permission = user.getId().equals(targetView.getOwnerId()) ? 2 : 16;
          int permission = user.isAdmin() ? 0 : (user.getId().equals(targetView.getOwnerId()) ? 16 : 22);
          WPaloCubeViewServiceProvider.getInstance().checkPermission(sessionId, permission, new Callback <Boolean>(){
            public void onSuccess(Boolean result) {
              if (result) {
                final EditViewPropertiesDialog dlg =
                  new EditViewPropertiesDialog(viewToModify);
                dlg.addButtonListener(EditViewPropertiesDialog.BUTTON_OK,
                    new Listener<BaseEvent>() {
                      public void handleEvent(BaseEvent be) {
                        boolean pub = dlg.isPublic();
                        boolean edi = dlg.isEditable();
                        String ownerId = dlg.getOwner();
                        String accId = dlg.getAccountId();
                        String dbId = dlg.getDatabaseId();
                        String cubeId = dlg.getCubeId();
                        WPaloCubeViewServiceProvider.getInstance().setVisibility(
                            sessionId, (XFolderElement) xObject, pub, edi, ownerId, accId, dbId, cubeId, new Callback <XView>(){
                              public void onSuccess(XView view) {                                                             
                                XFolderElement xObj = (XFolderElement) browserModel.getWrappedXObject(nodeOfView);
                                xObj.setSourceObject(view);                               
                                selectedItem.setIconStyle(getIconStyle(view));
                                treeBinder.getStore().update(nodeOfView);
                              }});
                      }
                    });
                dlg.show();
              } else {
                MessageBox.alert(constants.notEnoughRights(), constants.notEnoughRightsToModifyVisibility(), null);
              }
            }
          });
        }
      }
    });
    menu.add(editViewProperties);
   
    createDirectLink = new MenuItem(constants.createDirectLink());
    createDirectLink.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        if (treeBinder != null && treeBinder.getTree() != null) {
          TreeItem selection = treeBinder.getTree().getSelectedItem();
          if (selection != null) {
            TreeNode node = (TreeNode) selection.getModel();
            final XObject xObj = browserModel.getWrappedXObject(node);
            if (xObj instanceof XFolderElement) {
              final XObject source = ((XFolderElement) xObj).getSourceObject();
              if (source != null && source instanceof XView) {
                final CreateDirectLinkDialog cdl = new CreateDirectLinkDialog((XView) source);
                cdl.show();
              }
            }
          }
        }
      }
    });
    menu.add(createDirectLink);
   
    MenuItem abi = new MenuItem(constants.about());
    abi.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        WPaloPropertyServiceProvider.getInstance().getBuildNumber(new AsyncCallback<String>() {
          public void onFailure(Throwable arg0) {
            displayAboutDialog("<" + constants.unknown() + ">", null);
          }
View Full Code Here

  final Menu getMenu() {
    return contextMenu;
  }

  final void add(String action, String icon) {
    MenuItem item = new MenuItem();
    item.setText(action);
    item.setIconStyle(icon);
    item.addSelectionListener(this);
    contextMenu.add(item);
  }
View Full Code Here

    }
   
    private void buildUserMenu(MenuBar mainMenu)
    {
        Menu userMenu = new Menu();
        MenuItem userSettings = new MenuItem(textMessages.settings());
        Menu userSettingsMenu = new Menu();
        //userSettingsMenu.add(new MenuItem("General"));
        userSettingsMenu.add(new MenuItem(textMessages.changePassword(), new SelectionListener<MenuEvent>() {
            @Override
            public void componentSelected(MenuEvent ce) {
                doChangePassword();
            }
        }));
        userSettings.setSubMenu(userSettingsMenu);
        userMenu.add(userSettings);

//        MenuItem userRole = new MenuItem("Role");
//        Menu userRoleMenu = new Menu();
//        userRoleMenu.add(new MenuItem("User"));
//        userRoleMenu.add(new MenuItem("Admin"));
//        userRole.setSubMenu(userRoleMenu);
//        userMenu.add(userRole);

        userMenu.add(new MenuItem(textMessages.logout(), new SelectionListener<MenuEvent>() {
            @Override
            public void componentSelected(MenuEvent ce) {
                doLogout();
            }
        }));
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.widget.menu.MenuItem

Copyright © 2018 www.massapicom. 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.