/** * Callback to handle showing edge details for the active cytoscape edge. * * @see NetworkDetailsListener#onSelectEvent(cytoscape.data.SelectEvent) * @param kn the {@link KAMNetwork kam network} containing the edge * @param edge the {@link CyEdge cytoscape edge} that is active */ public void showEdgeDetails(final KAMNetwork kn, final CyEdge edge) { final KamEdge kamEdge = kn.getKAMEdge(edge); final List<BelStatement> statements = kamService.getSupportingEvidence(kamEdge); // set edge details and show results panel stmtTableModel.setStatements(statements); // show edge details panel int edgeTabIdx = resultsPanel.indexOfComponent(edgeDetailPanel); resultsPanel.setSelectedIndex(edgeTabIdx); edgeDetailPanel.setVisible(true); }
/** * Callback to handle showing node details for the active cytoscape node. * * @see NetworkDetailsListener#onSelectEvent(cytoscape.data.SelectEvent) * @param kn the {@link KAMNetwork kam network} containing the node * @param node the {@link CyNode cytoscape node} that is active */ public void showNodeDetails(final KAMNetwork kn, final CyNode node) { final KamNode kamNode = kn.getKAMNode(node); if (kamNode == null) { // node is not kam backed return; } final List<BelTerm> terms = kamService.getSupportingTerms(kamNode); // set node details and show results panel termTableModel.setTerms(terms); // show node details panel int nodeTabIdx = resultsPanel.indexOfComponent(nodeDetailPanel); resultsPanel.setSelectedIndex(nodeTabIdx); nodeDetailPanel.setVisible(true); }
private DetailsView() { resultsPanel = (CytoPanelImp) Cytoscape.getDesktop().getCytoPanel(SwingConstants.EAST); this.kamService = KAMServiceFactory.getInstance().getKAMService(); // build node details panel and add to results panel nodeDetailPanel = new JPanel(); nodeDetailPanel.setName("KAM Node Info"); JScrollPane tblScroll = new JScrollPane(); JTable termTbl = new JTable(); termTbl.setShowGrid(true); termTbl.setShowHorizontalLines(true); termTbl.setShowVerticalLines(true); nodeDetailPanel.setLayout(new BorderLayout()); JLabel nodeLbl = new JLabel("Supporting BEL Terms"); nodeDetailPanel.add(nodeLbl, BorderLayout.NORTH); termTableModel = new TermTableModel(); termTbl.setModel(termTableModel); tblScroll.setViewportView(termTbl); nodeDetailPanel.add(tblScroll, BorderLayout.CENTER); resultsPanel.add(nodeDetailPanel); // build edge details panel and add to results panel edgeDetailPanel = new JPanel(new GridLayout(3, 1)); edgeDetailPanel.setName("KAM Edge Info"); TextAreaCellRenderer textRenderer = new TextAreaCellRenderer(); // statement panel JPanel stmtPanel = new JPanel(); stmtPanel.setLayout(new BorderLayout()); JLabel edgeLbl = new JLabel("Supporting BEL Statements"); stmtPanel.add(edgeLbl, BorderLayout.NORTH); JScrollPane stmtScroll = new JScrollPane(); JTable stmtTbl = new JTable(); stmtTbl.setShowGrid(true); stmtTbl.setShowHorizontalLines(true); stmtTbl.setShowVerticalLines(true); stmtTableModel = new StatementTableModel(); stmtTbl.setModel(stmtTableModel); stmtTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); stmtTbl.getSelectionModel().addListSelectionListener(new StatementSelectionListener()); stmtScroll.setViewportView(stmtTbl); stmtPanel.add(stmtScroll, BorderLayout.CENTER); edgeDetailPanel.add(stmtPanel); // annotation panel JPanel annPanel = new JPanel(); annPanel.setLayout(new BorderLayout()); JLabel annLbl = new JLabel("Statement Annotations"); annPanel.add(annLbl, BorderLayout.NORTH); JScrollPane annScroll = new JScrollPane(); JTable annTbl = new JTable(); annTbl.setShowGrid(true); annTbl.setShowHorizontalLines(true); annTbl.setShowVerticalLines(true); annTableModel = new AnnotationTableModel(); annTbl.setModel(annTableModel); annTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); annTbl.getColumnModel().getColumn(1).setCellRenderer(textRenderer); annScroll.setViewportView(annTbl); annPanel.add(annScroll, BorderLayout.CENTER); edgeDetailPanel.add(annPanel); // citation panel JPanel citPanel = new JPanel(); citPanel.setLayout(new BorderLayout()); JLabel citLbl = new JLabel("Citation"); citPanel.add(citLbl, BorderLayout.NORTH); JScrollPane citScroll = new JScrollPane(); JTable citTbl = new JTable(); citTbl.setShowGrid(true); citTbl.setShowHorizontalLines(true); citTbl.setShowVerticalLines(true); citTableModel = new CitationTableModel(); citTbl.setModel(citTableModel); citTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); citTbl.getColumnModel().getColumn(0).setCellRenderer(textRenderer); citTbl.getColumnModel().getColumn(1).setCellRenderer(textRenderer); citTbl.getColumnModel().getColumn(2).setCellRenderer(textRenderer); citTbl.getColumnModel().getColumn(3).setCellRenderer(textRenderer); citScroll.setViewportView(citTbl); citPanel.add(citScroll, BorderLayout.CENTER); edgeDetailPanel.add(citPanel); // add edge details to Results Panel (cytoscape) resultsPanel.add(edgeDetailPanel); // delay showing panels nodeDetailPanel.setVisible(false); edgeDetailPanel.setVisible(false); }