public class WDialog extends AbstractWComponent implements Container
WDialog is used to display pop-up content. It uses theme and skin features which keep the dialog associated with its
parent window. Using a MODAL
dialog eliminates much of the workflow complication involved when using the
WWindow
component.
The content of the dialog is held in a WNamingContext
with an id of "dlg" to make the ids of the content
unique and have the same id prefix.
Modifier and Type | Class and Description |
---|---|
static class |
WDialog.DialogModel
Holds the state information of a WDialog.
|
AbstractWComponent.WComponentRef
Modifier and Type | Field and Description |
---|---|
static int |
ACTIVE_STATE
This state is when the dialog is open and the initial render of the content is complete.
|
static int |
INACTIVE_STATE
This is the "normal" state for the Dialog component, when the dialog is not visible.
|
static int |
MANUAL_OPEN_STATE
This state is when the dialog has been manually requested to open.
|
static int |
MODAL
In this mode the dialog retains the input focus while open.
|
static int |
MODELESS
In this mode the dialog displays even when the user switches input focus to the window.
|
static String |
OPEN_DIALOG_ACTION
Action command string for opening dialog via AJAX.
|
DEFAULT_APPLICATION_ID, DEFAULT_INTERNAL_ID, DEFAULT_NO_ID, ID_CONTEXT_SEPERATOR, ID_FRAMEWORK_ASSIGNED_SEPERATOR, ID_VALIDATION_PATTERN
Constructor and Description |
---|
WDialog()
Creates a WDialog.
|
WDialog(WComponent content)
Creates a WDialog containing the given content.
|
WDialog(WComponent content,
WButton trigger)
Deprecated.
1.2.3 use
WDialog(WComponent) and setTrigger(DialogOpenTrigger) instead. |
Modifier and Type | Method and Description |
---|---|
void |
display()
Signals that the dialog should be opened.
|
WComponent |
getChildAt(int index)
Retrieves a child component by its index.
|
int |
getChildCount() |
List<WComponent> |
getChildren()
Retrieves the children of this component.
|
protected WDialog.DialogModel |
getComponentModel()
Returns the effective component model for this component.
|
WComponent |
getContent() |
int |
getHeight() |
int |
getIndexOfChild(WComponent childComponent)
Retrieves the index of the given child.
|
int |
getMode()
Returns the relationship of the dialog to the parent window.
|
protected WDialog.DialogModel |
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.
|
int |
getState()
Retrieves the state of the dialog in the given context.
|
String |
getTitle() |
DialogOpenTrigger |
getTrigger() |
Action |
getTriggerOpenAction()
The action used when a dialog is opened via its trigger.
|
int |
getWidth() |
void |
handleRequest(Request request)
Override handleRequest in order to perform processing specific to this component.
|
protected void |
handleTriggerOpenAction(Request request)
Run the trigger open action.
|
boolean |
hasLegacyTriggerButton()
Deprecated.
1.2.3 for backwards compatibility only.
|
boolean |
isAjaxTargeted()
Indicates whether the dialog is currently the target of an AJAX operation.
|
boolean |
isResizable()
Deprecated.
1.2.0 as dialogs must always be resizeable.
|
protected WDialog.DialogModel |
newComponentModel()
Creates a new component model.
|
protected void |
preparePaintComponent(Request request)
Subclasses may override this method to place the component in the correct state before it is painted.
|
void |
setContent(WComponent content)
Set the WComponent which will handle the content for this dialog.
|
void |
setHeight(int height)
Sets the dialog height.
|
void |
setMode(int mode)
Set the relationship of the dialog to the parent window.
|
void |
setResizable(boolean resizable)
Deprecated.
1.2.0 as dialogs must always be resizeable.
|
void |
setTitle(String title,
Serializable... args)
Sets the dialog title.
|
void |
setTrigger(DialogOpenTrigger trigger)
Set the component which will open the WDialog.
|
void |
setTriggerOpenAction(Action action)
The action used when a dialog is opened via its trigger.
|
void |
setWidth(int width)
Sets the dialog width.
|
String |
toString()
Creates a String representation of this component; usually for debugging purposes.
|
addHtmlClass, addHtmlClass, addNotify, afterPaint, assertAddSupported, beforePaint, createErrorDiagnostic, createErrorDiagnostic, forward, getAccessibleText, getAttribute, getBaseUrl, getDefaultModel, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getScratchMap, getTabIndex, getTag, getTemplate, getTemplateMarkUp, getToolTip, hasNoComponentModel, hasTabIndex, initialiseComponentModel, invokeLater, invokeLaters, isDebugStructure, isDefaultState, isFlagSet, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, paintComponent, preparePaint, removeAttribute, removeComponentModel, removeHtmlClass, removeHtmlClass, removeNotify, replaceWComponent, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFlag, setFocussed, setHidden, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showErrorIndicatorsForComponent, showWarningIndicators, showWarningIndicatorsForComponent, tidyUpUIContext, tidyUpUIContextForTree, validate, validateComponent, writeReplace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addHtmlClass, addHtmlClass, forward, getAccessibleText, getAttribute, getBaseUrl, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getTabIndex, getTag, getToolTip, hasTabIndex, invokeLater, isDefaultState, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, preparePaint, removeAttribute, removeHtmlClass, removeHtmlClass, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFocussed, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContextForTree, validate
public static final int INACTIVE_STATE
public static final int MANUAL_OPEN_STATE
public static final int ACTIVE_STATE
public static final int MODAL
public static final int MODELESS
public static final String OPEN_DIALOG_ACTION
public WDialog()
public WDialog(WComponent content)
content
- the dialog content.public WDialog(WComponent content, WButton trigger)
WDialog(WComponent)
and setTrigger(DialogOpenTrigger)
instead.content
- the dialog content.trigger
- the WButton used to trigger the dialog to display.public final boolean hasLegacyTriggerButton()
public void setContent(WComponent content)
content
- the dialog content.public WComponent getContent()
public void display()
public int getHeight()
public void setHeight(int height)
height
- The height of the dialog, in pixels.public int getWidth()
public void setWidth(int width)
width
- The width of the dialog, in pixels.public final boolean isResizable()
public final void setResizable(boolean resizable)
resizable
- true if the dialog should be resizable, false if not.public void setMode(int mode)
public int getMode()
public String getTitle()
public void setTitle(String title, Serializable... args)
title
- the title to set, using MessageFormat
syntax.args
- optional arguments for the message format string.public void setTrigger(DialogOpenTrigger trigger)
trigger
- the WComponent which will open the dialog on click/changepublic DialogOpenTrigger getTrigger()
public void setTriggerOpenAction(Action action)
action
- the trigger open actionpublic Action getTriggerOpenAction()
public void handleRequest(Request request)
handleRequest
in interface WComponent
handleRequest
in class AbstractWComponent
request
- the request being responded to.protected void handleTriggerOpenAction(Request request)
request
- the request being processedprotected void preparePaintComponent(Request request)
preparePaintComponent
in class AbstractWComponent
request
- the request being responded to.public final boolean isAjaxTargeted()
public int getState()
public int getChildCount()
getChildCount
in interface Container
public WComponent getChildAt(int index)
getChildAt
in interface Container
index
- the index of the child component to be retrieved.public int getIndexOfChild(WComponent childComponent)
getIndexOfChild
in interface Container
childComponent
- the child component to retrieve the index for.public List<WComponent> getChildren()
AbstractWComponent
getChildren
in interface Container
public String toString()
AbstractWComponent
toString
in class AbstractWComponent
protected WDialog.DialogModel newComponentModel()
newComponentModel
in class AbstractWComponent
protected WDialog.DialogModel getComponentModel()
getComponentModel
in class AbstractWComponent
protected WDialog.DialogModel getOrCreateComponentModel()
getOrCreateComponentModel
in class AbstractWComponent
Copyright © 2021. All rights reserved.