KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jsftest > DummyBean


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package jsftest;
18
19 import java.util.Properties;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23
24 /**
25  * Object that can be used as a backing bean for components in the zoo
26  *
27  * @author gavinc
28  */

29 public class DummyBean
30 {
31    private static Log logger = LogFactory.getLog(DummyBean.class);
32    
33    private String name;
34    private Properties properties;
35    
36    public DummyBean()
37    {
38       this.properties = new Properties();
39       this.properties.put("one", "This is 1");
40       this.properties.put("two", "This is 2");
41       this.properties.put("three", "This is 3");
42       this.properties.put("four", "This is 4");
43    }
44    
45    public Properties getProperties()
46    {
47       return this.properties;
48    }
49
50    /**
51     * @return Returns the name.
52     */

53    public String getName()
54    {
55       return name;
56    }
57    
58    /**
59     * @param name The name to set.
60     */

61    public void setName(String name)
62    {
63       this.name = name;
64    }
65    
66    /**
67     * @see java.lang.Object#toString()
68     */

69    public String toString()
70    {
71       StringBuilder builder = new StringBuilder(super.toString());
72       builder.append(" (name=").append(this.name);
73       builder.append(" properties=").append(this.properties).append(")");
74       return builder.toString();
75    }
76
77    /**
78     * Method to call on form submit buttons
79     */

80    public void submit()
81    {
82       if (logger.isDebugEnabled())
83          logger.debug("Submit called on DummyBean, state = " + toString());
84    }
85 }
86
Popular Tags