com.sage.swt.client.widget
Class SwtDialogBox

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.SimplePanel
                  extended by com.google.gwt.user.client.ui.PopupPanel
                      extended by com.google.gwt.user.client.ui.DecoratedPopupPanel
                          extended by com.sage.swt.client.widget.ClosableDialogBox
                              extended by com.sage.swt.client.widget.SwtDialogBox
All Implemented Interfaces:
com.google.gwt.event.dom.client.MouseDownHandler, com.google.gwt.event.dom.client.MouseMoveHandler, com.google.gwt.event.dom.client.MouseUpHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.EventPreview, com.google.gwt.user.client.ui.AcceptsOneWidget, com.google.gwt.user.client.ui.HasAnimation, com.google.gwt.user.client.ui.HasHTML, com.google.gwt.user.client.ui.HasOneWidget, com.google.gwt.user.client.ui.HasText, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.SourcesPopupEvents, HasBeforePopupClosedHandlers, java.lang.Iterable<com.google.gwt.user.client.ui.Widget>
Direct Known Subclasses:
AbstractPortalMenuWidget

public class SwtDialogBox
extends ClosableDialogBox
implements HasBeforePopupClosedHandlers, com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>

SwtDialogBox is a customized dialog box for SWT. It extends the ClosableDialogBox by adding the ability to have a "close" button (looks like "x"), "help" button (looks like "?") , and "applicationMenu" menu (looks like menu drop-down) in the title bar.


Nested Class Summary
static class SwtDialogBox.DialogResult
          List of possible results of how the dialog got closed.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.PopupPanel
com.google.gwt.user.client.ui.PopupPanel.PositionCallback
 
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
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
SwtDialogBox()
          Creates a modal SWT dialog box that shows the "close" image (an "X" at the top corner of the dialog box) and that does not auto-hide when the mouse is clicked outside of it.
SwtDialogBox(boolean showCloseImage)
          Creates a modal SWT dialog box that does not auto-hide when the mouse is clicked outside of it and that specifies whether or not to show the "close" image (an "X" at the top corner of the dialog box).
SwtDialogBox(boolean autoHide, boolean showCloseImage)
          Creates a modal SWT dialog box that specifies whether or not to auto-hide the dialog box when the mouse is clicked outside of it and whether or not to show the "close" image (an "X" at the top corner of the dialog box).
SwtDialogBox(boolean autoHide, boolean showCloseImage, boolean showHelpButton)
          Creates a modal SWT dialog box.
SwtDialogBox(boolean autoHide, boolean showCloseImage, boolean showHelpButton, boolean modal)
          Creates a modal SWT dialog box.
SwtDialogBox(WidgetKey widgetKey, SwtErrorStack errorStack, boolean autoHide, boolean showCloseImage, boolean showHelpButton, boolean showMenuButton, boolean modal, java.lang.String portletCommunicationID)
          Creates a modal SWT dialog box.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addBeforePopupClosedHandler(BeforePopupClosedHandler handler)
          Adds a BeforePopupClosedEvent handler
 com.google.gwt.event.shared.HandlerRegistration addHelpbuttonClickedHandler(com.google.gwt.event.dom.client.ClickHandler handler)
          Add a handler for the help button
 com.google.gwt.event.shared.HandlerRegistration addMenuButtonClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
          Adds a handler interface to the menu button to receive click events.
 SwtDialogBox.DialogResult getDialogResult()
           Gets the dialog box's result code (which indicates whether or not the dialog was closed with the intention of cancelling it).
 java.lang.String getPortletCommunicationID()
           
 void hide()
          
 void hide(boolean autoClosed)
          This override fires a BeforePopupClosed event that lets us cancel the closing (hiding) of the dialog box if one of those "before" handlers indicates that we should cancel that closing.
 void setApplicationMenuHelp(java.lang.String helpID)
          Sets the application menu Help ID so that a menu item can be created
 void setApplicationMenuXML(java.lang.String menuXML)
          Sets the application menu XML so that menu items can be created
 void setCloseButtonVisible(boolean show)
          Sets whether or not to show the close image (an "X" at the top corner of the dialog box).
 void setInstanceContext(InstanceContext context)
          Sets the instance context where this widget resides.
 void setMenuButtonVisible(boolean visible)
          Sets the visibility of the Menu Button.
 void show()
          This override ensures that the "close" image (an "X" at the top corner of the dialog box) is always shown in the correct state.
 void showCentered()
           Displays the DialogBox in the center of the screen.
 
