use of org.cytoscape.filter.internal.view.SelectPanel in project cytoscape-impl by cytoscape.
the class UiScaffold method start.
void start() {
MockitoAnnotations.initMocks(this);
Random random = new Random(0);
NetworkTestSupport networkTestSupport = new NetworkTestSupport();
CyNetwork network = networkTestSupport.getNetwork();
CyTable nodeTable = network.getDefaultNodeTable();
nodeTable.createColumn("Score", Double.class, false);
nodeTable.createColumn("IsSpecial", Boolean.class, false);
for (int i = 0; i < TOTAL_NODES; i++) {
CyNode node = network.addNode();
network.getRow(node).set("Score", random.nextGaussian());
network.getRow(node).set("IsSpecial", i % 2 == 0);
}
List<CyNode> nodes = network.getNodeList();
for (int i = 0; i < TOTAL_EDGES; i++) {
CyNode source = nodes.get(random.nextInt(nodes.size()));
CyNode target = nodes.get(random.nextInt(nodes.size()));
network.addEdge(source, target, false);
}
when(applicationManager.getCurrentNetworkView()).thenReturn(networkView);
when(applicationManager.getCurrentNetwork()).thenReturn(network);
when(networkView.getModel()).thenReturn(network);
when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
when(serviceRegistrar.getService(TaskManager.class)).thenReturn(taskManager);
when(serviceRegistrar.getService(IconManager.class)).thenReturn(iconManager);
JFrame frame = new JFrame();
frame.setTitle("Select");
Map<String, String> properties = Collections.emptyMap();
TransformerManagerImpl transformerManager = new TransformerManagerImpl();
transformerManager.registerFilterFactory(new ColumnFilterFactory(), properties);
transformerManager.registerFilterFactory(new DegreeFilterFactory(), properties);
transformerManager.registerFilterFactory(new TopologyFilterFactory(), properties);
transformerManager.registerElementTransformerFactory(new InteractionTransformerFactory(), properties);
ModelMonitor modelMonitor = new ModelMonitor();
modelMonitor.handleEvent(new SetCurrentNetworkEvent(applicationManager, network));
ValidationManager validationManager = new ValidationManager();
FilterPanelStyle style = new StandardStyle();
TransformerViewManager transformerViewManager = new TransformerViewManager(transformerManager);
// transformerViewManager.registerTransformerViewFactory(new ColumnFilterViewFactory(style, modelMonitor), properties);
transformerViewManager.registerTransformerViewFactory(new DegreeFilterViewFactory(style, modelMonitor), properties);
transformerViewManager.registerTransformerViewFactory(new TopologyFilterViewFactory(style), properties);
transformerViewManager.registerTransformerViewFactory(new InteractionTransformerViewFactory(style), properties);
LazyWorkQueue queue = new LazyWorkQueue();
FilterWorker filterWorker = new FilterWorker(queue, serviceRegistrar);
FilterIO filterIo = null;
FilterPanelController filterPanelController = new FilterPanelController(transformerManager, transformerViewManager, validationManager, filterWorker, modelMonitor, filterIo, style, serviceRegistrar);
FilterPanel filterPanel = new FilterPanel(filterPanelController, filterWorker, serviceRegistrar);
TransformerWorker transformerWorker = new TransformerWorker(queue, transformerManager, serviceRegistrar);
TransformerPanelController transformerPanelController = new TransformerPanelController(transformerManager, transformerViewManager, validationManager, filterPanelController, transformerWorker, filterIo, style, serviceRegistrar);
TransformerPanel transformerPanel = new TransformerPanel(transformerPanelController, transformerWorker, serviceRegistrar);
SelectPanel selectPanel = new SelectPanel(filterPanel, transformerPanel);
JRootPane root = frame.getRootPane();
root.setLayout(new GridBagLayout());
root.add(selectPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
frame.setSize(450, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
Aggregations