1 16 19 20 package org.apache.pluto.portalImpl.aggregation.navigation; 21 22 import java.util.ArrayList ; 23 import java.util.Collection ; 24 import java.util.Iterator ; 25 26 import org.apache.pluto.util.StringUtils; 27 28 public class Navigation 29 { 30 31 private org.apache.pluto.portalImpl.om.page.Navigation navigation = null; 32 private org.apache.pluto.portalImpl.aggregation.navigation.Navigation parent = null; 33 private org.apache.pluto.portalImpl.aggregation.Fragment linkedFragment = null; 34 private Collection children = new ArrayList (); 35 36 public Navigation(org.apache.pluto.portalImpl.aggregation.navigation.Navigation parent, 37 org.apache.pluto.portalImpl.om.page.Navigation navigation) 38 { 39 this.parent = parent; 40 this.navigation = navigation; 41 42 if (this.parent != null) 43 { 44 this.parent.getChildren().add(this); 45 } 46 } 47 48 public boolean isRootNavigation() 49 { 50 return navigation == null; 51 } 52 53 public String getTitle() 54 { 55 if (isRootNavigation()) { 56 return null; 57 } else { 58 return navigation.getTitle(); 59 } 60 } 61 62 public String getDescription() 63 { 64 if (isRootNavigation()) { 65 return null; 66 } else { 67 return navigation.getDescription(); 68 } 69 } 70 71 public Navigation getParent() 72 { 73 return parent; 74 } 75 76 public Collection getChildren() 77 { 78 return children; 79 } 80 81 public org.apache.pluto.portalImpl.aggregation.Fragment getLinkedFragment() 82 { 83 return linkedFragment; 84 } 85 86 public void setLinkedFragment(org.apache.pluto.portalImpl.aggregation.Fragment linkedFragment) 87 { 88 this.linkedFragment = linkedFragment; 89 } 90 91 public String toString() 92 { 93 return toString(0); 94 } 95 96 public String toString(int indent) 97 { 98 StringBuffer buffer = new StringBuffer (200); 99 StringUtils.newLine(buffer,indent); 100 buffer.append(getClass().toString()); buffer.append(":"); 101 StringUtils.newLine(buffer,indent); 102 buffer.append("{"); 103 if (navigation != null) 104 { 105 buffer.append(((org.apache.pluto.portalImpl.om.page.impl.NavigationImpl)navigation).toString(indent)); 106 } 107 Iterator iterator = children.iterator(); 108 if (iterator.hasNext()) 109 { 110 StringUtils.newLine(buffer,indent); 111 buffer.append("Children:"); 112 } 113 while (iterator.hasNext()) 114 { 115 buffer.append(((Navigation)iterator.next()).toString(indent+2)); 116 } 117 StringUtils.newLine(buffer,indent); 118 buffer.append("}"); 119 return buffer.toString(); 120 } 121 122 } 123 | Popular Tags |