1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.form; |
16 |
| |
17 |
| import org.apache.tapestry.IMarkupWriter; |
18 |
| import org.apache.tapestry.IRequestCycle; |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| public class RadioPropertySelectionRenderer implements IPropertySelectionRenderer |
29 |
| { |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
0
| public void beginRender(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle)
|
37 |
| { |
38 |
0
| writer.begin("table");
|
39 |
0
| writer.attribute("border", 0);
|
40 |
0
| writer.attribute("cellpadding", 0);
|
41 |
0
| writer.attribute("cellspacing", 2);
|
42 |
| } |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
0
| public void endRender(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle)
|
50 |
| { |
51 |
0
| writer.end();
|
52 |
| } |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
| |
59 |
| |
60 |
0
| public void renderOption(
|
61 |
| PropertySelection component, |
62 |
| IMarkupWriter writer, |
63 |
| IRequestCycle cycle, |
64 |
| IPropertySelectionModel model, |
65 |
| Object option, |
66 |
| int index, |
67 |
| boolean selected) |
68 |
| { |
69 |
0
| writer.begin("tr");
|
70 |
0
| writer.begin("td");
|
71 |
| |
72 |
0
| writer.beginEmpty("input");
|
73 |
0
| writer.attribute("type", "radio");
|
74 |
0
| writer.attribute("name", component.getName());
|
75 |
0
| writer.attribute("value", model.getValue(index));
|
76 |
| |
77 |
0
| if (component.isDisabled())
|
78 |
0
| writer.attribute("disabled", "disabled");
|
79 |
| |
80 |
0
| if (selected)
|
81 |
0
| writer.attribute("checked", "checked");
|
82 |
| |
83 |
0
| writer.end();
|
84 |
| |
85 |
0
| writer.println();
|
86 |
| |
87 |
0
| writer.begin("td");
|
88 |
0
| writer.print(model.getLabel(index));
|
89 |
0
| writer.end();
|
90 |
0
| writer.end();
|
91 |
| |
92 |
0
| writer.println();
|
93 |
| } |
94 |
| } |