Examples of AbstractAction


Examples of javax.swing.AbstractAction

    if (mConfigs.length > 1) {
      ArrayList<AbstractAction> list = new ArrayList<AbstractAction>();

      for (final AbstractPluginProgramFormating config : mConfigs) {
        if (config != null && config.isValid()) {
          list.add(new AbstractAction(config.getName()) {
            public void actionPerformed(ActionEvent e) {
              blogThis(program, config);
            }
          });
        }
      }

      return new ActionMenu(mLocalizer.ellipsisMsg("contextMenuText", "Create a new Blog-Entry"), icon,
          list.toArray(new AbstractAction[list.size()]));
    } else {
      AbstractAction blog = new AbstractAction(mLocalizer.msg("contextMenuText", "Create a new Blog-Entry")) {
        public void actionPerformed(ActionEvent evt) {
          blogThis(program, mConfigs.length != 1 ? DEFAULT_CONFIG : mConfigs[0]);
        }
      };

      blog.putValue(Action.SMALL_ICON, icon);

      return new ActionMenu(blog);
    }
  }
View Full Code Here

Examples of javax.swing.AbstractAction

    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

Examples of javax.swing.AbstractAction

   *
   * @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();
      }
    };

    if (OperatingSystem.isMacOs()) {
      // Add MacOS Apple+W for Closing of Dialogs
      KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
          InputEvent.META_DOWN_MASK);
      component.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
          .put(stroke, "CLOSE_ON_APPLE_W");
      component.getRootPane().getActionMap().put("CLOSE_ON_APPLE_W", a);

      stroke = KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.META_DOWN_MASK);
      component.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
          .put(stroke, "CLOSE_COMPLETE_ON_APPLE");
      component.getRootPane().getActionMap().put("CLOSE_COMPLETE_ON_APPLE",
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              MainFrame.getInstance().quit();
            }
          });
    }
View Full Code Here

Examples of javax.swing.AbstractAction

      final ReminderListItem item = mReminderList.getReminderItem(program);
      String[] entries = ReminderFrame.REMIND_MSG_ARR;

      ArrayList<ActionMenu> actions = new ArrayList<ActionMenu>(maxIndex + 2);

      actions.add(new ActionMenu(new AbstractAction(entries[0]) {
        public void actionPerformed(ActionEvent e) {
          mReminderList.removeWithoutChecking(program);
          updateRootNode(true);
        }
      }));
      actions.add(new ActionMenu(ContextMenuSeparatorAction.getInstance()));

      for (int i = 1; i <= maxIndex; i++) {
        final int minutes = ReminderFrame.REMIND_VALUE_ARR[i];
        actions.add(new ActionMenu(new AbstractAction(entries[i]) {
          public void actionPerformed(ActionEvent e) {
            item.setMinutes(minutes);
          }
        }, minutes == item.getMinutes()));
      }

      actions.add(new ActionMenu(ContextMenuSeparatorAction.getInstance()));
      actions.add(new ActionMenu(new AbstractAction(mLocalizer.msg("comment",
          "Change comment"), TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL)) {
        @Override
        public void actionPerformed(ActionEvent e) {
          item.changeComment(parentFrame);
        }
View Full Code Here

Examples of javax.swing.AbstractAction

   */
  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

Examples of javax.swing.AbstractAction

    thread.start();
  }


  protected static ActionMenu getButtonAction() {
    AbstractAction action = new AbstractAction() {
      public void actionPerformed(ActionEvent evt) {
        getInstance().showManageRemindersDialog();
      }
    };

    action.putValue(Action.NAME, getName());
    action.putValue(Action.SMALL_ICON, IconLoader.getInstance()
        .getIconFromTheme("apps", "appointment", 16));
    action.putValue(Plugin.BIG_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 22));
    action.putValue(Action.SHORT_DESCRIPTION, mLocalizer.msg("description",
        "Eine einfache Implementierung einer Erinnerungsfunktion."));

    return new ActionMenu(action);
  }
View Full Code Here

Examples of javax.swing.AbstractAction

  public ProgramContextMenu(PluginTree tree, TreePath[] paths, Plugin plugin, Program[] programs) {
    super(tree);
    mPaths = paths;
    mPrograms = programs;
    mDefaultAction = new AbstractAction() {
      public void actionPerformed(ActionEvent e) {
        Node node = (Node) mPaths[0].getLastPathComponent();
        ProgramItem programItem = (ProgramItem) node.getUserObject();
        final Program program = programItem.getProgram();
        MainFrame.getInstance().scrollToProgram(program, new Runnable() {
View Full Code Here

Examples of javax.swing.AbstractAction

  }


  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

Examples of javax.swing.AbstractAction

    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

Examples of javax.swing.AbstractAction

  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
TOP
Copyright © 2018 www.massapi.com. 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.