Package javax.swing

Examples of javax.swing.Action


        // TODO Auto-generated method stub
        return null;
    }

    private void setActionMenuDefaultValues(ActionMenu menu) {
      Action action = menu.getAction();
      if (action != null) {
        if (action.getValue(Action.SMALL_ICON) == null) {
          action.putValue(Action.SMALL_ICON, BEANICON);
        }
        if (action.getValue(Action.NAME) == null) {
          action.putValue(Action.NAME, mBshFile.getName());
        }
      }
      else {
        ActionMenu[] subItems = menu.getSubItems();
        for (ActionMenu subItem : subItems) {
View Full Code Here


    if (menu == null) {
      return;
    }

    if (isDoubleClick) {
      Action defaultAction = menu.getDefaultAction();
      if (defaultAction != null) {
        defaultAction.actionPerformed(new ActionEvent(mTree, 0, ""));
      }
    }

  }
View Full Code Here

    TreePath[] selectedPaths = mTree.getSelectionPaths();
    ContextMenu menu = createContextMenu(selectedPaths);
    for (MenuElement element : menu.getPopupMenu().getSubElements()) {
      if (element instanceof JMenuItem) {
        final JMenuItem item = (JMenuItem) element;
        final Action action = item.getAction();
        if (action != null) {
          Object keyboard = action
              .getValue(ContextMenuIf.ACTIONKEY_KEYBOARD_EVENT);
          if (keyboard != null && keyboard instanceof Integer
              && (Integer) keyboard == event.getKeyCode()) {
            action.actionPerformed(null);
          }
        }
      }
    }
  }
View Full Code Here

    }
    if (menu == null) {
      return;
    }

    Action action = menu.getAction();

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

  private void createPluginAction(ButtonActionIf plugin) {
    ActionMenu actionMenu = plugin.getButtonAction();
    if (actionMenu != null) {
      if (!actionMenu.hasSubItems()) {
        Action action = actionMenu.getAction();
        action.putValue(ToolBar.ACTION_ID_KEY, plugin.getId());
        mAvailableActions.put(plugin.getId(), action);
        String tooltip = (String) action.getValue(Action.SHORT_DESCRIPTION);
        if (tooltip == null) {
          action.putValue(Action.SHORT_DESCRIPTION, plugin.getButtonActionDescription());
        }
      } else {
        createPluginAction(plugin, actionMenu.getSubItems());
      }
    }
View Full Code Here

  private void createPluginAction(ButtonActionIf plugin, ActionMenu[] subMenus) {
    for(ActionMenu menu : subMenus) {
      if(menu.hasSubItems()) {
        createPluginAction(plugin, menu.getSubItems());
      } else {
        Action action = menu.getAction();
        if (!ContextMenuSeparatorAction.getInstance().equals(action)) {
          action.putValue(ToolBar.ACTION_ID_KEY, plugin.getId() + "##"
              + action.getValue(Action.NAME));
          mAvailableActions.put(plugin.getId() + "##"
              + action.getValue(Action.NAME), action);
          String tooltip = (String) action.getValue(Action.SHORT_DESCRIPTION);
          if (tooltip == null) {
            if (subMenus.length == 1) {
              action.putValue(Action.SHORT_DESCRIPTION, plugin
                .getButtonActionDescription());
            }
            else {
              action.putValue(Action.SHORT_DESCRIPTION, action.getValue(Action.NAME));
            }
          }
        }
      }
    }
View Full Code Here

        String[] buttonNames = Settings.propToolbarButtons.getStringArray();

        if(buttonNames != null) {
          for (int j = 0; j < buttonNames.length; j++) {
            if(buttonNames[j].compareTo(activatedPlugins[i].getId()) == 0) {
              Action action = mAvailableActions.get(buttonNames[j]);

              if(action != null) {
                int index = mVisibleActions.size();
                mVisibleActions.add(j > index ? index : j , action);
              }
View Full Code Here

    String[] keys = new String[mAvailableActions.keySet().size()];
    mAvailableActions.keySet().toArray(keys);
    ArrayList<String> availableTimeActions = new ArrayList<String>();

    for (String key : keys) {
      Action action = mAvailableActions.get(key);
      String test = action.getValue(Action.NAME).toString();

      if (test.indexOf(':') != -1 && (test.length() == 4 || test.length() == 5)) {
        availableTimeActions.add(key);
      }
    }

    String scrollTo = MainFrame.mLocalizer
        .msg("menuinfo.scrollTo", "Scroll to")
        + ": ";
    for (final int timeMinutes : Settings.propTimeButtons.getIntArray()) {
      int hour = timeMinutes / 60;
      String time = String.valueOf(timeMinutes % 60);

      if (time.length() == 1) {
        time = hour + ":0" + time;
      } else {
        time = hour + ":" + time;
      }

      if (availableTimeActions.contains("#scrollTo" + time)) {
        availableTimeActions.remove("#scrollTo" + time);
        continue;
      }

      createAction(time, "#scrollTo" + time,
          scrollTo + time, IconLoader.getInstance().getIconFromTheme("actions",
              "scroll-to-specific-time", 16), IconLoader.getInstance().getIconFromTheme(
              "actions", "scroll-to-specific-time", 22), ToolBar.BUTTON_ACTION,
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              MainFrame.getInstance().scrollToTime(timeMinutes);
            }
          });
    }

    Iterator<String> it = availableTimeActions.iterator();

    while (it.hasNext()) {
      final String timeActionId = it.next();
      Action action = mAvailableActions.remove(timeActionId);

      if (mVisibleActions.contains(action)) {
        mVisibleActions.remove(action);
      }
    }
View Full Code Here

  }

  private void createVisibleActions(String[] buttonNames) {
    mVisibleActions = new ArrayList<Action>();
    for (String buttonName : buttonNames) {
      Action action = mAvailableActions.get(buttonName);

      if (action != null) {
        mVisibleActions.add(action);
      } else if ("#separator".equals(buttonName)) {
        mVisibleActions.add(mSeparatorAction);
View Full Code Here

  private void addButtonActionIfToVisibleActions(ButtonActionIf buttonAction) {
    ActionMenu actionMenu = buttonAction.getButtonAction();
    if (actionMenu != null) {
      if (!actionMenu.hasSubItems()) {
        Action action = mAvailableActions.get(buttonAction.getId());
        if (action != null
            && !ContextMenuSeparatorAction.getInstance().equals(action)) {
          mVisibleActions.add(action);
        }
      }
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.