Last modified by Pascal Robert on 2010/09/13 00:33

Show last authors
1 First of, it's handy to add a convenience method to your "page" component to define this "list" of objects:
2
3 {{code}}
4
5 protected void addObjectToPathComponents(Object anObject, String aPageName, Object aTitle) {
6
7 if ( anObject != null ) {
8 Map aMap = new HashMap();
9
10 aMap.put( Path.ObjectKey, anObject );
11 aMap.put( Path.PageNameKey, aPageName );
12 aMap.put( Path.TitleKey, aTitle );
13
14 this.pathComponents().add( aMap );
15
16 return;
17 }
18
19 throw new IllegalArgumentException ( "Page.addObjectWithPageNameAndTitleToPath: null object.");
20 }
21
22 {{/code}}
23
24 Now, in each concrete page you could initialize the path components:
25
26 {{code}}
27
28 protected void initPathComponents()
29 {
30 Envelope anEnvelope = this.value();
31 Date aDate = anEnvelope.creationDate();
32 List aList = anEnvelope.list();
33
34 this.addObjectToPathComponents( aDate, "Timeline", "TIMELINE" );
35 this.addObjectToPathComponents( aDate );
36
37 if ( aList != null )
38 {
39 this.addObjectToPathComponents( aList );
40 }
41
42 this.addObjectToPathComponents( anEnvelope );
43 }
44
45 {{/code}}
46
47 Finally, the path component itself could look like this:
48
49 {{code}}
50 <webobject name = "IsMain">
51 <webobject name = "MainLink"><webobject name = "MainLabel"></webobject></webobject>
52 </webobject>
53
54 <webobject name = "IsNotMain">
55 <webobject name = "Components">
56 <webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "Component"></webobject>
57 </webobject>
58
59 <webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "LastComponent"></webobject>
60 </webobject>
61 {{/code}}
62
63 {{code}}
64
65 Components: WORepetition
66 {
67 count = count;
68 index = index;
69 };
70 IsMain: WOConditional{
71 condition = isMain;
72 };
73 IsNotMain: WOConditional{
74 condition = isMain;
75 negate = true;
76 };
77 ainLink: WOHyperlink{
78 action = getMail;
79 title = "get new mail";
80 };
81 MainLabel: SpanString{
82 value = "get mail";
83 isSmall = true;
84 isUpperCase = true;
85 //isBold = true;
86 class = "Label";
87 length = 30;
88 };
89
90 HasPrefix: WOConditional{
91 condition = hasPrefix;
92 };
93 Prefix: WOImage{
94 src = prefixUrl;
95 border = 0;
96 align = "middle";
97 };
98 Component: Link{
99 value = component.object;
100 description = component.title;
101 altDescription = component.title;
102 value = component.object;
103 pageName = component.pageName;
104 isUpperCase = true;
105 isSmall = true;
106 //isBold = true;
107 class = "Label";
108 };
109 LastComponent: SpanString{
110 value = lastComponentTitle;
111 isSmall = true;
112 isUpperCase = true;
113 //isBold = true;
114 class = "Label";
115 length = 30;
116 }; 
117
118
119 {{/code}}
120
121 That's all folks.