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

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


            clientSessionUtil.isAuthorized(Function.UPDATE_USER) ||
            clientSessionUtil.isAuthorized(Function.ADD_GROUP) ||
            clientSessionUtil.isAuthorized(Function.UPDATE_GROUP) ||
            clientSessionUtil.isAuthorized(Function.UNBLOCK_IP))
        {
            Menu adminMenu = new Menu();
            //adminMenu.add(new MenuItem("Settings"));
   
            MenuItem adminUser = new MenuItem(textMessages.users());
            Menu adminUserMenu = new Menu();
            if (clientSessionUtil.isAuthorized(Function.ADD_USER))
            {
                adminUserMenu.add(new MenuItem(textMessages.add(), new SelectionListener<MenuEvent>() {
                    @Override
                    public void componentSelected(MenuEvent ce) {
                        doAddUser();
                    }
                }));
            }
            if (clientSessionUtil.isAuthorized(Function.UPDATE_USER))
            {
                adminUserMenu.add(new MenuItem(textMessages.edit(), new SelectionListener<MenuEvent>() {
                    @Override
                    public void componentSelected(MenuEvent ce) {
                        doEditUser();
                    }
                }));
            }
            adminUser.setSubMenu(adminUserMenu);
            adminMenu.add(adminUser);
           
            MenuItem adminGroup = new MenuItem(textMessages.groups());
            Menu adminGroupMenu = new Menu();
            if (clientSessionUtil.isAuthorized(Function.ADD_GROUP))
            {
                adminGroupMenu.add(new MenuItem(textMessages.add(), new SelectionListener<MenuEvent>() {
                    @Override
                    public void componentSelected(MenuEvent ce) {
                        doAddGroup();
                    }
                }));
            }
            if (clientSessionUtil.isAuthorized(Function.UPDATE_GROUP))
            {
                adminGroupMenu.add(new MenuItem(textMessages.edit(), new SelectionListener<MenuEvent>() {
                    @Override
                    public void componentSelected(MenuEvent ce) {
                        doEditGroup();
                    }
                }));
            }
            adminGroup.setSubMenu(adminGroupMenu);
            adminMenu.add(adminGroup);

            MenuItem adminTools = new MenuItem(textMessages.tools());
            Menu adminToolsMenu = new Menu();
            if (clientSessionUtil.isAuthorized(Function.UNBLOCK_IP))
            {
                adminToolsMenu.add(new MenuItem(textMessages.unblockIP(), new SelectionListener<MenuEvent>() {
                    @Override
                    public void componentSelected(MenuEvent ce) {
                        doUnblockIP();
                    }
                }));
View Full Code Here


//        adminMenu.add(adminRole);
    }
   
    private void buildReportsMenu(MenuBar mainMenu)
    {
        Menu reportsMenu = new Menu();
        List<Map<String, Object>> reports = getClientModel().getAvailableReports();
        for (final Map<String, Object> report : reports)
        {
            MenuItem menuItem = new MenuItem((String)report.get(Constants.I18N), new SelectionListener<MenuEvent>()
            {
                @Override
                public void componentSelected(MenuEvent ce)
                {
                    displayReportDialog(report);
                }
            });
            reportsMenu.add(menuItem);
        }
        mainMenu.add(new MenuBarItem(textMessages.reports(), reportsMenu));
    }
View Full Code Here

        new ReportDialog(report).show();
    }

    private void buildAboutMenu(MenuBar mainMenu)
    {
        Menu aboutMenu = new Menu();
        aboutMenu.add(new MenuItem(textMessages.help(), new SelectionListener<MenuEvent>()
        {
            @Override
            public void componentSelected(MenuEvent ce)
            {
                doShowHelp();
            }
        }));
        aboutMenu.add(new MenuItem(textMessages.about(), new SelectionListener<MenuEvent>()
        {
            @Override
            public void componentSelected(MenuEvent ce)
            {
                doShowAbout();
View Full Code Here

    c.hide();
  }

  protected void initMore() {
    if (more == null) {
      moreMenu = new Menu();
      moreMenu.addListener(Events.BeforeShow, new Listener<MenuEvent>() {

        public void handleEvent(MenuEvent be) {
          clearMenu();
          for (Component c : container.getItems()) {
View Full Code Here

  }
 
  @Override
  public void onTab(Component component, PreviewEvent pe) {
    if (!isManaged()) return;
    Menu menu = (Menu)component;
    if (menu.isVisible()) {
      Button btn = menu.getData("parent");
      if (btn != null) {
        pe.preventDefault();
        btn.hideMenu();
        focusNextWidget(btn.getParent());
      }
View Full Code Here

    super(dataIndex);
    rangeItems.add(RangeItem.LESSTHAN);
    rangeItems.add(RangeItem.GREATERTHAN);
    rangeItems.add(RangeItem.EQUAL);

    menu = new Menu();
    beforeItem = new CheckMenuItem();
    beforeItem.addListener(Events.CheckChange, menuListener);

    beforeMenu = new DateMenu();
    beforeMenu.addListener(Events.Select, menuListener);
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);
        }

      });
      menu.add(new SeparatorMenuItem());
      menu.add(groupBy);
    }

    if (menu != null && enableGroupingMenu && enableGrouping && enableNoGroups) {
      final CheckMenuItem showInGroups = new CheckMenuItem(GXT.MESSAGES.groupingView_showGroupsText());
      showInGroups.setChecked(true);
      showInGroups.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          onShowGroupsClick(ce, showInGroups.isChecked());
        }
      });
      menu.add(showInGroups);
    }
    return menu;
  }
View Full Code Here

      }
     });
    
     // select document
     Button selectDocumentMenuHead = new Button("Select Document");
     Menu selectDocumentMenu = new Menu();
     selectDocumentMenuHead.setMenu(selectDocumentMenu);
     topMenuBar.add(selectDocumentMenuHead)
   
     final CheckMenuItem selectDoc1 = new CheckMenuItem(initialization.getFile1Name());
     selectDoc1.setGroup("docSelection");
       selectDoc1.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        selectDoc1.setChecked(true);
        ClientState.workFile = ClientUtils.FILE1;
        selectSection.setEnabled(true);
        clearMainPanel();
        Commands.getInstance().selectDocument(ClientUtils.FILE1);
      }
     });
       selectDocumentMenu.add(selectDoc1);
    
       final CheckMenuItem selectDoc2 = new CheckMenuItem(initialization.getFile2Name());
       selectDoc2.setGroup("docSelection");
       selectDoc2.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        selectDoc2.setChecked(true);
        ClientState.workFile = ClientUtils.FILE2;
        selectSection.setEnabled(true);
        clearMainPanel();
        Commands.getInstance().selectDocument(ClientUtils.FILE2);
      }
     });
       selectDocumentMenu.add(selectDoc2)

       // add select section
     topMenuBar.add(selectSection);

     // about
