Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java @ 36:ad381cc47217
Format Code to max 80 Chars per Row
gnv/trunk@172 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 02 Oct 2009 08:54:13 +0000 |
parents | 0f4362d75e9e |
children | fccf90761825 |
comparison
equal
deleted
inserted
replaced
35:4405f31bbc30 | 36:ad381cc47217 |
---|---|
13 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticValue; | 13 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticValue; |
14 import de.intevation.gnv.artifactdatabase.objects.OutputMode; | 14 import de.intevation.gnv.artifactdatabase.objects.OutputMode; |
15 | 15 |
16 /** | 16 /** |
17 * @author Tim Englich <tim.englich@intevation.de> | 17 * @author Tim Englich <tim.englich@intevation.de> |
18 * | 18 * |
19 */ | 19 */ |
20 public class DefaultSessionModel implements SessionModel{ | 20 public class DefaultSessionModel implements SessionModel { |
21 | |
22 | 21 |
23 /** | 22 /** |
24 * the logger, used to log exceptions and additonaly information | 23 * the logger, used to log exceptions and additonaly information |
25 */ | 24 */ |
26 private static Logger log = Logger.getLogger(DefaultSessionModel.class); | 25 private static Logger log = Logger.getLogger(DefaultSessionModel.class); |
29 * The UID of this Class. | 28 * The UID of this Class. |
30 */ | 29 */ |
31 private static final long serialVersionUID = 3431484439985158311L; | 30 private static final long serialVersionUID = 3431484439985158311L; |
32 | 31 |
33 private Collection<ArtifactObject> artifactFactories = null; | 32 private Collection<ArtifactObject> artifactFactories = null; |
34 | 33 |
35 private ArtifactObject selectedArtifactFactory = null; | 34 private ArtifactObject selectedArtifactFactory = null; |
36 | 35 |
37 private ArtifactObject currentArtifact =null; | 36 private ArtifactObject currentArtifact = null; |
38 | 37 |
39 private DiagrammOptions diagrammOptions= null; | 38 private DiagrammOptions diagrammOptions = null; |
40 | 39 |
41 private Collection<ArtifactStatisticValue> statistics= null; | 40 private Collection<ArtifactStatisticValue> statistics = null; |
42 | |
43 | 41 |
44 /** | 42 /** |
45 * Constructor | 43 * Constructor |
46 */ | 44 */ |
47 public DefaultSessionModel() { | 45 public DefaultSessionModel() { |
50 | 48 |
51 /** | 49 /** |
52 * @see de.intevation.gnv.action.sessionmodel.SessionModel#selectArtifactFactory(java.lang.String) | 50 * @see de.intevation.gnv.action.sessionmodel.SessionModel#selectArtifactFactory(java.lang.String) |
53 */ | 51 */ |
54 public void selectArtifactFactory(String artiFactFactoryId) { | 52 public void selectArtifactFactory(String artiFactFactoryId) { |
55 Collection<ArtifactObject> artifactObjects = this.getArtifactFactories(); | 53 Collection<ArtifactObject> artifactObjects = this |
56 if (artifactObjects != null){ | 54 .getArtifactFactories(); |
55 if (artifactObjects != null) { | |
57 Iterator<ArtifactObject> unselect = artifactObjects.iterator(); | 56 Iterator<ArtifactObject> unselect = artifactObjects.iterator(); |
58 this.selectedArtifactFactory = null; | 57 this.selectedArtifactFactory = null; |
59 while (unselect.hasNext()){ | 58 while (unselect.hasNext()) { |
60 unselect.next().setSelected(false); | 59 unselect.next().setSelected(false); |
61 } | 60 } |
62 Iterator<ArtifactObject> it = artifactObjects.iterator(); | 61 Iterator<ArtifactObject> it = artifactObjects.iterator(); |
63 while (it.hasNext()){ | 62 while (it.hasNext()) { |
64 ArtifactObject obj = it.next(); | 63 ArtifactObject obj = it.next(); |
65 if(obj.getId().equals(artiFactFactoryId)){ | 64 if (obj.getId().equals(artiFactFactoryId)) { |
66 obj.setSelected(true); | 65 obj.setSelected(true); |
67 this.selectedArtifactFactory = obj; | 66 this.selectedArtifactFactory = obj; |
68 break; | 67 break; |
69 } | 68 } |
70 } | 69 } |
71 } | 70 } |
72 } | 71 } |
73 | 72 |
74 /** | 73 /** |
76 */ | 75 */ |
77 public void setArtifacteFactories( | 76 public void setArtifacteFactories( |
78 Collection<ArtifactObject> artifactFactories) { | 77 Collection<ArtifactObject> artifactFactories) { |
79 this.artifactFactories = artifactFactories; | 78 this.artifactFactories = artifactFactories; |
80 } | 79 } |
81 | 80 |
82 /** | 81 /** |
83 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getAttributeFactories() | 82 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getAttributeFactories() |
84 */ | 83 */ |
85 public Collection<ArtifactObject> getArtifactFactories() { | 84 public Collection<ArtifactObject> getArtifactFactories() { |
86 return this.artifactFactories; | 85 return this.artifactFactories; |
123 | 122 |
124 /** | 123 /** |
125 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getArtifactDescription() | 124 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getArtifactDescription() |
126 */ | 125 */ |
127 public ArtifactDescription getArtifactDescription() { | 126 public ArtifactDescription getArtifactDescription() { |
128 if (this.currentArtifact != null){ | 127 if (this.currentArtifact != null) { |
129 return (ArtifactDescription)this.currentArtifact; | 128 return (ArtifactDescription) this.currentArtifact; |
130 } | 129 } |
131 return null; | 130 return null; |
132 } | 131 } |
133 | 132 |
134 /** | 133 /** |
135 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getOutputMode(java.lang.String) | 134 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getOutputMode(java.lang.String) |
136 */ | 135 */ |
137 public OutputMode getOutputMode(String name) { | 136 public OutputMode getOutputMode(String name) { |
138 ArtifactDescription ad = this.getArtifactDescription(); | 137 ArtifactDescription ad = this.getArtifactDescription(); |
139 if (ad != null){ | 138 if (ad != null) { |
140 if (ad.getOutputModes() != null){ | 139 if (ad.getOutputModes() != null) { |
141 return ad.getOutputModes().get(name); | 140 return ad.getOutputModes().get(name); |
142 } | 141 } |
143 } | 142 } |
144 return null; | 143 return null; |
145 } | 144 } |
146 | 145 |
147 /** | 146 /** |
148 * @see de.intevation.gnv.action.sessionmodel.SessionModel#resetModel() | 147 * @see de.intevation.gnv.action.sessionmodel.SessionModel#resetModel() |
149 */ | 148 */ |
150 public void resetModel() { | 149 public void resetModel() { |
151 log.debug("DefaultSessionModel.resetModel"); | 150 log.debug("DefaultSessionModel.resetModel"); |
152 this.selectedArtifactFactory = null; | 151 this.selectedArtifactFactory = null; |
153 this.currentArtifact =null; | 152 this.currentArtifact = null; |
154 this.diagrammOptions= null; | 153 this.diagrammOptions = null; |
155 this.statistics = null; | 154 this.statistics = null; |
156 | 155 |
157 } | 156 } |
158 | 157 |
159 /** | 158 /** |
160 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getStatistics() | 159 * @see de.intevation.gnv.action.sessionmodel.SessionModel#getStatistics() |
161 */ | 160 */ |