01: /*
02: * Copyright 2007 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;
17:
18: import com.google.gwt.core.client.JavaScriptObject;
19:
20: /**
21: * An opaque handle to a native DOM Element. An <code>Element</code> cannot be
22: * created directly. Instead, use the <code>Element</code> type when returning
23: * a native DOM element from JSNI methods. An <code>Element</code> passed back
24: * into JSNI becomes the original DOM element the <code>Element</code> was
25: * created from, and can be accessed in JavaScript code as expected. This is
26: * typically done by calling methods in the
27: * {@link com.google.gwt.user.client.DOM} class.
28: */
29: public final class Element extends JavaScriptObject {
30:
31: /**
32: * Not directly instantiable. Subclasses should also define a protected
33: * no-arg constructor to prevent client code from directly instantiating
34: * the class.
35: */
36: protected Element() {
37: }
38:
39: /*
40: * (non-Javadoc)
41: *
42: * @see java.lang.Object#equals(java.lang.Object)
43: */
44: @Override
45: public boolean equals(Object other) {
46: if (other instanceof Element) {
47: return DOM.compare(this , (Element) other);
48: }
49:
50: return super .equals(other);
51: }
52:
53: /*
54: * (non-Javadoc)
55: *
56: * @see java.lang.Object#hashCode()
57: */
58: @Override
59: public int hashCode() {
60: return super .hashCode();
61: }
62:
63: /*
64: * (non-Javadoc)
65: *
66: * @see java.lang.Object#toString()
67: */
68: @Override
69: public String toString() {
70: return DOM.toString(this);
71: }
72: }
|