1 /***
2 * Copyright (C) 2005 The Java Community
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
7 * version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19 package org.bejug.javacareers.project.properties;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23
24
25 /***
26 * This class binds the values defined in the application config to a specific javacareers Item class.
27 * It holds metadata for that class like the Clazz field to pass as a parameter to a searchCriteria object,
28 * an enabled/ disabled field to protect from unauthorized view and a message key to retrieve the I18nzed message
29 * from the messages resource bundle.
30 *
31 * @author : Peter Symoens (Last modified by $Author: shally $)
32 * @version $Revision: 1.5 $ - $Date: 2005/12/20 15:36:47 $:
33 */
34 public class ItemValueBinding {
35
36 /***
37 * The logger.
38 */
39 private static final Log LOG = LogFactory.getLog(ItemValueBinding.class);
40
41 /***
42 *
43 */
44 private Class clazz;
45
46 /***
47 *
48 */
49 private boolean enabled;
50
51 /***
52 * The message key from the resource bundle
53 */
54 private String messageKey;
55
56
57 /***
58 *
59 * @return the class object of this item.
60 */
61 public Class getClazz() {
62 return clazz;
63 }
64
65 /***
66 * Setter for the Spring container.
67 * @param className The string to get the class from.
68 */
69 public void setClazzName(String className) {
70 try{
71 this.clazz = Class.forName(className);
72 } catch (ClassNotFoundException e){
73 LOG.fatal(e.getMessage());
74 }
75 }
76
77 /***
78 *
79 * @param enabled the boolean to set
80 */
81 public void setEnabled(boolean enabled) {
82 this.enabled = enabled;
83 }
84
85 /***
86 *
87 * @return is this enabled enabled
88 */
89 public boolean isEnabled() {
90 return enabled;
91 }
92
93 /***
94 * Setter for the Spring container.
95 * @param enabled to enable
96 */
97 public void setEnabledString(String enabled) {
98 if(enabled.equalsIgnoreCase("true")){
99 this.enabled = true;
100 }
101 else{
102 this.enabled = false;
103 }
104 }
105
106 /***
107 *
108 * @return the messageKey.
109 */
110 public String getMessageKey() {
111 return messageKey;
112 }
113
114 /***
115 *
116 * @param messageKey The messageKey to set.
117 */
118 public void setMessageKey(String messageKey) {
119 this.messageKey = messageKey;
120 }
121
122
123 }
124
125 /***
126 * $Log: ItemValueBinding.java,v $
127 * Revision 1.5 2005/12/20 15:36:47 shally
128 * CheckStyle and PMD changes.
129 *
130 * Revision 1.4 2005/08/30 14:05:15 psong09
131 * added javadoc
132 *
133 * Revision 1.3 2005/08/30 13:07:48 psong09
134 * renamed author: psong09
135 *
136 * Revision 1.2 2005/08/29 12:45:02 psong09
137 * moved spinner actionListener to ItemAction
138 *
139 * Revision 1.1 2005/08/24 12:32:13 psong09
140 * Added spinner component and renamed commentAction
141 *
142 */