annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java @ 4205:0dd8963cec9c

Set also the width of the GaugeTree when resizing the GaugePanel GWT is no longer able to calculate and set the correct width of the GaugeTree since the GaugeTree is added via a Canvas wrapper. Therefore set the width manually when resizing the GaugeTree.
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 22 Oct 2012 15:33:16 +0200
parents 79a94c4171cb
children
rev   line source
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.artifacts.Artifact;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import de.intevation.artifacts.CallContext;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
6 import de.intevation.artifactdatabase.state.Facet;
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import de.intevation.flys.artifacts.FLYSArtifact;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 public class DataFacet
2122
81312f84689a Refactored to easier enjoy benefits of caching.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2121
diff changeset
13 extends BlackboardDataFacet
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 protected ComputeType type;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 protected String hash;
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
17 protected String stateId;
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
19
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
20 /** Trivial constructor. */
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
21 public DataFacet() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
22 }
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
23
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
24 /**
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
25 * Defaults to ADVANCE Compute type.
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
26 * @param name Name of the facet.
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
27 * @param description maybe localized description of the facet.
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
28 */
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 public DataFacet(String name, String description) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 this(name, description, ComputeType.ADVANCE);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32
2121
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
33
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 public DataFacet(String name, String description, ComputeType type) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 this(name, description, type, null);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
2121
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
38
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 public DataFacet(
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 String name,
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 705
diff changeset
41 String description,
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 ComputeType type,
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 String hash
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 ) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 super(name, description);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 this.type = type;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 this.hash = hash;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
50
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
51 public DataFacet(
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
52 String name,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
53 String description,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
54 ComputeType type,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
55 String hash,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
56 String stateId
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
57 ) {
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
58 super(name, description);
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
59 this.type = type;
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
60 this.hash = hash;
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
61 this.stateId = stateId;
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
62 }
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
63
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
64
2121
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
65 public DataFacet(
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
66 int index,
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
67 String name,
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
68 String description,
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
69 ComputeType type,
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
70 String hash,
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
71 String stateId
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
72 ) {
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
73 super(index, name, description);
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
74 this.type = type;
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
75 this.hash = hash;
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
76 this.stateId = stateId;
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
77 }
70ef5fdc7414 Cosmetics, added new DataFacet constructor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1160
diff changeset
78
2141
79a94c4171cb Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
79
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
80 /**
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
81 * Return computation result.
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
82 */
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
83 @Override
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 public Object getData(Artifact artifact, CallContext context) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 FLYSArtifact flys = (FLYSArtifact)artifact;
1070
b1ed0ec0236f Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
86 String theHash = (hash != null) ? hash : flys.hash();
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
87
1136
8da5f5a9ed3c Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1117
diff changeset
88 return (stateId != null && stateId.length() > 0)
1117
ea80e652f033 Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1070
diff changeset
89 ? flys.compute(context, theHash, stateId, type, false)
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
90 : flys.compute(context, theHash, type, false);
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 }
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
92
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
93
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
94 /**
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
95 * Return a deep copy.
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1136
diff changeset
96 */
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
97 @Override
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
98 public Facet deepCopy() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
99 DataFacet copy = new DataFacet();
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
100 copy.set(this);
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
101 copy.type = type;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
102 copy.hash = hash;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
103 copy.stateId = stateId;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
104 return copy;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 930
diff changeset
105 }
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org