1 4 package com.openedit.web; 5 6 import java.util.ArrayList ; 7 import java.util.List ; 8 9 10 14 public class Crumb { 15 String fieldText; 16 String fieldPath; 17 Crumb fieldParent; 18 boolean fieldFinal; 19 public Crumb() 20 { 21 22 } 23 public Crumb getParent() { 24 return fieldParent; 25 } 26 public void setParent(Crumb inParent) 27 { 28 fieldParent = inParent; 40 } 41 public String getPath() { 42 return fieldPath; 43 } 44 public void setPath(String inPath) { 45 fieldPath = inPath; 46 } 47 public String getText() { 48 return fieldText; 49 } 50 public void setText(String inText) { 51 fieldText = inText; 52 } 53 String toLink() 54 { 55 if ( getText() == null ) 56 { 57 return ""; 58 } 59 return "<a HREF='" + getPath()+ "'>" + getText() + "</a>"; 60 } 61 public List getCrumbs() 62 { 63 List parents = new ArrayList (); 64 Crumb parent = this; 65 while(parent != null ) 66 { 67 parents.add(0, parent); 68 parent = parent.getParent(); 69 } 70 return parents; 71 } 72 public boolean isFinal() { 73 return fieldFinal; 74 } 75 public void setFinal(boolean inFinal) { 76 fieldFinal = inFinal; 77 } 78 79 public String toString() 80 { 81 if ( getParent() == null ) 82 { 83 return toLink(); 84 } 85 else 86 { 87 return getParent().toString() + " : " + toLink(); 88 } 89 } 90 } 91 | Popular Tags |