1 22 23 package org.meshcms.taglib; 24 25 import java.io.*; 26 import java.util.*; 27 import org.meshcms.core.*; 28 import org.meshcms.util.*; 29 30 33 public final class Links extends AbstractTag { 34 private String separator = " "; 35 private String style; 36 private String target; 37 private String current; 38 private String pre; 39 private String post; 40 41 public void setSeparator(String separator) { 42 if (separator != null) { 43 this.separator = separator; 44 } 45 } 46 47 public void setStyle(String style) { 48 this.style = style; 49 } 50 51 public void setTarget(String target) { 52 this.target = target; 53 } 54 55 public void setPre(String pre) { 56 this.pre = pre; 57 } 58 59 public void setPost(String post) { 60 this.post = post; 61 } 62 63 public void writeTag() throws IOException { 64 List list = webSite.getSiteMap().getPagesInDirectory(pagePath, 65 Utils.isTrue(current)); 66 67 if (list != null) { 68 Writer w = getOut(); 69 PageInfo[] pages = (PageInfo[]) list.toArray(new PageInfo[list.size()]); 70 String [] outs = webSite.getLinkList(pages, request.getContextPath(), 71 target, style); 72 73 if (outs != null && outs.length > 0) { 74 if (pre != null) { 75 w.write(pre); 76 } 77 78 w.write(Utils.generateList(outs, separator)); 79 80 if (post != null) { 81 w.write(post); 82 } 83 } else { 84 w.write(" "); 85 } 86 } 87 } 88 89 public String getSeparator() { 90 return separator; 91 } 92 93 public String getStyle() { 94 return style; 95 } 96 97 public String getTarget() { 98 return target; 99 } 100 101 public String getCurrent() { 102 return current; 103 } 104 105 public void setCurrent(String current) { 106 this.current = current; 107 } 108 109 public String getPre() { 110 return pre; 111 } 112 113 public String getPost() { 114 return post; 115 } 116 } 117 | Popular Tags |