com.sencha.gxt.widget.core.client
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.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.widget.core.client.container.Container
                  extended by com.sencha.gxt.widget.core.client.container.ResizeContainer
                      extended by com.sencha.gxt.widget.core.client.container.SimpleContainer
                          extended by com.sencha.gxt.widget.core.client.ContentPanel
                              extended by com.sencha.gxt.widget.core.client.Window
All Implemented Interfaces:
HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, AcceptsOneWidget, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, ProvidesResize, RequiresResize, Collapsible, HasLayout, ActivateEvent.HasActivateHandlers<Window>, AddEvent.HasAddHandlers, BeforeAddEvent.HasBeforeAddHandlers, BeforeCollapseEvent.HasBeforeCollapseHandlers, BeforeExpandEvent.HasBeforeExpandHandlers, BeforeHideEvent.HasBeforeHideHandlers, BeforeRemoveEvent.HasBeforeRemoveHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, CollapseEvent.HasCollapseHandlers, ContainerHandler.HasContainerHandlers, DeactivateEvent.HasDeactivateHandlers<Window>, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, ExpandEvent.HasExpandHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MaximizeEvent.HasMaximizeHandlers, MinimizeEvent.HasMinimizeHandlers, MoveEvent.HasMoveHandlers, RemoveEvent.HasRemoveHandlers, RestoreEvent.HasRestoreHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasItemId, Iterable<Widget>
Direct Known Subclasses:
Dialog

public class Window
extends ContentPanel
implements ActivateEvent.HasActivateHandlers<Window>, DeactivateEvent.HasDeactivateHandlers<Window>, MaximizeEvent.HasMaximizeHandlers, MinimizeEvent.HasMinimizeHandlers, RestoreEvent.HasRestoreHandlers

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

Code snippet:

    Window w = new Window();
    w.setHeadingText("Product Information");
    w.setModal(true);
    w.setPixelSize(600, 400);
    w.setMaximizable(true);
    w.setToolTip("The Ext GWT product page...");
    w.setWidget(new Frame("http://www.sencha.com/products/gxt"));
    w.show();
 


Nested Class Summary
static interface Window.WindowAppearance
           
static interface Window.WindowMessages
           
 
Nested classes/interfaces inherited from class com.sencha.gxt.widget.core.client.ContentPanel
ContentPanel.ContentPanelAppearance, ContentPanel.ContentPanelMessages, ContentPanel.PanelHeaderAppearance
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Window()
          Creates a new window with the default appearance.
Window(Window.WindowAppearance appearance)
          Creates a new window with the specified appearance.
 
Method Summary
 HandlerRegistration addActivateHandler(ActivateEvent.ActivateHandler<Window> handler)
          Adds a ActivateEvent handler.
 HandlerRegistration addDeactivateHandler(DeactivateEvent.DeactivateHandler<Window> handler)
          Adds a DeactivateEvent handler.
 HandlerRegistration addMaximizeHandler(MaximizeEvent.MaximizeHandler handler)
          Adds a MaximizeEvent handler.
 HandlerRegistration addMinimizeHandler(MinimizeEvent.MinimizeHandler handler)
          Adds a MinimizeEvent handler.
 HandlerRegistration addRestoreHandler(RestoreEvent.RestoreHandler handler)
          Adds a RestoreEvent.RestoreHandler handler for RestoreEvent events.
 void alignTo(Element elem, Style.AnchorAlignment alignment, int[] offsets)
          Aligns the window to the specified element.
 void center()
          Centers the window in the viewport.
 void focus()
          Focus the window.
 boolean getConstrain()
          Returns true if the window is constrained.
 Element getContainer()
          Returns the windows's container element.
 Draggable getDraggable()
          Returns the window's draggable instance.
 Widget getFocusWidget()
          Returns the focus widget.
 TextButton getHideButton()
          Returns the button the was clicked to initiate the hide.
 int getMinHeight()
          Returns the minimum height.
 int getMinWidth()
          Returns the minimum width.
 Resizable getResizable()
          Returns the window's resizable instance.
 void hide()
          Hide this widget.
 void hide(TextButton 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 maximizing 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 isResizable()
          Returns true if window resizing is enabled.
 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 onBrowserEvent(Event event)
           
 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 XDOM.getViewportSize(), false to allow it to fall outside of the Viewport (defaults to true).
 void setContainer(Element container)
          Sets the container element 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(Widget focusWidget)
          Widget to be given focus when the window is focused).
 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 widget.
 void setPosition(int left, int top)
          Sets the left and top of the widget.
 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 setWindowMessages(Window.WindowMessages windowMessages)
          Sets the window messages.
 void setZIndex(int zIndex)
          Sets the z-index for the window.
 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.sencha.gxt.widget.core.client.ContentPanel
