Package devplugin

Examples of devplugin.ProgramFilter


     */
    public JMenuItem[] createFilterMenuItems() {
        ButtonGroup group = new ButtonGroup();
        FilterList filterList = FilterList.getInstance();
        ProgramFilter[] filterArr = filterList.getFilterArr();
        ProgramFilter curFilter = mMainFrame.getProgramFilter();
       
        int size = filterArr.length + 2;
       
        if ((curFilter != null) && !(curFilter instanceof ShowAllFilter)) {
            size++;
        }
       
        JMenuItem[] result = new JMenuItem[size];
       
        mCreateFilterMI = new JMenuItem(mLocalizer.ellipsisMsg("createFilter", "Create filter"));
        mCreateFilterMI.addActionListener(this);
       
        int count = 2;

        if ((curFilter != null) && !(curFilter instanceof ShowAllFilter)){
            mSendFilterMI = new JMenuItem(mLocalizer.msg("sendPrograms", "Send visible Programs to another Plugin"));
            mSendFilterMI.addActionListener(this);
            result[1] = mSendFilterMI;
            result[2] = null;
            count++;
        }
        else {
          result[1] = null;
        }
       
        result[0] = mCreateFilterMI;
       
        for (int i = 0; i < filterArr.length; i++) {
         
            if (filterArr[i] != null) {
              final ProgramFilter filter = filterArr[i];
             
              if (filter instanceof SeparatorFilter) {
                result[i+count] = null;
              } else {
                final JRadioButtonMenuItem item = new JRadioButtonMenuItem(filter.toString());
               
                result[i+count] = item;
               
                group.add(item);
                result[i+count].addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent event) {
                        mMainFrame.setProgramFilter(filter);
                        item.setSelected(true);
                    }
                });

                if (curFilter != null
              && (curFilter.getName().equals(filter.getName()))) {
                    result[i+count].setSelected(true);
                } else if ((curFilter == null) && (filter instanceof ShowAllFilter)) {
                    result[i+count].setSelected(true);
                }
               
                String id = filter.getClass().getName();
                String name = filter.getName();
               
                if((Settings.propDefaultFilter.getString().equals(id + "###" + name)) ||
                    (Settings.propDefaultFilter.getString().trim().length() < 1 && filter instanceof ShowAllFilter)) {
                  result[i+count].setFont(result[i+count].getFont().deriveFont(Font.BOLD));
                }
View Full Code Here


    super(parent, true);

    UiUtilities.registerForClosing(this);

    mFilterList = FilterList.getInstance();
    ProgramFilter defaultFilter = FilterManagerImpl.getInstance().getDefaultFilter();
    mDefaultFilterId = defaultFilter.getClass().getName() + "###" + defaultFilter.getName();


    mParent = parent;
    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setLayout(new BorderLayout(7, 13));
View Full Code Here

      UserFilter filter = dlg.getUserFilter();
      if (filter != null) {
        mFilterListModel.addElement(filter);
      }
    } else if (e.getSource() == mEditBtn) {
      ProgramFilter filter = (ProgramFilter) mFilterListBox.getSelectedValue();
      if (filter instanceof UserFilter) {
        new EditFilterDlg(mParent, mFilterList, (UserFilter) filter);
      }
    } else if (e.getSource() == mRemoveBtn) {
      mFilterListModel.removeElement(mFilterListBox.getSelectedValue());
      mFilterList.remove((ProgramFilter) mFilterListBox.getSelectedValue());
      updateBtns();
    } else if (e.getSource() == mUpBtn) {
      UiUtilities.moveSelectedItems(mFilterListBox,mFilterListBox.getSelectedIndex()-1,true);
    } else if (e.getSource() == mDownBtn) {
      UiUtilities.moveSelectedItems(mFilterListBox,mFilterListBox.getSelectedIndex()+ mFilterListBox.getSelectedIndices().length + 1,true);
    } else if (e.getSource() == mSeperator) {
      mFilterListModel.addElement(new SeparatorFilter());
    } else if (e.getSource() == mDefaultFilterBtn) {
      ProgramFilter filter = ((ProgramFilter)mFilterListBox.getSelectedValue());
      mDefaultFilterId = filter.getClass().getName() + "###" + filter.getName();
      mFilterListBox.repaint();
      updateBtns();
    }

  }
View Full Code Here

    } else {
      topicExcl = true;
    }
   
    if(mFilterName != null) {
      ProgramFilter filter = getFilter();
     
      if(filter != null) {
        filterExclusion = filter.accept(prog);
      }
      else {
        filterExclusion = true;
      }
    }
View Full Code Here

    if (value instanceof Exclusion) {
      Exclusion excl = (Exclusion) value;

      String title = excl.getTitle();
      String topic = excl.getTopic();
      ProgramFilter filter = excl.getFilter();
      Channel channel = excl.getChannel();
      String timeMsg = createTimeMessage(excl.getTimeLowerBound(), excl.getTimeUpperBound(), excl.getDayOfWeek());
     
      StringBuilder textValue = new StringBuilder();
     
      if(title != null) {
        textValue.append(mLocalizer.msg("exclude.title","Exclude all programs with title '")).append(title).append("'");
      }
      if(topic != null && title != null) {
        textValue.append(" ").append(mLocalizer.msg("appendTopic","with topic '")).append(topic).append("'");
      }
      else if (topic != null) {
        textValue.append(mLocalizer.msg("exclude.topic","Exclude all programs with topic '")).append(topic).append("'");
      }
      if(filter != null && (title != null || topic != null)) {
        textValue.append(" ").append(mLocalizer.msg("appendFilter","of the filter '")).append(filter.getName()).append("'");
      }
      else if(filter != null) {
        textValue.append(mLocalizer.msg("exclude.filter","Exclude all programs of the filter '")).append(filter.getName()).append("'");
      }
      if(channel != null && (title != null || topic != null || filter != null)) {
        textValue.append(" ").append(mLocalizer.msg("exclude.appendChannel","on channel '")).append(channel.getName()).append("'");
      }
      else if(channel != null) {
View Full Code Here

TOP

Related Classes of devplugin.ProgramFilter

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.