1
|
|
package com.tirsen.angkor;
|
2
|
|
|
3
|
|
import java.io.IOException;
|
4
|
|
|
5
|
|
/*
|
6
|
|
* Angkor Web Framework
|
7
|
|
*
|
8
|
|
* Distributable under LGPL license.
|
9
|
|
* See terms of license at gnu.org.
|
10
|
|
*/
|
11
|
|
|
12
|
|
|
13
|
|
/**
|
14
|
|
* Refactor this a little bit.
|
15
|
|
* Maybe we need a ViewHolder that holds a named registered component from an application.
|
16
|
|
* We don't need this class though, it is only used internally within an application.
|
17
|
|
* <!-- $Id: ViewLink.java,v 1.4 2002/10/09 21:37:37 tirsen Exp $ -->
|
18
|
|
* <!-- $Author: tirsen $ -->
|
19
|
|
*
|
20
|
|
* @author Jon Tirs´n (tirsen@users.sourceforge.net)
|
21
|
|
* @version $Revision: 1.4 $
|
22
|
|
*/
|
23
|
|
public class ViewLink extends AbstractViewFactory implements View
|
24
|
|
{
|
25
|
|
private ViewFactory current;
|
26
|
|
private ViewFactory original;
|
27
|
|
|
28
|
2
|
public ViewLink(ViewFactory original)
|
29
|
|
{
|
30
|
2
|
this.original = original;
|
31
|
2
|
reset();
|
32
|
|
}
|
33
|
|
|
34
|
15
|
public ViewFactory getTarget()
|
35
|
|
{
|
36
|
15
|
return current;
|
37
|
|
}
|
38
|
|
|
39
|
2
|
public void relink(ViewFactory target)
|
40
|
|
{
|
41
|
2
|
this.current = target;
|
42
|
|
}
|
43
|
|
|
44
|
|
/**
|
45
|
|
* Resets the link to it's original binding.
|
46
|
|
*/
|
47
|
2
|
public void reset()
|
48
|
|
{
|
49
|
2
|
current = original;
|
50
|
|
}
|
51
|
|
|
52
|
5
|
public View getView()
|
53
|
|
{
|
54
|
5
|
return getTarget().getView();
|
55
|
|
}
|
56
|
|
|
57
|
0
|
public View getContainer()
|
58
|
|
{
|
59
|
0
|
return getView().getContainer();
|
60
|
|
}
|
61
|
|
|
62
|
1
|
public void setContainer(View container)
|
63
|
|
{
|
64
|
1
|
getView().setContainer(container);
|
65
|
|
}
|
66
|
|
|
67
|
0
|
public String uniqueId(RenderContext context)
|
68
|
|
{
|
69
|
0
|
return getView().uniqueId(context);
|
70
|
|
}
|
71
|
|
|
72
|
2
|
public void render(RenderContext context) throws IOException
|
73
|
|
{
|
74
|
2
|
getView().render(context);
|
75
|
|
}
|
76
|
|
|
77
|
0
|
public void parse(RenderContext context)
|
78
|
|
{
|
79
|
0
|
getView().parse(context);
|
80
|
|
}
|
81
|
|
|
82
|
0
|
public void setVisible(boolean visible)
|
83
|
|
{
|
84
|
0
|
getView().setVisible(visible);
|
85
|
|
}
|
86
|
|
|
87
|
2
|
public boolean isVisible()
|
88
|
|
{
|
89
|
2
|
return getView().isVisible();
|
90
|
|
}
|
91
|
|
}
|
92
|
|
|