Revision: 10301
Author: [email protected]
Date: Wed Jun 8 13:02:49 2011
Log: Introduces the HasVisibility characteristic interface, due to
popular
demand.
Review at http://gwt-code-reviews.appspot.com/1451813
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=10301
Added:
/trunk/user/src/com/google/gwt/user/client/ui/HasVisibility.java
Modified:
/trunk/user/src/com/google/gwt/user/client/ui/UIObject.java
=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/user/client/ui/HasVisibility.java Wed
Jun 8 13:02:49 2011
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
+ * use this file except in compliance with the License. You may obtain a
copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package com.google.gwt.user.client.ui;
+
+/**
+ * Implemented by objects that have the visibility trait.
+ */
+public interface HasVisibility {
+
+ /**
+ * Determines whether or not this object is visible. Note that this does
not
+ * necessarily take into account whether or not the receiver's parent is
+ * visible, or even if it is attached to the
+ * {@link com.google.gwt.dom.client.Document Document}. The default
+ * implementation of this trait in {@link UIObject} is based on the
value of a
+ * dom element's style object's display attribute.
+ *
+ * @return <code>true</code> if the object is visible
+ */
+ boolean isVisible();
+
+ /**
+ * Sets whether this object is visible.
+ *
+ * @param visible <code>true</code> to show the object,
<code>false</code> to
+ * hide it
+ */
+ void setVisible(boolean visible);
+
+}
=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/UIObject.java Mon Jun 6
04:09:34 2011
+++ /trunk/user/src/com/google/gwt/user/client/ui/UIObject.java Wed Jun 8
13:02:49 2011
@@ -123,7 +123,7 @@
*
* Style names can be space or comma separated.
*/
-public abstract class UIObject {
+public abstract class UIObject implements HasVisibility {
/**
* Stores a regular expression object to extract float values from the
@@ -582,11 +582,7 @@
return DOM.getElementProperty(getElement(), "title");
}
- /**
- * Determines whether or not this object is visible.
- *
- * @return <code>true</code> if the object is visible
- */
+ @Override
public boolean isVisible() {
return isVisible(getElement());
}
@@ -729,12 +725,7 @@
}
}
- /**
- * Sets whether this object is visible.
- *
- * @param visible <code>true</code> to show the object,
<code>false</code> to
- * hide it
- */
+ @Override
public void setVisible(boolean visible) {
setVisible(getElement(), visible);
}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors