1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package p3j.gui.misc;
17
18 import javax.swing.AbstractListModel;
19
20 import p3j.pppm.ProjectionModel;
21
22
23
24
25
26
27
28
29
30
31 public class SetTypesListModel extends AbstractListModel {
32
33
34 private static final long serialVersionUID = 8369935030761632549L;
35
36
37 private ProjectionModel projection;
38
39
40
41
42
43
44
45 public SetTypesListModel(ProjectionModel currentProjection) {
46 this.projection = currentProjection;
47 }
48
49 @Override
50 public Object getElementAt(int index) {
51 return this.projection.getSetType(index);
52 }
53
54 @Override
55 public int getSize() {
56 return this.projection.getNumOfSetTypes();
57 }
58
59
60
61
62
63
64
65 public void removeSetType(int index) {
66 this.projection.removeSetType(index);
67 this.fireContentsChanged(this, index, getSize() + 1);
68 }
69
70
71
72
73
74
75
76
77
78 public void addSetType(String name, String desc) {
79 int index = this.projection.getNumOfSetTypes();
80 this.projection.createSetType(name, desc);
81 this.fireContentsChanged(this, index, index + 1);
82 }
83
84
85
86
87
88
89
90 public void setTypeChanged(int stIndex) {
91 this.fireContentsChanged(this, stIndex, stIndex);
92 }
93
94 public ProjectionModel getProjection() {
95 return projection;
96 }
97
98 public void setProjection(ProjectionModel scenario) {
99 this.projection = scenario;
100 }
101
102 }