Package bpntojava.controller

Source Code of bpntojava.controller.Controller

package bpntojava.controller;

import bpntojava.model.Model;
import bpntojava.model.bpndata.BPN;
import bpntojava.model.stafftable.Usable;
import bpntojava.view.View.View;
import java.util.LinkedList;
import javax.swing.table.DefaultTableModel;

/**
* Der Controller.
*
* @author mschuessler
*/
public class Controller {

    /**
     * BPN-Tool.
     */
    private BPN bpn;
    /**
     * Model.
     */
    private Model model;
    /**
     * View.
     */
    private View view;

    /**
     * Konstruktor.
     */
    public Controller() {
        view = new View(this);
        view.setGetTableButtonUsable(false);
    }

    /**
     * Daten aus BPN laden bzw aus einer Datei.
     */
    public void getBPNData() {
        bpn = new BPN();
        model = new Model(bpn, this);
        if (bpn.getAppUsable()) {
            model.go();
            bpn.closeApp();
            view.fillDates();
            view.setGetTableButtonUsable(true);
            view.setTitle(Constant.MAIN_TITLE + getCreated());
            view.setGetDataButtonUsable(false);
        } else {
            view.setInfo("BPN nicht erreichbar.");
        }
    }

    /**
     * Usables erhalten.
     *
     * @return Liste der Usables
     */
    public LinkedList<Usable> getUsables() {
        return model.getStaffTable().getUsables();
    }

    /**
     * Summe der Preise erhalten in Abhängigkeit.
     *
     * @param date Datum (MM.YYYY)
     * @param staff Mitarbeiter
     * @param article Artikel
     * @return Betrag
     */
    public float getData(String date, String staff, String article) {
        return model.getData(date, staff, article);
    }

    /**
     * Erstellungsdatum der Daten.
     *
     * @return Erstellungsdatum
     */
    public String getCreated() {
        return model.getCreated();
    }

    /**
     * Tabelle erhalten in Abhängigkeit vom Datum.
     *
     * @param date Datumsstring (MM.YYYY)
     * @return Tabelle
     */
    public DefaultTableModel getTable(String date) {
        return model.getTable(date);
    }

    /**
     * Verändert den Text des InfoLabels.
     *
     * @param value Text
     */
    public void setInfo(String value) {
        view.setInfo(value);
    }
}
TOP

Related Classes of bpntojava.controller.Controller

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.