com.google.gwt.widgetideas.client
Class ResizableWidgetCollection

java.lang.Object
  extended by com.google.gwt.widgetideas.client.ResizableWidgetCollection
All Implemented Interfaces:
com.google.gwt.user.client.WindowResizeListener, java.util.EventListener

public class ResizableWidgetCollection
extends java.lang.Object
implements com.google.gwt.user.client.WindowResizeListener

A collection of ResizableWidget that periodically checks the outer dimensions of a widget and redraws it as necessary. Every ResizableWidgetCollection uses a timer, so consider the cost when adding one. Typically, a ResizableWidgetCollection is only needed if you expect your widgets to resize based on window resizing or other events. Fixed sized Widgets do not need to be added to a ResizableWidgetCollection as they cannot be resized.


Constructor Summary
  ResizableWidgetCollection()
          Create a ResizableWidget.
  ResizableWidgetCollection(boolean resizeCheckingEnabled)
          Constructor.
  ResizableWidgetCollection(int resizeCheckDelay)
          Constructor.
protected ResizableWidgetCollection(int resizeCheckDelay, boolean resizeCheckingEnabled)
          Constructor.
 
Method Summary
 void add(ResizableWidget widget)
          Add a resizable widget to the collection.
 void checkWidgetSize()
          Check to see if any Widgets have been resized and call their handlers appropriately.
static ResizableWidgetCollection get()
          Get the globally accessible ResizableWidgetCollection.
 int getResizeCheckDelay()
          Get the delay between resize checks in milliseconds.
 boolean isResizeCheckingEnabled()
          Check whether or not resize checking is enabled.
 void onWindowResized(int width, int height)
          Called when the browser window is resized.
 void remove(ResizableWidget widget)
          Remove a ResizableWidget from the collection.
 void setResizeCheckDelay(int resizeCheckDelay)
          Set the delay between resize checks in milliseconds.
 void setResizeCheckingEnabled(boolean enabled)
          Set whether or not resize checking is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResizableWidgetCollection

public ResizableWidgetCollection()
Create a ResizableWidget.


ResizableWidgetCollection

public ResizableWidgetCollection(boolean resizeCheckingEnabled)
Constructor.

Parameters:
resizeCheckingEnabled - false to disable resize checking

ResizableWidgetCollection

public ResizableWidgetCollection(int resizeCheckDelay)
Constructor.

Parameters:
resizeCheckDelay - the delay between checks in milliseconds

ResizableWidgetCollection

protected ResizableWidgetCollection(int resizeCheckDelay,
                                    boolean resizeCheckingEnabled)
Constructor.

Method Detail

get

public static ResizableWidgetCollection get()
Get the globally accessible ResizableWidgetCollection. In most cases, the global collection can be used for all ResizableWidgets.

Returns:
the global ResizableWidgetCollection

add

public void add(ResizableWidget widget)
Add a resizable widget to the collection.

Parameters:
widget - the resizable widget to add

checkWidgetSize

public void checkWidgetSize()
Check to see if any Widgets have been resized and call their handlers appropriately.


getResizeCheckDelay

public int getResizeCheckDelay()
Get the delay between resize checks in milliseconds.

Returns:
the resize check delay

isResizeCheckingEnabled

public boolean isResizeCheckingEnabled()
Check whether or not resize checking is enabled.

Returns:
true is resize checking is enabled

onWindowResized

public void onWindowResized(int width,
                            int height)
Called when the browser window is resized.

Specified by:
onWindowResized in interface com.google.gwt.user.client.WindowResizeListener
Parameters:
width - the width of the window's client area.
height - the height of the window's client area.

remove

public void remove(ResizableWidget widget)
Remove a ResizableWidget from the collection.

Parameters:
widget - the widget to remove

setResizeCheckDelay

public void setResizeCheckDelay(int resizeCheckDelay)
Set the delay between resize checks in milliseconds.

Parameters:
resizeCheckDelay - the new delay

setResizeCheckingEnabled

public void setResizeCheckingEnabled(boolean enabled)
Set whether or not resize checking is enabled. If disabled, elements will still be resized on window events, but the timer will not check their dimensions periodically.

Parameters:
enabled - true to enable the resize checking timer