Child pages
  • Development-Examples-Path Inspector

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

First of, it's handy to add a convenience method to your "page" component to define this "list" of objects:

Panel
Wiki Markup
Code Block

  protected void addObjectToPathComponents(Object anObject, String aPageName, Object aTitle)
 {

   
if ( anObject !=
_
 null
_) ____{ ______Map__aMap_=_new_
 ) {
     Map  aMap = 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_(_

   throw new IllegalArgumentException ( "Page.addObjectWithPageNameAndTitleToPath:
_
 null
_
 object.");
__
 }

Now, _ in _ each _ concrete _ page _ you _ could _ initialize _ the _ path _ components:

__protected_void_
Panel
Wiki Markup
Code Block

protected void initPathComponents()
__
 {
____Envelope__anEnvelope_=_
   Envelope  anEnvelope = this.value();
____Date____aDate_=_
   Date    aDate = anEnvelope.creationDate();
____List____aList_=_
   List    aList = anEnvelope.list();
____ ____

   this.addObjectToPathComponents(
_
 aDate,
_
 "Timeline",
_
 "TIMELINE"
_
 );
____
   this.addObjectToPathComponents(
_
 aDate
_
 );
____ ____if_(_aList_

   if ( aList != null )
   
{
     this.addObjectToPathComponents( aList );
   }

   this.addObjectToPathComponents( anEnvelope );
 
}

Finally, the path component itself could look like this:

Code Block
{panel}
  <webobject name = "IsMain">
    <webobject name = "MainLink"><webobject name = "MainLabel"></webobject></webobject>
  </webobject>
  
  <webobject name = "IsNotMain">
    <webobject name = "Components">
      <webobject name = "HasPrefix">&nbsp; <webobject name = "Prefix"></webobject>&nbsp; </webobject><webobject name = "Component"></webobject>
    </webobject>
  
    <webobject name = "HasPrefix">&nbsp; <webobject name = "Prefix"></webobject>&nbsp; </webobject><webobject name = "LastComponent"></webobject>
  </webobject>
{panel}
Panel
Wiki Markup
Code Block

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