Package javax.swing

Examples of javax.swing.Action


          if (progArr.length > 0) {
            PluginTreeNode newNode = new PluginTreeNode(child.toString());
            newNode.setGroupingByWeekEnabled(true);
            newNode.getMutableTreeNode().setIcon(FavoritesPlugin.getFavoritesIcon(16));
            node.add(newNode);
            Action editFavorite = new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
                FavoritesPlugin.getInstance().editFavorite(child.getFavorite());
              }
            };
            editFavorite.putValue(Action.NAME, mLocalizer.ellipsisMsg("editTree","Edit"));
            editFavorite.putValue(Action.SMALL_ICON, TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL));

            Action deleteFavorite = new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
                FavoritesPlugin.getInstance().askAndDeleteFavorite(child.getFavorite());
              }
            };
            deleteFavorite.putValue(Action.NAME, mLocalizer.ellipsisMsg("deleteTree","Delete"));
            deleteFavorite.putValue(Action.SMALL_ICON, TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
            deleteFavorite.putValue(ContextMenuIf.ACTIONKEY_KEYBOARD_EVENT,
                KeyEvent.VK_DELETE);

            newNode.addAction(editFavorite);
            newNode.addAction(deleteFavorite);
View Full Code Here


    b.add(getMessageLabel(), cc.xy(12, 1));

    /*
     * Close action for the SearchPanel.
     */
    Action close = new AbstractAction() {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent e) {
        mSearchBar.setVisible(false);
        setBlockAutoClosing(false);
View Full Code Here

   *
   * @param component
   *          The component to close on pressing escape key.
   */
  public static void registerForClosing(final WindowClosingIf component) {
    Action a = new AbstractAction() {
      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent e) {
        component.close();
      }
View Full Code Here

   */
  public void updateRootNode(boolean save) {
    mRootNode.removeAllActions();
    mRootNode.getMutableTreeNode().setIcon(IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16));

    Action editReminders = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        ReminderListDialog dlg = new ReminderListDialog(MainFrame.getInstance(), mReminderList);
        UiUtilities.centerAndShow(dlg);
      }
    };
    editReminders.putValue(Action.SMALL_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16));
    editReminders.putValue(Action.NAME, mLocalizer.ellipsisMsg("buttonText", "Edit reminder list"));

    Action openSettings = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        MainFrame.getInstance().showSettingsDialog(SettingsItem.REMINDER);
      }
    };
    openSettings.putValue(Action.SMALL_ICON, TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));
    openSettings.putValue(Action.NAME, Localizer.getLocalization(Localizer.I18N_SETTINGS));

    mRootNode.addAction(editReminders);
    mRootNode.addAction(null);
    mRootNode.addAction(openSettings);

View Full Code Here

              boolean found = false;
              Program program = (Program) tr.getTransferData(flavors[0]);

              for (PluginProxy pluginAccess : pa) {
                if (pluginAccess.getRootNode().getMutableTreeNode().equals(target)) {
                  Action action = getAction(pluginAccess
                      .getContextMenuActions(program));

                  if (action != null) {
                    found = true;
                    ActionEvent evt = new ActionEvent(program, 0,
                        (String) action.getValue(Action.ACTION_COMMAND_KEY));
                    action.actionPerformed(evt);
                  }
                }
              }

              if (!found) {
                Action action = null;

                if (FavoritesPlugin.getRootNode()
                    .getMutableTreeNode().equals(target)) {
                  action = getAction(FavoritesPluginProxy.getInstance()
                      .getContextMenuActions(program));
                } else if (ReminderPlugin.getRootNode()
                    .getMutableTreeNode().equals(target)) {
                  action = getAction(ReminderPluginProxy.getInstance()
                      .getContextMenuActions(program));
                }

                if (action != null) {
                  found = true;
                  ActionEvent evt = new ActionEvent(program, 0, (String) action
                      .getValue(Action.ACTION_COMMAND_KEY));
                  action.actionPerformed(evt);
                }
              }
            }
          } catch (Exception ee) {}
        }
View Full Code Here

    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);
    }
View Full Code Here

  }


  protected JMenuItem getExpandAllMenuItem(final TreePath treePath) {

    Action action = new AbstractAction(){
      public void actionPerformed(ActionEvent e) {
        mTree.expandAll(treePath);
      }
    };

    action.putValue(Action.NAME, mLocalizer.msg("expandAll","Expand All"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    return item;
  }
View Full Code Here

    return item;
  }

  protected JMenuItem getCollapseAllMenuItem(final TreePath treePath) {

    Action action = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        mTree.collapseAll(treePath);
      }
    };

    action.putValue(Action.NAME, mLocalizer.msg("collapseAll",
        "Collapse All"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    return item;
View Full Code Here

  protected Action getCollapseExpandAction(final TreePath treePath) {

    final boolean mIsExpanded = mTree.isExpanded(treePath);

    Action action = new AbstractAction(){
      public void actionPerformed(ActionEvent e) {
        if (mIsExpanded) {
          mTree.collapsePath(treePath);
        }
        else {
          mTree.expandPath(treePath);
        }
      }
    };
    if (mIsExpanded) {
      action.putValue(Action.NAME, mLocalizer.msg("collapse","collapse"));
    }
    else {
      action.putValue(Action.NAME, mLocalizer.msg("expand","expand"));
    }

    return action;
  }
View Full Code Here

      }
      pathName = pathName + treePath.getPathComponent(i);
    }
    final String filterName = mLocalizer.msg("pluginFilter.name", "Plugin filter ({0})", pathName);

    Action action = new AbstractAction(){
      public void actionPerformed(ActionEvent e) {
        Program[] programs = collectProgramsFromNode(node);
        final ArrayList<Program> programList = new ArrayList<Program>();
        if (programs != null) {
          for (Program program : programs) {
            programList.add(program);
          }
          if (programs.length > 0) {
            ProgramFilter pluginFilter = new ProgramFilter() {

              public boolean accept(Program prog) {
                return programList.contains(prog);
              }

              public String getName() {
                return filterName;
              }
            };
            MainFrame.getInstance().setProgramFilter(pluginFilter);
          }
          else {
            JOptionPane
                .showMessageDialog(
                    UiUtilities.getBestDialogParent(MainFrame.getInstance()),
                    mLocalizer
                        .msg(
                            "pluginFilter.noPrograms",
                            "The plugin has marked no program, therefore your current filter will remain active."),
                    mLocalizer.msg("pluginFilter.noProgramsTitle",
                        "No programs marked"), JOptionPane.INFORMATION_MESSAGE);
          }
        }
      }
    };
    action.putValue(Action.NAME, mLocalizer.msg("filter","Show only contained programs"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    item.setIcon(TVBrowserIcons.filter(TVBrowserIcons.SIZE_SMALL));
    return item;
View Full Code Here

TOP

Related Classes of javax.swing.Action

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.