|
|||||||||||||||||||
Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
BasicValueModel.java | - | 100% | 100% | 100% |
|
1 |
/* |
|
2 |
* Angkor Web Framework |
|
3 |
* |
|
4 |
* Distributable under LGPL license. |
|
5 |
* See terms of license at gnu.org. |
|
6 |
*/ |
|
7 |
package com.tirsen.angkor.widget; |
|
8 |
|
|
9 |
import java.beans.PropertyEditor; |
|
10 |
import java.beans.PropertyEditorManager; |
|
11 |
|
|
12 |
/** |
|
13 |
* A simple value model that keeps track of the a value, the type of the value is determined based |
|
14 |
* on the value given when constructed. |
|
15 |
* |
|
16 |
* <!-- $Id: BasicValueModel.java,v 1.3 2002/10/07 19:49:20 tirsen Exp $ --> |
|
17 |
* |
|
18 |
* @author $Author: tirsen $ |
|
19 |
* @version $Revision: 1.3 $ |
|
20 |
*/ |
|
21 |
public class BasicValueModel extends AbstractValueModel |
|
22 |
{ |
|
23 |
private Object value = ""; |
|
24 |
|
|
25 | 3 |
public BasicValueModel(Object value) |
26 |
{ |
|
27 | 3 |
this.value = value; |
28 |
} |
|
29 |
|
|
30 | 20 |
public BasicValueModel() |
31 |
{ |
|
32 |
} |
|
33 |
|
|
34 | 25 |
public Object getValue() |
35 |
{ |
|
36 | 25 |
return value; |
37 |
} |
|
38 |
|
|
39 | 12 |
public void setValue(Object value) |
40 |
{ |
|
41 | 12 |
this.value = value; |
42 | 12 |
changed(); |
43 |
} |
|
44 |
|
|
45 | 8 |
public boolean isReadOnly() |
46 |
{ |
|
47 | 8 |
return false; |
48 |
} |
|
49 |
|
|
50 | 15 |
public Class getValueClass() |
51 |
{ |
|
52 | 15 |
return value.getClass(); |
53 |
} |
|
54 |
|
|
55 | 15 |
public PropertyEditor getPropertyEditor() |
56 |
{ |
|
57 | 15 |
return PropertyEditorManager.findEditor(getValueClass()); |
58 |
} |
|
59 |
} |
|
60 |
|
|