Version 4.1 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
51 <webobject name = "IsMain">
52 <webobject name = "MainLink"><webobject name = "MainLabel"></webobject></webobject>
53 </webobject>
54
55 <webobject name = "IsNotMain">
56 <webobject name = "Components">
57 <webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "Component"></webobject>
58 </webobject>
59
60 <webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "LastComponent"></webobject>
61 </webobject>
62
63 {{/code}}
64
65 {{code}}
66
67 Components: WORepetition
68 {
69 count = count;
70 index = index;
71 };
72 IsMain: WOConditional{
73 condition = isMain;
74 };
75 IsNotMain: WOConditional{
76 condition = isMain;
77 negate = true;
78 };
79 ainLink: WOHyperlink{
80 action = getMail;
81 title = "get new mail";
82 };
83 MainLabel: SpanString{
84 value = "get mail";
85 isSmall = true;
86 isUpperCase = true;
87 //isBold = true;
88 class = "Label";
89 length = 30;
90 };
91
92 HasPrefix: WOConditional{
93 condition = hasPrefix;
94 };
95 Prefix: WOImage{
96 src = prefixUrl;
97 border = 0;
98 align = "middle";
99 };
100 Component: Link{
101 value = component.object;
102 description = component.title;
103 altDescription = component.title;
104 value = component.object;
105 pageName = component.pageName;
106 isUpperCase = true;
107 isSmall = true;
108 //isBold = true;
109 class = "Label";
110 };
111 LastComponent: SpanString{
112 value = lastComponentTitle;
113 isSmall = true;
114 isUpperCase = true;
115 //isBold = true;
116 class = "Label";
117 length = 30;
118 }; 
119
120
121 {{/code}}
122
123 That's all folks.