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

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


        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>(){
View Full Code Here


          Commands.getInstance().gotoStaticDisplay(link.getCurrentDerivedId(), ClientUtils.DERIVED);
        }
      });
      matchMenu.add(gotoStaticDisplay);
     
      matchMenu.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) {
          //
          final NoteItem mItem = (NoteItem) tabPanel.getSelectedItem().getWidget(0);
          String id = mItem.getId();
           new NotesPanel(id, TCNote.TYPE_PARAGRAPH, new NotePanelCallback<TCNote, Integer>(){
            public void callback(TCNote note, Integer type) {
              if(type == NotesPanel.NOTE_ADDED)
                mItem.addNote(note);
            }
           });
        }
      });
      matchMenu.add(addNote);
     
      MenuItem addNoteMatch = new MenuItem("Add Note to Match");
      addNoteMatch.setIconStyle("icon-menu-addNote");
      addNoteMatch.addSelectionListener(new SelectionListener<MenuEvent>(){

        @Override
        public void componentSelected(MenuEvent ce) {
          //
          final NoteItem mItem = (NoteItem) tabPanel.getSelectedItem().getWidget(0);
          String id = mItem.getId();
           new NotesPanel(id, TCNote.TYPE_LINK, new NotePanelCallback<TCNote, Integer>(){
            public void callback(TCNote note, Integer type) {
              if(type == NotesPanel.NOTE_ADDED)
                mItem.addNote(note);
            }
           });
        }
      });
      matchMenu.add(addNoteMatch);
     
      matchMenu.add(new SeparatorMenuItem());
     
      MenuItem confirmLink = new MenuItem("Confirm Match");
      confirmLink.setIconStyle("icon-menu-confirmLink");
      confirmLink.addSelectionListener(new SelectionListener<MenuEvent>(){
        @Override
        public void componentSelected(MenuEvent ce) {
          // find out which tab was selected
          TCLink link = tabLookup.get(tabPanel.getSelectedItem());
          Commands.getInstance().confirmMatch(link);
        }
      });
      matchMenu.add(confirmLink);
     
      matchMenu.add(new SeparatorMenuItem());

      MenuItem deleteLink = new MenuItem("Delete Match");
      deleteLink.setIconStyle("icon-menu-deleteLink");
      deleteLink.addSelectionListener(new SelectionListener<MenuEvent>(){
        @Override
        public void componentSelected(MenuEvent ce) {
          // find out which tab was selected
          TCLink link = tabLookup.get(tabPanel.getSelectedItem());
          Commands.getInstance().removeMatch(link);
        }
      });
      matchMenu.add(deleteLink);
     
     
      // separator
      mb.add(new SeparatorToolItem());
     
      // Highlighting
      Button highlightingMenuHead = new Button("Highlighting");
      highlightingMenuHead.setIconStyle("icon-menu-highlightMenu");
      Menu highlightingMenu = new Menu();
     
      highlightingMenuHead.setMenu(highlightingMenu);
      mb.add(highlightingMenuHead)
     
      final MenuItem toggleHighlighting = new MenuItem();
      if(ClientState.showHighlighting){
        toggleHighlighting.setText("Deactivate Highlighting");
        toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
      } else {
        toggleHighlighting.setText("Activate Highlighting");
        toggleHighlighting.setIconStyle("icon-menu-highlightingDeactivated");
      }
     
      toggleHighlighting.addSelectionListener(new SelectionListener<MenuEvent>(){
        @Override
        public void componentSelected(MenuEvent ce) {
          ClientState.showHighlighting = !ClientState.showHighlighting;

          if(ClientState.showHighlighting)
            tabPanel.addStyleName("showHighlighting");
          else
            tabPanel.removeStyleName("showHighlighting");   
         
          // switch state
          if(ClientState.showHighlighting){
            toggleHighlighting.setText("Deactivate Highlighting");
            toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
          } else {
            toggleHighlighting.setText("Activate Highlighting");
            toggleHighlighting.setIconStyle("icon-menu-highlightingDeactivated");
          }
        }
      });
      highlightingMenu.add(toggleHighlighting);
     
      highlightingMenu.add(new SeparatorMenuItem());
     
      MenuItem highlightInSource = new MenuItem("Highlight in Source");
      highlightInSource.addSelectionListener(new SelectionListener<MenuEvent>(){
        @Override
        public void componentSelected(MenuEvent ce) {
View Full Code Here

          Commands.getInstance().gotoStaticDisplay(selectedProposal.getId(), ClientUtils.DERIVED);
      }
    });
    proposalMenu.add(gotoStaticDisplay);

    proposalMenu.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) {
        //
        MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
        if(null == selectedProposal)
          Window.alert("Please select proposal.");
        else {
          String id = selectedProposal.getId();
          new NotesPanel(id, TCNote.TYPE_PARAGRAPH, new NotePanelCallback<TCNote, Integer>(){
            public void callback(TCNote note, Integer type) {
              if(type == NotesPanel.NOTE_ADDED)
                matchProp.addNote(note);
            }
           });
        }
      }
    });
    proposalMenu.add(addNote);
   
    proposalMenu.add(new SeparatorMenuItem());
   
    MenuItem createLink = new MenuItem("Create Link");
    createLink.setIconStyle("icon-menu-createLink");
    createLink.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
        if(null == selectedProposal)
          Window.alert("Please select proposal.");
        else if(selectedProposal.isMatched())
          Window.alert("The match has has already been established.");
        else
          Commands.getInstance().createLink(selectedPartsID, selectedProposal);
      }
    });
    proposalMenu.add(createLink);
   
    // sepearator
    mb.add(new SeparatorToolItem());
   
    // Highlighting
    Button highlightingMenuHead = new Button("Highlighting");
    highlightingMenuHead.setIconStyle("icon-menu-highlightMenu");
    Menu highlightingMenu = new Menu();
   
    highlightingMenuHead.setMenu(highlightingMenu);
    mb.add(highlightingMenuHead)
   
    final MenuItem toggleHighlighting = new MenuItem();
    if(ClientState.showHighlighting){
      toggleHighlighting.setText("Deactivate Highlighting");
      toggleHighlighting.setIconStyle("icon-menu-highlightingDeactivated");
    } else {
      toggleHighlighting.setText("Activate Highlighting");
      toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
    }
   
    toggleHighlighting.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        matchProp.toggleHighlighting();   
       
        // switch state
        if(ClientState.showHighlighting){
          toggleHighlighting.setText("Deactivate Highlighting");
          toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
        } else {
          toggleHighlighting.setText("Activate Highlighting");
          toggleHighlighting.setIconStyle("icon-menu-highlightingDeactivated");
        }
      }
    });
    highlightingMenu.add(toggleHighlighting);
   
    highlightingMenu.add(new SeparatorMenuItem());
   
    MenuItem highlightInSource = new MenuItem("Highlight Proposal in Source");
    highlightInSource.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
