Package calendarexportplugin.exporter

Examples of calendarexportplugin.exporter.ExporterIf


      Action[] actions = new Action[activeExporter.length];

      int max = activeExporter.length;

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

            actions[j].putValue(Action.NAME, new StringBuilder(mLocalizer.msg("contextMenuDeleteText","Remove marking for ")).append(mConfigs[j].getName()).toString());
            actions[j].putValue(Action.SMALL_ICON, TVBrowserIcons.delete(TVBrowserIcons.SIZE_SMALL));
          }
          else {
            actions[j] = new AbstractAction() {
              public void actionPerformed(final ActionEvent e) {
                new Thread(new Runnable() {
                  public void run() {
                    Program[] programArr = {program};
                    if (export.exportPrograms(programArr, mSettings, mConfigs[count])) {
                      markProgram(program, export);
                      getRootNode().update();
                    }
                  }
                }, "Export to calendar").start();
View Full Code Here


        if (version >= 4) {
          int treeNodeCount = in.readInt();

          HashMap<ExporterIf,ArrayList<Program>> exporterMap = new HashMap<ExporterIf,ArrayList<Program>>(treeNodeCount);
          for (int i = 0; i < treeNodeCount; i++) {
            final ExporterIf exporter = findExporter((String) in.readObject());

            int progCount = in.readInt();
            ArrayList<Program> programs = null;

            if (exporter != null) {
              programs = new ArrayList<Program>(progCount);
              exporterMap.put(exporter,programs);
            }

            for (int v = 0; v < progCount; v++) {
              Date programDate = Date.readData(in);
              String progId = (String) in.readObject();
              if (programs != null) {
                Program program = Plugin.getPluginManager().getProgram(programDate, progId);
                programs.add(program);
              }
            }
          }

          ExporterIf[] keys = exporterMap.keySet().toArray(new ExporterIf[exporterMap.size()]);

          Arrays.sort(keys, new Comparator<ExporterIf>() {
            public int compare(final ExporterIf o1, final ExporterIf o2) {
              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);
View Full Code Here

TOP

Related Classes of calendarexportplugin.exporter.ExporterIf

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.