1 /*
2 * Copyright 2003 - 2013 The eFaps Team
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * Revision: $Rev$
17 * Last Changed: $Date$
18 * Last Changed By: $Author$
19 */
20
21 package org.efaps.admin.ui.field;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import org.efaps.util.cache.CacheReloadException;
27
28 /**
29 * TODO comment!
30 *
31 * @author The eFaps Team
32 * @version $Id$
33 */
34 public class FieldSet
35 extends Field
36 {
37 /**
38 * Needed for serialization.
39 */
40 private static final long serialVersionUID = 1L;
41
42 /**
43 * Order of this FieldSet.
44 */
45 private final List<String> order = new ArrayList<String>();
46
47 /**
48 * @param _id id of the field set
49 * @param _uuid UUID of the field set
50 * @param _name name of the field set
51 */
52 public FieldSet(final long _id,
53 final String _uuid,
54 final String _name)
55 {
56 super(_id, _uuid, _name);
57 }
58
59 /**
60 * Sets the property for this field set. This includes
61 * <ul>
62 * <li>{@link #order}</li>
63 * </ul>
64 *
65 * @param _name name / key of the property
66 * @param _value value of the property
67 * @throws CacheReloadException from called super property method
68 */
69 @Override
70 protected void setProperty(final String _name,
71 final String _value)
72 throws CacheReloadException
73 {
74 if ("Order".equals(_name)) {
75 final String[] values = _value.split("\\|");
76 for (final String value : values) {
77 this.order.add(value);
78 }
79 } else {
80 super.setProperty(_name, _value);
81 }
82 }
83
84 /**
85 * Getter method for the instance variable {@link #order}.
86 *
87 * @return value of instance variable {@link #order}
88 */
89 public List<String> getOrder()
90 {
91 return this.order;
92 }
93 }