Version 2.1 by smmccraw on 2007/07/08 09:45

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 {{panel}}
4
5 protected void addObjectToPathComponents(Object anObject, String aPageName, Object aTitle)
6 {
7 if ( anObject !=_null_)
8 ____{
9 ______Map__aMap_=_new_HashMap();
10 ______
11 ______aMap.put(_Path.ObjectKey,_anObject_);
12 ______aMap.put(_Path.PageNameKey,_aPageName_);
13 ______aMap.put(_Path.TitleKey,_aTitle_);
14 ______
15 ______this.pathComponents().add(_aMap_);
16 ______
17 ______return;
18 ____}
19 ____
20 ____throw_new_IllegalArgumentException_(_"Page.addObjectWithPageNameAndTitleToPath:_null_object.");
21 __}
22
23 {{/panel}}
24
25 Now,//in//each//concrete//page//you//could//initialize//the//path//components:
26
27 {{panel}}
28
29 __protected_void_initPathComponents()
30 __{
31 ____Envelope__anEnvelope_=_this.value();
32 ____Date____aDate_=_anEnvelope.creationDate();
33 ____List____aList_=_anEnvelope.list();
34 ____
35 ____this.addObjectToPathComponents(_aDate,_"Timeline",_"TIMELINE"_);
36 ____this.addObjectToPathComponents(_aDate_);
37 ____
38 ____if_(_aList_!= null )
39 {
40 this.addObjectToPathComponents( aList );
41 }
42
43 this.addObjectToPathComponents( anEnvelope );
44 }
45
46 {{/panel}}
47
48 Finally, the path component itself could look like this:
49
50 {{code}}
51
52 {panel}
53 <webobject name = "IsMain">
54 <webobject name = "MainLink"><webobject name = "MainLabel"></webobject></webobject>
55 </webobject>
56
57 <webobject name = "IsNotMain">
58 <webobject name = "Components">
59 <webobject name = "HasPrefix">&nbsp;<webobject name = "Prefix"></webobject>&nbsp;</webobject><webobject name = "Component"></webobject>
60 </webobject>
61
62 <webobject name = "HasPrefix">&nbsp;<webobject name = "Prefix"></webobject>&nbsp;</webobject><webobject name = "LastComponent"></webobject>
63 </webobject>
64 {panel}
65
66 {{/code}}
67
68 {{panel}}
69
70 Components: WORepetition
71 {
72 count = count;
73 index = index;
74 };
75 IsMain: WOConditional{
76 condition = isMain;
77 };
78 IsNotMain: WOConditional{
79 condition = isMain;
80 negate = true;
81 };
82 ainLink: WOHyperlink{
83 action = getMail;
84 title = "get new mail";
85 };
86 MainLabel: SpanString{
87 value = "get mail";
88 isSmall = true;
89 isUpperCase = true;
90 //isBold = true;
91 class = "Label";
92 length = 30;
93 };
94
95 HasPrefix: WOConditional{
96 condition = hasPrefix;
97 };
98 Prefix: WOImage{
99 src = prefixUrl;
100 border = 0;
101 align = "middle";
102 };
103 Component: Link{
104 value = component.object;
105 description = component.title;
106 altDescription = component.title;
107 value = component.object;
108 pageName = component.pageName;
109 isUpperCase = true;
110 isSmall = true;
111 //isBold = true;
112 class = "Label";
113 };
114 LastComponent: SpanString{
115 value = lastComponentTitle;
116 isSmall = true;
117 isUpperCase = true;
118 //isBold = true;
119 class = "Label";
120 length = 30;
121 };
122
123 {{/panel}}
124
125 That's all folks.
126
127 Category:WebObjects