1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.html; |
16 |
| |
17 |
| import org.apache.tapestry.BaseComponent; |
18 |
| import org.apache.tapestry.IMarkupWriter; |
19 |
| import org.apache.tapestry.IRequestCycle; |
20 |
| import org.apache.tapestry.bean.EvenOdd; |
21 |
| import org.apache.tapestry.util.exception.ExceptionDescription; |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| public abstract class ExceptionDisplay extends BaseComponent |
31 |
| { |
32 |
| public abstract ExceptionDescription[] getExceptions(); |
33 |
| |
34 |
| private ExceptionDescription _exception; |
35 |
| |
36 |
| private EvenOdd _evenOdd; |
37 |
| |
38 |
| public abstract int getIndex(); |
39 |
| |
40 |
| public abstract int getCount(); |
41 |
| |
42 |
| public abstract void setCount(int count); |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
48
| public void setException(ExceptionDescription value)
|
50 |
| { |
51 |
48
| _exception = value;
|
52 |
| |
53 |
48
| _evenOdd.setEven(true);
|
54 |
| } |
55 |
| |
56 |
178
| public ExceptionDescription getException()
|
57 |
| { |
58 |
178
| return _exception;
|
59 |
| } |
60 |
| |
61 |
34
| protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
|
62 |
| { |
63 |
34
| ExceptionDescription[] exceptions = getExceptions();
|
64 |
| |
65 |
34
| setCount(exceptions.length);
|
66 |
| |
67 |
34
| try
|
68 |
| { |
69 |
34
| _evenOdd = (EvenOdd) getBeans().getBean("evenOdd");
|
70 |
| |
71 |
34
| super.renderComponent(writer, cycle);
|
72 |
| } |
73 |
| finally |
74 |
| { |
75 |
34
| _exception = null;
|
76 |
34
| _evenOdd = null;
|
77 |
| } |
78 |
| } |
79 |
| |
80 |
96
| public boolean isLast()
|
81 |
| { |
82 |
96
| return getIndex() == (getCount() - 1);
|
83 |
| } |
84 |
| } |