1 package prefuse.visual; 2 3 import prefuse.Visualization; 4 import prefuse.data.Graph; 5 import prefuse.data.Table; 6 import prefuse.data.event.EventConstants; 7 import prefuse.util.collections.IntIterator; 8 9 18 public class VisualGraph extends Graph implements VisualTupleSet { 19 20 private Visualization m_vis; 21 private String m_group; 22 23 34 public VisualGraph(VisualTable nodes, VisualTable edges, boolean directed, 35 String nodeKey, String sourceKey, String targetKey) 36 { 37 super(nodes, edges, directed, nodeKey, sourceKey, targetKey); 38 } 39 40 45 protected void fireGraphEvent(Table t, 46 int first, int last, int col, int type) 47 { 48 if ( type==EventConstants.UPDATE && 50 col==VisualItem.IDX_VALIDATED && t==getNodeTable() ) 51 { 52 VisualTable nodes = (VisualTable)t; 53 VisualTable edges = (VisualTable)getEdgeTable(); 54 55 for ( int i=first; i<=last; ++i ) { 56 if ( nodes.isValidated(i) ) 57 continue; 59 if ( i < 0 ) { 60 System.err.println("catch me - VisualGraph fireGraphEvent"); 61 } 62 IntIterator erows = edgeRows(i); 64 while ( erows.hasNext() ) { 65 int erow = erows.nextInt(); 66 edges.setValidated(erow, false); 67 } 68 } 72 } 73 super.fireGraphEvent(t, first, last, col, type); 75 } 76 77 81 public int getNodeIndex(int key) { 82 if ( m_nkey == null ) { 83 return ((VisualTable)getNodeTable()).getChildRow(key); 84 } else { 85 return super.getNodeIndex(key); 86 } 87 } 88 89 92 95 public Visualization getVisualization() { 96 return m_vis; 97 } 98 99 103 public void setVisualization(Visualization vis) { 104 m_vis = vis; 105 } 106 107 111 public String getGroup() { 112 return m_group; 113 } 114 115 119 public void setGroup(String group) { 120 m_group = group; 121 } 122 123 } | Popular Tags |