1
2
3
4
5
6
7 package net.sf.tacos.components.dojo;
8
9 import org.apache.tapestry.IMarkupWriter;
10 import org.apache.tapestry.IRequestCycle;
11 import org.apache.tapestry.dojo.AbstractWidget;
12
13
14
15
16
17
18 public abstract class GenericWidget extends AbstractWidget{
19
20 public abstract boolean getIsContainer();
21 public abstract boolean getNeverDestroy();
22
23
24
25
26 public boolean getContainerState()
27 {
28 return getIsContainer();
29 }
30
31 public void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
32 {
33 if(!cycle.isRewinding() && !getNeverDestroy()) {
34 if (!cycle.getResponseBuilder().isDynamic()
35 || cycle.getResponseBuilder().explicitlyContains(this)) {
36 setDestroy(false);
37 } else
38 setDestroy(true);
39 }
40
41
42 if (!getContainerState()) {
43 if (cycle.getResponseBuilder().isDynamic()
44 && (!cycle.getResponseBuilder().explicitlyContains(this)
45 && !cycle.getResponseBuilder().contains(this))) {
46 return;
47 }
48 }
49
50 renderWidget(writer, cycle);
51 }
52
53
54 }