1 21 24 package org.lobobrowser.html.domimpl; 25 26 import org.lobobrowser.html.style.*; 27 import org.mozilla.javascript.Function; 28 import org.w3c.dom.Document ; 29 import org.w3c.dom.html2.*; 30 31 public class HTMLBodyElementImpl extends HTMLAbstractUIElement implements 32 HTMLBodyElement { 33 public HTMLBodyElementImpl(String name) { 34 super(name); 35 } 36 37 void setOwnerDocument(Document value, boolean deep) { 38 super.setOwnerDocument(value, deep); 39 if(value instanceof HTMLDocument) { 40 ((HTMLDocument) value).setBody(this); 41 } 42 } 43 44 void setOwnerDocument(Document value) { 45 super.setOwnerDocument(value); 46 if(value instanceof HTMLDocument) { 47 ((HTMLDocument) value).setBody(this); 48 } 49 } 50 51 public String getALink() { 52 return this.getAttribute("alink"); 53 } 54 55 public void setALink(String aLink) { 56 this.setAttribute("alink", aLink); 57 } 58 59 public String getBackground() { 60 return this.getAttribute("background"); 61 } 62 63 public void setBackground(String background) { 64 this.setAttribute("background", background); 65 } 66 67 public String getBgColor() { 68 return this.getAttribute("bgcolor"); 69 } 70 71 public void setBgColor(String bgColor) { 72 this.setAttribute("bgcolor", bgColor); 73 } 74 75 public String getLink() { 76 return this.getAttribute("link"); 77 } 78 79 public void setLink(String link) { 80 this.setAttribute("link", link); 81 } 82 83 public String getText() { 84 return this.getAttribute("text"); 85 } 86 87 public void setText(String text) { 88 this.setAttribute("text", text); 89 } 90 91 public String getVLink() { 92 return this.getAttribute("vlink"); 93 } 94 95 public void setVLink(String vLink) { 96 this.setAttribute("vlink", vLink); 97 } 98 99 protected RenderState createRenderState(RenderState prevRenderState) { 100 return new BodyRenderState(prevRenderState, this); 101 } 102 103 public Function getOnload() { 104 Object document = this.document; 105 if(document instanceof HTMLDocumentImpl) { 106 return ((HTMLDocumentImpl) document).getOnloadHandler(); 107 } 108 else { 109 return null; 110 } 111 } 112 113 public void setOnload(Function onload) { 114 Object document = this.document; 115 if(document instanceof HTMLDocumentImpl) { 116 ((HTMLDocumentImpl) document).setOnloadHandler(onload); 119 } 120 } 121 122 protected void assignAttributeField(String normalName, String value) { 123 if("onload".equals(normalName)) { 124 Function onload = this.getEventFunction(null, normalName); 125 if(onload != null) { 126 this.setOnload(onload); 127 } 128 } 129 else { 130 super.assignAttributeField(normalName, value); 131 } 132 } 133 134 135 } 136 | Popular Tags |