comparison gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultOutputMode.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultOutputMode.java@821a02bbfb4e
children 172338b1407f
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.client.shared.model;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.dive4elements.river.client.client.ui.CollectionView;
7 import org.dive4elements.river.client.client.ui.OutputTab;
8
9
10 /**
11 * The default implementation of an Output.
12 *
13 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
14 */
15 public class DefaultOutputMode implements OutputMode {
16
17 /** The name of this mode.*/
18 protected String name;
19
20 /** The description of this mode.*/
21 protected String description;
22
23 /** The mime-type of this mode.*/
24 protected String mimeType;
25
26 /** The type that this output mode represents.*/
27 protected String type;
28
29 /** The list of available facets of this export mode.*/
30 protected List<Facet> facets;
31
32
33 /** A convinience constructor.*/
34 public DefaultOutputMode() {
35 facets = new ArrayList<Facet>();
36 }
37
38
39 /**
40 * The default constructor.
41 *
42 * @param name The name of this mode.
43 * @param description The description of this mode.
44 * @param mimeType The mime-type of this mode.
45 */
46 public DefaultOutputMode(String name, String description, String mimeType) {
47 this.name = name;
48 this.description = description;
49 this.mimeType = mimeType;
50 }
51
52
53 public DefaultOutputMode(
54 String name,
55 String description,
56 String mimeType,
57 String type)
58 {
59 this(name, description, mimeType);
60
61 this.type = type;
62 }
63
64
65 public DefaultOutputMode(
66 String name,
67 String description,
68 String mimeType,
69 List<Facet> facets)
70 {
71 this(name, description, mimeType);
72 this.type = "";
73 this.facets = facets;
74 }
75
76
77 public String getName() {
78 return name;
79 }
80
81
82 public String getDescription() {
83 return description;
84 }
85
86
87 public String getMimeType() {
88 return mimeType;
89 }
90
91
92 public String getType() {
93 return type;
94 }
95
96
97 /**
98 * Adds a new facet to this export.
99 *
100 * @param facet The new facet.
101 */
102 public void addFacet(Facet facet) {
103 facets.add(facet);
104 }
105
106
107 /**
108 * Returns the number of facets supported by this export.
109 *
110 * @return the number of facets.
111 */
112 public int getFacetCount() {
113 return facets.size();
114 }
115
116
117 /**
118 * Returns the facet at a given position.
119 *
120 * @param idx The position of a facet.
121 *
122 * @return a facet.
123 */
124 public Facet getFacet(int idx) {
125 if (idx < getFacetCount()) {
126 return facets.get(idx);
127 }
128
129 return null;
130 }
131
132
133 public Facet getFacet(String name) {
134 for (Facet facet: facets) {
135 if (name.equals(facet.getName())) {
136 return facet;
137 }
138 }
139
140 return null;
141 }
142
143
144 public List<Facet> getFacets() {
145 return facets;
146 }
147
148
149 public OutputTab createOutputTab(String t, Collection c, CollectionView p) {
150 return null;
151 }
152 }
153 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org