001    /**
002     * Created by IntelliJ IDEA.
003     * User: Wei Wang
004     * Date: Nov 28, 2002
005     * Time: 2:27:40 AM
006     */
007    
008    package EVolve.visualization.XYViz.ValRefViz.HotSpotViz;
009    
010    import EVolve.data.Element;
011    import EVolve.util.painters.ThreadHotspotPainter;
012    import EVolve.util.painters.Painter;
013    import EVolve.visualization.Dimension;
014    import EVolve.visualization.ReferenceDimension;
015    import EVolve.visualization.ValueDimension;
016    
017    public class ThreadHotspotViz extends HotSpotVisualization{
018    
019        public ThreadHotspotViz() {
020            super();
021            painters = new Painter[1];
022            painters[0] = new ThreadHotspotPainter();
023        }
024    
025        public Dimension[] createDimension() {
026            Dimension [] returnDimension = new Dimension[3];
027    
028            xAxis = new ValueDimension();
029            yAxis = new ReferenceDimension(true);
030            zAxis = new ReferenceDimension();
031    
032            returnDimension[0] = xAxis;
033            returnDimension[1] = yAxis;
034            returnDimension[2] = zAxis;
035    
036            return returnDimension;
037        }
038    
039        public void preVisualize() {
040            super.preVisualize();
041            image = null;
042        }
043    
044        public void receiveElement(Element element) {
045            if (element.isOptional()) return;
046    
047            long threadId = zAxis.getField(element);
048    
049            switchThread(threadId);
050    
051            long x = xAxis.getField(element);
052            long y = yAxis.getField(element);
053            long z = 0;
054            paint(x,y,z);
055        }
056    
057        public void visualize() {
058            image = ((ThreadHotspotPainter)painter).getImage();
059            super.visualize();
060        }
061    
062        protected void installPainter() {
063            ((ThreadHotspotPainter)painters[0]).setImageMap(imageMap);
064            super.installPainter();
065        }
066    }