Search in sources :

Example 1 with CyFilter

use of org.cytoscape.filter.internal.filters.model.CyFilter in project cytoscape-impl by cytoscape.

the class FilterSettingPanel method updateNegationStatus.

// user Clicked CheckBox_Not left-side of the child filter
private void updateNegationStatus(JCheckBox _chk) {
    int widgetGridY = (new Integer(_chk.getName())).intValue();
    int childIndex = widgetGridY / 2;
    CyFilter childFilter = theFilter.getChildren().get(childIndex);
    if (childFilter instanceof CompositeFilter) {
        CompositeFilter tmpFilter = (CompositeFilter) childFilter;
        theFilter.setNotTable(tmpFilter, new Boolean(_chk.isSelected()));
    } else {
        // it is an AtomiCFilter
        childFilter.setNegation(_chk.isSelected());
    }
    // Update the selection on screen
    doSelection();
}
Also used : CyFilter(org.cytoscape.filter.internal.filters.model.CyFilter) CompositeFilter(org.cytoscape.filter.internal.filters.model.CompositeFilter)

Example 2 with CyFilter

use of org.cytoscape.filter.internal.filters.model.CyFilter in project cytoscape-impl by cytoscape.

the class FilterSettingPanel method updateSelectionType.

private void updateSelectionType() {
    boolean selectNode = false;
    boolean selectEdge = false;
    List<CyFilter> childFilters = theFilter.getChildren();
    for (int i = 0; i < childFilters.size(); i++) {
        CyFilter child = childFilters.get(i);
        if (child instanceof AtomicFilter) {
            AtomicFilter tmp = (AtomicFilter) child;
            if (tmp.getIndexType() == QuickFind.INDEX_NODES) {
                selectNode = true;
            }
            if (tmp.getIndexType() == QuickFind.INDEX_EDGES) {
                selectEdge = true;
            }
        } else if (child instanceof CompositeFilter) {
            CompositeFilter tmp = (CompositeFilter) child;
            if (tmp.getAdvancedSetting().isNodeChecked()) {
                selectNode = true;
            }
            if (tmp.getAdvancedSetting().isEdgeChecked()) {
                selectEdge = true;
            }
        }
    }
    // end of for loop
    theFilter.getAdvancedSetting().setNode(selectNode);
    theFilter.getAdvancedSetting().setEdge(selectEdge);
}
Also used : CyFilter(org.cytoscape.filter.internal.filters.model.CyFilter) CompositeFilter(org.cytoscape.filter.internal.filters.model.CompositeFilter) AtomicFilter(org.cytoscape.filter.internal.filters.model.AtomicFilter)

Example 3 with CyFilter

use of org.cytoscape.filter.internal.filters.model.CyFilter in project cytoscape-impl by cytoscape.

the class FilterSettingPanel method refreshIndicesForWidgets.

// Refresh indices for widget after network switch or Cytoscape.ATTRIBUTES_CHANGED event is received
// The method may be triggered by event of NETWORK_VIEW_FOCUSED
public void refreshIndicesForWidgets() {
    // Check if each widget has associatd index, if not, try to create one
    // System.out.println("FilterSettingpanel:refreshIndicesForWidgets()...\n");
    List<CyFilter> children = theFilter.getChildren();
    if ((children == null) || (children.size() == 0)) {
        return;
    }
    CyNetwork network = applicationManager.getCurrentNetwork();
    for (int i = 0; i < children.size(); i++) {
        CyFilter child = children.get(i);
        if (child instanceof StringFilter) {
            if (pnlCustomSettings.getComponent(i * 5 + 3) instanceof TextIndexComboBox) {
                TextIndexComboBox theBox = (TextIndexComboBox) pnlCustomSettings.getComponent(i * 5 + 3);
                if (network != null) {
                    CyNetworkView networkView = applicationManager.getCurrentNetworkView();
                    if (networkView != null) {
                        TextIndex textIndex = createTextIndex((StringFilter) child);
                        ;
                        if (textIndex != null) {
                            theBox.setTextIndex(textIndex);
                            StringFilter aFilter = (StringFilter) child;
                            aFilter.setIndex(textIndex);
                        }
                    }
                }
            }
        }
        if (child instanceof NumericFilter) {
            if (pnlCustomSettings.getComponent(i * 5 + 3) instanceof JRangeSliderExtended) {
                JRangeSliderExtended theSlider = (JRangeSliderExtended) pnlCustomSettings.getComponent(i * 5 + 3);
                if (network != null) {
                    CyNetworkView networkView = applicationManager.getCurrentNetworkView();
                    if (networkView != null) {
                        NumberIndex numIndex = createNumberIndex((NumericFilter) child);
                        ;
                        if (numIndex != null) {
                            NumberRangeModel rangeModel = (NumberRangeModel) theSlider.getModel();
                            rangeModel.setMinValue(numIndex.getMinimumValue());
                            rangeModel.setMaxValue(numIndex.getMaximumValue());
                            NumericFilter aFilter = (NumericFilter) child;
                            aFilter.setIndex(numIndex);
                        }
                    }
                }
            }
        }
    }
}
Also used : CyFilter(org.cytoscape.filter.internal.filters.model.CyFilter) TextIndexComboBox(org.cytoscape.filter.internal.widgets.autocomplete.view.TextIndexComboBox) NumberIndex(org.cytoscape.filter.internal.widgets.autocomplete.index.NumberIndex) TextIndex(org.cytoscape.filter.internal.widgets.autocomplete.index.TextIndex) NumericFilter(org.cytoscape.filter.internal.filters.model.NumericFilter) NumberRangeModel(org.cytoscape.filter.internal.prefuse.data.query.NumberRangeModel) CyNetwork(org.cytoscape.model.CyNetwork) StringFilter(org.cytoscape.filter.internal.filters.model.StringFilter) JRangeSliderExtended(org.cytoscape.filter.internal.widgets.slider.JRangeSliderExtended) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Aggregations

CyFilter (org.cytoscape.filter.internal.filters.model.CyFilter)3 CompositeFilter (org.cytoscape.filter.internal.filters.model.CompositeFilter)2 AtomicFilter (org.cytoscape.filter.internal.filters.model.AtomicFilter)1 NumericFilter (org.cytoscape.filter.internal.filters.model.NumericFilter)1 StringFilter (org.cytoscape.filter.internal.filters.model.StringFilter)1 NumberRangeModel (org.cytoscape.filter.internal.prefuse.data.query.NumberRangeModel)1 NumberIndex (org.cytoscape.filter.internal.widgets.autocomplete.index.NumberIndex)1 TextIndex (org.cytoscape.filter.internal.widgets.autocomplete.index.TextIndex)1 TextIndexComboBox (org.cytoscape.filter.internal.widgets.autocomplete.view.TextIndexComboBox)1 JRangeSliderExtended (org.cytoscape.filter.internal.widgets.slider.JRangeSliderExtended)1 CyNetwork (org.cytoscape.model.CyNetwork)1 CyNetworkView (org.cytoscape.view.model.CyNetworkView)1