|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
- package gui_adressverwaltung.Controller;
-
- import gui_adressverwaltung.Controller.Interface.CommandInterface;
- import gui_adressverwaltung.model.AdressverwaltungModel;
- import gui_adressverwaltung.view.Hauptfenster;
- import java.io.File;
- import java.io.IOException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.swing.JFileChooser;
-
- /**
- *
- * @author nobody
- */
- public class AdressenSpeichern implements CommandInterface
- {
- private AdressverwaltungModel model;
- private Hauptfenster view;
-
-
- public AdressenSpeichern(AdressverwaltungModel model, Hauptfenster view)
- {
- this.model = model;
- this.view = view;
- }
-
- /**
- * Führt den Befehl aus
- */
-
- @Override
- public void execute()
- {
- JFileChooser chooser = new JFileChooser();
- chooser.showSaveDialog(view);
- File file = chooser.getSelectedFile();
- try
- {
- model.datenSpeichern(file);
- view.getLblStatus().setText("Adressen wurden gespeichert");
- }
- catch(IOException ex)
- {
- Logger.getLogger(AdressenSpeichern.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
-
- /**
- * Nimmt den Befehl zurück
- */
-
- @Override
- public void undo()
- {
- }
-
- /**
- * Giubt zurück ob der Befehl rücknehmbar ist
- */
-
- @Override
- public boolean isUndoable()
- {
- return false;
- }
- }
|