1 16 package com.google.gwt.user.client.ui; 17 18 import com.google.gwt.core.client.JavaScriptObject; 19 import com.google.gwt.user.client.DOM; 20 import com.google.gwt.user.client.Element; 21 22 27 public class NamedFrame extends Frame { 28 29 private static JavaScriptObject PATTERN_NAME; 32 33 static { 34 initStatics(); 35 } 36 37 private static native void initStatics() ; 40 41 46 private static native boolean isValidName(String name) ; 49 50 60 public NamedFrame(String name) { 61 if (name == null || !isValidName(name.trim())) { 62 throw new IllegalArgumentException ( 63 "expecting one or more non-whitespace chars with no '<', '>', or '&'"); 64 } 65 66 Element div = DOM.createDiv(); 69 DOM.setInnerHTML(div, "<iframe name='" + name + "'>"); 70 71 Element iframe = DOM.getFirstChild(div); 72 setElement(iframe); 73 } 74 75 80 public String getName() { 81 return DOM.getElementProperty(getElement(), "name"); 82 } 83 } 84 | Popular Tags |