Methods inherited from class com.sage.swt.client.widget.ClosableDialogBox
center, getHTML, getPanel, getText, getWidget, onEnsureDebugId, onEventPreview, onMouseDown, onMouseMove, onMouseUp, remove, setCaptionHTML, setCaptionText, setHTML, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.DecoratedPopupPanel
clear, doAttachChildren, doDetachChildren, getCellElement, iterator
 
Methods inherited from class com.google.gwt.user.client.ui.PopupPanel
addAutoHidePartner, addCloseHandler, addPopupListener, getContainerElement, getGlassElement, getGlassStyleName, getOffsetHeight, getOffsetWidth, getPopupLeft, getPopupTop, getStyleElement, getTitle, isAnimationEnabled, isAutoHideEnabled, isAutoHideOnHistoryEventsEnabled, isGlassEnabled, isModal, isPreviewingAllNativeEvents, isShowing, isVisible, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, onPreviewNativeEvent, onUnload, removeAutoHidePartner, removePopupListener, setAnimationEnabled, setAutoHideEnabled, setAutoHideOnHistoryEventsEnabled, setGlassEnabled, setGlassStyleName, setHeight, setModal, setPopupPosition, setPopupPositionAndShow, setPreviewingAllNativeEvents, setTitle, setVisible, setWidth, showRelativeTo
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, disown, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.logical.shared.HasCloseHandlers
addCloseHandler
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

SwtDialogBox

public SwtDialogBox()
Creates a modal SWT dialog box that shows the "close" image (an "X" at the top corner of the dialog box) and that does not auto-hide when the mouse is clicked outside of it.


SwtDialogBox

public SwtDialogBox(boolean showCloseImage)
Creates a modal SWT dialog box that does not auto-hide when the mouse is clicked outside of it and that specifies whether or not to show the "close" image (an "X" at the top corner of the dialog box).

Parameters:
showCloseImage - Indicates whether or not to show the "close" image (an "X" at the top corner of the dialog box).

SwtDialogBox

public SwtDialogBox(boolean autoHide,
                    boolean showCloseImage)
Creates a modal SWT dialog box that specifies whether or not to auto-hide the dialog box when the mouse is clicked outside of it and whether or not to show the "close" image (an "X" at the top corner of the dialog box).

Parameters:
autoHide - Whether or not to auto-hide the dialog box when the mouse is clicked outside of it.
showCloseImage - Indicates whether or not to show the "close" image (an "X" at the top corner of the dialog box).

SwtDialogBox

public SwtDialogBox(boolean autoHide,
                    boolean showCloseImage,
                    boolean showHelpButton)
Creates a modal SWT dialog box.

Parameters:
autoHide - Whether or not to auto-hide the dialog box when the mouse is clicked outside of it.
showCloseImage - Indicates whether or not to show the "close" image (an "X" at the top corner of the dialog box).
showHelpButton - Indicates whether or not to show the help image (an "?" at the top corner of the dialog box).

SwtDialogBox

public SwtDialogBox(boolean autoHide,
                    boolean showCloseImage,
                    boolean showHelpButton,
                    boolean modal)
Creates a modal SWT dialog box.

Parameters:
autoHide - Whether or not to auto-hide the dialog box when the mouse is clicked outside of it.
showCloseImage - Indicates whether or not to show the "close" image (an "X" at the top corner of the dialog box).
showHelpButton - Indicates whether or not to show the help image (an "?" at the top corner of the dialog box).
modal - true if keyboard and mouse events for widgets not contained by the dialog should be ignored

SwtDialogBox

public SwtDialogBox(WidgetKey widgetKey,
                    SwtErrorStack errorStack,
                    boolean autoHide,
                    boolean showCloseImage,
                    boolean showHelpButton,
                    boolean showMenuButton,
                    boolean modal,
                    java.lang.String portletCommunicationID)
