com.extjs.gxt.ui.client.widget
Class Window

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.Container<T>
                      extended by com.extjs.gxt.ui.client.widget.ScrollContainer<Component>
                          extended by com.extjs.gxt.ui.client.widget.LayoutContainer
                              extended by com.extjs.gxt.ui.client.widget.ContentPanel
                                  extended by com.extjs.gxt.ui.client.widget.Window
All Implemented Interfaces:
Observable, IconSupport, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
Dialog

public class Window
extends ContentPanel

A specialized content panel intended for use as an application window.

Code snippet:
   Window w = new Window();        
   w.setHeading("Product Information");
   w.setModal(true);
   w.setSize(600, 400);
   w.setMaximizable(true);
   w.setToolTip("The ExtGWT product page...");
   w.setUrl("http://www.extjs.com/products/gxt");
   w.show();
 
Events:
Activate : WindowEvent(window)
Fires after the window has been visually activated via setActive(boolean).
Deactivate : WindowEvent(window)
Fires after the window has been visually deactivated via setActive(boolean)
Minimize : WindowEvent(window)
Fires after the window has been minimized.
Maximize : WindowEvent(window)
Fires after the window has been maximized.
Restore : WindowEvent(window)
Fires after the window has been restored to its original size after being maximized.
Resize : WindowEvent(window)
Fires after the window has been resized.
BeforeHide : WindowEvent(window, buttonClicked)
Fires before the window is to be hidden.
Hide : WindowEvent(window, buttonClicked)
Fires after the window has been hidden.
Inherited Events:
ContentPanel BeforeExpand
ContentPanel Expand
ContentPanel BeforeCollapse
ContentPanel Collapse
ContentPanel BeforeClose
ContentPanel Close
LayoutContainer AfterLayout
ScrollContainer Scroll
Container BeforeAdd
Container Add
Container BeforeRemove
Container Remove
BoxComponent Move
BoxComponent Resize
Component Enable
Component Disable
Component BeforeHide
Component Hide
Component BeforeShow
Component Show
Component Attach
Component Detach
Component BeforeRender
Component Render
Component BrowserEvent
Component BeforeStateRestore
Component StateRestore
Component BeforeStateSave
Component SaveState


Nested Class Summary
 
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
Window()
          Creates a new window.
 
