KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > refactoring > query > views > WhereUsedView


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * WhereUsedView.java
22  *
23  * Created on October 25, 2005, 2:09 PM
24  *
25  * To change this template, choose Tools | Template Manager
26  * and open the template in the editor.
27  */

28
29 package org.netbeans.modules.xml.schema.refactoring.query.views;
30
31 import java.awt.BorderLayout JavaDoc;
32 import java.awt.Color JavaDoc;
33 import java.awt.Dimension JavaDoc;
34 import java.awt.event.MouseEvent JavaDoc;
35 import java.beans.PropertyChangeEvent JavaDoc;
36 import java.beans.PropertyChangeListener JavaDoc;
37 import java.util.ArrayList JavaDoc;
38 import java.util.HashMap JavaDoc;
39 import java.util.Iterator JavaDoc;
40 import java.util.List JavaDoc;
41 import java.util.Map JavaDoc;
42 import javax.swing.JPanel JavaDoc;
43 import org.netbeans.modules.xml.nbprefuse.AggregateDragControl;
44 import org.netbeans.modules.xml.nbprefuse.AnalysisConstants;
45 import org.netbeans.modules.xml.nbprefuse.AnalysisViewer;
46 import org.netbeans.modules.xml.nbprefuse.EdgeFillColorAction;
47 import org.netbeans.modules.xml.nbprefuse.EdgeStrokeColorAction;
48 import org.netbeans.modules.xml.nbprefuse.FindUsagesFocusControl;
49 import org.netbeans.modules.xml.nbprefuse.MouseoverActionControl;
50 import org.netbeans.modules.xml.nbprefuse.NodeExpansionMouseControl;
51 import org.netbeans.modules.xml.nbprefuse.NodeFillColorAction;
52 import org.netbeans.modules.xml.nbprefuse.NodeStrokeColorAction;
53 import org.netbeans.modules.xml.nbprefuse.NodeTextColorAction;
54 import org.netbeans.modules.xml.nbprefuse.PopupMouseControl;
55 import org.netbeans.modules.xml.nbprefuse.View;
56 import org.netbeans.modules.xml.nbprefuse.layout.AggregateLayout;
57 import org.netbeans.modules.xml.nbprefuse.layout.NbFruchtermanReingoldLayout;
58 import org.netbeans.modules.xml.nbprefuse.render.CompositionEdgeRenderer;
59 import org.netbeans.modules.xml.nbprefuse.render.FindUsagesRendererFactory;
60 import org.netbeans.modules.xml.nbprefuse.render.GeneralizationEdgeRenderer;
61 import org.netbeans.modules.xml.nbprefuse.render.NbLabelRenderer;
62 import org.netbeans.modules.xml.nbprefuse.render.ReferenceEdgeRenderer;
63 import org.netbeans.modules.xml.refactoring.ui.util.AnalysisUtilities;
64 import org.netbeans.modules.xml.schema.model.SchemaComponent;
65 import org.netbeans.modules.xml.schema.model.SchemaComponentReference;
66 import org.netbeans.modules.xml.schema.model.SchemaModel;
67 import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
68 import org.netbeans.modules.xml.schema.refactoring.ui.QueryUtilities;
69 import org.netbeans.modules.xml.xam.Component;
70 import org.netbeans.modules.xml.xam.Named;
71 import org.openide.ErrorManager;
72 import org.openide.filesystems.FileObject;
73 import org.openide.util.NbBundle;
74 import prefuse.Constants;
75 import prefuse.Display;
76 import prefuse.Visualization;
77 import prefuse.action.ActionList;
78 import prefuse.action.RepaintAction;
79 import prefuse.action.animate.ColorAnimator;
80 import prefuse.action.animate.QualityControlAnimator;
81 import prefuse.action.animate.VisibilityAnimator;
82 import prefuse.action.assignment.ColorAction;
83 import prefuse.action.assignment.DataColorAction;
84 import prefuse.activity.SlowInSlowOutPacer;
85 import prefuse.controls.ControlAdapter;
86 import prefuse.controls.NeighborHighlightControl;
87 import prefuse.controls.PanControl;
88 import prefuse.controls.ToolTipControl;
89 import prefuse.controls.WheelZoomControl;
90 import prefuse.controls.ZoomControl;
91 import prefuse.data.Graph;
92 import prefuse.data.Tuple;
93 import prefuse.data.tuple.TupleSet;
94 import prefuse.render.EdgeRenderer;
95 import prefuse.render.PolygonRenderer;
96 import prefuse.render.Renderer;
97 import prefuse.util.ColorLib;
98 import prefuse.visual.AggregateItem;
99 import prefuse.visual.AggregateTable;
100 import prefuse.visual.NodeItem;
101 import prefuse.visual.VisualItem;
102
103 /**
104  *
105  * @author Jeri Lockhart
106  */

