public DomainTableModel( CyIdentifiable cyId, CDDDomainManager manager, String[] columnNames, String chain) { this.domainManager = manager; this.cyId = cyId; this.chain = chain; this.svHandler = domainManager.getStructureHandler(); chainTable = (columnNames.length == 4 && svHandler.structureVizAvailable()) ? true : false; if (!chainTable) { hits = manager.getHits(cyId); features = manager.getFeatures(cyId); this.columnNames = Arrays.copyOf(columnNames, 3); shown = null; } else { hits = manager.getHits(cyId, chain); features = manager.getFeatures(cyId, chain); shown = new ArrayList<Boolean>(hits.size() + features.size()); this.columnNames = columnNames; for (int i = 0; i < (hits.size() + features.size()); i++) shown.add(Boolean.FALSE); } }
public void setValueAt(Object value, int rowIndex, int column) { // System.out.println("SetValue at: "+rowIndex+","+column+" to "+value); // System.out.println(" current value at: "+rowIndex+","+column+" is "+getValueAt(rowIndex, // column)); if (column != 3 || !(value instanceof Boolean)) return; Boolean boolValue = (Boolean) value; if (shown.get(rowIndex).equals(boolValue)) return; if (boolValue) { domainManager.setIgnoreSelection(true); // System.out.println("Selection ignored"); // Show the structure & select the domain/site svHandler.openStructure(CyUtils.getName(domainManager.getCurrentNetwork(), cyId), chain); svHandler.select(chain, (String) getValueAt(rowIndex, 2)); // System.out.println("Selection not ignored"); domainManager.setIgnoreSelection(false); } else { domainManager.setIgnoreSelection(true); // Unselect the domain/site svHandler.unSelect(chain, (String) getValueAt(rowIndex, 2)); domainManager.setIgnoreSelection(false); } shown.set(rowIndex, boolValue); }