Package tvbrowser.core.filters

Examples of tvbrowser.core.filters.UserFilter


  }

  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == mNewBtn) {
      EditFilterDlg dlg = new EditFilterDlg(mParent, mFilterList, null);
      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


      UserFilter[] userFilterArr = mFilterList.getUserFilterArr();
      FilterComponent fc = mComponentTableModel.getElement(mRuleTableBox.getSelectedRow());

      // Create the Filter based on the new Rule and check if the FC exists
      // there
      UserFilter testFilter = new UserFilter("test");

      try {
        testFilter.setRule(mFilterRuleTF.getText());

        if (testFilter.containsRuleComponent(fc.getName())) {
          allowRemove = false;
          JOptionPane.showMessageDialog(this, mLocalizer.msg("usedByAnotherFilter",
              "This filter component is used by filter '{0}'\nRemove the filter first.", mFilterNameTF.getText()));
        }
      } catch (Exception ex) {
        // Filter creation failed, assume the old one is correct
        if ((mFilter != null) && (mFilter.containsRuleComponent(fc.getName()))) {
          allowRemove = false;
          JOptionPane.showMessageDialog(this, mLocalizer.msg("usedByAnotherFilter",
              "This filter component is used by filter '{0}'\nRemove the filter first.", mFilterNameTF.getText()));
        }
      }

      for (int i = 0; i < userFilterArr.length && allowRemove; i++) {
        if ((userFilterArr[i] != mFilter) && userFilterArr[i].containsRuleComponent(fc.getName())) {
          allowRemove = false;
          JOptionPane.showMessageDialog(this, mLocalizer.msg("usedByAnotherFilter",
              "This filter component is used by filter '{0}'\nRemove the filter first.", userFilterArr[i].toString()));
        }
      }
      if (allowRemove) {
        FilterComponentList.getInstance().remove(fc.getName());
        mComponentTableModel.removeElement(mRuleTableBox.getSelectedRow());
        updateBtns();
      }

    } else if (o == mOkBtn) {
      String filterName = mFilterNameTF.getText();
      if (!filterName.equalsIgnoreCase(mFilterName) && mFilterList.containsFilter(filterName)) {
        JOptionPane
            .showMessageDialog(this, mLocalizer.msg("alreadyExists", "Filter '{0}' already exists.", filterName));
      } else {
        if (mFilter == null) {
          mFilter = new UserFilter(mFilterNameTF.getText());
        } else {
          mFilter.setName(mFilterNameTF.getText());
        }

        try {
View Full Code Here

TOP

Related Classes of tvbrowser.core.filters.UserFilter

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.