Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java @ 453:a2efc9d65a11 2.9.8
Doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 28 Dec 2012 13:32:32 +0100 |
parents | 71ff234713a6 |
children |
rev | line source |
---|---|
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.artifactdatabase.state; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
3 import java.util.List; |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
4 |
295
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
5 import org.w3c.dom.Document; |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
6 import org.w3c.dom.Element; |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
7 import org.w3c.dom.Node; |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
8 |
280
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
9 import de.intevation.artifacts.Artifact; |
295
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
10 import de.intevation.artifacts.ArtifactNamespaceContext; |
280
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
12 |
295
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
13 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
14 |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 /** |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * The default implementation of a Facet. |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 */ |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 public class DefaultFacet implements Facet { |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
23 /** The index of this facet. */ |
277
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
24 protected int index; |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
25 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
26 /** The name of this facet. */ |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 protected String name; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
29 /** The description of this facet. */ |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 protected String description; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
32 |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
33 /** Trivial, empty constructor. */ |
322
93a774fe2bb4
Added deepCopy() method to facets and state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
295
diff
changeset
|
34 public DefaultFacet() { |
93a774fe2bb4
Added deepCopy() method to facets and state data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
295
diff
changeset
|
35 } |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
37 |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 /** |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 * The default constructor to create new Facet objects. |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * @param name The name of this new facet. |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * @param description The description of this new facet. |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 */ |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public DefaultFacet(String name, String description) { |
277
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
45 this(0, name, description); |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
46 } |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
47 |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
48 |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
49 /** |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
50 * The default constructor to create new Facet objects. |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
51 * |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
52 * @param index The index of this new facet. |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
53 * @param name The name of this new facet. |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
54 * @param description The description of this new facet. |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
55 */ |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
56 public DefaultFacet(int index, String name, String description) { |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
57 this.index = index; |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 this.name = name; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 this.description = description; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
62 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
63 /** Get index. */ |
277
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
64 public int getIndex() { |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
65 return index; |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
66 } |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
67 |
0a579b71496b
Facets have indices now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
226
diff
changeset
|
68 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
69 /** Returns the name ('type'). */ |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 public String getName() { |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 return name; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
75 /** Returns the description (e.g. displayed in gui). */ |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 public String getDescription() { |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 return description; |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 } |
280
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
79 |
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
80 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
81 /** |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
82 * @return null |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
83 */ |
280
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
84 public Object getData(Artifact artifact, CallContext context) { |
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
85 return null; |
7fbe674d758a
Facets got a method that return its required data from the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
277
diff
changeset
|
86 } |
283
7c33cac15134
Added DefaultFacet.toString() method to help debugging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
280
diff
changeset
|
87 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
88 |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
89 /** |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
90 * (Do not) provide data. |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
91 * Override to allow other facets to access your data. |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
92 * @return always null. |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
93 */ |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
94 public Object provideBlackboardData( |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
95 Artifact artifact, |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
96 Object key, |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
97 Object param, |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
98 CallContext context |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
99 ) { |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
100 return null; |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
101 } |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
102 |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
103 |
378
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
104 /* |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
105 * Return list of keys (objects) for which this facet can provide data |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
106 * ("external parameterization"), for other facets, via blackboard. |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
107 * These are the keys that are independent from the current call (thus |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
108 * 'static'). |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
109 * @param artifact that this facet belongs to. |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
110 */ |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
111 public List getStaticDataProviderKeys(Artifact artifact) { |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
112 return null; |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
113 } |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
114 |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
115 /** |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
116 * Return list of keys (objects) for which this facet can provide data |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
117 * ("external parameterization"), for other facets, via blackboard. |
357
1d11a0531242
Added artifact parameter to facets getDataProviderKeys.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
351
diff
changeset
|
118 * @param artifact that this facet belongs to. |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
119 */ |
378
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
120 public List getDataProviderKeys(Artifact artifact, CallContext context) { |
71ff234713a6
Pass context when asking facets for keys to write on blackboard.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
367
diff
changeset
|
121 return getStaticDataProviderKeys(artifact); |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
122 } |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
123 |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
124 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
125 /** Create a xml represantation. */ |
295
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
126 public Node toXML(Document doc) { |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
127 ElementCreator ec = new ElementCreator( |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
128 doc, |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
129 ArtifactNamespaceContext.NAMESPACE_URI, |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
130 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
131 |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
132 Element facet = ec.create("facet"); |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
133 ec.addAttr(facet, "description", description, true); |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
134 ec.addAttr(facet, "name", name, true); |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
135 ec.addAttr(facet, "index", String.valueOf(index), true); |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
136 |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
137 return facet; |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
138 } |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
139 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
140 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
141 /** Create a string representation. */ |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
142 public String toString() { |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
143 return new StringBuilder("name = '") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
144 .append(name).append("', index = ") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
145 .append(index).append(", description = '") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
146 .append(description).append("'") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
147 .toString(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
148 } |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
149 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
150 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
151 /** |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
152 * Copies name, index and description of other facet. |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
153 */ |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
154 public void set(Facet other) { |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
155 index = other.getIndex(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
156 name = other.getName(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
157 description = other.getDescription(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
158 } |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
159 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
160 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
161 /** Create a deep copy of this facet. */ |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
162 public Facet deepCopy() { |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
163 DefaultFacet copy = new DefaultFacet(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
164 copy.set(this); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
165 return copy; |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
166 } |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |