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 super("a",null,null);
49 }
50
51 public CompositeComponentPropertyDescriptor(String propertyName)
52 throws IntrospectionException
53 {
54 super(propertyName, null, null);
55 }
56
57 public void readExternal(ObjectInput in) throws IOException,
58 ClassNotFoundException
59 {
60 setName((String) in.readObject());
61 setDisplayName((String) in.readObject());
62 setExpert(in.readBoolean());
63 setPreferred(in.readBoolean());
64 setShortDescription((String)in.readObject());
65
66 Map<String,Object> map = (Map) in.readObject();
67
68 for (Map.Entry<String, Object> entry : map.entrySet())
69 {
70 setValue(entry.getKey(), entry.getValue());
71 }
72 }
73
74 public void writeExternal(ObjectOutput out) throws IOException
75 {
76 out.writeObject(getName());
77 out.writeObject(getDisplayName());
78 out.writeBoolean(isExpert());
79 out.writeBoolean(isPreferred());
80 out.writeObject(getShortDescription());
81
82
83
84 Map<String,Object> map = new HashMap<String, Object>(6,1);
85
86 for (Enumeration<String> e = attributeNames(); e.hasMoreElements();)
87 {
88 String name = e.nextElement();
89 map.put(name, getValue(name));
90 }
91 out.writeObject(map);
92 }
93 }