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();
}
}
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);
}
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);
}
Aggregations