import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.LinkedBlockingQueue;
+import org.altusmetrum.AltosLib.*;
public class AltosInfoTable extends JTable {
private AltosFlightInfoTableModel model;
- private Font infoLabelFont = new Font("SansSerif", Font.PLAIN, 14);
- private Font infoValueFont = new Font("Monospaced", Font.PLAIN, 14);
-
static final int info_columns = 3;
static final int info_rows = 17;
int desired_row_height() {
- FontMetrics infoValueMetrics = getFontMetrics(infoValueFont);
+ FontMetrics infoValueMetrics = getFontMetrics(Altos.table_value_font);
return (infoValueMetrics.getHeight() + infoValueMetrics.getLeading()) * 18 / 10;
}
public AltosInfoTable() {
super(new AltosFlightInfoTableModel(info_rows, info_columns));
model = (AltosFlightInfoTableModel) getModel();
- setFont(infoValueFont);
+ setFont(Altos.table_value_font);
setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
setShowGrid(true);
setRowHeight(desired_row_height());
doLayout();
}
+ public void set_font() {
+ setFont(Altos.table_value_font);
+ doLayout();
+ }
+
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
}
info_add_row(0, "Max Speed", "%8.1f m/s", state.max_speed);
info_add_row(0, "Temperature", "%9.2f °C", state.temperature);
info_add_row(0, "Battery", "%9.2f V", state.battery);
- info_add_row(0, "Drogue", "%9.2f V", state.drogue_sense);
- info_add_row(0, "Main", "%9.2f V", state.main_sense);
+ if (state.drogue_sense != AltosRecord.MISSING)
+ info_add_row(0, "Drogue", "%9.2f V", state.drogue_sense);
+ if (state.main_sense != AltosRecord.MISSING)
+ info_add_row(0, "Main", "%9.2f V", state.main_sense);
info_add_row(0, "Pad altitude", "%6.0f m", state.ground_altitude);
- if (state.gps == null) {
+ if (state.gps == null || !state.gps.connected) {
info_add_row(1, "GPS", "not available");
} else {
if (state.gps_ready)