1 14 package org.wings.header; 15 16 import org.wings.Renderable; 17 import org.wings.SimpleURL; 18 import org.wings.URLResource; 19 import org.wings.io.Device; 20 21 import java.io.IOException ; 22 23 27 public class Link implements Renderable { 28 protected String rel = null; 29 protected String rev = null; 30 protected String type = null; 31 protected String target = null; 32 protected URLResource urlSource = null; 33 34 public Link(String rel, String rev, String type, 35 String target, URLResource urlSource) { 36 this.rel = rel; 37 this.rev = rev; 38 this.type = type; 39 this.target = target; 40 this.urlSource = urlSource; 41 } 42 43 public void setRel(String rel) { 44 this.rel = rel; 45 } 46 47 public String getRel() { return rel; } 48 49 public void setRev(String rev) { 50 this.rev = rev; 51 } 52 53 public String getRev() { return rev; } 54 55 public void setType(String type) { 56 this.type = type; 57 } 58 59 public String getType() { return type; } 60 61 public SimpleURL getURL() { return urlSource.getURL(); } 62 63 public void setTarget(String target) { 64 this.target = target; 65 } 66 67 public String getTarget() { return target; } 68 69 public void write(Device d) 70 throws IOException { 71 d.print("<link"); 72 if (rel != null) 73 d.print(" rel=\"" + rel + "\""); 74 if (rev != null) 75 d.print(" rev=\"" + rev + "\""); 76 if (type != null) 77 d.print(" type=\"" + type + "\""); 78 if (target != null) 79 d.print(" target=\"" + target + "\""); 80 81 if (urlSource != null && urlSource.getURL() != null) { 82 d.print(" HREF=\""); 83 urlSource.getURL().write(d); 84 d.print("\""); 85 } 86 d.print("/>"); 87 } 88 } 89 90 91 | Popular Tags |