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 org.efaps.util.cache.CacheReloadException;
24  
25  /**
26   * @author The eFaps Team
27   * @version $Id$
28   */
29  public class FieldGroup
30      extends Field
31  {
32      /**
33       * Needed for serialization.
34       */
35      private static final long serialVersionUID = 1L;
36  
37      /**
38       * Group Count if in a row / columnd must be shown more than one value. The
39       * default value is <code>-1</code> meaning no group count is set.
40       *
41       * @see #setGroupCount
42       * @see #getGroupCount
43       */
44      private int groupCount = -1;
45  
46      /**
47       *
48       * @param _id       id of the field group
49       * @param _uuid     UUID of the field group
50       * @param _name     name of the field group
51       */
52      public FieldGroup(final long _id,
53                        final String _uuid,
54                        final String _name)
55      {
56          super(_id, _uuid, _name);
57      }
58  
59      /**
60       * This is the setter method for the instance variable {@link #groupCount}.
61       *
62       * @return value of instance variable {@link #groupCount}
63       * @see #groupCount
64       * @see #setGroupCount
65       */
66      public int getGroupCount()
67      {
68          return this.groupCount;
69      }
70  
71      /**
72       * Sets the property for this field group. This includes
73       * <ul>
74       * <li>{@link #groupCount}</li>
75       * </ul>
76       *
77       * @param _name     name / key of the property
78       * @param _value    value of the property
79       * @throws CacheReloadException from called super property method
80       */
81      @Override
82      protected void setProperty(final String _name,
83                                 final String _value)
84          throws CacheReloadException
85      {
86          if ("GroupCount".equals(_name)) {
87              this.groupCount = Integer.parseInt(_value);
88          } else {
89              super.setProperty(_name, _value);
90          }
91      }
92  }