Search in sources :

Example 1 with CompositeFilterPanel

use of org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel in project cytoscape-impl by cytoscape.

the class AbstractPanelController method removeOrphans.

private void removeOrphans(CompositeFilterPanel<V> panel) {
    CompositeFilter<CyNetwork, CyIdentifiable> model = panel.getModel();
    if (model.getLength() > 0) {
        return;
    }
    Container parent = panel.getParent();
    if (!(parent instanceof CompositeFilterPanel)) {
        return;
    }
    @SuppressWarnings("unchecked") CompositeFilterPanel<V> parentPanel = (CompositeFilterPanel<V>) parent;
    CompositeFilter<CyNetwork, CyIdentifiable> parentModel = parentPanel.getModel();
    for (int index = 0; index < parentModel.getLength(); index++) {
        Filter<CyNetwork, CyIdentifiable> filter = parentModel.get(index);
        if (model == filter) {
            parentPanel.removeTransformer(index, true);
            removeOrphans(parentPanel);
            return;
        }
    }
}
Also used : Container(java.awt.Container) CyNetwork(org.cytoscape.model.CyNetwork) CompositeFilterPanel(org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 2 with CompositeFilterPanel

use of org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel in project cytoscape-impl by cytoscape.

the class TransformerPanelController method createView.

@Override
public JComponent createView(TransformerPanel parent, Transformer<CyNetwork, CyIdentifiable> transformer, int depth) {
    // CompositeFilterImpl needs a CompositeFilterPanel but the top is blank so view will be null
    JComponent view = transformerViewManager.createView(transformer);
    if (transformer instanceof SubFilterTransformer || transformer instanceof CompositeFilter) {
        String addButtonTT = transformerViewManager.getAddButtonTooltip(transformer);
        CompositeFilterController controller = CompositeFilterController.createFor(view, addButtonTT);
        CompositeFilter<CyNetwork, CyIdentifiable> compositeFilter;
        if (transformer instanceof SubFilterTransformer)
            compositeFilter = ((SubFilterTransformer<CyNetwork, CyIdentifiable>) transformer).getCompositeFilter();
        else
            compositeFilter = (CompositeFilter<CyNetwork, CyIdentifiable>) transformer;
        return new CompositeFilterPanel<TransformerPanel>(parent, this, controller, compositeFilter, depth);
    }
    if (view == null)
        throw new IllegalArgumentException("view could not be created for: " + transformer.getId());
    return view;
}
Also used : CompositeFilter(org.cytoscape.filter.model.CompositeFilter) JComponent(javax.swing.JComponent) CyNetwork(org.cytoscape.model.CyNetwork) CompositeFilterController(org.cytoscape.filter.internal.filters.composite.CompositeFilterController) CompositeFilterPanel(org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel) SubFilterTransformer(org.cytoscape.filter.model.SubFilterTransformer) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 3 with CompositeFilterPanel

use of org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel in project cytoscape-impl by cytoscape.

the class FilterPanelController method createView.

@Override
public JComponent createView(FilterPanel parent, Transformer<CyNetwork, CyIdentifiable> filter, int depth) {
    // CompositeFilterImpl needs a CompositeFilterPanel but the top is blank so view will be null
    JComponent view = transformerViewManager.createView(filter);
    if (view instanceof InteractivityChangedListener) {
        ((InteractivityChangedListener) view).handleInteractivityChanged(isInteractive);
    }
    if (filter instanceof CompositeFilter) {
        String addButtonTT = transformerViewManager.getAddButtonTooltip(filter);
        CompositeFilterController controller = CompositeFilterController.createFor(view, addButtonTT);
        return new CompositeFilterPanel<FilterPanel>(parent, this, controller, (CompositeFilter<CyNetwork, CyIdentifiable>) filter, depth);
    }
    if (view == null)
        throw new IllegalArgumentException("view could not be created for: " + filter.getId());
    return view;
}
Also used : CompositeFilter(org.cytoscape.filter.model.CompositeFilter) JComponent(javax.swing.JComponent) CyNetwork(org.cytoscape.model.CyNetwork) InteractivityChangedListener(org.cytoscape.filter.view.InteractivityChangedListener) CompositeFilterController(org.cytoscape.filter.internal.filters.composite.CompositeFilterController) CompositeFilterPanel(org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Aggregations

CompositeFilterPanel (org.cytoscape.filter.internal.filters.composite.CompositeFilterPanel)3 CyIdentifiable (org.cytoscape.model.CyIdentifiable)3 CyNetwork (org.cytoscape.model.CyNetwork)3 JComponent (javax.swing.JComponent)2 CompositeFilterController (org.cytoscape.filter.internal.filters.composite.CompositeFilterController)2 CompositeFilter (org.cytoscape.filter.model.CompositeFilter)2 Container (java.awt.Container)1 SubFilterTransformer (org.cytoscape.filter.model.SubFilterTransformer)1 InteractivityChangedListener (org.cytoscape.filter.view.InteractivityChangedListener)1