107 public class WhereUsedView implements View, PropertyChangeListener JavaDoc {
108     
109     private SchemaModel model;
110     private SchemaComponent query;
111     private Display display = null;
112     private JPanel JavaDoc displayPanel;
113     private boolean isPrimitive;
114     private Graph graph;
115     private boolean usePacer = false; // slow in slow out pacer for initial
116
// graph animation
117
// private boolean firstShow = false;
118
private int resizeCounter = 0; // counter to prevent reshowing
119
//view on first invocation
120
// private DefaultTreeModel defaultTreeModel;
121

122     private static int paletteCount = 0;
123     
124     
125     
126     public WhereUsedView(SchemaComponentReference ref){
127         if (ref != null){
128             this.query = (SchemaComponent)ref.get();
129             this.isPrimitive = query.getModel() ==
130                     SchemaModelFactory.getDefault().getPrimitiveTypesModel();
131             this.model =
132                     (this.isPrimitive?
133                         SchemaModelFactory.getDefault().getPrimitiveTypesModel():
134                         query.getModel());
135         }
136     }
137     /**
138      * Creates a new instance of WhereUsedView
139      * taking a SchemaComponent argument
140      */

141     public WhereUsedView(SchemaModel model,
142             SchemaComponent query,
143             boolean isPrimitive
144             ) {
145         this.model = model;
146         this.query = query;
147         this.isPrimitive = isPrimitive;
148     }
149     
150     
151     /**
152      * Creates a new instance of WhereUsedView
153      * taking a SchemaComponent argument
154      */

155     public WhereUsedView(SchemaModel model, SchemaComponent query) {
156         this(model, query, false);
157     }
158     
159     
160     /**
161      * Implement View
162      *
163      */

164     
165     public JPanel JavaDoc getDisplayPanel() {
166         return displayPanel;
167     }
168     public Named getQueryComponent() {
169         return (Named)query;
170     }
171     
172     /**
173      * Create the graph and the tree model
174      * or only the graph
175      *
176      */

177     public Object JavaDoc[] createModels(){
178         return null;
179     }
180     
181    
182     public boolean showView(AnalysisViewer viewer) {
183         boolean wasShown = false;
184         
185         
186         // resizing will call showView() from AnalysisViewer
187
// prevent showing the view twice the first time
188
if (resizeCounter == 0){
189             resizeCounter++;
190         } else if (resizeCounter == 1 || resizeCounter == 2){
191             resizeCounter++;
192             return wasShown;
193         }
194         final Visualization viz = new Visualization();
195         if (graph == null){
196             ErrorManager.getDefault().log(ErrorManager.ERROR,
197                     NbBundle.getMessage(WhereUsedView.class,
198                     "LBL_Graph_Not_Created_Error"));
199             return wasShown;
200         }
201         
202         try {
203             
204             // initialize display
205
this.display = new Display();
206             display.setBackground(Color.WHITE);
207             viz.addGraph(AnalysisConstants.GRAPH_GROUP, graph);
208             display.setVisualization(viz);
209             
210             int aggrCount = 0;
211             if (graph.getNodeCount() > 1){
212                 AggregateTable at = viz.addAggregates(AnalysisConstants.GRAPH_GROUP_AGGR);
213                 at.addColumn(VisualItem.POLYGON, float[].class);
214                 at.addColumn(AnalysisConstants.ID, int.class,-1); // default value -1
215
at.addColumn(AnalysisConstants.IS_FILE_GROUP_AGGREGATE, boolean.class, false);
216                 
217                 List JavaDoc<NodeItem> fileNodes = new ArrayList JavaDoc<NodeItem>();
218                 aggrCount = createAggregates(viz, at, fileNodes);
219                 
220                 AnalysisUtilities.expandCollapseFileNodes(fileNodes);
221             }
222             
223             // size the AnalysisViewer to the available space in the main
224
// parent panel
225
// if width is < 1, use preferred size
226
Dimension JavaDoc dim = viewer.getPanel().getBounds().getSize();
227 // System.out.println("AnalysisView dimensions:" + dim.toString());
228
Dimension JavaDoc displayDim = display.getBounds().getSize();
229             if (dim.width < 1 || dim.height < 1){
230                 display.setSize(dim.width < 1?AnalysisConstants.DISPLAY_PREFERRED_WIDTH:
231                     dim.width,dim.height<1?AnalysisConstants.DISPLAY_PREFERRED_HEIGHT:dim.height);
232                 viewer.getPanel().setSize(display.getSize());
233             } else if (!dim.equals(displayDim)) {
234                 display.setSize(dim.width, dim.height);
235             }
236             
237             this.displayPanel = new JPanel JavaDoc(new BorderLayout JavaDoc());
238             displayPanel.add(display, BorderLayout.CENTER);
239             viewer.addDisplayPanel(displayPanel);
240             
241             
242             // initialize renderers
243

244             // draw aggregates as polygons with curved edges
245
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
246             ((PolygonRenderer)polyR).setCurveSlack(0.15f);
247             
248             viz.setRendererFactory(new FindUsagesRendererFactory(
249                     new NbLabelRenderer(),
250                     new NbLabelRenderer(),
251                     new GeneralizationEdgeRenderer(),
252                     new CompositionEdgeRenderer(),
253                     new ReferenceEdgeRenderer(),
254                     new EdgeRenderer(),
255                     polyR
256                     ));
257             
258             
259             
260             final int[][] palettes = new int[][]{
261                 QueryUtilities.getHSBPalette(
262                         aggrCount+1, // palette size
263
0.17f, // saturation 23%
264
1.0f, // brightness 100%
265
null
266 // new AnalysisConstants.HSBHues[] {
267
// AnalysisConstants.HSBHues.GREEN,
268
// AnalysisConstants.HSBHues.PINK,
269
// AnalysisConstants.HSBHues.RED}
270
),
271                 ColorLib.getGrayscalePalette(
272                         aggrCount // palette size
273
),
274                 ColorLib.getCoolPalette(
275                         aggrCount // palette size
276
),
277                 ColorLib.getHotPalette(
278                         aggrCount // palette size
279
),
280                 ColorLib.getInterpolatedPalette(
281                         aggrCount, // palette size
282
new Color JavaDoc(204, 255, 255).getRGB(),
283                         new Color JavaDoc(255, 204, 255).getRGB()
284                         )
285             };
286             
287             final RepaintAction repaintAction = new RepaintAction();
288             viz.putAction(AnalysisConstants.ACTION_REPAINT, repaintAction);
289             
290             ColorAction aggrFill = new DataColorAction(
291                     AnalysisConstants.GRAPH_GROUP_AGGR,
292                     AnalysisConstants.ID,
293                     Constants.NOMINAL,
294                     VisualItem.FILLCOLOR, palettes[0]);
295             
296             NodeFillColorAction nFill = new NodeFillColorAction();
297             NodeTextColorAction nText = new NodeTextColorAction();
298             NodeStrokeColorAction nStroke = new NodeStrokeColorAction();
299             EdgeStrokeColorAction eStroke = new EdgeStrokeColorAction();
300             EdgeFillColorAction eFill = new EdgeFillColorAction();
301             
302             ActionList draw = new ActionList();
303             draw.add(nFill);
304             draw.add(nText);
305             draw.add(nStroke);
306             draw.add(eStroke);
307             draw.add(eFill);
308             draw.add(aggrFill);
309             viz.putAction(AnalysisConstants.ACTION_DRAW, draw);
310             
311             
312 // System.out.println("layout.getLayoutBounds() " + layout.getLayoutBounds()); // null
313
// Rectangle2D rect = layout.getLayoutBounds(viz);
314
// layout.setLayoutBounds(new Rectangle(rect.getBounds().width-10, rect.getBounds().height-10));
315

316 // ActionList update = new ActionList(Activity.INFINITY);
317
ActionList update = new ActionList(viz);
318             update.add(nFill);
319             update.add(nText);
320             update.add(nStroke);
321             update.add(eStroke);
322             update.add(eFill);
323             update.add(aggrFill);
324             viz.putAction(AnalysisConstants.ACTION_UPDATE, update);
325             
326             ActionList updateRepaint = new ActionList(viz);
327             updateRepaint.add(nFill);
328             updateRepaint.add(nText);
329             updateRepaint.add(nStroke);
330             updateRepaint.add(eStroke);
331             updateRepaint.add(eFill);
332             updateRepaint.add(aggrFill);
333             updateRepaint.add(repaintAction);
334             viz.putAction(AnalysisConstants.ACTION_UPDATE_REPAINT, updateRepaint);
335             
336             AggregateLayout aggregateLayout = new AggregateLayout(viz,
337                     AnalysisConstants.GRAPH_GROUP_AGGR);
338             viz.putAction(AnalysisConstants.ACTION_AGGREGATE_LAYOUT, aggregateLayout);
339             
340             
341             ActionList updateAggregateLayoutRepaint = new ActionList(viz);
342             updateAggregateLayoutRepaint.add(nFill);
343             updateAggregateLayoutRepaint.add(nText);
344             updateAggregateLayoutRepaint.add(nStroke);
345             updateAggregateLayoutRepaint.add(eStroke);
346             updateAggregateLayoutRepaint.add(eFill);
347             updateAggregateLayoutRepaint.add(aggrFill);
348             updateAggregateLayoutRepaint.add(aggregateLayout);
349             updateAggregateLayoutRepaint.add(repaintAction);
350             viz.putAction(AnalysisConstants.ACTION_UPDATE_AGGREGATE_LAYOUT_REPAINT,
351                     updateAggregateLayoutRepaint);
352             
353             ActionList layout = new ActionList();
354             layout.add(new NbFruchtermanReingoldLayout(
355                     AnalysisConstants.GRAPH_GROUP));
356             layout.add(aggregateLayout);
357             layout.add(repaintAction);
358             viz.putAction(AnalysisConstants.ACTION_LAYOUT, layout);
359             
360             ActionList layoutR = new ActionList();
361             layoutR.add(new NbFruchtermanReingoldLayout(
362                     AnalysisConstants.GRAPH_GROUP));
363             layoutR.add(aggregateLayout);
364             layoutR.add(repaintAction);
365             viz.putAction(AnalysisConstants.ACTION_LAYOUT_REPAINT, layoutR);
366             
367             
368             // remove SubtreeDragControl from Display - it doesn't
369
// work well with the AggregateItems
370
// display.addControlListener(new SubtreeDragControl());
371
display.setHighQuality(true);
372             display.addControlListener(new AggregateDragControl());
373             display.addControlListener(new PanControl());
374             display.addControlListener(new ZoomControl());
375             display.addControlListener(new WheelZoomControl());
376             display.addControlListener(new ToolTipControl(
377                     AnalysisConstants.TOOLTIP)); // "tooltip"
378
FindUsagesFocusControl selectionFocusControl =
379                     new FindUsagesFocusControl(1,
380                     AnalysisConstants.ACTION_UPDATE_REPAINT);
381             FindUsagesFocusControl schemaViewSearchFocusControl =
382                     new FindUsagesFocusControl(2,
383                     AnalysisConstants.ACTION_UPDATE_AGGREGATE_LAYOUT_REPAINT);
384             selectionFocusControl.addGraphNodeSelectionChangeListener(
385                     viewer);
386             // FindUsagesFocusControl default is SINGLE selection
387
display.addControlListener(selectionFocusControl); // one click
388
display.addControlListener(schemaViewSearchFocusControl); // double click
389
display.addControlListener(
390                     new MouseoverActionControl(AnalysisConstants.ACTION_UPDATE_REPAINT));// mouseover
391
display.addControlListener(
392                     new NeighborHighlightControl(AnalysisConstants.ACTION_UPDATE_REPAINT)); //NOI18N
393
display.addControlListener(new PopupMouseControl());
394             display.addControlListener(new NodeExpansionMouseControl(viz,
395                     AnalysisConstants.ACTION_UPDATE_AGGREGATE_LAYOUT_REPAINT));
396             //////////////////////////////////////////////////////////////////
397
display.addControlListener(new ControlAdapter(){
398                 public void mouseClicked(MouseEvent JavaDoc evt){
399                     if ( evt.isAltDown()){
400                         paletteCount++;
401                         if (paletteCount > palettes.length-1){
402                             paletteCount = 0;
403                         }
404                         ColorAction aFill = new DataColorAction(
405                                 AnalysisConstants.GRAPH_GROUP_AGGR,
406                                 AnalysisConstants.ID,
407                                 Constants.NOMINAL,
408                                 VisualItem.FILLCOLOR, palettes[1]);
409 // VisualItem.FILLCOLOR, palettes[paletteCount]);
410
ActionList drawAggr = new ActionList();
411                         drawAggr.add(aFill);
412                         drawAggr.add(repaintAction);
413                         viz.putAction("drawAggr", drawAggr);
414                         viz.run("drawAggr");
415                         String JavaDoc paletteName = null;
416                         switch (paletteCount){
417                             case 0:
418                                 paletteName = "HSB Palette: Saturation 10f, Brightness 150f";
419                                 break;
420                             case 1:
421                                 paletteName = "Grayscale Palette";
422                                 break;
423                             case 2:
424                                 paletteName = "Cool Palette";
425                                 break;
426                             case 3:
427                                 paletteName = "Hot Palette";
428                                 break;
429                             case 4:
430                                 paletteName = "Interpolated (204,255,255) to (255,204,255)";
431                                 break;
432                         }
433 // StatusDisplayer.getDefault().setStatusText(paletteName);
434
}
435                 }
436             });
437             
438             if (usePacer) {
439                 // animated transition
440
ActionList animate = new ActionList(1500, 40);
441                 animate.setPacingFunction(new SlowInSlowOutPacer());
442                 animate.add(new QualityControlAnimator());
443                 animate.add(new VisibilityAnimator());
444 // animate.add(new PolarLocationAnimator(
445
// AnalysisConstants.GRAPH_GROUP));
446
animate.add(new ColorAnimator());
447                 animate.add(repaintAction);
448                 viz.putAction(AnalysisConstants.ACTION_ANIMATE, animate);
449                 viz.runAfter(AnalysisConstants.ACTION_LAYOUT_REPAINT, AnalysisConstants.ACTION_ANIMATE);
450             }
451             viz.runAfter(AnalysisConstants.ACTION_DRAW, AnalysisConstants.ACTION_LAYOUT_REPAINT);
452             
453             viz.run(AnalysisConstants.ACTION_DRAW);
454             wasShown = true;
455             
456             
457         } catch ( Exception JavaDoc e ) {
458             ErrorManager.getDefault().notify(e);
459         }
460         return wasShown;
461     }
462     
463     
464     /**
465      * Create visual aggregates for each file node group
466      * returns the number of aggregates created
467      *
468      */

469     private int createAggregates(Visualization vis, AggregateTable at, List JavaDoc<NodeItem> fileNodes){
470         Map JavaDoc<Integer JavaDoc,AggregateItem> fileMap = new HashMap JavaDoc<Integer JavaDoc,AggregateItem>();
471         Iterator JavaDoc nodes = vis.getGroup(AnalysisConstants.GRAPH_GROUP_NODES).tuples();
472         while(nodes.hasNext()){
473             Integer JavaDoc fileGroup = null;
474             NodeItem n = NodeItem.class.cast(nodes.next());
475             // skip the query node
476
if (n.getBoolean(AnalysisConstants.IS_QUERY_NODE)){
477                 continue;
478             }
479             // schema component nodes will have a positive FILE_GROUP number
480
if (n.canGetInt(AnalysisConstants.FILE_GROUP)){
481                 fileGroup = (Integer JavaDoc)n.getInt(AnalysisConstants.FILE_GROUP);
482                 if (fileGroup == -1){
483                     // file nodes will have a positive FILE_NODE_FILE_GROUP
484
if (n.canGetInt(AnalysisConstants.FILE_NODE_FILE_GROUP)){
485                         fileNodes.add(n);
486                         fileGroup =
487                                 (Integer JavaDoc)n.getInt(AnalysisConstants.FILE_NODE_FILE_GROUP);
488                     }
489                 }
490             }
491             if (fileGroup != null){
492                 AggregateItem ai = null;
493                 if (fileMap.containsKey(fileGroup)){
494                     ai = fileMap.get(fileGroup);
495                 } else {
496                     ai = (AggregateItem)at.addItem();
497                     ai.setInt(AnalysisConstants.ID, fileGroup.intValue());
498                     ai.setBoolean(AnalysisConstants.IS_FILE_GROUP_AGGREGATE,true);
499                     fileMap.put(fileGroup,ai);
500                 }
501                 ai.addItem(n);
502             }
503         }
504         return fileMap.size();
505     }
506     
507     public void usePacer(boolean use) {
508         this.usePacer = use;
509     }
510     
511     /**
512      * Should the SchemaColumnView make the Column
513      * that the View is shown in as wide as possible?
514      * @return boolean true if View should be shown
515      * in a column as wide as the available horizontal space
516      * in the column view
517      */

518     public boolean getMaximizeWidth(){
519         return true;
520     }
521     
522     // TODO was in RefactoringPanel
523
public static final String JavaDoc
524             NODE_SELECTION_CHANGE = "node-selection-change"; // NOI18N fire
525

526     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
527         if (evt.getPropertyName().equals(
528                 NODE_SELECTION_CHANGE)){
529             // In the FindUsages explorer, a new node has been selected
530
Object JavaDoc newVal = evt.getNewValue();
531             if (display == null || graph == null){
532                 return;
533             }
534             Visualization vis = display.getVisualization();
535             // get the current focus set
536
TupleSet ts = vis.getFocusGroup(vis.FOCUS_ITEMS);
537 // setUnselectNodeStroke(ts);
538
ts.clear();
539             if (newVal == null){
540                 vis.run(AnalysisConstants.ACTION_UPDATE_REPAINT);
541                 return;
542             }
543             TupleSet allItems = vis.getGroup(AnalysisConstants.GRAPH_GROUP_NODES);
544             Iterator JavaDoc it = allItems.tuples();
545             while (it.hasNext()){
546                 Tuple n = (Tuple)it.next();
547                 if (n.canGet(AnalysisConstants.XAM_COMPONENT,
548                         Component.class)){
549                     Component sc = (Component)n.get(
550                             AnalysisConstants.XAM_COMPONENT);
551                     if (sc == newVal){
552                         ts.setTuple(n);
553 // NodeItem.class.cast(n).setStroke(AnalysisConstants.SELECTED_STROKE);
554
break;
555                     }
556                 } else if (n.canGet(AnalysisConstants.FILE_OBJECT,
557                         FileObject.class)){
558                     FileObject fo = (FileObject)n.get(
559                             AnalysisConstants.FILE_OBJECT);
560                     if (fo == newVal){
561                         ts.setTuple(n);
562 // NodeItem.class.cast(n).setStroke(AnalysisConstants.SELECTED_STROKE);
563
break;
564                     }
565                 }
566             }
567             vis.run(AnalysisConstants.ACTION_UPDATE_REPAINT);
568         }
569     }
570     
571     /**
572      * Switch to a different graph
573      * @param newGraph the new Graph to use for the Visualization
574      */

575     public void setGraph(Graph newGraph){
576         this.graph = newGraph;
577     }
578     
579     
580     /**
581      * Assumes single selection of graph nodes
582      *
583      *
584      */

585 // private void setUnselectNodeStroke(TupleSet currentlySelectedTuples){
586
// Tuple currentlySelected = null;
587
// Iterator currentlySelectedIt = currentlySelectedTuples.tuples();
588
// if (currentlySelectedIt.hasNext()){
589
// currentlySelected = (Tuple)currentlySelectedIt.next();
590
// }
591
// assert (currentlySelectedIt.hasNext()==false):"The Find Usages graph supports only single selection of nodes.";
592
// if (currentlySelected instanceof NodeItem){
593
// NodeItem.class.cast(currentlySelected).setStroke(AnalysisConstants.UNSELECTED_STROKE);
594
// }
595
// else if (currentlySelected != null){
596
// assert true:"The currently selected item is not a NodeItem: " + currentlySelected;
597
// }
598
// }
599

600     
601 }
602
Popular Tags