Examples of FilterComponent


Examples of tvbrowser.core.filters.FilterComponent

      if (mRulePanel != null) {
        mCenterPanel.remove(mRulePanel);
      }
      Object item = mRuleCb.getSelectedItem();
      if (item instanceof FilterComponent) {
        FilterComponent fItem = (FilterComponent) item;
        mRulePanel = fItem.getSettingsPanel();
        mRulePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        mCenterPanel.add(mRulePanel, BorderLayout.CENTER);
      }
      mContentPane.updateUI();
      updateOkBtn();

    } else if (o == mOkBtn) {

      String compName = mNameTF.getText();

      if (FilterComponentList.getInstance().exists(compName)) {

        JOptionPane.showMessageDialog(this, "Component '" + compName + "' already exists");
      } else {

        FilterComponent c = (FilterComponent) mRuleCb.getSelectedItem();
        c.saveSettings();
        mSelectedFilterComponent = c;
        mSelectedFilterComponent.setName(compName);
        mSelectedFilterComponent.setDescription(mDescTF.getText());
        setVisible(false);
      }
View Full Code Here

Examples of tvbrowser.core.filters.FilterComponent

  public void actionPerformed(ActionEvent e) {

    Object o = e.getSource();
    if (o == mNewBtn) {
      EditFilterComponentDlg dlg = new EditFilterComponentDlg(mParent);
      FilterComponent rule = dlg.getFilterComponent();
      if (rule != null) {
        mComponentTableModel.addElement(rule);
        tvbrowser.core.filters.FilterComponentList.getInstance().add(rule);
        String text = mFilterRuleTF.getText();
        if (text.length() > 0) {
          text += " " + mFilterLocalizer.msg("or", "or") + " ";
        }
        text += rule.getName();
        mFilterRuleTF.setText(text);

      }
    } else if (o == mEditBtn) {
      int inx = mRuleTableBox.getSelectedRow();

      if(inx == -1) {
        return;
      }

      FilterComponent rule = mComponentTableModel.getElement(inx);
      FilterComponentList.getInstance().remove(rule.getName());
      mComponentTableModel.removeElement(rule);
      EditFilterComponentDlg dlg = new EditFilterComponentDlg(mParent, rule);
      FilterComponent newRule = dlg.getFilterComponent();
      if (newRule == null) {
        newRule = rule;
      }
      FilterComponentList.getInstance().add(newRule);
      mComponentTableModel.addElement(newRule);
      // mRuleListBox.repaint();
      updateBtns();

    } else if (o == mRuleTableBox) {
      updateBtns();
    } else if (o == mRemoveBtn) {
      boolean allowRemove = true;
      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) {
View Full Code Here

Examples of tvbrowser.core.filters.FilterComponent

    }

    public Object getValueAt(int rowIndex, int columnIndex) {
      Object row = dataVector.get(rowIndex);
      if (row instanceof FilterComponent) {
        FilterComponent comp = (FilterComponent) row;

        if (columnIndex == 0) {
          return comp.getName();
        } else if (columnIndex == 1) {
          return comp.getDescription();
        }

      }
      return "?";
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.