org.opensourcephysics.display
Class HighlightableDataset

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended byorg.opensourcephysics.display.Dataset
          extended byorg.opensourcephysics.display.HighlightableDataset
All Implemented Interfaces:
Drawable, Measurable, java.io.Serializable, javax.swing.table.TableModel

public class HighlightableDataset
extends Dataset

A Dataset that can highlight selected points.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.opensourcephysics.display.Dataset
AREA, BAR, CIRCLE, CUSTOM, customMarker, datasetID, errorBars, generalPath, index, maxPoints, NO_MARKER, PIXEL, POST, sorted, SQUARE, xmax, xmin, xpoints, ymax, ymin, ypoints
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
HighlightableDataset()
          Default contructor.
HighlightableDataset(java.awt.Color markerColor)
          Contructor specifying the marker color.
HighlightableDataset(java.awt.Color markerColor, java.awt.Color lineColor, boolean connected)
          Contructor specifying the marker color, line color, and whether points are connected.
 
Method Summary
 void append(double[] xarray, double[] yarray)
          Appends (x,y) arrays to the Dataset.
 void append(double x, double y)
          Appends an (x,y) datum to the Dataset.
 void clear()
          Clear all data from this Dataset.
 void clearHighlights()
          .
 void draw(DrawingPanel drawingPanel, java.awt.Graphics g)
          Draw this Dataset in the drawing panel.
static XML.ObjectLoader getLoader()
          Returns the XML.ObjectLoader for this class.
 boolean isHighlighted(int i)
          Gets the highlighted flag for the specified point.
protected  void moveDatum(int loc)
          Move an out-of-place datum into its correct position.
 void restoreHighlights()
          Restores previous highlights.
 void setHighlightColor(java.awt.Color color)
          Sets the highlight color.
 void setHighlighted(int i, boolean highlight)
          Sets the highlighted flag for the specified point.
 void setHighlighted(int start, int end, boolean highlight)
          Sets the highlighted flag for the specified point range.
 
Methods inherited from class org.opensourcephysics.display.Dataset
append, append, convertTableColumnIndex, countColumnsVisible, drawFilledPlot, drawLinePlot, drawScatterPlot, getColumnClass, getColumnCount, getColumnName, getEdgeColor, getFillColor, getID, getIndex, getLineColor, getMarkerShape, getMarkerSize, getName, getPoints, getRowCount, getValidXPoints, getValidYPoints, getValueAt, getXMax, getXMin, getXPoints, getYMax, getYMin, getYPoints, insertionSort, isConnected, isMeasured, isSorted, isXColumnVisible, isYColumnVisible, read, recalculatePath, setConnected, setCustomMarker, setID, setLineColor, setMarkerColor, setMarkerColor, setMarkerColor, setMarkerShape, setMarkerSize, setMaximumPoints, setName, setSorted, setStride, setXColumnVisible, setXYColumnNames, setXYColumnNames, setYColumnVisible, toString, write
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HighlightableDataset

public HighlightableDataset()
Default contructor.


HighlightableDataset

public HighlightableDataset(java.awt.Color markerColor)
Contructor specifying the marker color.

Parameters:
markerColor - marker color

HighlightableDataset

public HighlightableDataset(java.awt.Color markerColor,
                            java.awt.Color lineColor,
                            boolean connected)
Contructor specifying the marker color, line color, and whether points are connected.

Parameters:
markerColor - marker color
lineColor - line color
connected - true to connect points with line
Method Detail

append

public void append(double x,
                   double y)
Appends an (x,y) datum to the Dataset.

Overrides:
append in class Dataset
Parameters:
x - the x value
y - the y value

append

public void append(double[] xarray,
                   double[] yarray)
Appends (x,y) arrays to the Dataset.

Overrides:
append in class Dataset
Parameters:
xarray - the x array
yarray - the y array

clear

public void clear()
Clear all data from this Dataset.

Overrides:
clear in class Dataset

restoreHighlights

public void restoreHighlights()
Restores previous highlights.


clearHighlights

public void clearHighlights()
.


setHighlighted

public void setHighlighted(int i,
                           boolean highlight)
Sets the highlighted flag for the specified point.

Parameters:
i - the array index
highlight - true to highlight the point

setHighlighted

public void setHighlighted(int start,
                           int end,
                           boolean highlight)
Sets the highlighted flag for the specified point range.

Parameters:
start - the start array index
end - the start array index
highlight - true to highlight the points

isHighlighted

public boolean isHighlighted(int i)
Gets the highlighted flag for the specified point.

Parameters:
i - the array index
Returns:
true if point is highlighted

setHighlightColor

public void setHighlightColor(java.awt.Color color)
Sets the highlight color.

Parameters:
color - the color

moveDatum

protected void moveDatum(int loc)
Move an out-of-place datum into its correct position.

Overrides:
moveDatum in class Dataset
Parameters:
loc - the datum

draw

public void draw(DrawingPanel drawingPanel,
                 java.awt.Graphics g)
Draw this Dataset in the drawing panel.

Specified by:
draw in interface Drawable
Overrides:
draw in class Dataset
Parameters:
drawingPanel - the drawing panel
g - the graphics

getLoader

public static XML.ObjectLoader getLoader()
Returns the XML.ObjectLoader for this class.

Returns:
the object loader