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

Hide last authors
smmccraw 1.1 1 First of, it's handy to add a convenience method to your "page" component to define this "list" of objects:
2
Pascal Robert 3.1 3 {{code}}
smmccraw 1.1 4
Pascal Robert 3.1 5 protected void addObjectToPathComponents(Object anObject, String aPageName, Object aTitle) {
smmccraw 1.1 6
Pascal Robert 3.1 7 if ( anObject != null ) {
8 Map aMap = new HashMap();
smmccraw 1.1 9
Pascal Robert 3.1 10 aMap.put( Path.ObjectKey, anObject );
11 aMap.put( Path.PageNameKey, aPageName );
12 aMap.put( Path.TitleKey, aTitle );
smmccraw 1.1 13
Pascal Robert 3.1 14 this.pathComponents().add( aMap );
smmccraw 1.1 15
Pascal Robert 3.1 16 return;
17 }
smmccraw 1.1 18
Pascal Robert 3.1 19 throw new IllegalArgumentException ( "Page.addObjectWithPageNameAndTitleToPath: null object.");
20 }
smmccraw 1.1 21
Pascal Robert 3.1 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
smmccraw 1.1 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>
Pascal Robert 3.1 53
smmccraw 1.1 54 <webobject name = "IsNotMain">
55 <webobject name = "Components">
Pascal Robert 3.1 56 <webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "Component"></webobject>
smmccraw 1.1 57 </webobject>
Pascal Robert 3.1 58
59 <webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "LastComponent"></webobject>
smmccraw 1.1 60 </webobject>
Pascal Robert 5.1 61 {{/code}}
smmccraw 1.1 62
Pascal Robert 3.1 63 {{code}}
smmccraw 1.1 64
Pascal Robert 3.1 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 };
smmccraw 1.1 89
Pascal Robert 3.1 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 }; 
smmccraw 1.1 117
Pascal Robert 3.1 118
119 {{/code}}
120
smmccraw 1.1 121 That's all folks.