1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.view.facelets.tag.composite; |
20 | |
|
21 | |
import java.beans.IntrospectionException; |
22 | |
import java.beans.PropertyDescriptor; |
23 | |
import java.io.Externalizable; |
24 | |
import java.io.IOException; |
25 | |
import java.io.ObjectInput; |
26 | |
import java.io.ObjectOutput; |
27 | |
import java.util.Enumeration; |
28 | |
import java.util.HashMap; |
29 | |
import java.util.Map; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public class CompositeComponentPropertyDescriptor extends PropertyDescriptor |
38 | |
implements Externalizable |
39 | |
{ |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
public CompositeComponentPropertyDescriptor() throws IntrospectionException |
47 | |
{ |
48 | 0 | super("a",null,null); |
49 | 0 | } |
50 | |
|
51 | |
public CompositeComponentPropertyDescriptor(String propertyName) |
52 | |
throws IntrospectionException |
53 | |
{ |
54 | 0 | super(propertyName, null, null); |
55 | 0 | } |
56 | |
|
57 | |
public void readExternal(ObjectInput in) throws IOException, |
58 | |
ClassNotFoundException |
59 | |
{ |
60 | 0 | setName((String) in.readObject()); |
61 | 0 | setDisplayName((String) in.readObject()); |
62 | 0 | setExpert(in.readBoolean()); |
63 | 0 | setPreferred(in.readBoolean()); |
64 | 0 | setShortDescription((String)in.readObject()); |
65 | |
|
66 | 0 | Map<String,Object> map = (Map) in.readObject(); |
67 | |
|
68 | 0 | for (Map.Entry<String, Object> entry : map.entrySet()) |
69 | |
{ |
70 | 0 | setValue(entry.getKey(), entry.getValue()); |
71 | 0 | } |
72 | 0 | } |
73 | |
|
74 | |
public void writeExternal(ObjectOutput out) throws IOException |
75 | |
{ |
76 | 0 | out.writeObject(getName()); |
77 | 0 | out.writeObject(getDisplayName()); |
78 | 0 | out.writeBoolean(isExpert()); |
79 | 0 | out.writeBoolean(isPreferred()); |
80 | 0 | out.writeObject(getShortDescription()); |
81 | |
|
82 | |
|
83 | |
|
84 | 0 | Map<String,Object> map = new HashMap<String, Object>(6,1); |
85 | |
|
86 | 0 | for (Enumeration<String> e = attributeNames(); e.hasMoreElements();) |
87 | |
{ |
88 | 0 | String name = e.nextElement(); |
89 | 0 | map.put(name, getValue(name)); |
90 | 0 | } |
91 | 0 | out.writeObject(map); |
92 | 0 | } |
93 | |
} |