Method Summary
 void addWindowListener(WindowListener listener)
          Adds a listener to receive window events.
 void alignTo(com.google.gwt.user.client.Element elem, java.lang.String pos, int[] offsets)
          Aligns the window to the specified element.
 void center()
          Centers the window in the viewport.
 void close()
          Deprecated. 
 void close(Button b)
          Deprecated. 
 void focus()
          Focus the window.
 boolean getConstrain()
          Returns true if the window is constrained.
 com.google.gwt.user.client.Element getContainer()
          Returns the windows's container element.
 Draggable getDraggable()
          Returns the window's draggable instance.
 com.google.gwt.user.client.ui.Widget getFocusWidget()
          Returns the focus widget.
 int getInitialWidth()
          Returns the window's initial width.
 int getMinHeight()
          Returns the min height.
 int getMinWidth()
          Returns the min width.
 Resizable getResizable()
          Returns the window's resizable instance.
 void hide()
          Hide this component.
 void hide(Button buttonPressed)
          Hides the window.
 boolean isAutoHide()
          Returns true if auto hide is enabled.
 boolean isBlinkModal()
          Returns true if modal blinking is enabled.
 boolean isClosable()
          Returns true if the window is closable.
 boolean isDraggable()
          Returns true if the panel is draggable.
 boolean isMaximizable()
          Returns true if window miximizing is enabled.
 boolean isMaximized()
          Returns true if the window is maximized.
 boolean isMinimizable()
          Returns true if window minimizing is enabled.
 boolean isModal()
          Returns true if modal behavior is enabled.
 boolean isOnEsc()
          Returns true if the window is closed when the esc key is pressed.
 boolean isPlain()
          Returns true if the plain style is enabled.
 boolean isResizable()
          Returns true if window resizing is enabled.
 boolean layout()
          Executes the container's layout.
 void maximize()
          Fits the window within its current container and automatically replaces the 'maximize' tool button with the 'restore' tool button.
 void minimize()
          Placeholder method for minimizing the window.
 void removeWindowListener(WindowListener listener)
          Removes a previously added listener.
 void restore()
          Restores a maximized window back to its original size and position prior to being maximized and also replaces the 'restore' tool button with the 'maximize' tool button.
 void setActive(boolean active)
          Makes this the active window by showing its shadow, or deactivates it by hiding its shadow.
 void setAutoHide(boolean autoHide)
          True to hide the window when the user clicks outside of the window's bounds (defaults to false, pre-render).
 void setBlinkModal(boolean blinkModal)
          True to blink the window when the user clicks outside of the windows bounds (defaults to false).
 void setClosable(boolean closable)
          True to display the 'close' tool button and allow the user to close the window, false to hide the button and disallow closing the window (default to true).
 void setConstrain(boolean constrain)
          True to constrain the window to the Viewport, false to allow it to fall outside of the Viewport (defaults to true).
 void setContainer(com.google.gwt.user.client.Element container)
          Sets the container elemen to be used to size and position the window when maximized.
 void setDraggable(boolean draggable)
          True to enable dragging of this Panel (defaults to false).
 void setFocusWidget(com.google.gwt.user.client.ui.Widget focusWidget)
          Widget to be given focus when the window is focused).
 void setInitialWidth(int initialWidth)
          The width of the window if no width has been specified (defaults to 300).
 void setMaximizable(boolean maximizable)
          True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button and disallow maximizing the window (defaults to false).
 void setMinHeight(int minHeight)
          The minimum height in pixels allowed for this window (defaults to 100).
 void setMinimizable(boolean minimizable)
          True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button and disallow minimizing the window (defaults to false).
 void setMinWidth(int minWidth)
          The minimum width in pixels allowed for this window (defaults to 200).
 void setModal(boolean modal)
          True to make the window modal and mask everything behind it when displayed, false to display it without restricting access to other UI elements (defaults to false).
 void setOnEsc(boolean onEsc)
          Allows override of the built-in processing for the escape key.
 void setPagePosition(int x, int y)
          Sets the page XY position of the component.
 void setPlain(boolean plain)
          True to render the window body with a transparent background so that it will blend into the framing elements, false to add a lighter background color to visually highlight the body element and separate it more distinctly from the surrounding frame (defaults to false).
 void setPosition(int left, int top)
          Sets the left and top of the component.
 void setResizable(boolean resizable)
          True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to true).
 void setZIndex(int zIndex)
           
 void show()
          Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.
 void toBack()
          Sends this window to the back of (lower z-index than) any other visible windows.
 void toFront()
          Brings this window to the front of any other visible windows.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.ContentPanel
addButton, collapse, expand, getAnimCollapse, getBody, getBodyBorder, getBodyStyle, getBottomComponent, getButtonAlign, getButtonBar, getCollapseBtn, getCollapsible, getElement, getFrame, getFrameHeight, getFrameWidth, getHeader, getHeading, getIcon, getInnerHeight, getInnerWidth, getLayoutTarget, getMinButtonWidth, getTitleCollapse, getTitleText, getTopComponent, isCollapsed, isExpanded, isFooter, isHeaderVisible, isHideCollapseTool, onComponentEvent, setAnimCollapse, setBodyBorder, setBodyStyle, setBodyStyleName, setBottomComponent, setButtonAlign, setCollapsible, setExpanded, setFooter, setFrame, setHeaderVisible, setHeading, setHideCollapseTool, setIcon, setIconStyle, setInsetBorder, setMinButtonWidth, setTitleCollapse, setTopComponent, setUrl
 
Methods inherited from class com.extjs.gxt.ui.client.widget.LayoutContainer
add, add, addText, findComponent, getLayout, getWindowResizeDelay, insert, insert, isLayoutOnChange, isMonitorWindowResize, layout, remove, removeAll, setLayout, setLayoutData, setLayoutOnChange, setMonitorWindowResize, setWindowResizeDelay
 
Methods inherited from class com.extjs.gxt.ui.client.widget.ScrollContainer
addScrollListener, getHScrollPosition, getScrollMode, getVScrollPosition, removeScrollListener, scrollIntoView, setHScrollPosition, setScrollMode, setVScrollPosition
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Container
disable, enable, findItem, getItem, getItemByItemId, getItemCount, getItems, getWidget, indexOf, iterator, scrollIntoView
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPixelSize, setShadow, setShadowOffset, setShadowPosition, setShim, setSize, setSize, setWidth, setWidth, sync, syncSize
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, clearState, disableEvents, disableTextSelection, el, enableEvents, fireEvent, fireEvent, fireEvent, fly, getBaseStyle, getBorders, getContextMenu, getData, getElement, getHideMode, getId, getItemId, getListeners, getModel, getState, getStateId, getToolTip, hasListeners, hasListeners, hideToolTip, isDisabledEvents, isEnabled, isRendered, isStateful, isVisible, mask, mask, mask, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setBorders, setContextMenu, setData, setElement, setEnabled, setHideMode, setId, setIntStyleAttribute, setItemId, setStateful, setStateId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, sinkEvents, swallowEvent, swallowEvent, toString, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Window

