Package devplugin

Examples of devplugin.PluginTreeNode


      while(e.hasMoreElements()) {
        final FavoriteNode child = e.nextElement();

        if(child.isDirectoryNode()) {
          PluginTreeNode newNode = new PluginTreeNode(child.toString());
          newNode.setGroupingByWeekEnabled(true);

          updatePluginTree(newNode, allPrograms, child);
          if (!newNode.isEmpty()) {
            node.add(newNode);
          }
        } else {
          Program[] progArr = child.getFavorite().getWhiteListPrograms();
          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);


            if(progArr.length <= 10) {
              newNode.setGroupingByDateEnabled(false);
            }
            boolean episodeOnly = progArr.length > 1;
            for (Program program : progArr) {
              String episode = program.getTextField(ProgramFieldType.EPISODE_TYPE);
              if (StringUtils.isBlank(episode)) {
                episodeOnly = false;
                break;
              }
            }

            for (Program program : progArr) {
              PluginTreeNode pNode = newNode.addProgramWithoutCheck(program);
              allPrograms.add(program);
              if (episodeOnly || progArr.length <= 10) {
                pNode.setNodeFormatter(new NodeFormatter() {
                  public String format(ProgramItem pitem) {
                    Program p = pitem.getProgram();
                    return FavoriteTreeModel.getFavoriteLabel(child.getFavorite(), p);
                  }
                });
View Full Code Here


      for (int i = 0; i < max; i++) {
        final ExporterIf export = activeExporter[i];

        AbstractAction action = null;
        StringBuilder name = new StringBuilder();
        final PluginTreeNode node = getNodeForExporter(export);

        if(node.contains(program)) {
          action = new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              node.removeProgram(program);
              getRootNode().update();

              if(getRootNode().contains(program,true)) {
                program.mark(CalendarExportPlugin.getInstance());
              }
            }
          };

          name.append(mLocalizer.msg("contextMenuDeleteText","Remove marking for "));

          action.putValue(Action.SMALL_ICON, TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
        }
        else {
          action = new AbstractAction() {
            public void actionPerformed(ActionEvent evt) {
              new Thread(new Runnable() {
                public void run() {
                  Program[] programArr = {program};
                  if (export.exportPrograms(programArr, mSettings, mConfigs[0])) {
                    markProgram(program, export);
                    getRootNode().update();
                  }
                }
              }, "Export to calendar").start();
            }
          };

          if (max == 1) {
            name.append(mLocalizer.msg("contextMenuText", "Export to")).append(' ');
          }

          action.putValue(Action.SMALL_ICON, getExporterIcon(export));
        }

        name.append(activeExporter[i].getName());
        action.putValue(Action.NAME, name.toString());

        actions[i] = action;
      }

      if (actions.length == 1) {
        return new ActionMenu(actions[0]);
      }

      return new ActionMenu(menuLabel, menuIcon, actions);
    } else {
      ActionMenu[] exporters = new ActionMenu[activeExporter.length];

      for (int i = 0; i < exporters.length; i++) {
        Action[] actions = new Action[mConfigs.length];

        for (int j = 0; j < actions.length; j++) {
          final ExporterIf export = activeExporter[i];
          final int count = j;

          final PluginTreeNode node = getNodeForExporter(export);

          if(node.contains(program)) {
            actions[j] = new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
                node.removeProgram(program);
                getRootNode().update();

                if(getRootNode().contains(program,true)) {
                  program.mark(CalendarExportPlugin.getInstance());
                }
View Full Code Here

    return false;
  }

  private void markProgram(Program program, ExporterIf export) {
    if (mSettings.getMarkItems()) {
      PluginTreeNode node = getNodeForExporter(export);
      node.addProgram(program);
    }
  }
View Full Code Here

      node.addProgram(program);
    }
  }

  private PluginTreeNode getNodeForExporter(ExporterIf export) {
    PluginTreeNode node = mTreeNodes.get(export);

    if (node == null) {
      node = new PluginTreeNode(export.getName());
      node.getMutableTreeNode().setIcon(getExporterIcon(export));

      createNodeActionForNode(node);

      getRootNode().add(node);
      mTreeNodes.put(export, node);
View Full Code Here

      final Set<ExporterIf> exporters = mTreeNodes.keySet();
      out.writeInt(exporters.size());

      for (final ExporterIf exp : exporters) {
        out.writeObject(exp.getClass().getName());
        final PluginTreeNode node = mTreeNodes.get(exp);
        final Program[] nodePrograms = node.getPrograms();
        out.writeInt(nodePrograms.length);
        for (final Program p : nodePrograms) {
          if (p != null) {
            p.getDate().writeData((java.io.DataOutput) out);
            out.writeObject(p.getID());
View Full Code Here

              return o1.getName().compareToIgnoreCase(o2.getName());
            }
          });

          for (ExporterIf exporter : keys) {
            PluginTreeNode node = getRootNode().addNode(exporter.getName());
            node.getMutableTreeNode().setIcon(getExporterIcon(exporter));

            createNodeActionForNode(node);
            mTreeNodes.put(exporter, node);

            ArrayList<Program> progs = exporterMap.get(exporter);

            for(Program p : progs) {
              node.addProgram(p);
            }
          }
        }

        getRootNode().update();
View Full Code Here

    insertSorted(n);
  }


  public void addPluginTree(PluginProxy plugin) {
    PluginTreeNode pluginRoot;
    if (plugin.hasArtificialPluginTree()) {
      pluginRoot = plugin.getArtificialRootNode();
    }
    else {
      pluginRoot = plugin.getRootNode();
View Full Code Here

    return mPluginInfo;
  }

  public void onActivation() {
    PluginTreeNode root = getRootNode();
    Program[] progs = root.getPrograms();
    for (Program program : progs) {
      program.mark(this);
    }
    root.update();
    root.addAction(new EmptyQueueAction());
  }
View Full Code Here

    }
  }

  @Override
  public boolean receivePrograms(Program[] programArr, ProgramReceiveTarget receiveTarget) {
    PluginTreeNode rootNode = getRootNode();
    for (Program program : programArr) {
      if (!rootNode.contains(program)) {
        rootNode.addProgram(program);
        program.mark(this);
      }
    }
    rootNode.update();
    return true;
  }
View Full Code Here

      super.setText(mLocalizer.msg("emptyQueue" ,"Druckerwarteschlange leeren"));
      super.setSmallIcon(TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
    }

    public void actionPerformed(ActionEvent e) {
      PluginTreeNode root = PrintPlugin.getInstance().getRootNode();
      root.removeAllChildren();
      root.update();
    }
View Full Code Here

TOP

Related Classes of devplugin.PluginTreeNode

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.