use of org.jfree.data.xy.XYDatasetSelectionState in project graphcode2vec by graphcode2vec.
the class AbstractXYItemRenderer method initialise.
/**
* Initialises the renderer and returns a state object that should be
* passed to all subsequent calls to the drawItem() method.
* <P>
* This method will be called before the first item is rendered, giving the
* renderer an opportunity to initialise any state information it wants to
* maintain. The renderer can do nothing if it chooses.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
* @param plot the plot.
* @param dataset the dataset.
* @param info an optional info collection object to return data back to
* the caller.
*
* @return The renderer state (never <code>null</code>).
*/
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
XYItemRendererState state = createState(info);
// determine if there is any selection state for the dataset
XYDatasetSelectionState selectionState = null;
if (dataset instanceof SelectableXYDataset) {
SelectableXYDataset sxyd = (SelectableXYDataset) dataset;
selectionState = sxyd.getSelectionState();
}
// and ask if it has state...
if (selectionState == null && info != null) {
ChartRenderingInfo cri = info.getOwner();
if (cri != null) {
RenderingSource rs = cri.getRenderingSource();
selectionState = (XYDatasetSelectionState) rs.getSelectionState(dataset);
}
}
state.setSelectionState(selectionState);
return state;
}
use of org.jfree.data.xy.XYDatasetSelectionState in project graphcode2vec by graphcode2vec.
the class XYLineAndShapeRenderer method initialise.
/**
* Initialises the renderer.
* <P>
* This method will be called before the first item is rendered, giving the
* renderer an opportunity to initialise any state information it wants to
* maintain. The renderer can do nothing if it chooses.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
* @param plot the plot.
* @param dataset the dataset.
* @param info an optional info collection object to return data back to
* the caller.
*
* @return The renderer state.
*/
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
State state = new State(info);
state.seriesPath = new GeneralPath();
// determine if there is any selection state for the dataset
XYDatasetSelectionState selectionState = null;
if (dataset instanceof SelectableXYDataset) {
SelectableXYDataset sxyd = (SelectableXYDataset) dataset;
selectionState = sxyd.getSelectionState();
}
// and ask if it has state...
if (selectionState == null && info != null) {
ChartRenderingInfo cri = info.getOwner();
if (cri != null) {
RenderingSource rs = cri.getRenderingSource();
if (rs != null) {
selectionState = (XYDatasetSelectionState) rs.getSelectionState(dataset);
}
}
}
state.setSelectionState(selectionState);
return state;
}
Aggregations