public Window()
Creates a new window.

Method Detail

addWindowListener

public void addWindowListener(WindowListener listener)
Adds a listener to receive window events.

Parameters:
listener - the listener

alignTo

public void alignTo(com.google.gwt.user.client.Element elem,
                    java.lang.String pos,
                    int[] offsets)
Aligns the window to the specified element. Should only be called when the window is visible.

Parameters:
elem - the element to align to.
pos - the position to align to (see El.alignTo(com.google.gwt.user.client.Element, java.lang.String, int[]) for more details)
offsets - the offsets

center

public void center()
Centers the window in the viewport. Should only be called when the window is visible.


close

@Deprecated
public void close()
Deprecated. 


close

@Deprecated
public void close(Button b)
Deprecated. 


focus

public void focus()
Focus the window. If a focusWidget is set, it will receive focus, otherwise the window itself will receive focus.

Overrides:
focus in class Component

getConstrain

public boolean getConstrain()
Returns true if the window is constrained.

Returns:
the constrain state

getContainer

public com.google.gwt.user.client.Element getContainer()
Returns the windows's container element.

Returns:
the container element or null if not specified.

getDraggable

public Draggable getDraggable()
Returns the window's draggable instance.

Returns:
the draggable instance

getFocusWidget

public com.google.gwt.user.client.ui.Widget getFocusWidget()
Returns the focus widget.

Returns:
the focus widget

getInitialWidth

public int getInitialWidth()
Returns the window's initial width.

Returns:
the width

getMinHeight

public int getMinHeight()
Returns the min height.

Returns:
the min height

getMinWidth

public int getMinWidth()
Returns the min width.

Returns:
the min width

getResizable

public Resizable getResizable()
Returns the window's resizable instance.

Returns:
the resizable

hide

public void hide()
Description copied from class: Component
Hide this component. Fires the BeforeHide event before the component is hidden, the fires the Hide event after the component is hidden.

Overrides:
hide in class Component

hide

public void hide(Button buttonPressed)
Hides the window.

Parameters:
buttonPressed - the button that was pressed or null

isAutoHide

public boolean isAutoHide()
Returns true if auto hide is enabled.

Returns:
the auto hide state

isBlinkModal

public boolean isBlinkModal()
Returns true if modal blinking is enabled.

Returns:
the blink modal state

isClosable

public boolean isClosable()
Returns true if the window is closable.

Returns:
the closable state

isDraggable

public boolean isDraggable()
Returns true if the panel is draggable.

Returns:
the draggable state

isMaximizable

public boolean isMaximizable()
Returns true if window miximizing is enabled.

Returns:
the maximizable state

isMaximized

public boolean isMaximized()
Returns true if the window is maximized.

Returns:
the plain style state

isMinimizable

public boolean isMinimizable()
Returns true if window minimizing is enabled.

Returns:
the minimizable state

isModal

public boolean isModal()
Returns true if modal behavior is enabled.

Returns:
the modal state

isOnEsc

public boolean isOnEsc()
Returns true if the window is closed when the esc key is pressed.

Returns:
the on esc state

isPlain

public boolean isPlain()
Returns true if the plain style is enabled.

Returns:
the plain style state

isResizable

public boolean isResizable()
Returns true if window resizing is enabled.

Returns:
the resizable state

layout

public boolean layout()
Description copied from class: Container
Executes the container's layout. If a layout has not been set a FlowLayout will be used.

Overrides:
layout in class LayoutContainer
Returns:
true if layout was executed.

maximize

public void maximize()
Fits the window within its current container and automatically replaces the 'maximize' tool button with the 'restore' tool button.


minimize

public void minimize()
Placeholder method for minimizing the window. By default, this method simply fires the minimize event since the behavior of minimizing a window is application-specific. To implement custom minimize behavior, either the minimize event can be handled or this method can be overridden.


removeWindowListener

public void removeWindowListener(WindowListener listener)
Removes a previously added listener.

Parameters:
listener - the listener to remove

restore

