Package javax.swing

Examples of javax.swing.JPopupMenu$Separator


    int inx = locationToIndex(e.getPoint());
    setSelectedIndex(inx);

    if (getModel().getElementAt(inx) instanceof Program) {
      Program prog = (Program) getModel().getElementAt(inx);
      JPopupMenu menu = mng.createPluginContextMenu(prog, caller);
      menu.show(ProgramList.this, e.getX() - 15, e.getY() - 15);
    }
  }
View Full Code Here


   * @param caller
   *          ContextMenuIf that called this
   */
  private void showPopup(MouseEvent evt, ContextMenuIf caller) {
    if (SwingUtilities.isRightMouseButton(evt)) {
      JPopupMenu menu = PluginProxyManager.createPluginContextMenu(mProgram,
          caller);
      menu.show(evt.getComponent(), evt.getX() - 15, evt.getY() - 15);
    }
  }
View Full Code Here

  public ChannelContextMenu(MouseEvent e, Channel ch, Object src) {
    mSource = src;
    mChannel = ch;
    mComponent = e.getComponent();

    mMenu = new JPopupMenu();
    mChAdd = new JMenuItem(mLocalizer.msg("addChannels", "Add/Remove channels"));
    mChConf = new JMenuItem(mLocalizer.msg("configChannel", "Setup channel"),
        TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL));
    mChGoToURL = new JMenuItem(mLocalizer.msg("openURL", "Open internet page"),
        IconLoader.getInstance().getIconFromTheme("apps",
View Full Code Here

      return;
    }

    // create popup menu and show
    JTextComponent tc = (JTextComponent) comp;
    JPopupMenu menu = new JPopupMenu();
    addStandardContextMenu(tc, menu);

    Point pt = SwingUtilities
        .convertPoint(me.getComponent(), me.getPoint(), tc);
    menu.show(tc, pt.x, pt.y);
  }
View Full Code Here

    add(button);
  }

  private void showPopupMenu(MouseEvent e) {
    JPopupMenu menu = new JPopupMenu();
    String label = mLocalizer.ellipsisMsg("configure", "Configure");
    String name = null;
    boolean configItemEnabled = false;

    if (e.getSource() instanceof AbstractButton) {
      name = ((AbstractButton) e.getSource()).getName();

      if (name.startsWith("#scrollTo") && name.indexOf("Channel") == -1) {
        configItemEnabled = true;
        label = mLocalizer.ellipsisMsg("configureTime", "Configure time buttons");
      }
      else if(name.startsWith("#filter")) {
        configItemEnabled = true;
        label = FilterButtons.mLocalizer.ellipsisMsg("createFilter", "Create filter");
      }
      else if(name.startsWith("#scrollToChannel")) {
        configItemEnabled = true;
        label = ChannelContextMenu.mLocalizer.ellipsisMsg("addChannels", "Add/Remove channels");
      }
      else if (name.indexOf("##") != -1) {
        PluginProxy plugin = PluginProxyManager.getInstance().getActivatedPluginForId(name.substring(0,name.indexOf("##")));
        configItemEnabled = plugin != null && plugin.getSettingsTab() != null;
      }
      else if (PluginProxyManager.getInstance().getActivatedPluginForId(name) != null) {
        configItemEnabled = PluginProxyManager.getInstance().getActivatedPluginForId(name).getSettingsTab() != null;
      }
      else if (InternalPluginProxyList.getInstance().getProxyForId(name) != null) {
        configItemEnabled = InternalPluginProxyList.getInstance().getProxyForId(name).getSettingsTab() != null;
        name = InternalPluginProxyList.getInstance().getProxyForId(name).getSettingsId();
      }
    } else {
      return;
    }


    JMenuItem item = new JMenuItem(label);
    item.setActionCommand(name);
    item.setEnabled(configItemEnabled);

    item.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand().startsWith("#scrollTo") && e.getActionCommand().indexOf("Channel") == -1) {
          MainFrame.getInstance().showSettingsDialog("#timebuttons");
        } else if (e.getActionCommand().startsWith("#filter")) {
          MainFrame.getInstance().showFilterDialog();
        } else if (e.getActionCommand().startsWith("#scrollToChannel")) {
          MainFrame.getInstance().showSettingsDialog(SettingsItem.CHANNELS);
        } else if (e.getActionCommand().indexOf("##") != -1){
          MainFrame.getInstance().showSettingsDialog(e.getActionCommand().substring(0,e.getActionCommand().indexOf("##")));
        } else {
          MainFrame.getInstance().showSettingsDialog(e.getActionCommand());
        }
      }
    });
    menu.add(item);
    menu.addSeparator();

    item = new JMenuItem(mLocalizer.msg("removeButton", "Remove button"));
    final String buttonName = name;
    item.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        Action[] actions = mModel.getActions();
        ArrayList<String> idList = new ArrayList<String>();
       
        for(Action a : actions) {
          String key = (String)a.getValue(ACTION_ID_KEY);
          String test = key;
         
          if (test.equals("searchplugin.SearchPlugin") && buttonName.equals("#search")) {
            test = "#search";
          } else if (test.equals("reminderplugin.ReminderPlugin") && buttonName.equals("#reminder")) {
            test = "#reminder";
          } else if (test.equals("favoritesplugin.FavoritesPlugin") && buttonName.equals("#favorite")) {
            test = "#favorite";
          }
         
          if (test.compareTo(buttonName) != 0) {
            idList.add(key);
          }
        }

        String[] ids = new String[idList.size()];
        idList.toArray(ids);
        DefaultToolBarModel.getInstance().setButtonIds(ids);
        MainFrame.getInstance().updateToolbar();
        Settings.propToolbarButtons.setStringArray(ids);
      }
    });
   
    menu.add(item);
    menu.add(ContextMenu.getSubMenu());

    menu.show(e.getComponent(), e.getX(), e.getY());
  }