addBeforeCollapseHandler, addBeforeExpandHandler, addButton, addCollapseHandler, addExpandHandler, addTool, collapse, expand, getAnimationDuration, getBody, getButtonAlign, getButtonBar, getHeader, getHTML, getMessages, getMinButtonWidth, getText, isAnimCollapse, isCollapsed, isCollapsible, isExpanded, isHideCollapseTool, isTitleCollapse, setAnimationDuration, setAnimCollapse, setBodyBorder, setBodyStyle, setBodyStyleName, setButtonAlign, setCollapsible, setExpanded, setHeaderVisible, setHeadingHtml, setHeadingHtml, setHeadingText, setHideCollapseTool, setMessages, setMinButtonWidth, setTitleCollapse
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.SimpleContainer
add, add, getWidget, isResize, setResize, setWidget, setWidget
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.ResizeContainer
forceLayout, isLayoutRunning, isOrWasLayoutRunning, onResize
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.Container
add, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, clear, disable, enable, findWidget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, remove, remove, remove
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disableEvents, enableEvents, fireEvent, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPixelSize, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, 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 with the default appearance.


Window

public Window(Window.WindowAppearance appearance)
Creates a new window with the specified appearance.

Parameters:
appearance - the window appearance
Method Detail

addActivateHandler

public HandlerRegistration addActivateHandler(ActivateEvent.ActivateHandler<Window> handler)
Description copied from interface: ActivateEvent.HasActivateHandlers
Adds a ActivateEvent handler.

Specified by:
addActivateHandler in interface ActivateEvent.HasActivateHandlers<Window>
Parameters:
handler - the handler
Returns:
the registration for the event

addDeactivateHandler

public HandlerRegistration addDeactivateHandler(DeactivateEvent.DeactivateHandler<Window> handler)
Description copied from interface: DeactivateEvent.HasDeactivateHandlers
Adds a DeactivateEvent handler.

Specified by:
addDeactivateHandler in interface DeactivateEvent.HasDeactivateHandlers<Window>
Parameters:
handler - the handler
Returns:
the registration for the event

addMaximizeHandler

public HandlerRegistration addMaximizeHandler(MaximizeEvent.MaximizeHandler handler)
Description copied from interface: MaximizeEvent.HasMaximizeHandlers
Adds a MaximizeEvent handler.

Specified by:
addMaximizeHandler in interface MaximizeEvent.HasMaximizeHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addMinimizeHandler

public HandlerRegistration addMinimizeHandler(MinimizeEvent.MinimizeHandler handler)
Description copied from interface: MinimizeEvent.HasMinimizeHandlers
Adds a MinimizeEvent handler.

Specified by:
addMinimizeHandler in interface MinimizeEvent.HasMinimizeHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addRestoreHandler

public HandlerRegistration addRestoreHandler(RestoreEvent.RestoreHandler handler)
Description copied from interface: RestoreEvent.HasRestoreHandlers
Adds a RestoreEvent.RestoreHandler handler for RestoreEvent events.

Specified by:
addRestoreHandler in interface RestoreEvent.HasRestoreHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

alignTo

public void alignTo(Element elem,
                    Style.AnchorAlignment alignment,
                    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.
alignment - the position to align to (see XElement.alignTo(com.google.gwt.dom.client.Element, com.sencha.gxt.core.client.Style.AnchorAlignment, 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.


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 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 Widget getFocusWidget()
Returns the focus widget.

Returns:
the focus widget

getHideButton

public TextButton getHideButton()
Returns the button the was clicked to initiate the hide.

Returns:
the hide button or null

getMinHeight

public int getMinHeight()
Returns the minimum height.

Returns:
the minimum height

getMinWidth

public int getMinWidth()
Returns the minimum width.

Returns:
the minimum 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 widget.

Overrides:
hide in class Component

hide

public void hide(TextButton 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 maximizing 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

isResizable

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

Returns:
the resizable state

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.


onBrowserEvent

public void onBrowserEvent(Event event)
Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class ContentPanel

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.

Parameters:
active - true to make the window active

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 XDOM.getViewportSize(), false to allow it to fall outside of the Viewport (defaults to true).

Parameters:
constrain - true to constrain, otherwise false

setContainer

public void setContainer(Element container)
Sets the container element 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(Widget focusWidget)
Widget to be given focus when the window is focused).

Parameters:
focusWidget - the focus widget

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: Component
Sets the page XY position of the widget. To set the left and top instead, use Component.setPosition(int, int).

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

setPosition

public void setPosition(int left,
                        int top)
Description copied from class: Component
Sets the left and top of the widget. To set the page XY position instead, use Component.setPagePosition(int, int).

Overrides:
setPosition in class Component
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

setWindowMessages

public void setWindowMessages(Window.WindowMessages windowMessages)
Sets the window messages.

Parameters:
windowMessages - the window messages

setZIndex

public void setZIndex(int zIndex)
Sets the z-index for the window. A larger value will cause the window to appear over windows with smaller values.

Parameters:
zIndex - the z-index (stacking order) of the window

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.



Copyright © 2012. All Rights Reserved.