/** {@inheritDoc} */ @Override public void valueChanged(ListSelectionEvent e) { final ListSelectionModel selModel = (ListSelectionModel) e.getSource(); int selectedIndex = selModel.getMinSelectionIndex(); if (selectedIndex != -1) { final List<BelStatement> stmts = stmtTableModel.statements; final BelStatement selected = stmts.get(selectedIndex); annTableModel.setAnnotations(selected.getAnnotations()); final Citation citation = selected.getCitation(); citTableModel.setCitations(Arrays.asList(new Citation[] {citation})); } }
/** {@inheritDoc} */ @Override public Object getValueAt(int ri, int ci) { final BelStatement stmt = statements.get(ri); switch (ci) { case 0: return stmt.getSubjectTerm().getLabel(); case 1: // can return null return stmt.getRelationship(); case 2: final BelTerm objTerm = stmt.getObjectTerm(); final BelStatement objStmt = stmt.getObjectStatement(); if (objTerm != null) { return objTerm.getLabel(); } else if (objStmt != null) { if (objStmt.getSubjectTerm() == null || objStmt.getRelationship() == null || objStmt.getObjectTerm() == null) { return null; } return objStmt.getSubjectTerm().getLabel() + " " + objStmt.getRelationship() + " " + objStmt.getObjectTerm().getLabel(); } } return null; }