Creates a modal SWT dialog box.

Parameters:
widgetKey - The WidgetKey for the widget.
errorStack - The SwtErrorStack that stores the list of UI errors.
autoHide - Whether or not to auto-hide the dialog box when the mouse is clicked outside of it.
showCloseImage - Indicates whether or not to show the "close" image (an "X" at the top corner of the dialog box).
showHelpButton - Indicates whether or not to show the help image (an "?" at the top corner of the dialog box).
showMenuButton - Indicates whether or not to show the menu button (at the top corner of the dialog box).
modal - true if keyboard and mouse events for widgets not contained by the dialog should be ignored
portletCommunicationID - The portlet communication ID
Method Detail

getPortletCommunicationID

public java.lang.String getPortletCommunicationID()
Returns:
The portlet communication ID, if any

setApplicationMenuHelp

public void setApplicationMenuHelp(java.lang.String helpID)
Sets the application menu Help ID so that a menu item can be created

Parameters:
helpID - The helpID for the application menu

setApplicationMenuXML

public void setApplicationMenuXML(java.lang.String menuXML)
Sets the application menu XML so that menu items can be created

Parameters:
menuXML - The XML for the application menu

setMenuButtonVisible

public void setMenuButtonVisible(boolean visible)
Sets the visibility of the Menu Button.

Parameters:
visible - Whether or not this widget should be is visible.

addHelpbuttonClickedHandler

public com.google.gwt.event.shared.HandlerRegistration addHelpbuttonClickedHandler(com.google.gwt.event.dom.client.ClickHandler handler)
Add a handler for the help button

Parameters:
handler - the handler which handles the click event from the help button
Returns:
HandlerRegistration

addMenuButtonClickHandler

public com.google.gwt.event.shared.HandlerRegistration addMenuButtonClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
Adds a handler interface to the menu button to receive click events.

Parameters:
handler - The handler interface to add.
Returns:
The HandlerRegistration used to remove this handler.

addBeforePopupClosedHandler

public com.google.gwt.event.shared.HandlerRegistration addBeforePopupClosedHandler(BeforePopupClosedHandler handler)
Adds a BeforePopupClosedEvent handler

Specified by:
addBeforePopupClosedHandler in interface HasBeforePopupClosedHandlers
Parameters:
handler - the handler
Returns:
the handler registration

show

public void show()
This override ensures that the "close" image (an "X" at the top corner of the dialog box) is always shown in the correct state.

Overrides:
show in class ClosableDialogBox

showCentered

public void showCentered()

Displays the DialogBox in the center of the screen.

Found this code in the GWT discussion group: http://groups.google.com/group /Google-Web-Toolkit/browse_thread/thread/9e113d a433ccf79a/b79facc1159b482a#b79facc1159b482a


hide

public void hide()

Overrides:
hide in class ClosableDialogBox

hide

public void hide(boolean autoClosed)
This override fires a BeforePopupClosed event that lets us cancel the closing (hiding) of the dialog box if one of those "before" handlers indicates that we should cancel that closing.

Overrides:
hide in class ClosableDialogBox
Parameters:
autoClosed - Whether or not the attempt to hide the dialog box was automatically triggered (by clicking outside the dialog when it has auto-hide behavior).

getDialogResult

public SwtDialogBox.DialogResult getDialogResult()

Gets the dialog box's result code (which indicates whether or not the dialog was closed with the intention of cancelling it).

This result code is only meaningful at the time when PopupListener.onPopupClosed happens. It is not meaningful while the dialog is shown (from the "show"-type method call until that onPopupClosed). Specifically, it is not meaningful during

Returns:
The dialog box's result code.

setCloseButtonVisible

public void setCloseButtonVisible(boolean show)
Sets whether or not to show the close image (an "X" at the top corner of the dialog box).

Parameters:
show - Whether or not to show the close image (an "X" at the top corner of the dialog box).

setInstanceContext

public void setInstanceContext(InstanceContext context)
Sets the instance context where this widget resides.

Parameters:
context - The instance context where the widget will reside.


Copyright © 2011 Sage Software, Inc. All rights reserved.