1 package tim.prune.function.distance;
3 import java.util.ArrayList;
5 import javax.swing.table.AbstractTableModel;
7 import tim.prune.I18nManager;
8 import tim.prune.data.DataPoint;
11 * General table model class for the two models in the distance function
13 public abstract class GenericTableModel extends AbstractTableModel
16 protected ArrayList<DataPoint> _pointList = null;
18 private static String _currPointLabel = I18nManager.getText("dialog.distances.currentpoint");
21 * Initialize the table model with the point list
22 * @param inPointList list of points
24 public void init(ArrayList<DataPoint> inPointList)
26 _pointList = inPointList;
32 public int getRowCount()
34 if (_pointList == null) {return 0;}
35 return _pointList.size();
39 * Get the name of the specified point from the list
40 * @param inIndex index of point
41 * @return waypoint name if waypoint, otherwise "current point"
43 protected String getPointName(int inIndex)
45 if (_pointList == null) {return "null";}
46 DataPoint point = _pointList.get(inIndex);
47 if (point.isWaypoint()) {return point.getWaypointName();}
48 return _currPointLabel;