1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /*
- * 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 am
- */
- public class AdressenOeffnen implements CommandInterface
- {
- private AdressverwaltungModel model;
- private Hauptfenster view;
-
-
- /**
- *
- * @param model
- * @param view
- */
- public AdressenOeffnen(AdressverwaltungModel model, Hauptfenster view)
- {
- this.model = model;
- this.view = view;
- }
-
- /**
- * Führt den Befehl aus
- */
- @Override
- public void execute()
- {
- JFileChooser chooser = new JFileChooser();
- chooser.showOpenDialog(view);
- File file = chooser.getSelectedFile();
- try
- {
- model.datenLesen(file);
- view.getLblStatus().setText("Neue Datei geöffnet");
- }
- catch(IOException | ClassNotFoundException ex)
- {
- Logger.getLogger(AdressenOeffnen.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
-
- /**
- * Macht den Befehl rückgängig
- */
-
- @Override
- public void undo()
- {
- }
-
- /**
- * Gibt zurück ob die Aktion rücknehmbar ist
- */
-
- @Override
- public boolean isUndoable()
- {
- return false;
- }
- }
|