Search in sources :

Example 1 with CompositeTransformerPanel

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

the class TransformerPanelController method handleDrop.

@Override
public void handleDrop(TransformerPanel parent, JComponent source, List<Integer> sourcePath, JComponent target, List<Integer> targetPath) {
    CompositeTransformerPanel root = parent.getRootPanel();
    try {
        if (sourcePath.size() == 1 && targetPath.size() == 1) {
            int sourceIndex = sourcePath.get(0);
            List<Transformer<CyNetwork, CyIdentifiable>> model = root.getModel();
            Transformer<CyNetwork, CyIdentifiable> transformer = model.remove(sourceIndex);
            int targetIndex = targetPath.get(targetPath.size() - 1) + 1;
            if (sourceIndex < targetIndex) {
                targetIndex--;
            }
            model.add(targetIndex, transformer);
        } else {
            super.handleFilterDrop(parent, source, sourcePath, target, targetPath);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        root.updateLayout();
    }
}
Also used : CompositeTransformerPanel(org.cytoscape.filter.internal.filters.composite.CompositeTransformerPanel) Transformer(org.cytoscape.filter.model.Transformer) NamedTransformer(org.cytoscape.filter.model.NamedTransformer) SubFilterTransformer(org.cytoscape.filter.model.SubFilterTransformer) CyNetwork(org.cytoscape.model.CyNetwork) InvocationTargetException(java.lang.reflect.InvocationTargetException) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 2 with CompositeTransformerPanel

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

the class TransformerPanelController method handleElementSelected.

@Override
protected void handleElementSelected(TransformerElement selected, TransformerPanel panel) {
    CompositeTransformerPanel root = new CompositeTransformerPanel(panel, this, selected.getChain(), serviceRegistrar);
    panel.setRootPanel(root);
}
Also used : CompositeTransformerPanel(org.cytoscape.filter.internal.filters.composite.CompositeTransformerPanel)

Example 3 with CompositeTransformerPanel

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

the class TransformerPanel method createView.

private void createView(List<Transformer<CyNetwork, CyIdentifiable>> chain) {
    if (chain == null) {
        setRootPanel(null);
        return;
    }
    CompositeTransformerPanel panel = new CompositeTransformerPanel(this, controller, chain, serviceRegistrar);
    new TransformerElementViewModel<>(panel, controller, this);
    setRootPanel(panel);
}
Also used : CompositeTransformerPanel(org.cytoscape.filter.internal.filters.composite.CompositeTransformerPanel)

Aggregations

CompositeTransformerPanel (org.cytoscape.filter.internal.filters.composite.CompositeTransformerPanel)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 NamedTransformer (org.cytoscape.filter.model.NamedTransformer)1 SubFilterTransformer (org.cytoscape.filter.model.SubFilterTransformer)1 Transformer (org.cytoscape.filter.model.Transformer)1 CyIdentifiable (org.cytoscape.model.CyIdentifiable)1 CyNetwork (org.cytoscape.model.CyNetwork)1