1 38 package com.gargoylesoftware.htmlunit; 39 40 41 49 public class TopLevelWindow implements WebWindow { 50 51 private String name_; 52 private Page enclosedPage_; 53 private WebClient webClient_; 54 private WebWindow opener_; 55 56 private Object scriptObject_; 57 58 59 64 public TopLevelWindow( final String name, final WebClient webClient ) { 65 Assert.notNull("name", name); 66 Assert.notNull("webClient", webClient); 67 68 name_ = name; 69 webClient_ = webClient; 70 71 webClient_.registerWebWindow(this); 72 } 73 74 75 80 public String getName() { 81 return name_; 82 } 83 84 85 90 public void setName(String name) { 91 name_ = name; 92 } 93 94 95 100 public Page getEnclosedPage() { 101 return enclosedPage_; 102 } 103 104 105 110 public void setEnclosedPage( final Page page ) { 111 enclosedPage_ = page; 112 } 113 114 115 121 public WebWindow getParentWindow() { 122 return this; 123 } 124 125 126 132 public WebWindow getTopWindow() { 133 return this; 134 } 135 136 137 141 public WebClient getWebClient() { 142 return webClient_; 143 } 144 145 146 150 public String toString() { 151 return "TopLevelWindow[name=\""+getName()+"\"]"; 152 } 153 154 155 161 public void setScriptObject( final Object scriptObject ) { 162 scriptObject_ = scriptObject; 163 } 164 165 166 171 public Object getScriptObject() { 172 return scriptObject_; 173 } 174 175 176 180 public void setOpener( final WebWindow opener ) { 181 opener_ = opener; 182 } 183 184 185 189 public WebWindow getOpener() { 190 return opener_; 191 } 192 193 196 public void close() { 197 getWebClient().deregisterWebWindow(this); 198 } 199 } 200 | Popular Tags |