diff options
Diffstat (limited to 'Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper')
2 files changed, 125 insertions, 0 deletions
diff --git a/Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper/Auftrag.java b/Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper/Auftrag.java new file mode 100644 index 0000000..ade052e --- /dev/null +++ b/Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper/Auftrag.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package helper; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; +import javax.swing.AbstractListModel; + +/** + * Diese Klasse stellt einen Auftrag dar, der aus mehreren Auftragspositionen besteht + * @author jmueller + */ +public class Auftrag extends AbstractListModel implements Serializable { + private List<AuftragsPosition> positionen; + + + public Auftrag(){ + this.positionen = new LinkedList<AuftragsPosition>(); + } + + + /** + * gibt die Positionen zurück + * @return die Auftragspositionen + */ + public List<AuftragsPosition> getPositionen() { + return this.positionen; + } + + public int getSize() { + return this.positionen.size(); + } + + public Object getElementAt(int arg0) { + return this.positionen.get(arg0); + } + + + public void addPosition(int id, int anzahl){ + this.addPosition(new AuftragsPosition(id, anzahl)); + + } + + public void addPosition(AuftragsPosition position){ + this.positionen.add(position); + this.fireIntervalAdded(position, this.positionen.size()-1, this.positionen.size()-1); + } + + public void removePosition(AuftragsPosition position){ + this.positionen.remove(position); + this.fireIntervalRemoved(position, 0, this.positionen.size()); + } + + + public void positionChanged(AuftragsPosition position){ + int index = this.positionen.indexOf(position); + this.fireContentsChanged(position, index, index); + } + + + + + + +} diff --git a/Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper/AuftragsPosition.java b/Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper/AuftragsPosition.java new file mode 100644 index 0000000..fe276fa --- /dev/null +++ b/Master/Daten- und Systemintegration/Praktikum/DSI-Praktikum-1_ausgang/DSI1-ausgang/DSI-ejb/src/java/helper/AuftragsPosition.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package helper; + +import java.io.Serializable; + +/** + * Die Klasse stellt eine Auftragsposition dar + * @author jmueller + */ +public class AuftragsPosition implements Serializable { + private int id; + private int anzahl; + + public AuftragsPosition() { + this.id = 0; + this.anzahl = 0; + } + + public AuftragsPosition(int _id, int _anzahl){ + this.id = _id; + this.anzahl = _anzahl; + } + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getAnzahl() { + return anzahl; + } + + public void setAnzahl(int anzahl) { + this.anzahl = anzahl; + } + + + @Override + public String toString(){ + return "Id: " + this.id + ", Anzahl: " + this.anzahl; + } + + + + + + +} |
