Programming__WebObjects-Web Applications-Development-Examples-Path Inspector
First of, it's handy to add a convenience method to your "page" component to define this "list" of objects:
protected void addObjectToPathComponents(Object anObject, String aPageName, Object aTitle)
{
if ( anObject !=_null_)
{
MapaMap_=_new_HashMap();
aMap.put(_Path.ObjectKey,_anObject_);
aMap.put(_Path.PageNameKey,_aPageName_);
aMap.put(_Path.TitleKey,_aTitle_);
this.pathComponents().add(_aMap_);
return;
}
throw_new_IllegalArgumentException_(_"Page.addObjectWithPageNameAndTitleToPath:_null_object.");
}
Now,ineachconcretepageyoucouldinitializethepathcomponents:
protected_void_initPathComponents()
{
EnvelopeanEnvelope_=_this.value();
DateaDate_=_anEnvelope.creationDate();
ListaList_=_anEnvelope.list();
this.addObjectToPathComponents(_aDate,_"Timeline",_"TIMELINE"_);
this.addObjectToPathComponents(_aDate_);
if_(_aList_!= null )
{
this.addObjectToPathComponents( aList );
}
this.addObjectToPathComponents( anEnvelope );
}
Finally, the path component itself could look like this:
{panel}
<webobject name = "IsMain">
<webobject name = "MainLink"><webobject name = "MainLabel"></webobject></webobject>
</webobject>
<webobject name = "IsNotMain">
<webobject name = "Components">
<webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "Component"></webobject>
</webobject>
<webobject name = "HasPrefix"> <webobject name = "Prefix"></webobject> </webobject><webobject name = "LastComponent"></webobject>
</webobject>
{panel}
Components: WORepetition
{
count = count;
index = index;
};
IsMain: WOConditional{
condition = isMain;
};
IsNotMain: WOConditional{
condition = isMain;
negate = true;
};
ainLink: WOHyperlink{
action = getMail;
title = "get new mail";
};
MainLabel: SpanString{
value = "get mail";
isSmall = true;
isUpperCase = true;
isBold = true;
class = "Label";
length = 30;
};
HasPrefix: WOConditional{
condition = hasPrefix;
};
Prefix: WOImage{
src = prefixUrl;
border = 0;
align = "middle";
};
Component: Link{
value = component.object;
description = component.title;
altDescription = component.title;
value = component.object;
pageName = component.pageName;
isUpperCase = true;
isSmall = true;
isBold = true;
class = "Label";
};
LastComponent: SpanString{
value = lastComponentTitle;
isSmall = true;
isUpperCase = true;
isBold = true;
class = "Label";
length = 30;
};
That's all folks.
Category:WebObjects