View Javadoc
1   /**
2    * Copyright (C) 2007 Joern Krueger surething@users.sourceforge.net
3    * 
4    * This program is free software; you can redistribute
5    * it and/or modify it under the terms of the GNU General
6    * Public License version 2 as published by the Free Software
7    * Foundation.
8    *
9    * This program is distributed in the hope that it will be
10   * useful, but WITHOUT ANY WARRANTY; without even the implied
11   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12   * PURPOSE.  See the GNU General Public License for more
13   * details.
14   *
15   * You should have received a copy of the GNU General Public
16   * License along with this program; if not, write to the
17   * Free Software Foundation, Inc., 59 Temple Place,
18   * Suite 330, Boston, MA  02111-1307  USA
19   */
20  package de.surething.lda.locations;
21  
22  import java.util.SortedSet;
23  import java.util.TreeSet;
24  
25  import de.surething.lda.resources.Messages;
26  import de.surethingies.properties.Parameter;
27  import de.surethingies.properties.ParameterImpl;
28  import de.surethingies.properties.ValueType;
29  
30  public enum LocationSettings {
31  
32      DISPLAY_NAME(Messages.getString("Location.DisplayName"), "", true, ValueType.STRING), 
33      TELEPHONE(Messages.getString("Location.Telephone"), "", true, ValueType.STRING);
34  
35      public static final String GROUP = "location";
36  
37      private final Parameter param;
38  
39      private int order = 0;
40      
41      /**
42       * Initialize
43       */
44      private LocationSettings(
45              String displayName, 
46              String defaultValue, 
47              boolean isEditable, 
48              ValueType 
49              valueType) {
50  
51          param = new ParameterImpl(GROUP, this.name(), displayName, defaultValue, isEditable, valueType, order++);
52      }
53  
54      public Parameter param() {
55          return param;
56      }
57  
58      public static synchronized SortedSet<Parameter> params() {
59          SortedSet<Parameter> result = new TreeSet<Parameter>();
60  
61          for (LocationSettings config : values()) {
62              result.add(config.param);
63          }
64  
65          return result;
66      }
67  }