blob: ade052e022f57b9431a1ae1c68677e24c14dd969 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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);
}
}
|