Package devplugin

Examples of devplugin.ActionMenu


      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);
        }
      }));

      return new ActionMenu(getName(), IconLoader.getInstance().getIconFromTheme("apps",
          "appointment", 16), actions.toArray(new ActionMenu[actions
          .size()]));
    } else if ((program.isExpired() || program.isOnAir())
        && (!program.equals(Plugin.getPluginManager().getExampleProgram()))) {
      return null;
    } else {
      ContextMenuAction action = new ContextMenuAction();
      action.setText(mLocalizer.msg("contextMenuText", "Remind me"));
      action.setSmallIcon(IconLoader.getInstance().getIconFromTheme("actions",
          "appointment-new", 16));
      action.setActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
          final Window w = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
          try {
            UIThreadRunner.invokeAndWait(new Runnable() {

              @Override
              public void run() {
                ReminderDialog dlg = new ReminderDialog(w, program, mSettings);
                Settings.layoutWindow("extras.remiderContext", dlg);

                if(mSettings.getProperty("showTimeSelectionDialog","true").compareTo("true") == 0) {
                  UiUtilities.centerAndShow(dlg);

                  if (dlg.getOkPressed()) {
                    mReminderList.add(program, dlg.getReminderContent());
                    mReminderList.unblockProgram(program);
                    updateRootNode(true);
                  }
                  dlg.dispose();
                }
                else {
                  mReminderList.add(program, dlg.getReminderContent());
                  mReminderList.unblockProgram(program);
                  updateRootNode(true);
                }
              }
            });
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      });
      return new ActionMenu(action);
    }
  }
View Full Code Here


        .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

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

    }

    AbstractAction[] actionArray = new AbstractAction[actions.size()];
    actions.toArray(actionArray);

    return new ActionMenu(mLocalizer.msg("printProgram","Print"), icon,actionArray);
  }
View Full Code Here

    action.putValue(Action.NAME, mLocalizer.msg("print","Print"));
    action.putValue(Action.SMALL_ICON, createImageIcon("devices", "printer", 16));
    action.putValue(BIG_ICON, createImageIcon("devices", "printer", 22));
    action.putValue(Action.SHORT_DESCRIPTION, getInfo().getDescription());

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

        action.putValue(Action.NAME, mLocalizer.msg("buttonName", "View Liste"));
        action.putValue(Action.SMALL_ICON, createImageIcon("actions", "view-list", 16));
        action.putValue(BIG_ICON, createImageIcon("actions", "view-list", 22));
       
       
        return new ActionMenu(action);
    }