View Full Code Here

    ToolBar mb = new ToolBar();
    mb.setWidth("100%");
   
    // Selected paragraph
    Button selectionMenuHead = new Button("Selected Paragraph");
    Menu selectiontMenu = new Menu();
    selectionMenuHead.setMenu(selectiontMenu);
    mb.add(selectionMenuHead);
   
   
    MenuItem getInformation = new MenuItem("More Information");
    getInformation.setIconStyle("icon-menu-information");
    getInformation.addSelectionListener(new SelectionListener<MenuEvent>(){

      @Override
      public void componentSelected(MenuEvent ce) {

        //
        String id = contentSection.getSelectedItemsId();
        if(null == id)
          Window.alert("Please select item");
        else
          Commands.getInstance().getInformationOn(id, ClientUtils.MASTER);
      }
    });
    selectiontMenu.add(getInformation);
   
    MenuItem gotoStaticDisplay = new MenuItem("Goto Static Display");
    gotoStaticDisplay.setIconStyle("icon-menu-gotoStatic");
    gotoStaticDisplay.addSelectionListener(new SelectionListener<MenuEvent>(){

      @Override
      public void componentSelected(MenuEvent ce) {
        //
        String id = contentSection.getSelectedItemsId();
        if(null == id)
          Window.alert("Please select item");
        else
          Commands.getInstance().gotoStaticDisplay(id, ClientUtils.MASTER);
      }
    });
    selectiontMenu.add(gotoStaticDisplay);
    selectiontMenu.add(new SeparatorMenuItem());
   

    MenuItem addNote = new MenuItem("Add Note to Paragraph");
    addNote.setIconStyle("icon-menu-addNote");
    addNote.addSelectionListener(new SelectionListener<MenuEvent>(){

      @Override
      public void componentSelected(MenuEvent ce) {
        //
        String id = contentSection.getSelectedItemsId();
        if(null == id)
          Window.alert("Please select item");
        else {
           new NotesPanel(id, TCNote.TYPE_PARAGRAPH, new NotePanelCallback<TCNote, Integer>(){
            public void callback(TCNote note, Integer type) {
              if(type == NotesPanel.NOTE_ADDED)
                contentSection.addNote(note);
            }
           });
        }
      }
    });
    selectiontMenu.add(addNote);
   
   
   
   
    selectiontMenu.add(new SeparatorMenuItem());
   
    MenuItem showMatches = new MenuItem("Display Matches");
    showMatches.setIconStyle("icon-menu-displayMatches");
    showMatches.addSelectionListener(new SelectionListener<MenuEvent>(){

      @Override
      public void componentSelected(MenuEvent ce) {
        contentSection.loadAndDisplayMatches();
      }
    });
    selectiontMenu.add(showMatches);
   
    // Navigation
    createNavigateInSectionMenu(mb, ClientState.workFile, ClientState.selectedSectionMaster, new CommandCallback<Section>(){
        public void cc_callback(Section value) {
          // display section in master panel
View Full Code Here

    }
   
    private void createNavigateInSectionMenu(ToolBar mb, final int file, final TableOfContentsEntry selectedSection, final CommandCallback<Section> callback){
      // Navigation
      Button navigationMenuHead = new Button("Navigation");
    Menu navigationMenu = new Menu();
    navigationMenuHead.setMenu(navigationMenu);
    mb.add(navigationMenuHead);
   
    Button gotoNextSection = new Button("Goto Next Section");
    gotoNextSection.setIconStyle("icon-menu-nextSection");
    if(!selectedSection.hasNext())
      gotoNextSection.disable();
    else {
      String nextSectionsTitle = selectedSection.getNext().getTitle();
      if(nextSectionsTitle.length() > 20)
        gotoNextSection.setText("Goto Next Section: " + nextSectionsTitle.substring(0, 20) + "..." );
      else
        gotoNextSection.setText("Goto Next Section: " + nextSectionsTitle);
    }
    gotoNextSection.addSelectionListener(new SelectionListener<ButtonEvent>(){
      @Override
      public void componentSelected(ButtonEvent ce) {
        if(null != selectedSection)
          Commands.getInstance().selectNextSection(file, selectedSection, callback);
      }
    });
    navigationMenu.add(gotoNextSection);
   
    Button gotoPreviousSection = new Button("Goto Previous Section");
    gotoPreviousSection.setIconStyle("icon-menu-previousSection");
    if(!selectedSection.hasPrev())
      gotoPreviousSection.disable();
    else {
      String prevSectionsTitle = selectedSection.getPrev().getTitle();
      if(prevSectionsTitle.length() > 20)
        gotoPreviousSection.setText("Goto Previous Section: " + prevSectionsTitle.substring(0, 20) + "..." );
      else
        gotoPreviousSection.setText("Goto Previous Section: " + prevSectionsTitle);
    }
    gotoPreviousSection.addSelectionListener(new SelectionListener<ButtonEvent>(){
      @Override
      public void componentSelected(ButtonEvent ce) {
        if(null != selectedSection)
          Commands.getInstance().selectPreviousSection(file, selectedSection, callback);
      }
    });
    navigationMenu.add(gotoPreviousSection);
    }
View Full Code Here

TOP

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

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.