Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java @ 367:6431b7efe240
Cosmetics.
artifacts/trunk@3680 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 16 Jan 2012 08:58:36 +0000 |
parents | 1d11a0531242 |
children | 71ff234713a6 |
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 |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
104 /** |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
105 * 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
|
106 * ("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
|
107 * @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
|
108 */ |
357
1d11a0531242
Added artifact parameter to facets getDataProviderKeys.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
351
diff
changeset
|
109 public List getDataProviderKeys(Artifact artifact) { |
351
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
110 return null; |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
111 } |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
112 |
eb1136134d09
Prepare inter-facet pre-rendering communication ('blackboard') phase.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
322
diff
changeset
|
113 |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
114 /** 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 |
e5bc48dc3ec3
Facets can write its internal representation to XML using a toXML() method now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
283
diff
changeset
|
121 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
|
122 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
|
123 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
|
124 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
|
125 |
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 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
|
127 } |
367
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
128 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
129 |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
130 /** Create a string representation. */ |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
131 public String toString() { |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
132 return new StringBuilder("name = '") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
133 .append(name).append("', index = ") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
134 .append(index).append(", description = '") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
135 .append(description).append("'") |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
136 .toString(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
137 } |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
138 |
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 * Copies name, index and description of other facet. |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
142 */ |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
143 public void set(Facet other) { |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
144 index = other.getIndex(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
145 name = other.getName(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
146 description = other.getDescription(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
147 } |
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 /** Create a deep copy of this facet. */ |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
151 public Facet deepCopy() { |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
152 DefaultFacet copy = new DefaultFacet(); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
153 copy.set(this); |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
154 return copy; |
6431b7efe240
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
357
diff
changeset
|
155 } |
226
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 } |
41404961c804
Added support for facets - facets of output modes are read from configuration now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |