WebObjects/Web Applications/Development/Examples/Alphabetic List

An alphabetic list is simply a list that display its elements in, er, alphabetic order... There is also some pagination (not shown) when there is too many elements in one batch. The pagination is done alphabetically at runtime if necessary: eg A-D E-Z.

Here is the html:

  <webobject name = "HasData">
    <webobject name = "Table">
      <tr>
        <td align = "left" valign = "top" colspan = "3">
          <div class = "Line"></div>
          <webobject name = "ItemDescription"></webobject>
          <webobject name = "HasBatches">
            <span class = "Label"><small> | </small></span>
            <webobject name = "Batches">
              <webobject name = "IsCurrentBatch">
               <webobject name = "Batch"></webobject>
              </webobject>
              <webobject name = "IsNotCurrentBatch">
               <webobject name = "BatchLink"><webobject name = "Batch"></webobject></webobject>
              </webobject>
            </webobject>
          </webobject>
          <div class = "Line"></div><br>
        </td>
      </tr>
      <tr>
        <webobject name = "Columns">
          <td align = "left" valign = "top">
            <webobject name = "Rows">
              <webobject name = "HasHref">
                <webobject name = "HrefLink"><webobject name = "Prefix"></webobject><webobject name = "Suffix"></webobject></webobject>   
              </webobject>
              <webobject name = "HasNoHref">
                <webobject name = "Link"><webobject name = "Prefix"></webobject><webobject name = "Suffix"></webobject></webobject>   
              </webobject>
              <div class = "Space"></div>
            </webobject>
          </td>
        </webobject>
      </tr>
      <webobject name = "HasBatches">
        <tr>
          <td align = "left" valign ="top">
            <webobject name = "PreviousLink"><webobject name = "Previous"></webobject></webobject>
          </td>
          <td align = "left" valign = "top">
             
          </td>
          <td align = "right" valign ="top">
            <webobject name = "NextLink"><webobject name = "Next"></webobject></webobject>
          </td>
        </tr>
      </webobject>
    </webobject>
  </webobject>

And the wod:

 HasData: WOConditional{
   condition = hasData;
 };
 
 Table: WOGenericContainer{
   elementName = "table";
   border = "0";
   cellSpacing = "3";
   cellPadding = "0";
 };
 
 ItemDescription: SpanString{
   value = itemDescription;
   isSmall = true;
   class = "Label";
 };
 
 HasBatches: WOConditional{
   condition = hasBatches;
 };
 
 Batches: WORepetition{
   count = batchCount;
   index = batchIndex;
 };
 
 Batch: SpanString{
   value = batchLabel;
   isItalic = isCurrentBatch;
   isSmall = true;
   class = "Label";
 };
 
 IsCurrentBatch: WOConditional{
   condition = isCurrentBatch;
 };
 
 IsNotCurrentBatch: WOConditional{
   condition = isCurrentBatch;
   negate = true;
 };
 
 BatchLink: WOHyperlink{
   action = displayBatch;
 };
 
 Rows: WORepetition{
   count = rowCount;
   index = rowIndex;
 };
 
 Columns: WORepetition{
   count = columnCount;
   index = columnIndex;
 };
 
 Prefix: SpanString{
   value = prefix;
   isBold = shouldBreak;
   class = "Text";
 };
 
 Suffix: SpanString{
   value = suffix;
   class = "Text";
 };
 
 ShouldBreak: WOConditional{
   condition = shouldBreak;
 };
 
 Link: WOHyperlink{
   action = displayItem;
   title = altDescription;
 };
 
 HasHref: WOConditional{
   condition = hasHref;
 };
 
 HasNoHref: WOConditional{
   condition = hasHref;
   negate = true;
 };
 
 HrefLink: WOHyperlink{
   href = href;
   title = altDescription;
   target = "SZLink";
 };
 
 PreviousLink: WOHyperlink{
   action = displayPrevious;
 };
 
 Previous: SpanString{
   value = "<PREVIOUS";
   isSmall = true;
   class = "Label";
 };
 
 NextLink: WOHyperlink{
   action = displayNext;
 };
 
 Next: SpanString{
   value = "NEXT>";
   isSmall = true;
   class = "Label";
 };

As usual, the component implementation is left to the imagination of the reader.

Last modified on 11 May 2009, at 20:45