comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultOutputMode.java @ 270:d01b0d81b92a

Parse the facets of a Collection and distinguish between an ordinary OutputMode and an ExportMode (new). flys-client/trunk@1895 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 11 May 2011 09:11:40 +0000
parents c8e651530f34
children 8264b02091ef
comparison
equal deleted inserted replaced
269:eb3c16df59db 270:d01b0d81b92a
1 package de.intevation.flys.client.shared.model; 1 package de.intevation.flys.client.shared.model;
2
3 import java.util.ArrayList;
4 import java.util.List;
2 5
3 6
4 /** 7 /**
5 * The default implementation of an Output. 8 * The default implementation of an Output.
6 * 9 *
15 protected String description; 18 protected String description;
16 19
17 /** The mime-type of this mode.*/ 20 /** The mime-type of this mode.*/
18 protected String mimeType; 21 protected String mimeType;
19 22
23 /** The list of available facets of this export mode.*/
24 protected List<Facet> facets;
25
20 26
21 /** A convinience constructor.*/ 27 /** A convinience constructor.*/
22 public DefaultOutputMode() { 28 public DefaultOutputMode() {
29 facets = new ArrayList<Facet>();
23 } 30 }
24 31
25 32
26 /** 33 /**
27 * The default constructor. 34 * The default constructor.
35 this.description = description; 42 this.description = description;
36 this.mimeType = mimeType; 43 this.mimeType = mimeType;
37 } 44 }
38 45
39 46
47 public DefaultOutputMode(
48 String name,
49 String description,
50 String mimeType,
51 List<Facet> facets)
52 {
53 this(name, description, mimeType);
54 this.facets = facets;
55 }
56
57
40 public String getName() { 58 public String getName() {
41 return name; 59 return name;
42 } 60 }
43 61
44 62
48 66
49 67
50 public String getMimeType() { 68 public String getMimeType() {
51 return mimeType; 69 return mimeType;
52 } 70 }
71
72
73 /**
74 * Adds a new facet to this export.
75 *
76 * @param facet The new facet.
77 */
78 public void addFacet(Facet facet) {
79 facets.add(facet);
80 }
81
82
83 /**
84 * Returns the number of facets supported by this export.
85 *
86 * @return the number of facets.
87 */
88 public int getFacetCount() {
89 return facets.size();
90 }
91
92
93 /**
94 * Returns the facet at a given position.
95 *
96 * @param idx The position of a facet.
97 *
98 * @return a facet.
99 */
100 public Facet getFacet(int idx) {
101 if (idx < getFacetCount()) {
102 return facets.get(idx);
103 }
104
105 return null;
106 }
107
108
109 public Facet getFacet(String name) {
110 for (Facet facet: facets) {
111 if (name.equals(facet.getName())) {
112 return facet;
113 }
114 }
115
116 return null;
117 }
53 } 118 }
54 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org