01: /*
02: * Copyright 2006 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.user.client.ui;
17:
18: import com.google.gwt.user.client.DOM;
19:
20: /**
21: * A widget that wraps an IFRAME element, which can contain an arbitrary web
22: * site.
23: *
24: * <p>Note that if you are using {@link com.google.gwt.user.client.History}, any
25: * browser history items generated by the Frame will interleave with your
26: * application's history.</p>
27: *
28: * <h3>CSS Style Rules</h3>
29: * <ul class='css'>
30: * <li>.gwt-Frame { }</li>
31: * </ul>
32: *
33: * <p>
34: * <h3>Example</h3> {@example com.google.gwt.examples.FrameExample}
35: * </p>
36: */
37: public class Frame extends Widget {
38:
39: /**
40: * Creates an empty frame.
41: */
42: public Frame() {
43: setElement(DOM.createIFrame());
44: }
45:
46: /**
47: * Creates a frame that displays the resource at the specified URL.
48: *
49: * @param url the URL of the resource to be displayed
50: */
51: public Frame(String url) {
52: this ();
53: setUrl(url);
54: }
55:
56: /**
57: * Gets the URL of the frame's resource.
58: *
59: * @return the frame's URL
60: */
61: public String getUrl() {
62: return DOM.getElementProperty(getElement(), "src");
63: }
64:
65: /**
66: * Sets the URL of the resource to be displayed within the frame.
67: *
68: * @param url the frame's new URL
69: */
70: public void setUrl(String url) {
71: DOM.setElementProperty(getElement(), "src", url);
72: }
73: }
|