diff options
| author | Keith Packard <keithp@keithp.com> | 2011-01-14 16:44:50 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-01-14 16:48:29 -0800 | 
| commit | 2d154be89246e111a36f7c2700effbb2c97da541 (patch) | |
| tree | 3bbd7cd45185b6c30d1b9fd5a8535cd4fc78e253 | |
| parent | b490455807d1c70c81785ed8931a07ab44e8e421 (diff) | |
altosui: Show dialog after successful delete or when no flights
Make sure the user always sees confirmation for flight log management.
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | altosui/AltosEepromManage.java | 29 | 
1 files changed, 26 insertions, 3 deletions
diff --git a/altosui/AltosEepromManage.java b/altosui/AltosEepromManage.java index b64ee525..2704f883 100644 --- a/altosui/AltosEepromManage.java +++ b/altosui/AltosEepromManage.java @@ -50,6 +50,20 @@ public class AltosEepromManage implements ActionListener {  		}  	} +	private String showDeletedFlights() { +		String	result = ""; + +		for (AltosEepromLog flight : flights) { +			if (flight.delete) { +				if (result.equals("")) +					result = String.format("%d", flight.flight); +				else +					result = String.format("%s, %d", result, flight.flight); +			} +		} +		return result; +	} +  	public void actionPerformed(ActionEvent e) {  		String	cmd = e.getActionCommand();  		boolean	success = e.getID() != 0; @@ -57,15 +71,19 @@ public class AltosEepromManage implements ActionListener {  		System.out.printf("Eeprom manager action %s %d\n", cmd, e.getID());  		if (cmd.equals("download")) {  			if (success) { -				System.out.printf("Download succeeded\n");  				if (any_delete)  					delete.start();  				else  					finish();  			}  		} else if (cmd.equals("delete")) { -			if (success) -				System.out.printf("Delete succeeded\n"); +			if (success) { +				JOptionPane.showMessageDialog(frame, +							      String.format("Flights erased: %s", +									    showDeletedFlights()), +							      serial_line.device.toShortString(), +							      JOptionPane.INFORMATION_MESSAGE); +			}  			finish();  		}  	} @@ -88,6 +106,11 @@ public class AltosEepromManage implements ActionListener {  				flights = new AltosEepromList(serial_line, remote);  				if (flights.size() == 0) { +					JOptionPane.showMessageDialog(frame, +								      String.format("No flights available on %d", +										    device.getSerial()), +								      serial_line.device.toShortString(), +						JOptionPane.INFORMATION_MESSAGE);  				} else {  					AltosEepromSelect	select = new AltosEepromSelect(frame, flights);  | 
