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

Examples of com.extjs.gxt.ui.client.widget.toolbar.ToolBar


    contentPanel.setBodyBorder(false);
    contentPanel.setStyleName("tc-right-panel");
   
    if(matches.size() == 0){
      // create menu
      ToolBar mb = new ToolBar();
     
      createFindMatchesMenu(mb, "Find Matches", selectedPartsID);
     
      // add menubar to vpanel
      contentPanel.setTopComponent(mb);
     
      // add info that no match was found
      contentPanel.add(new HTML("No Match Found!"));
     
      // tell section to put right class to paragraph
      contentSection.markPart(selectedPartsID, TCSection.MARKUP_PART_NOMATCH);
    } else {
      // prepare tabpanel, add matches and create a lookup table
      final TabPanel tabPanel = new TabPanel();
      tabPanel.setStyleName("tc-inner-panel");
      if(ClientState.showHighlighting)
        tabPanel.addStyleName("showHighlighting");
      tabPanel.setPlain(true);
      tabPanel.setBodyBorder(false);
      tabPanel.setBorders(false);
     
      final HashMap<TabItem, TCLink> tabLookup = new HashMap<TabItem, TCLink>();
     
      for(int i = 0; i < matches.size(); i++){
        TabItem item = new TabItem("match " + (i+1));
        item.setScrollMode(Scroll.AUTO);
        item.setLayout(new FitLayout());
        NoteItem mItem = new NoteItem(matches.get(i).getText(), matches.get(i).getLink().getCurrentDerivedId(), matches.get(i).getNotes());
        item.add(mItem);
        if(matches.get(i).getLink().getType().equals(TCLink.TYPE_CONFIRMED))
          item.addStyleName("tc-match-confirmedMatch");
        else
          item.addStyleName("tc-match-unconfirmedMatch");
        tabPanel.add(item);
        tabLookup.put(item, matches.get(i).getLink());
      }
     
      // tab selection listener to unhighlight paragraph in TCSection
      tabPanel.addListener(Events.Select, new Listener<TabPanelEvent>(){
        public void handleEvent(TabPanelEvent be) {
          contentSection.unhighlightParagraph();
        }
      });
     
      // create menu
      ToolBar mb = new ToolBar();
     
      // Match Menu
      Button matchMenuHead = new Button("Match");
      Menu matchMenu = new Menu();
      matchMenuHead.setMenu(matchMenu);
      mb.add(matchMenuHead)
     
      MenuItem moreInformation = new MenuItem("More Information");
      moreInformation.setIconStyle("icon-menu-information");
      moreInformation.addSelectionListener(new SelectionListener<MenuEvent>(){
        @Override
        public void componentSelected(MenuEvent ce) {
          // find out which tab was selected
          TCLink link = tabLookup.get(tabPanel.getSelectedItem());
          Commands.getInstance().getInformationOn(link.getCurrentDerivedId(), ClientUtils.DERIVED);
        }
      });
      matchMenu.add(moreInformation);
     
      MenuItem gotoStaticDisplay = new MenuItem("Goto static display");
      gotoStaticDisplay.setIconStyle("icon-menu-gotoStatic");
      gotoStaticDisplay.addSelectionListener(new SelectionListener<MenuEvent>(){
        @Override
        public void componentSelected(MenuEvent ce) {
          // find out which tab was selected
          TCLink link = tabLookup.get(tabPanel.getSelectedItem());
          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) {
          // find out which tab was selected
          TCLink link = tabLookup.get(tabPanel.getSelectedItem());
          Commands.getInstance().highlightSource(selectedPartsID, link.getCurrentDerivedId());
        }
      });
      highlightingMenu.add(highlightInSource);
     
      // separator
      mb.add(new SeparatorToolItem());
     
     
      // add more matches
      createFindMatchesMenu(mb, "Find Additional Matches", selectedPartsID);
     
View Full Code Here


    // create list of proposals
    final TCMatchProposal matchProp = new TCMatchProposal(results.getProposals());
   
    // create menu
    ToolBar mb = new ToolBar();
    mb.setWidth("100%");

    // cancel
    createCancelToolbarButton(mb, "Cancel", selectedPartsID);
   
    // separator
    mb.add(new SeparatorToolItem());
   
    // Proposal
    Button proposalMenuHead = new Button("Proposal");
    Menu proposalMenu = new Menu();
   
    proposalMenuHead.setMenu(proposalMenu);
    mb.add(proposalMenuHead);   
   
    MenuItem entireProposal = new MenuItem("Show Proposal");
    entireProposal.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        matchProp.showProposal();
      }
    });
    proposalMenu.add(entireProposal);

    MenuItem moreInformation = new MenuItem("More Information");
    moreInformation.setIconStyle("icon-menu-information");
    moreInformation.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        matchProp.displayInformation();       
      }
    });
    proposalMenu.add(moreInformation);
   
    MenuItem gotoStaticDisplay = new MenuItem("Goto static display");
    gotoStaticDisplay.setIconStyle("icon-menu-gotoStatic");
    gotoStaticDisplay.addSelectionListener(new SelectionListener<MenuEvent>(){
      @Override
      public void componentSelected(MenuEvent ce) {
        MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
        if(null == selectedProposal)
          Window.alert("Please select proposal");
        else
          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) {
        MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
        if(null == selectedProposal)
          Window.alert("Please select proposal");
        else
          Commands.getInstance().highlightSource(selectedPartsID, selectedProposal.getId());
      }
    });
    highlightingMenu.add(highlightInSource);

   
    // separator
    mb.add(new SeparatorToolItem());
   
    // more matches
    if(results.getType() == SearchResults.TYPE_PROPOSED){
      // propose matches
      final Button proposeMatch = new Button("Propose More Matches");
      if(null != ClientState.proposeMoreMatches && ClientState.proposeMoreMatches.equals(selectedPartsID))
        proposeMatch.disable();
      proposeMatch.addSelectionListener(new SelectionListener<ButtonEvent>(){
        @Override
        public void componentSelected(ButtonEvent ce) {
          proposeMatch.disable();
          ClientState.proposeMoreMatches = selectedPartsID;
          Commands.getInstance().findNewMatchFor(selectedPartsID,ClientUtils.SHINGLE_CLOUD_FUZZY);
        }
      });
      mb.add(proposeMatch);
    }
   
    // Navigation
    if(results.getType() == SearchResults.TYPE_MANUAL_SEARCH){
      Button navigationMenuHead = new Button("Navigation");
      Menu navigationMenu = new Menu();
      navigationMenuHead.setMenu(navigationMenu);
      mb.add(navigationMenuHead);
     
      Button gotoNextSection = new Button("Goto Next Page");
      gotoNextSection.setIconStyle("icon-menu-nextSection");
      if(! results.isMore())
        gotoNextSection.disable();
View Full Code Here

      contentPanel.setStyleName("tc-right-panel");
     
      final TCSection tcSection = new TCSection(section, TCSection.MODE_RIGHT_MATCHING);
     
      // create menu
    ToolBar mb = new ToolBar();
    mb.setWidth("100%");
   
    // cancel
    createCancelToolbarButton(mb, "Cancel", contentSection.getSelectedItemsId());
   
    //
    mb.add(new SeparatorToolItem());
   
    // Selected paragraph
    Button selectionMenuHead = new Button("Selected Paragraph");
    Menu selectionMenu = new Menu();
    selectionMenuHead.setMenu(selectionMenu);
    mb.add(selectionMenuHead);
   
    Button getInformation = new Button("More Information");
    getInformation.setIconStyle("icon-menu-information");
    getInformation.addSelectionListener(new SelectionListener<ButtonEvent>(){

      @Override
      public void componentSelected(ButtonEvent ce) {
        String id = tcSection.getSelectedItemsId();
        if(null == id)
          Window.alert("Please select item");
        else
          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
      public void componentSelected(ButtonEvent ce) {
        try{
          LinkableItem linkItem = tcSection.getLinkableItem();
          Commands.getInstance().createLink(contentSection.getSelectedItemsId(),linkItem );
        } catch(IllegalStateException e){
          Window.alert("Please select item");
        }
      }
    });
    selectionMenu.add(createLink);
   
    //
    mb.add(new SeparatorToolItem());
   
    // Navigation
    createNavigateInSectionMenu(mb, ClientState.getCurrentlyDerivedFile(), ClientState.selectedSectionDerived, new CommandCallback<Section>(){
        public void cc_callback(Section value) {
          // display section in master panel
View Full Code Here

      return;
    }
    Component c = (Component) findNextWidget(component);
    if (c != null && c.getData("gxt-overflow") != null) {
      pe.stopEvent();
      ToolBar bar = (ToolBar) component.getParent();
      ToolBarLayout layout = bar.getLayout();
      Button more = layout.getMoreButton();
      more.focus();
      return;
    }
View Full Code Here

  @Override
  public void onLeft(Component component, PreviewEvent pe) {
    if (component.getParent() instanceof PagingToolBar) {
      return;
    }
    ToolBar bar = (ToolBar)component.getParent();
    ToolBarLayout layout = bar.getLayout();
    Button more = layout.getMoreButton();
    if (component == more) {
      for (int i = bar.getItemCount() - 1; i >= 0; i--) {
        Component c = bar.getItem(i);
        if (!isIgnore(c) && c.getData("gxt-overflow") == null) {
          focusWidget(c, false);
          return;
        }
      }
View Full Code Here

    msgs.setLastText(msgs.getLastText() == null ? msg.pagingToolBar_lastText() : msgs.getLastText());
    msgs.setBeforePageText(msgs.getBeforePageText() == null ? msg.pagingToolBar_beforePageText()
        : msgs.getBeforePageText());
    msgs.setEmptyMsg(msgs.getEmptyMsg() == null ? msg.pagingToolBar_emptyMsg() : msgs.getEmptyMsg());

    toolBar = new ToolBar();

    first = new TextToolItem();
    first.setIconStyle("x-tbar-page-first");
    if (showToolTips) first.setToolTip(msgs.getFirstText());
    first.addSelectionListener(new SelectionListener<ComponentEvent>() {
View Full Code Here

      return;
    }
    Component c = (Component) findNextWidget(component);
    if (c != null && c.getData("gxt-overflow") != null) {
      pe.stopEvent();
      ToolBar bar = (ToolBar) component.getParent();
      ToolBarLayout layout = bar.getLayout();
      Button more = layout.getMoreButton();
      more.focus();
      return;
    }
View Full Code Here

  @Override
  public void onLeft(Component component, PreviewEvent pe) {
    if (component.getParent() instanceof PagingToolBar) {
      return;
    }
    ToolBar bar = (ToolBar)component.getParent();
    ToolBarLayout layout = bar.getLayout();
    Button more = layout.getMoreButton();
    if (component == more) {
      for (int i = bar.getItemCount() - 1; i >= 0; i--) {
        Component c = bar.getItem(i);
        if (!isIgnore(c) && c.getData("gxt-overflow") == null) {
          focusWidget(c, false);
          return;
        }
      }
View Full Code Here

      };

      HtmlEditorImages g = getImages();
      HtmlEditorMessages m = getMessages();

      tb = new ToolBar();
      tb.addListener(Events.OnClick, new Listener<ComponentEvent>() {
        public void handleEvent(ComponentEvent be) {
          if (fly(be.getTarget()).findParent(".x-toolbar-cell", 10) != null) {
            be.cancelBubble();
          }
View Full Code Here

            }
          }
        }
      };

      toolbar = new ToolBar();
      if (sourceEditMode) {
        toolbar.add(sourceEdit = createToggleButton(getImages().getSource(), getMessages().getSourceEditTipText(),
            getMessages().getSourceEditTipTitle()));
        toolbar.add(new SeparatorToolItem());
      }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.widget.toolbar.ToolBar

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.