com.google.gwt.widgetideas.client
Class CollapsiblePanel

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.Composite
              extended by com.google.gwt.widgetideas.client.CollapsiblePanel
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesChangeEvents

public class CollapsiblePanel
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.user.client.ui.SourcesChangeEvents, com.google.gwt.user.client.ui.HasWidgets

CollapsiblePanel makes its contained contents collapsible. By default, the contents are fully expanded. When collapsed, the contents of the panel will be displayed only when the user mouse hovers over the hover bar, otherwise is will stay collapsed to the left. A change event is fired whenever the CollapsiblePanel switched between its expanded and collapsed states.

The default style name is gwt-CollapsiblePanel.

Planned enhancements: Allow panel to be collapsed in arbitrary direction.


Nested Class Summary
protected static class CollapsiblePanel.State
          Current CollapsiblePanel state.
static class CollapsiblePanel.Styles
          CollapsiblePanel styles.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
CollapsiblePanel()
          Constructor.
CollapsiblePanel(com.google.gwt.user.client.ui.Widget widget)
           
 
Method Summary
 void add(com.google.gwt.user.client.ui.Widget w)
           
 void addChangeListener(com.google.gwt.user.client.ui.ChangeListener listener)
           
protected  void becomeCollapsed()
          Display this panel in its collapsed state.
protected  void becomeExpanded()
          Display this panel in its expanded state.
 void clear()
           
 com.google.gwt.user.client.ui.Widget getContents()
           
protected  void hide()
           
 void hookupControlToggle(com.google.gwt.user.client.ui.ToggleButton button)
          Uses the given toggle button to control whether the panel is collapsed or not.
 void initContents(com.google.gwt.user.client.ui.Widget contents)
          Initialize the panel's contents.
 boolean isCollapsed()
          Is the panel currently in its collapsed state.
 java.util.Iterator<com.google.gwt.user.client.ui.Widget> iterator()
           
protected  void onLoad()
          This method is called immediately after a widget becomes attached to the browser's document.
 boolean remove(com.google.gwt.user.client.ui.Widget w)
           
 void removeChangeListener(com.google.gwt.user.client.ui.ChangeListener listener)
           
 void setHoverBarContents(com.google.gwt.user.client.ui.Widget bar)
          Sets the contents of the hover bar.
protected  void setPanelPos(int pos)
           
 void setWidth(java.lang.String width)
           
protected  void show()
           
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement, getWidget, initWidget, isAttached, onAttach, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, onBrowserEvent, onUnload, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollapsiblePanel

public CollapsiblePanel()
Constructor.


CollapsiblePanel

public CollapsiblePanel(com.google.gwt.user.client.ui.Widget widget)
Method Detail

add

public void add(com.google.gwt.user.client.ui.Widget w)
Specified by:
add in interface com.google.gwt.user.client.ui.HasWidgets

addChangeListener

public void addChangeListener(com.google.gwt.user.client.ui.ChangeListener listener)
Specified by:
addChangeListener in interface com.google.gwt.user.client.ui.SourcesChangeEvents

clear

public void clear()
Specified by:
clear in interface com.google.gwt.user.client.ui.HasWidgets

getContents

public com.google.gwt.user.client.ui.Widget getContents()

hookupControlToggle

public void hookupControlToggle(com.google.gwt.user.client.ui.ToggleButton button)
Uses the given toggle button to control whether the panel is collapsed or not.


initContents

public void initContents(com.google.gwt.user.client.ui.Widget contents)
Initialize the panel's contents.

Parameters:
contents - contents

isCollapsed

public boolean isCollapsed()
Is the panel currently in its collapsed state.


iterator

public java.util.Iterator<com.google.gwt.user.client.ui.Widget> iterator()
Specified by:
iterator in interface com.google.gwt.user.client.ui.HasWidgets

remove

public boolean remove(com.google.gwt.user.client.ui.Widget w)
Specified by:
remove in interface com.google.gwt.user.client.ui.HasWidgets

removeChangeListener

public void removeChangeListener(com.google.gwt.user.client.ui.ChangeListener listener)
Specified by:
removeChangeListener in interface com.google.gwt.user.client.ui.SourcesChangeEvents

setHoverBarContents

public void setHoverBarContents(com.google.gwt.user.client.ui.Widget bar)
Sets the contents of the hover bar.


setWidth

public void setWidth(java.lang.String width)
Overrides:
setWidth in class com.google.gwt.user.client.ui.UIObject

becomeCollapsed

protected void becomeCollapsed()
Display this panel in its collapsed state.


becomeExpanded

protected void becomeExpanded()
Display this panel in its expanded state.


hide

protected void hide()

onLoad

protected void onLoad()
This method is called immediately after a widget becomes attached to the browser's document.

Overrides:
onLoad in class com.google.gwt.user.client.ui.Widget

setPanelPos

protected void setPanelPos(int pos)

show

protected void show()