Package org.pushingpixels.flamingo.api.common

Examples of org.pushingpixels.flamingo.api.common.JCommandMenuButton


            manipulatorButton.setPopupCallback(new PopupPanelCallback() {

                public JPopupPanel getPopupPanel(JCommandButton jcb) {
                    JCommandPopupMenu popup = new JCommandPopupMenu();

                    JCommandMenuButton button;
                    for (final AttributeColumn column : availableColumns) {

                        button = new JCommandMenuButton(column.getTitle(), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/column.png"), new Dimension(16, 16)));
                        button.addActionListener(new ActionListener() {

                            public void actionPerformed(ActionEvent e) {
                                DataLaboratoryHelper.getDefault().executeAttributeColumnsManipulator(acm, table, column);
                            }
                        });
View Full Code Here


import org.pushingpixels.flamingo.api.common.icon.EmptyResizableIcon;
import org.pushingpixels.flamingo.api.common.popup.JCommandPopupMenu;

public class SamplePopupMenu extends JCommandPopupMenu {
  public SamplePopupMenu(ComponentOrientation co) {
    this.addMenuButton(new JCommandMenuButton("Test menu item 1",
        new EmptyResizableIcon(16)));
    this.addMenuButton(new JCommandMenuButton("Test menu item 2",
        new EmptyResizableIcon(16)));
    this.addMenuButton(new JCommandMenuButton("Test menu item 3",
        new EmptyResizableIcon(16)));
    this.addMenuSeparator();
    this.addMenuButton(new JCommandMenuButton("Test menu item 4",
        new EmptyResizableIcon(16)));
    this.addMenuButton(new JCommandMenuButton("Test menu item 5",
        new EmptyResizableIcon(16)));

    this.applyComponentOrientation(co);
  }
View Full Code Here

 
  public static JCommandMenuButton createCommandMenuButton(final AFreeplaneAction action) {
    String title = ActionUtils.getActionTitle(action);
    ResizableIcon icon = ActionUtils.getActionIcon(action);
   
    final JCommandMenuButton button = new JCommandMenuButton(title, icon);
   
    updateRichTooltip(button, action, null);
    button.addActionListener(new RibbonActionListener(action));
    button.setFocusable(false);
    return button;
  }
View Full Code Here

            }
        }
    }

    private JCommandMenuButton createNoScriptsAvailableButton() {
        return new JCommandMenuButton(noScriptsAvailableMessage(), null);
    }
View Full Code Here

        final ScriptMetaData metaData = configuration.getMenuTitleToMetaDataMap().get(scriptName);
        final String title = scriptNameToMenuItemTitle(scriptName);
        AFreeplaneAction action = new ExecuteScriptAction(scriptName, title, scriptPath, executionMode,
            metaData.cacheContent(), metaData.getPermissions());
        ResizableIcon icon = ActionUtils.getActionIcon(action);
        final JCommandMenuButton scriptEntry = new JCommandMenuButton(title, icon);
        scriptEntry.setActionRichTooltip(createRichTooltip(title, metaData));
        scriptEntry.addActionListener(action);
        scriptEntry.setFocusable(false);
        scriptEntry.setEnabled(metaData.getExecutionModes().contains(executionMode));
        return scriptEntry;
    }
View Full Code Here

              final JCommandToggleMenuButton toggleButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showIconAction);
              showIconAction.setSelected();
              toggleButton.getActionModel().setSelected(showIconAction.isSelected());
              popupmenu.addMenuButton(toggleButton);
             
              JCommandMenuButton button = new JCommandMenuButton(TextUtils.removeTranslateComment(TextUtils.getText("note_window_location")), null);
              button.setDisplayState(CommandButtonDisplayState.MEDIUM);
              button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
              button.setPopupCallback(new PopupPanelCallback() {
                public JPopupPanel getPopupPanel(JCommandButton commandButton) {
                  JCommandPopupMenu popupmenu = new JCommandPopupMenu();
               
                  final SetNoteWindowPosition posTopAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.top");
                  final JCommandToggleMenuButton posTopButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posTopAction);             
                  popupmenu.addMenuButton(posTopButton);
                  posTopAction.setSelected();
                  posTopButton.getActionModel().setSelected(posTopAction.isSelected());
                 
                  final SetNoteWindowPosition posLeftAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.left");
                  final JCommandToggleMenuButton posLeftButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posLeftAction);             
                  popupmenu.addMenuButton(posLeftButton);
                  posLeftAction.setSelected();
                  posLeftButton.getActionModel().setSelected(posLeftAction.isSelected());
                 
                  final SetNoteWindowPosition posRightAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.right");
                  final JCommandToggleMenuButton posRightButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posRightAction);             
                  popupmenu.addMenuButton(posRightButton);
                  posRightAction.setSelected();
                  posRightButton.getActionModel().setSelected(posRightAction.isSelected());
                 
                  final SetNoteWindowPosition posBottomAction = (SetNoteWindowPosition) context.getBuilder().getMode().getAction("SetNoteWindowPosition.bottom");
                  final JCommandToggleMenuButton posBottomButton = RibbonActionContributorFactory.createCommandToggleMenuButton(posBottomAction);             
                  popupmenu.addMenuButton(posBottomButton);
                  posBottomAction.setSelected();
                  posBottomButton.getActionModel().setSelected(posBottomAction.isSelected());
                 
                  return popupmenu;
                }
              });             
              popupmenu.addMenuButton(button);
             
            return popupmenu;
          }
        });
        band.addCommandButton(displayNotesButton, RibbonElementPriority.MEDIUM);
      }

      private void createAttributeViewMenu(final RibbonBuildContext context, JRibbonBand band) {
        JCommandButton button = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_displayAttributes")));
        button.setDisplayState(CommandButtonDisplayState.MEDIUM);
        button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
        button.setPopupCallback(new PopupPanelCallback() {
          public JPopupPanel getPopupPanel(JCommandButton commandButton) {
            JCommandPopupMenu popupmenu = new JCommandPopupMenu();
           
            final AttributeViewTypeAction showSelectedAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("ShowSelectedAttributesAction");
            final JCommandToggleMenuButton showSelectedAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showSelectedAttributesAction);             
            popupmenu.addMenuButton(showSelectedAttributesButton);
            showSelectedAttributesAction.setSelected();
            showSelectedAttributesButton.getActionModel().setSelected(showSelectedAttributesAction.isSelected());
           
            final AttributeViewTypeAction showAllAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("ShowAllAttributesAction");
            final JCommandToggleMenuButton showAllAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showAllAttributesAction);           
            popupmenu.addMenuButton(showAllAttributesButton);
            showAllAttributesAction.setSelected();
            showAllAttributesButton.getActionModel().setSelected(showAllAttributesAction.isSelected());
           
            final AttributeViewTypeAction hideAllAttributesAction = (AttributeViewTypeAction) context.getBuilder().getMode().getAction("HideAllAttributesAction");           
            final JCommandToggleMenuButton hideAllAttributesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(hideAllAttributesAction);           
            popupmenu.addMenuButton(hideAllAttributesButton);
            hideAllAttributesAction.setSelected();
            hideAllAttributesButton.getActionModel().setSelected(hideAllAttributesAction.isSelected());
                       
              final SetBooleanMapPropertyAction showIconAction = (SetBooleanMapPropertyAction) context.getBuilder().getMode().getAction("SetBooleanMapPropertyAction.show_icon_for_attributes");
              final JCommandToggleMenuButton toggleButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showIconAction);
              showIconAction.setSelected();
              toggleButton.getActionModel().setSelected(showIconAction.isSelected());
              popupmenu.addMenuButton(toggleButton);
           
            context.getBuilder().getMapChangeAdapter().addListener(new IChangeObserver() {             
              public void updateState(CurrentState state) {
                showSelectedAttributesAction.setSelected();
                showSelectedAttributesButton.getActionModel().setSelected(showSelectedAttributesAction.isSelected());
                showAllAttributesAction.setSelected();
                showAllAttributesButton.getActionModel().setSelected(showAllAttributesAction.isSelected());
                hideAllAttributesAction.setSelected();
                hideAllAttributesButton.getActionModel().setSelected(hideAllAttributesAction.isSelected());
                showIconAction.setSelected();
                toggleButton.getActionModel().setSelected(showIconAction.isSelected());
              }
            });
           
            JCommandMenuButton button = RibbonActionContributorFactory.createCommandMenuButton(context.getBuilder().getMode().getAction("ShowAttributeDialogAction"));
            popupmenu.addMenuButton(button);
           
            return popupmenu;
          }
        });
