001: // HtmlLink.java
002: // $Id: HtmlLink.java,v 1.8 2000/08/16 21:37:40 ylafon Exp $
003: // (c) COPYRIGHT MIT and INRIA, 1996.
004: // Please first read the full copyright statement in file COPYRIGHT.html
005:
006: package org.w3c.jigsaw.html;
007:
008: import org.w3c.www.mime.MimeType;
009:
010: /*
011: * The link element contained in the HEAD of an html document
012: */
013:
014: public class HtmlLink {
015: String href = null;
016: String rel = null;
017: String rev = null;
018: String title = null;
019: String type = null;
020:
021: /**
022: * genereate a String representation that can be
023: * append in a HTML document
024: */
025:
026: public String toString() {
027: return "<LINK"
028: + ((href != null) ? " HREF=\"" + href + "\"" : "")
029: + ((rel != null) ? " REL=\"" + rel + "\"" : "")
030: + ((rev != null) ? " REV=\"" + rel + "\"" : "")
031: + ((type != null) ? " type=\"" + type + "\"" : "")
032: + ((title != null) ? " TITLE=\"" + rel + "\"" : "")
033: + ">\n";
034: }
035:
036: /**
037: * Create a link with only REL and HREF part
038: * @param rel, String part of rel
039: * @param href, String form of an URL or relative URL
040: */
041:
042: public HtmlLink(String rel, String href) {
043: this .rel = rel;
044: this .href = href;
045: }
046:
047: /**
048: * Create a link with only REL, HREF, and type part
049: * @param rel, String part of rel
050: * @param href, String form of an URL or relative URL
051: * @param type, mimetype
052: */
053:
054: public HtmlLink(String rel, String href, MimeType type) {
055: this .rel = rel;
056: this .href = href;
057: this .type = type.toString();
058: }
059:
060: /**
061: * Create a link with only HREF part (not very useful)
062: * @param href, String form of an URL or relative URL
063: */
064:
065: public HtmlLink(String href) {
066: this .href = href;
067: }
068:
069: /**
070: * Create a link with only REL and HREF part
071: * @param rev, String definition of rev
072: * @param rel, String definition of rel
073: * @param href, String form of an URL or relative URL
074: */
075:
076: public HtmlLink(String rev, String rel, String href) {
077: this .rev = rev;
078: this .rel = rel;
079: this .href = href;
080: }
081:
082: /**
083: * Create a link with only REV, REL, HREF, and type part
084: * @param rev, String definition of rev
085: * @param rel, String part of rel
086: * @param href, String form of an URL or relative URL
087: * @param type, mimetype
088: */
089:
090: public HtmlLink(String rev, String rel, String href, MimeType type) {
091: this .rev = rev;
092: this .rel = rel;
093: this .href = href;
094: this .type = type.toString();
095: }
096:
097: /**
098: * Create a complete link
099: * @param rev, String definition of rev
100: * @param rel, String definition of rel
101: * @param href, String form of an URL or relative URL
102: * @param title, String title
103: */
104:
105: public HtmlLink(String rev, String rel, String href, String title) {
106: this .rev = rev;
107: this .rel = rel;
108: this .href = href;
109: this .title = title;
110: }
111:
112: /**
113: * Create a link with REV, REL, HREF, type and title
114: * @param rev, String definition of rev
115: * @param rel, String part of rel
116: * @param href, String form of an URL or relative URL
117: * @param type, mimetype
118: * @param title, String title
119: */
120:
121: public HtmlLink(String rev, String rel, String href, MimeType type,
122: String title) {
123: this.rev = rev;
124: this.rel = rel;
125: this.href = href;
126: this.type = type.toString();
127: this.title = title;
128: }
129: }
|