View Full Code Here

    if (mAddresses == null) {
      createDefaultSettings();
    }
    Action mainAction = getMainContextMenuAction();
    if (program == getPluginManager().getExampleProgram()) {
      return new ActionMenu(mainAction);
    }

    final ArrayList<Object> actionList = new ArrayList<Object>();
    listActors = null;

    for (int i = 0; i < mAddresses.size(); i++) {
      try {
        WebAddress address = mAddresses.get(i);
        String actionName = mLocalizer.msg("SearchOn", "Search on ") + " " + address.getName();

        if (address.getUrl().equals(PROGRAM_SITE)) {
          final String url = program.getTextField(ProgramFieldType.URL_TYPE);
          if (url != null && url.length() > 0) {
            address = new WebAddress(mLocalizer.msg("programPage", "Open page of program"),url,null,false,address.isActive());
            actionName = address.getName();
          }
          else {
            address = null;
          }
        }
        // create address of channel on the fly
        if (address != null && address.getUrl().equals(CHANNEL_SITE)) {
          final Channel channel = program.getChannel();
          address = new WebAddress(mLocalizer.msg("channelPage",
              "Open page of {0}", channel.getName()), channel.getWebpage(),
              null, false, address.isActive());
          actionName = address.getName();
/*
          // automatically add separator if it is the last menu item (as it is by default)
          if (i == mAddresses.size() - 1) {
            actionList.add(ContextMenuSeparatorAction.getInstance());
          }
*/
        }
        if (address != null && address.isActive()) {
          // create items for a possible sub menu
          if (address.getUrl().contains(WEBSEARCH_ALL) && listActors == null) {
            findSearchItems(program);
          }
          if (address.getUrl().contains(WEBSEARCH_ALL) && (listActors.size() + listDirectors.size() + listScripts.size() > 0) && mShowDetails) {
            final ArrayList<Object> categoryList = new ArrayList<Object>();
            // title
            final WebAddress adrTitle = new WebAddress(address.getName(), address.getUrl().replace(WEBSEARCH_ALL, "\"" + program.getTitle() + "\""), null, false, true);
            categoryList.add(createSearchAction(program, adrTitle, program.getTitle()));
            categoryList.add(ContextMenuSeparatorAction.getDisabledOnTaskMenuInstance());
            createSubMenu(program, address, categoryList, mLocalizer.msg("actor", "Actor"), listActors);
            createSubMenu(program, address, categoryList, mLocalizer.msg("director","Director"), listDirectors);
            createSubMenu(program, address, categoryList, mLocalizer.msg("script","Script"), listScripts);
            if (categoryList.size() == 2) {
              categoryList.remove(1);
            }

            final ActionMenu searchMenu = new ActionMenu(actionName, address.getIcon(), categoryList.toArray());
            actionList.add(searchMenu);
          }
          // create only a single menu item for this search
          else {
            final WebAddress adrTitle = new WebAddress(address.getName(), address.getUrl().replace(WEBSEARCH_ALL, "\"" + program.getTitle() + "\""), null, false, true);
            final AbstractAction action = createSearchAction(program, adrTitle,
                actionName);
            action.putValue(Action.SMALL_ICON, address.getIcon());
            actionList.add(action);
          }
        }
      } catch (RuntimeException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    if (actionList.size() == 1) {
      final Object action = actionList.get(0);
      if (action instanceof ActionMenu) {
        return (ActionMenu) action;
      }
      else if (action instanceof Action) {
        return new ActionMenu((Action)action);
      }
    }

    final Object[] actions = new Object[actionList.size()];
    actionList.toArray(actions);
    return new ActionMenu((String)mainAction.getValue(Action.NAME), (Icon)mainAction.getValue(Action.SMALL_ICON), actions);
  }
View Full Code Here

        subActions[index] = createSearchAction(program, modifiedAddress, subItems.get(index));
        subActions[index].putValue(Plugin.DISABLED_ON_TASK_MENU, true);
      }
      if (subItems.size() > 1) {
        final ContextMenuAction menuAction = new ContextMenuAction(label);
        final ActionMenu menu = new ActionMenu((String)menuAction.getValue(Action.NAME), (Icon)menuAction.getValue(Action.SMALL_ICON), subActions);
        menuAction.putValue(Plugin.DISABLED_ON_TASK_MENU, true);
        categoryList.add(menu);
      }
      else {
        subActions[0].putValue(Action.NAME, subActions[0].getValue(Action.NAME) + " (" + label +")");
View Full Code Here

                  commandList.add(caction);
              }
            }

            if (!commandList.isEmpty()) {
              actionList.add(new ActionMenu(dev.getName(), commandList.toArray(new Action[commandList.size()])));
            }
        }

        if (actionList.size() == 1) {
            ActionMenu menu = actionList.get(0);

            if (menu.getSubItems().length == 0) {
                return null;
            }

            if (menu.getSubItems().length == 1) {
                Action action = menu.getSubItems()[0].getAction();
                action.putValue(Action.SMALL_ICON, menuIcon);
                return new ActionMenu(action);
            } else {
                return new ActionMenu(menu.getTitle(), menuIcon, menu.getSubItems());
            }

        }

        ActionMenu[] actions = new ActionMenu[actionList.size()];
        actionList.toArray(actions);

        if (actions.length == 0) {
            return null;
        }

        return new ActionMenu(menuText, menuIcon, actions);
    }
View Full Code Here

        };
        action.putValue(Action.NAME, mLocalizer.msg("CapturePlugin", "Capture Plugin"));
        action.putValue(Action.SMALL_ICON, createImageIcon("mimetypes", "video-x-generic", 16));
        action.putValue(BIG_ICON, createImageIcon("mimetypes", "video-x-generic", 22));

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

TOP

Related Classes of devplugin.ActionMenu

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.