View Full Code Here

    if (v.size() != 0) {
      for (int idx = 0; idx < v.size(); idx++) {
        String name = ((WoPeDRecentFile) v.get(idx)).getName();
        String path = ((WoPeDRecentFile) v.get(idx)).getPath();

        JCommandMenuButton recentMenuItem = new JCommandMenuButton(
            name, new file_recent());
        recentMenuItem.addActionListener(new recentFileListener(path));

        m_recentMenu.addMenuButton(recentMenuItem);
      }
    } else {
      JCommandMenuButton emptyItem = new JCommandMenuButton(
          Messages.getString("Menu.File.RecentMenu.empty"),
          new file_recent());
      m_recentMenu.addMenuButton(emptyItem);
      emptyItem.setEnabled(false);
      m_recentMenu.addMenuButton(emptyItem);
    }
   
    return m_recentMenu;
  }
View Full Code Here

  }
   
  public JCommandButton getCoverabilityGraphButton() {
   
    if (coverabilityGraphButton == null) {
      coverabilityGraphButton = new JCommandMenuButton(Messages.getString("Tools.reachabilityGraph.text"), new analyze_reachability_graph());
      coverabilityGraphButton.addActionListener(new ActionButtonListener(m_mediator,ActionFactory.ACTIONID_REACHGRAPH_START,                                        AbstractViewEvent.REACHGRAPH, coverabilityGraphButton));
      setTooltip(coverabilityGraphButton, "Tools.reachabilityGraph");
    }
   
    return coverabilityGraphButton;
View Full Code Here

            if (ze.getName().indexOf(innerPath) == 0
                && ze.getName().length() > innerPath.length()) {
              samplepath = "/" + ze.getName();
              name = ze.getName().substring(
                  ze.getName().lastIndexOf("/") + 1);
              JCommandMenuButton sampleItem = new JCommandMenuButton(
                  name, new help_smaplenets());
              sampleItem
                  .addActionListener(new sampleFileListener(
                      samplepath));

              m_sampleMenu.addMenuButton(sampleItem);
            }
          }
        }
        // Normal dir access
        else {
          path = "../WoPeD-FileInterface/bin/" + innerPath;
          File sampleDir = new File(path);
          if (sampleDir.isDirectory()) {
            for (int idx = 0; idx < sampleDir.listFiles().length; idx++) {
              if (!sampleDir.listFiles()[idx].isDirectory()) {
                JCommandMenuButton sampleItem = new JCommandMenuButton(
                    sampleDir.listFiles()[idx].getName(),
                    new help_smaplenets());
                String name = sampleDir.listFiles()[idx]
                    .getAbsolutePath();
                sampleItem
                    .addActionListener(new sampleFileListener(
                        name));

                m_sampleMenu.addMenuButton(sampleItem);
              }
View Full Code Here

    }
  }

  @Override
  public void update(Graphics g, JComponent c) {
    JCommandMenuButton menuButton = (JCommandMenuButton) c;
    super.update(g, c);

    // System.out.println("Updating " + menuButton.getText());
    KeyTipRenderingUtilities.renderMenuButtonKeyTips(g, menuButton,
        layoutManager);
View Full Code Here

TOP

Related Classes of org.pushingpixels.flamingo.api.common.JCommandMenuButton

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.