GWT Tk 0.2.3

asquare.gwt.tk.client.ui
Class GlassPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by asquare.gwt.tk.client.ui.CComplexPanel
                      extended by asquare.gwt.tk.client.ui.GlassPanel
All Implemented Interfaces:
ControllerSupport, EventListener, HasWidgets

public class GlassPanel
extends CComplexPanel

A panel which covers the entire viewport or document, whichever is larger. The GlassPanel prevents interaction with the document. Useful for modal dialogs and the "lightbox" effect. Window resizing logic is handled in a pluggable controller whose implementation varies by platform. When the GlassPanel is shown, a style name is applied to the body element; the style name is removed when the GlassPanel is hidden.

CSS Style Rules

CSS Example
 .tk-GlassPanel {
   background: black;
   opacity: 0.2;
   filter: alpha(opacity=20);
 }
 
This example uses a transparent PNG background to workaround a bug with Flash & transparency in Firefox/Mac:
 Java
 GlassPanel gp = new GlassPanel();
 Label content = new Label();
 content.setStyleName("Content");
 content.setSize("100%", "100%");
 gp.add(content);
 gp.show();
 
 CSS
 .tk-GlassPanel {
   filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Gray20.png', sizingMethod='scale');
 }
 .tk-GlassPanel .Content
   background: url('Gray20.png');
   filter: alpha(opacity=0);
 }
 
The filter rule applies transparency in IE.

See Also:
opacity on quirksmode, Filters for IE

Field Summary
static String DEFAULT_BODY_STYLENAME
           
 
Constructor Summary
GlassPanel()
          Creates a GlassPanel based on a div.
GlassPanel(Element element)
          Creates a GlassPanel based the specified element.
GlassPanel(Element element, String bodyStyleName)
          Creates a GlassPanel based the specified element.
GlassPanel(String bodyStyleName)
          Creates a GlassPanel based on a div.
 
Method Summary
 void add(Widget w)
           
protected  List createControllers()
          A factory method which gives subclasses the opportunity to override default controller creation.
 String getBodyStyleName()
          Gets the style name which will be applied to the body element while the GlassPanel is shown.
 void hide()
          Hides the GlassPanel by detaching it from the RootPanel.
 void setBodyStyleName(String bodyStyleName)
          Sets the style name which will be applied to the body element while the GlassPanel is shown.
 void show()
          Positions the GlassPanel, then makes it visible by appending it to the RootPanel.
 
Methods inherited from class asquare.gwt.tk.client.ui.CComplexPanel
addController, getController, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeController, setControllers, sinkEvents, unsinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, getChildren, insert, iterator, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, clear, disown
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BODY_STYLENAME

public static final String DEFAULT_BODY_STYLENAME
See Also:
Constant Field Values
Constructor Detail

GlassPanel

public GlassPanel()
Creates a GlassPanel based on a div.


GlassPanel

public GlassPanel(Element element)
Creates a GlassPanel based the specified element.


GlassPanel

public GlassPanel(String bodyStyleName)
Creates a GlassPanel based on a div. If not null, bodyStyleName will applied to the body element for the duration that the GlassPanel is visible.

Parameters:
bodyStyleName - a CSS class name, or null

GlassPanel

public GlassPanel(Element element,
                  String bodyStyleName)
Creates a GlassPanel based the specified element. If not null, bodyStyleName will applied to the body element for the duration that the GlassPanel is visible.

Parameters:
element - an element
bodyStyleName - a CSS class name, or null
Method Detail

createControllers

protected List createControllers()
Description copied from class: CComplexPanel
A factory method which gives subclasses the opportunity to override default controller creation.

Overrides:
createControllers in class CComplexPanel
Returns:
a List with 0 or more controllers, or null

getBodyStyleName

public String getBodyStyleName()
Gets the style name which will be applied to the body element while the GlassPanel is shown.

Returns:
a String or null

setBodyStyleName

public void setBodyStyleName(String bodyStyleName)
Sets the style name which will be applied to the body element while the GlassPanel is shown.

Parameters:
bodyStyleName - a CSS class name, or null

add

public void add(Widget w)
Specified by:
add in interface HasWidgets
Overrides:
add in class Panel

show

public void show()
Positions the GlassPanel, then makes it visible by appending it to the RootPanel.


hide

public void hide()
Hides the GlassPanel by detaching it from the RootPanel.


GWT Tk 0.2.3

© 2007 Mat Gessel