X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosEepromSelect.java;h=66a197c9af5ac300e102121ae81078909a123a4d;hp=0a6eec173b3eeabcba9e736aec48c712920c9e27;hb=9a4c2c7fc6af922d052e23a1b99bf847fbf9b0e9;hpb=56d045040c49728a854741e99545766f3723da5e diff --git a/altosui/AltosEepromSelect.java b/altosui/AltosEepromSelect.java index 0a6eec17..66a197c9 100644 --- a/altosui/AltosEepromSelect.java +++ b/altosui/AltosEepromSelect.java @@ -17,29 +17,21 @@ package altosui; -import java.lang.*; -import java.util.*; import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; -import libaltosJNI.libaltos; -import libaltosJNI.altos_device; -import libaltosJNI.SWIGTYPE_p_altos_file; -import libaltosJNI.SWIGTYPE_p_altos_list; +import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altosuilib_2.*; class AltosEepromItem implements ActionListener { AltosEepromLog log; JLabel label; - JCheckBox download; + JCheckBox action; JCheckBox delete; public void actionPerformed(ActionEvent e) { - if (e.getSource() == download) { - log.download = download.isSelected(); - } else if (e.getSource() == delete) { - log.delete = delete.isSelected(); - } + log.selected = action.isSelected(); } public AltosEepromItem(AltosEepromLog in_log) { @@ -54,16 +46,13 @@ class AltosEepromItem implements ActionListener { label = new JLabel(text); - download = new JCheckBox("", log.download); - download.addActionListener(this); - - delete = new JCheckBox("", log.delete); - delete.addActionListener(this); + action = new JCheckBox("", log.selected); + action.addActionListener(this); } } -public class AltosEepromSelect extends JDialog implements ActionListener { - private JList list; +public class AltosEepromSelect extends AltosUIDialog implements ActionListener { + //private JList list; private JFrame frame; JButton ok; JButton cancel; @@ -86,7 +75,8 @@ public class AltosEepromSelect extends JDialog implements ActionListener { } public AltosEepromSelect (JFrame in_frame, - AltosEepromList flights) { + AltosEepromList flights, + String action) { super(in_frame, String.format("Flight list for serial %d", flights.config_data.serial), true); frame = in_frame; @@ -95,7 +85,7 @@ public class AltosEepromSelect extends JDialog implements ActionListener { Container contentPane = getContentPane(); /* First, we create a pane containing the dialog's header/title */ - JLabel selectLabel = new JLabel("Select flights to download and/or delete", SwingConstants.CENTER); + JLabel selectLabel = new JLabel(String.format ("Select flights to %s", action), SwingConstants.CENTER); JPanel labelPane = new JPanel(); labelPane.setLayout(new BoxLayout(labelPane, BoxLayout.X_AXIS)); @@ -132,19 +122,9 @@ public class AltosEepromSelect extends JDialog implements ActionListener { c.weightx = 0.5; c.anchor = GridBagConstraints.CENTER; c.insets = i; - JLabel downloadHeaderLabel = new JLabel("Download"); + JLabel downloadHeaderLabel = new JLabel(action); flightPane.add(downloadHeaderLabel, c); - /* Delete Header */ - c = new GridBagConstraints(); - c.gridx = 2; c.gridy = 0; - c.fill = GridBagConstraints.NONE; - c.weightx = 0.5; - c.anchor = GridBagConstraints.CENTER; - c.insets = i; - JLabel deleteHeaderLabel = new JLabel("Delete"); - flightPane.add(deleteHeaderLabel, c); - /* Add the flights to the GridBag */ AltosEepromItem item; int itemNumber = 1; @@ -163,23 +143,14 @@ public class AltosEepromSelect extends JDialog implements ActionListener { c.insets = i; flightPane.add(item.label, c); - /* Add a download checkbox for the flight */ + /* Add action checkbox for the flight */ c = new GridBagConstraints(); c.gridx = 1; c.gridy = itemNumber; c.fill = GridBagConstraints.NONE; c.weightx = 0.5; c.anchor = GridBagConstraints.CENTER; c.insets = i; - flightPane.add(item.download, c); - - /* Add a delete checkbox for the flight */ - c = new GridBagConstraints(); - c.gridx = 2; c.gridy = itemNumber; - c.fill = GridBagConstraints.NONE; - c.weightx = 0.5; - c.anchor = GridBagConstraints.CENTER; - c.insets = i; - flightPane.add(item.delete, c); + flightPane.add(item.action, c); itemNumber++; }