View Full Code Here

          Commands.getInstance().getInformationOn(id, ClientUtils.DERIVED);
      }
    });
    selectionMenu.add(getInformation);
   
    selectionMenu.add(new SeparatorMenuItem());
   
    Button createLink = new Button("Create Link");
    createLink.addSelectionListener(new SelectionListener<ButtonEvent>(){

      @Override
View Full Code Here

    this.spacing = spacing;
  }

  protected void addComponentToMenu(Menu menu, Component c) {
    if (c instanceof SeparatorToolItem) {
      menu.add(new SeparatorMenuItem());
    } else if (c instanceof SplitButton) {
      final SplitButton sb = (SplitButton) c;
      MenuItem item = new MenuItem(sb.getText(), sb.getIcon());
      item.setEnabled(c.isEnabled());
      item.setItemId(c.getItemId());
      if (sb.getData("gxt-menutext") != null) {
        item.setText(sb.getData("gxt-menutext").toString());
      }
      if (sb.getMenu() != null) {
        item.setSubMenu(sb.getMenu());
      }
      item.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          ButtonEvent e = new ButtonEvent(sb);
          e.setEvent(ce.getEvent());
          sb.fireEvent(Events.Select, e);
        }

      });
      menu.add(item);

    } else if (c instanceof Button) {
      final Button b = (Button) c;
      MenuItem item = new MenuItem(b.getText(), b.getIcon());
      item.setItemId(c.getItemId());

      if (b.getData("gxt-menutext") != null) {
        item.setText(b.getData("gxt-menutext").toString());
      }
      if (b.getMenu() != null) {
        item.setHideOnClick(false);
        item.setSubMenu(b.getMenu());
      }
      item.setEnabled(c.isEnabled());
      item.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          ButtonEvent e = new ButtonEvent(b);
          e.setEvent(ce.getEvent());
          b.fireEvent(Events.Select, e);
        }

      });
      menu.add(item);
    } else if (c instanceof ButtonGroup) {
      ButtonGroup g = (ButtonGroup) c;
      g.setItemId(c.getItemId());
      menu.add(new SeparatorMenuItem());
      String heading = g.getHeading();
      if (heading != null && heading.length() > 0 && !heading.equals("&#160;")) {
        menu.add(new HeaderMenuItem(g.getHeading()));
      }
      for (Component c2 : g.getItems()) {
        addComponentToMenu(menu, c2);
      }
      menu.add(new SeparatorMenuItem());
    }

    if (menu.getItemCount() > 0) {
      if (menu.getItem(0) instanceof SeparatorMenuItem) {
        menu.remove(menu.getItem(0));
View Full Code Here

    this.spacing = spacing;
  }

  protected void addComponentToMenu(Menu menu, Component c) {
    if (c instanceof SeparatorToolItem) {
      menu.add(new SeparatorMenuItem());
    } else if (c instanceof SplitButton) {
      final SplitButton sb = (SplitButton) c;
      MenuItem item = new MenuItem(sb.getText(), sb.getIcon());
      item.setEnabled(c.isEnabled());
      item.setItemId(c.getItemId());
      if (sb.getData("gxt-menutext") != null) {
        item.setText((String) sb.getData("gxt-menutext"));
      } else {
        item.setText("&nbsp;");
      }
      if (sb.getMenu() != null) {
        item.setSubMenu(sb.getMenu());
      }
      item.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          ButtonEvent e = new ButtonEvent(sb);
          e.setEvent(ce.getEvent());
          sb.fireEvent(Events.Select, e);
        }

      });
      menu.add(item);

    } else if (c instanceof Button) {
      final Button b = (Button) c;
      MenuItem item = new MenuItem(b.getText(), b.getIcon());
      item.setItemId(c.getItemId());

      if (b.getData("gxt-menutext") != null) {
        item.setText((String) b.getData("gxt-menutext"));
      }
      if (b.getMenu() != null) {
        item.setHideOnClick(false);
        item.setSubMenu(b.getMenu());
      }
      item.setEnabled(c.isEnabled());
      item.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          ButtonEvent e = new ButtonEvent(b);
          e.setEvent(ce.getEvent());
          b.fireEvent(Events.Select, e);
        }

      });
      menu.add(item);
    } else if (c instanceof ButtonGroup) {
      ButtonGroup g = (ButtonGroup) c;
      g.setItemId(c.getItemId());
      menu.add(new SeparatorMenuItem());
      String heading = g.getHeading();
      if (heading != null && heading.length() > 0 && !heading.equals("&#160;")) {
        menu.add(new HeaderMenuItem(g.getHeading()));
      }
      for (Component c2 : g.getItems()) {
        addComponentToMenu(menu, c2);
      }
      menu.add(new SeparatorMenuItem());
    }

    if (menu.getItemCount() > 0) {
      if (menu.getItem(0) instanceof SeparatorMenuItem) {
        menu.remove(menu.getItem(0));
View Full Code Here

        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(
View Full Code Here

  /**
   * Adds a seperator to the "too" area.
   */
  public void addToolSeperator() {
    SeparatorMenuItem sep = new SeparatorMenuItem();
    sep.setStyleName("ux-toolmenu-sep");
    addTool(sep);
  }
View Full Code Here

  /**
   * Adds a separator to the "too" area.
   */
  public void addToolSeperator() {
    SeparatorMenuItem sep = new SeparatorMenuItem();
    sep.setStyleName("ux-toolmenu-sep");
    addTool(sep);
  }
View Full Code Here

    this.spacing = spacing;
  }

  protected void addComponentToMenu(Menu menu, Component c) {
    if (c instanceof SeparatorToolItem) {
      menu.add(new SeparatorMenuItem());
    } else if (c instanceof SplitButton) {
      final SplitButton sb = (SplitButton) c;
      MenuItem item = new MenuItem(sb.getHtml(), sb.getIcon());
      item.setEnabled(c.isEnabled());
      item.setItemId(c.getItemId());
      if (sb.getData("gxt-menutext") != null) {
        item.setHtml(sb.getData("gxt-menutext").toString());
      }
      if (sb.getMenu() != null) {
        item.setSubMenu(sb.getMenu());
      }
      item.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          ButtonEvent e = new ButtonEvent(sb);
          e.setEvent(ce.getEvent());
          sb.fireEvent(Events.Select, e);
        }

      });
      menu.add(item);

    } else if (c instanceof Button) {
      final Button b = (Button) c;
      MenuItem item = new MenuItem(b.getHtml(), b.getIcon());
      item.setItemId(c.getItemId());

      if (b.getData("gxt-menutext") != null) {
        item.setHtml(b.getData("gxt-menutext").toString());
      }
      if (b.getMenu() != null) {
        item.setHideOnClick(false);
        item.setSubMenu(b.getMenu());
      }
      item.setEnabled(c.isEnabled());
      item.addSelectionListener(new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
          ButtonEvent e = new ButtonEvent(b);
          e.setEvent(ce.getEvent());
          b.fireEvent(Events.Select, e);
        }

      });
      menu.add(item);
    } else if (c instanceof ButtonGroup) {
      ButtonGroup g = (ButtonGroup) c;
      g.setItemId(c.getItemId());
      menu.add(new SeparatorMenuItem());
      String heading = g.getHeadingHtml();
      if (heading != null && heading.length() > 0 && !heading.equals("&#160;")) {
        menu.add(new HeaderMenuItem(g.getHeadingHtml()));
      }
      for (Component c2 : g.getItems()) {
        addComponentToMenu(menu, c2);
      }
      menu.add(new SeparatorMenuItem());
    }

    if (menu.getItemCount() > 0) {
      if (menu.getItem(0) instanceof SeparatorMenuItem) {
        menu.remove(menu.getItem(0));
View Full Code Here

TOP

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

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.