/** * decide which cursor to use (based on text string) * * @param highlighterName */ public void setCurrentHighlighter(String highlighterName) { SWTPlotHighlighter newCursor = null; for (Iterator<SWTPlotHighlighter> thisHighlighter = _myHighlighterList.iterator(); thisHighlighter.hasNext(); ) { SWTPlotHighlighter thisP = (SWTPlotHighlighter) thisHighlighter.next(); if (thisP.getName().equals(highlighterName)) { newCursor = thisP; break; } } // cool. did we find one? if (newCursor != null) setCurrentHighlighter(newCursor); }
/** * decide which cursor to use (based on text string) * * @param cursorName */ public void setCurrentPainter(String cursorName) { TemporalLayerPainter newCursor = null; for (Iterator<TemporalLayerPainter> thisPainter = _myPainterList.iterator(); thisPainter.hasNext(); ) { TemporalLayerPainter thisP = (TemporalLayerPainter) thisPainter.next(); if (thisP.getName().equals(cursorName)) { newCursor = thisP; break; } } // cool. did we find one? if (newCursor != null) setCurrentPainter(newCursor); }
/** * constructor - to collate the list * * @param dataProvider */ public LayerPainterManager(TrackDataProvider dataProvider) { super(dataProvider); // and now build the painters _myPainterList = new Vector<TemporalLayerPainter>(0, 1); _myPainterList.add(new PlainHighlighter()); _myPainterList.add(new SnailHighlighter(dataProvider)); setCurrentPainter((TemporalLayerPainter) _myPainterList.firstElement()); // and the plot highlighters _myHighlighterList = new Vector<SWTPlotHighlighter>(0, 1); _myHighlighterList.add(new SWTPlotHighlighter.RectangleHighlight()); _myHighlighterList.add(new SWTSymbolHighlighter()); _myHighlighterList.add(new SWTRangeHighlighter()); _myHighlighterList.add(new NullHighlighter()); // and sort out the defaults _currentPainter = _myPainterList.firstElement(); _currentHighlighter = _myHighlighterList.firstElement(); }
/** get the list of painters */ public SWTPlotHighlighter[] getHighlighterList() { SWTPlotHighlighter[] res = new SWTPlotHighlighter[] {null}; return (SWTPlotHighlighter[]) _myHighlighterList.toArray(res); }
/** ditch ourselves */ public void close() { _myHighlighterList.clear(); _myPainterList.clear(); _currentHighlighter = null; _currentPainter = null; }
/** get the list of painters */ public TemporalLayerPainter[] getPainterList() { TemporalLayerPainter[] res = new TemporalLayerPainter[] {null}; return (TemporalLayerPainter[]) _myPainterList.toArray(res); }