View Full Code Here

    mTable.changeSelection(row, 0, false, false);

    Program p = (Program) mTable.getModel().getValueAt(row, 0);

    JPopupMenu menu = PluginManagerImpl.getInstance().createPluginContextMenu(p, ReminderPluginProxy.getInstance());
    menu.show(mTable, e.getX() - 15, e.getY() - 15);
  }
View Full Code Here

    super(tree);
    mPath = path;
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    menu.add(getExpandAllMenuItem(mPath));
    menu.add(getCollapseAllMenuItem(mPath));
    return menu;
  }
View Full Code Here

      mActionMenus = new ActionMenu[]{};
    }
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem defaultMI = new JMenuItem(mDefaultAction);
    menu.add(defaultMI);
    defaultMI.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
    menu.add(getExpandAllMenuItem(mPath));
    menu.add(getCollapseAllMenuItem(mPath));
    menu.add(getFilterMenuItem(mPath));
    menu.add(getExportMenu( mPath));
   
    ActionMenu pluginAction = getButtonAction();
    if (pluginAction != null) {
      menu.addSeparator();
      Action action = pluginAction.getAction();
      JMenuItem pluginMI = new JMenuItem(action);
      pluginMI.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
      menu.add(pluginMI);
    }

    if (mActionMenus.length>0) {
      for (ActionMenu actionMenu : mActionMenus) {
        JMenuItem menuItem = MenuUtil.createMenuItem(actionMenu);
        menu.add(menuItem);
      }
    }

    menu.addSeparator();
    if (hasSettingsTab()) {
      JMenuItem menuItem = MenuUtil.createMenuItem(Localizer.getEllipsisLocalization(Localizer.I18N_SETTINGS));
      menuItem.setIcon(TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));
      menuItem.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e) {
          MainFrame.getInstance().showSettingsDialog(getPluginId());
        }
      });
      menu.add(menuItem);
    }
    JMenuItem menuItem = MenuUtil.createMenuItem(mLocalizer.msg(
        "disablePlugin", "Disable plugin"));
    menuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        final PluginProxy plugin = PluginProxyManager.getInstance()
            .getPluginForId(getPluginId());
        if (plugin != null) {
          try {
            PluginProxyManager.getInstance().deactivatePlugin(plugin);
          } catch (TvBrowserException e1) {
            e1.printStackTrace();
          }
        }
      }
    });
    menu.add(menuItem);
    ImageIcon icon = IconLoader.getInstance().getIconFromTheme("apps",
        "help-browser", 16);
    menuItem = MenuUtil.createMenuItem(Localizer.getLocalization(Localizer.I18N_HELP));
    menuItem.setIcon(icon);
    menuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        final PluginProxy plugin = PluginProxyManager.getInstance()
            .getPluginForId(getPluginId());
        if (plugin != null) {
          String helpUrl = plugin.getInfo().getHelpUrl();
          if (helpUrl == null) {
            helpUrl = PluginInfo.getHelpUrl(plugin.getId());
          }
          if (helpUrl != null) {
            Launch.openURL(helpUrl);
          }
        }
      }
    });
    menu.add(menuItem);
    return menu;
  }
View Full Code Here

      mActionMenus = new ActionMenu[]{};
    }
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    if (mDefaultAction != null) {
      JMenuItem defaultMI = new JMenuItem(mDefaultAction);
      menu.add(defaultMI);
      defaultMI.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
    }

    if (((Node) mPath.getLastPathComponent()).getAllowsChildren()) {
      menu.add(getExpandAllMenuItem(mPath));
      menu.add(getCollapseAllMenuItem(mPath));
      menu.add(getFilterMenuItem(mPath));
      menu.add(getExportMenu(mPath));
    }

    if (mActionMenus.length>0) {
      if (mDefaultAction != null) {
        menu.addSeparator();
      }
      for (ActionMenu actionMenu : mActionMenus) {
        if (actionMenu.getAction() != mDefaultAction) {
          JMenuItem menuItem = MenuUtil.createMenuItem(actionMenu);
          if (menuItem == null) {
            menu.addSeparator();
          } else {
            menu.add(menuItem);
          }
        }
      }
    }
    return menu;
View Full Code Here

    };
    mDefaultAction.putValue(Action.NAME, mLocalizer.msg("show", "show"));
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem showMI = new JMenuItem(mDefaultAction);
    showMI.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);

    showMI.setEnabled(mPaths.length == 1);
    menu.add(showMI);

    menu.add(getExportMenu(mPaths[0]));

    menu.addSeparator();

    JMenu menus = ContextMenuManager.getInstance().createContextMenuItems(null, mPrograms[0], false);

    Component[] comps = menus.getMenuComponents();
    for (Component comp : comps) {
      menu.add(comp);
      comp.setEnabled(mPrograms.length == 1);
    }

    return menu;
  }
View Full Code Here

TOP

Related Classes of javax.swing.JPopupMenu$Separator

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.