public void restore()
Restores a maximized window back to its original size and position prior to being maximized and also replaces the 'restore' tool button with the 'maximize' tool button.


setActive

public void setActive(boolean active)
Makes this the active window by showing its shadow, or deactivates it by hiding its shadow. This method also fires the activate or deactivate event depending on which action occurred.


setAutoHide

public void setAutoHide(boolean autoHide)
True to hide the window when the user clicks outside of the window's bounds (defaults to false, pre-render).

Parameters:
autoHide - true for auto hide

setBlinkModal

public void setBlinkModal(boolean blinkModal)
True to blink the window when the user clicks outside of the windows bounds (defaults to false). Only applies window model = true.

Parameters:
blinkModal - true to blink

setClosable

public void setClosable(boolean closable)
True to display the 'close' tool button and allow the user to close the window, false to hide the button and disallow closing the window (default to true).

Parameters:
closable - true to enable closing

setConstrain

public void setConstrain(boolean constrain)
True to constrain the window to the Viewport, false to allow it to fall outside of the Viewport (defaults to true).

Parameters:
constrain - true to constrain, otherwise false

setContainer

public void setContainer(com.google.gwt.user.client.Element container)
Sets the container elemen to be used to size and position the window when maximized.

Parameters:
container - the container element

setDraggable

public void setDraggable(boolean draggable)
True to enable dragging of this Panel (defaults to false).

Parameters:
draggable - the draggable to state

setFocusWidget

public void setFocusWidget(com.google.gwt.user.client.ui.Widget focusWidget)
Widget to be given focus when the window is focused).

Parameters:
focusWidget - the focus widget

setInitialWidth

public void setInitialWidth(int initialWidth)
The width of the window if no width has been specified (defaults to 300).

Parameters:
initialWidth - the initial width

setMaximizable

public void setMaximizable(boolean maximizable)
True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button and disallow maximizing the window (defaults to false). Note that when a window is maximized, the tool button will automatically change to a 'restore' button with the appropriate behavior already built-in that will restore the window to its previous size.

Parameters:
maximizable - the maximizable state

setMinHeight

public void setMinHeight(int minHeight)
The minimum height in pixels allowed for this window (defaults to 100). Only applies when resizable = true.

Parameters:
minHeight - the min height

setMinimizable

public void setMinimizable(boolean minimizable)
True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button and disallow minimizing the window (defaults to false). Note that this button provides no implementation -- the behavior of minimizing a window is implementation-specific, so the minimize event must be handled and a custom minimize behavior implemented for this option to be useful.

Parameters:
minimizable - true to enabled minimizing

setMinWidth

public void setMinWidth(int minWidth)
The minimum width in pixels allowed for this window (defaults to 200). Only applies when resizable = true.

Parameters:
minWidth - the minimum height

setModal

public void setModal(boolean modal)
True to make the window modal and mask everything behind it when displayed, false to display it without restricting access to other UI elements (defaults to false).

Parameters:
modal - true for modal

setOnEsc

public void setOnEsc(boolean onEsc)
Allows override of the built-in processing for the escape key. Default action is to close the Window.

Parameters:
onEsc - true to close window on esc key press

setPagePosition

public void setPagePosition(int x,
                            int y)
Description copied from class: BoxComponent
Sets the page XY position of the component. To set the left and top instead, use BoxComponent.setPosition(int, int). This method fires the Move event.

Overrides:
setPagePosition in class BoxComponent
Parameters:
x - the x coordinate
y - the y coordinate

setPlain

public void setPlain(boolean plain)
True to render the window body with a transparent background so that it will blend into the framing elements, false to add a lighter background color to visually highlight the body element and separate it more distinctly from the surrounding frame (defaults to false).

Parameters:
plain - true to enable the plain style

setPosition

public void setPosition(int left,
                        int top)
Description copied from class: BoxComponent
Sets the left and top of the component. To set the page XY position instead, use BoxComponent.setPagePosition(int, int). This method fires the move event.

Overrides:
setPosition in class BoxComponent
Parameters:
left - the new left
top - the new top

setResizable

public void setResizable(boolean resizable)
True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to true).

Parameters:
resizable - true to enabled resizing

setZIndex

public void setZIndex(int zIndex)
Overrides:
setZIndex in class Component

show

public void show()
Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.

Overrides:
show in class Component

toBack

public void toBack()
Sends this window to the back of (lower z-index than) any other visible windows.


toFront

public void toFront()
Brings this window to the front of any other visible windows.