KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > user > client > Element


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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   public boolean equals(Object JavaDoc other) {
45     if (other instanceof Element) {
46       return DOM.compare(this, (Element) other);
47     }
48
49     return super.equals(other);
50   }
51
52   /*
53    * (non-Javadoc)
54    *
55    * @see java.lang.Object#hashCode()
56    */

57   public int hashCode() {
58     return super.hashCode();
59   }
60
61   /*
62    * (non-Javadoc)
63    *
64    * @see java.lang.Object#toString()
65    */

66   public String JavaDoc toString() {
67     return DOM.toString(this);
68   };
69 }
70
Popular Tags