Merge remote-tracking branch 'origin/master'
[fw/altos] / altosui / AltosCompanionInfo.java
index f287a8ea3348cb375b39d1595018c23467e446b9..1f446700218827c64ff1ff6673df8cf1654f2156 100644 (file)
 package altosui;
 
 import java.awt.*;
-import java.awt.event.*;
 import javax.swing.*;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import javax.swing.table.*;
-import java.io.*;
-import java.util.*;
-import java.text.*;
-import java.util.prefs.*;
-import java.util.concurrent.LinkedBlockingQueue;
+import org.altusmetrum.altoslib_2.*;
 
 public class AltosCompanionInfo 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 = 2;
        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 void set_font() {
+               setFont(Altos.table_value_font);
+               setRowHeight(desired_row_height());
+               doLayout();
+       }
+
        public AltosCompanionInfo() {
                super(new AltosFlightInfoTableModel(info_rows, info_columns));
                model = (AltosFlightInfoTableModel) getModel();
-               setFont(infoValueFont);
                setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
                setShowGrid(true);
-               setRowHeight(desired_row_height());
-               doLayout();
+               set_font();
        }
 
        public Dimension getPreferredScrollableViewportSize() {
@@ -76,24 +70,24 @@ public class AltosCompanionInfo extends JTable {
                model.clear();
        }
 
-       AltosRecordCompanion    companion;
+       AltosCompanion  companion;
 
        public String board_name() {
                if (companion == null)
                        return "None";
                switch (companion.board_id) {
-               case AltosRecordCompanion.board_id_telescience:
+               case AltosCompanion.board_id_telescience:
                        return "TeleScience";
                default:
                        return String.format("%02x\n", companion.board_id);
                }
        }
        
-       public void show(AltosState state, int crc_errors) {
+       public void show(AltosState state, AltosListenerState listener_state) {
                if (state == null)
                        return;
-               if (state.data.companion != null)
-                       companion = state.data.companion;
+               if (state.companion != null)
+                       companion = state.companion;
                info_reset();
                info_add_row(0, "Companion board", "%s", board_name());
                if (companion != null) {