Window
with specialized support for buttons. Defaults to a dialog with an 'ok' button. Code snippet: Dialog d = new Dialog(); d.setHeading("Exit Warning!"); d.addText("Do you wish to save before exiting?"); d.setBodyStyle("fontWeight:bold;padding:13px;"); d.setSize(300, 100); d.setHideOnButtonClick(true); d.setButtons(Dialog.YESNOCANCEL); d.show();The internal buttons can be retrieved from the button bar using their respective ids ('ok', 'cancel', 'yes', 'no', 'cancel') or by index. The method {@link #getButtonBar()} creates the buttons, so any call before thedialog is rendered will cause the buttons to be created based on the {@link #setButtons(String)} value.
public interface Display extends IsWidget { HasSelectHandlers getYesButton(); HasDialogHideHandlers getDialog(); }Add an implementation of the method(s) to the view:
{@literal @}Override public HasSelectHandlers getYesButton() { return dialog.getButton(PredefinedButton.YES); } {@literal @}Override public HasDialogHideHandlers getDialog() { return dialog; }And add a handler for the method(s) to the presenter:
display.getYesButton().addSelectHandler(new SelectHandler() { {@literal @}Override public void onSelect(SelectEvent event) { // Take action when user hides dialog by clicking on YES button } }); display.getDialog().addDialogHideHandler(new DialogHideHandler() { {@literal @}Override public void onDialogHide(DialogHideEvent event) { // Invoke event.getHideButton() and take action based on value of returned enum } });Note: this example illustrates using both a select handler and a dialog hide handler; you can use either approach.
Many typical modal dialogs such as alerts and confirmations are built into the system with convenience APIs - see say, warn and askForValue.
Dialogs can be modal or non-modal according to {@link com.smartgwt.client.widgets.Window#getIsModal isModal}.
NOTE: If you are building a dialog that will involve more than just buttons and a message, consider starting from the {@link com.smartgwt.client.widgets.Window} class instead, where arbitrary components can be added to the body area via {@link com.smartgwt.client.widgets.Window#addItem Window.addItem}.
Modality indicates that a dialog will block the calling thread even if the calling thread is the EDT. Notice that a dialog will not release the block until dispose is called even if show() from another form is called!
To determin the size of the dialog use the show method that accepts 4 integer values, notice that these values accept margin from the four sides rather than x, y, width and height values!
To style the dialog you would usually want to style the content pane rather than the dialog itself. @author Shai Almog
getInsets
method, however, since these dimensions are platform-dependent, a valid insets value cannot be obtained until the dialog is made displayable by either calling pack
or show
. Since the border area is included in the overall size of the dialog, the border effectively obscures a portion of the dialog, constraining the area available for rendering and/or displaying subcomponents to the rectangle which has an upper-left corner location of (insets.left, insets.top)
, and has a size of width - (insets.left + insets.right)
by height - (insets.top + insets.bottom)
. The default layout for a dialog is BorderLayout
.
A dialog may have its native decorations (i.e. Frame & Titlebar) turned off with setUndecorated
. This can only be done while the dialog is not {@link Component#isDisplayable() displayable}.
A dialog may have another window as its owner when it's constructed. When the owner window of a visible dialog is minimized, the dialog will automatically be hidden from the user. When the owner window is subsequently restored, the dialog is made visible to the user again.
In a multi-screen environment, you can create a Dialog
on a different screen device than its owner. See {@link java.awt.Frame} formore information.
A dialog can be either modeless (the default) or modal. A modal dialog is one which blocks input to some other top-level windows in the application, except for any windows created with the dialog as their owner. See AWT Modality specification for details.
Dialogs are capable of generating the following WindowEvents
: WindowOpened
, WindowClosing
, WindowClosed
, WindowActivated
, WindowDeactivated
, WindowGainedFocus
, WindowLostFocus
.
@see WindowEvent
@see Window#addWindowListener
@version 1.131, 04/13/09
@author Sami Shaio
@author Arthur van Hoff
@since JDK1.0
For example: In RFC3261 Chapter 14 a User Agent Server that receives a second INVITE before it sends the final response to a first INVITE with a lower CSeq sequence number on the same dialog MUST return a 500 (Server Internal Error) response to the second INVITE and MUST include a Retry-After header field with a randomly chosen value of between 0 and 10 seconds. In this release of this specification, the implementation handles retransmissions of Responses that are specified as being handled by the UA core, if there is an associated Dialog for a given transaction. If there is no associated Dialog for a given transaction, the application will be alerted to perform the retransmissions required by the UA core if desired. Applications should explicitly request such alerts see {@link ServerTransaction#enableRetransmissionAlerts()}. Once enabled the SipProvider will deliver retransmission timer events to the Listener with a {@link Timeout#RETRANSMIT} notification. TheSipListener can then retransmit the Response as necessary, see {@link SipListener#processTimeout(TimeoutEvent)}.
For INVITE Client Transactions:
Multiple 2xx responses may arrive at the UAC for a single INVITE request due to a forking proxy. Each response is distinguished by the tag parameter in the TO header field, and each represents a distinct Dialog, with a distinct Dialog identifier. In this case the first 2xx terminates the original INVITE additional 2xx responses will be presented to the SipListener as a ResponseEvent with null Client Transaction ID but with a valid and distinct Dialog. The Listener is expected to ACK the 2xx response - otherwise the Dialog is terminated after a timeout period. Note that unless automatic dialog creation is explictly disabled, the 2xx ResponseEvent will always contain a Dialog whether or not the outgoing INVITE was sent through a ClientTransaction or statelessly via a SipProvider. @author BEA Systems, NIST @version 1.2
Overall configuration of an individual dialog. During application execution, this information is immutable (so that simultaneous execution threads may be processing states or transitions through this dialog). Therefore, access to configuration information is not synchronized.
A {@link Dialog} is characterized by a set of named {@link State}s, which are executed in an order that is determined by {@link Transition}s between those {@link State}s. Execution of a {@link Dialog} begins atthe {@link State} specified by the start
property, and endswhen an {@link EndState} is executed.
{@link Transition}s describe the rule that determines the name of the next {@link State} to be executed, based upon a logical outcome returnedby the execution of a previous {@link State}. {@link Transition}s associated with a {@link Dialog} define dialog-wide rules for specifiedoutcomes, while {@link Transition}s associated with a particular {@link State} can replace the global {@link Transition} that would normallybe selected with one specific to the executing {@link State}.
@since 1.0.4Dialogs are usually modal. Consequently, it is generally bad practice to open a dialog without a parent. A modal dialog without a parent is not prevented from disappearing behind the application's other windows, making it very confusing for the user.
If there is more than one modal dialog is open the second one should be parented off of the shell of the first one otherwise it is possible that the OS will give focus to the first dialog potentially blocking the UI.
Note: The modality styles supported by this class are treated as HINTs, because not all are supported by every subclass on every platform. If a modality style is not supported, it is "upgraded" to a more restrictive modality style that is supported. For example, if PRIMARY_MODAL
is not supported by a particular dialog, it would be upgraded to APPLICATION_MODAL
. In addition, as is the case for shells, the window manager for the desktop on which the instance is visible has ultimate control over the appearance and behavior of the instance, including its modality.
Note: Only one of the styles APPLICATION_MODAL, PRIMARY_MODAL, and SYSTEM_MODAL may be specified.
@see Shell @see SWT Example: ControlExample @see Sample code and further informationDisplays a window wrapping this {@link WebMarkupContainer} markup.
This UI component is built from this {@link WebMarkupContainer}'s HTML markup. The correct markup should be a div
HTML element wrapping the contents to display in this window.
Example:
<div wicket:id="id" title="The window title"> The wrapped content </div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|