org.apache.myfaces.custom.dialog
Class AbstractModalDialog

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIPanel
              extended by org.apache.myfaces.custom.dialog.AbstractModalDialog
All Implemented Interfaces:
javax.faces.component.StateHolder, org.apache.myfaces.custom.dojo.DojoWidget

public abstract class AbstractModalDialog
extends javax.faces.component.UIPanel
implements org.apache.myfaces.custom.dojo.DojoWidget

Embeds into the current page a javascript object with methods which can be called to display (and hide) a modal popup window.

When the popup window is displayed, the current window contents become "greyed out" and the new window appears on top of the original. The original window does not respond to keys or clicks; only the new window can be accessed by the user. When the popup window is closed then the original window is again accessable.

When this component has a child facet named "titleBar" then the contents of that facet are rendered at the top of the popup window. This facet is intended to allow users to define their own custom window "decoration".

When this component has no "titleBar" facet, but does have a "dialogTitle" property, then a default window decoration is generated. It consists of a table row with two cells. The left cell contains the dialogTitle text. If property renderCloseButton is true, then the right cell holds a "close" icon. Styles are defined for the row and cells so that the look-and-feel can be customised.

The new window can optionally load a page from the server when it is displayed. If one of viewId or contentURL is defined, then an internal frame is inserted after the titleBar, and the specified contents is immediately loaded into the popup window when it is displayed.

The rest of the child components (ie other than titleBar) are displayed after the titlebar (and after the contents of viewId or contentURL if it is defined).

This component internally uses the Dojo modal window widget.


Field Summary
static java.lang.String COMPONENT_TYPE
           
static java.lang.String DEFAULT_RENDERER_TYPE
           
 
Fields inherited from class javax.faces.component.UIPanel
COMPONENT_FAMILY
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
AbstractModalDialog()
           
 
Method Summary
abstract  java.lang.Boolean getCloseButton()
          Specifies whether there should be a "close" icon to the right of the popup window title.
abstract  java.lang.String getContentURL()
          The URL to show within the content area of the dialog.
abstract  java.lang.String getDialogAttr()
          A space separated list with attribute='value' pairs, which control the behaviour of the dojo dialog.
abstract  java.lang.String getDialogId()
          An optional raw id to assign to the html div that encloses the modal dialog.
abstract  java.lang.String getDialogTitle()
          The title text to show in the title area of the popup window (ie the "window decoration").
abstract  java.lang.String getDialogVar()
          Specifies the name of the javascript variable which provides access to the dialog functionality.
abstract  java.lang.String getHiderIds()
          A list of ids of components which, when activated, should cause the popup dialog to be hidden.
 boolean getRendersChildren()
           
abstract  java.lang.String getStyle()
          HTML: CSS styling instructions.
abstract  java.lang.String getStyleClass()
          The CSS class for this element.
abstract  java.lang.String getViewId()
          The URL of the view to show within the content area of the dialog.
abstract  java.lang.String getWidgetId()
          Optional enforced dojo widgetId
 java.lang.String getWidgetVar()
          Deprecated. use getDialogVar instead.
abstract  void setDialogVar(java.lang.String dialogVar)
           
 void setWidgetVar(java.lang.String widgetVar)
           
 
Methods inherited from class javax.faces.component.UIPanel
getFamily
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.myfaces.custom.dojo.DojoWidget
setWidgetId
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values

DEFAULT_RENDERER_TYPE

public static final java.lang.String DEFAULT_RENDERER_TYPE
See Also:
Constant Field Values
Constructor Detail

AbstractModalDialog

public AbstractModalDialog()
Method Detail

getDialogAttr

public abstract java.lang.String getDialogAttr()
A space separated list with attribute='value' pairs, which control the behaviour of the dojo dialog.


getDialogId

public abstract java.lang.String getDialogId()
An optional raw id to assign to the html div that encloses the modal dialog.

This id can be useful for controlling the dialog with javascript. However in most cases it is not necessary.

If this is property is not defined then an id will be automatically generated.


getDialogVar

public abstract java.lang.String getDialogVar()
Specifies the name of the javascript variable which provides access to the dialog functionality.

For example, if this is "myDialog" then a javascript object with name "myDialog" will be defined. This exposes the following methods:


setDialogVar

public abstract void setDialogVar(java.lang.String dialogVar)

getHiderIds

public abstract java.lang.String getHiderIds()
A list of ids of components which, when activated, should cause the popup dialog to be hidden.

If the standard title-bar is displayed (ie no custom titleBar facet exists, and property dialogTitle is defined) then the standard close-button in that bar is automatically included.

If the child components of this component (which will appear in the popup) include other items that should cause the window to close (ie a button) then their ids should be defined via this property. This component will then automatically wire them up to the necessary functions to cause the popup to be closed when they are activated.


getViewId

public abstract java.lang.String getViewId()
The URL of the view to show within the content area of the dialog.

Optional; when not defined (or defined as an EL expression, but that expression returns null) then the popup dialog will be opened with no content. Presumably custom javascript in the calling page will arrange to populate the window content appropriately.

The modalDialog component treats this as a url relative to the webapp base. The value should not start with a slash.

Note that technically this value is not a viewId. A viewId is the internal path to the page definition (eg "foo.jsp" or "foo.xhtml"). What the browser accesses is a URL (which contains the path that triggers the facelets servlet, eg "foo.faces" or "foo.jsf" or "/faces/foo".

The valueIt should not start with a slash.


getContentURL

public abstract java.lang.String getContentURL()
The URL to show within the content area of the dialog.

This may be:


getRendersChildren

public boolean getRendersChildren()
Overrides:
getRendersChildren in class javax.faces.component.UIComponentBase

getStyle

public abstract java.lang.String getStyle()
HTML: CSS styling instructions.


getStyleClass

public abstract java.lang.String getStyleClass()
The CSS class for this element. Corresponds to the HTML 'class' attribute.

This value is also used as a base for defining style classes for parts of the standard window "title bar" decoration.


getWidgetId

public abstract java.lang.String getWidgetId()
Optional enforced dojo widgetId

Specified by:
getWidgetId in interface org.apache.myfaces.custom.dojo.DojoWidget

getDialogTitle

public abstract java.lang.String getDialogTitle()
The title text to show in the title area of the popup window (ie the "window decoration").

Ignored if there is a "titleBar" facet as a child.


getCloseButton

public abstract java.lang.Boolean getCloseButton()
Specifies whether there should be a "close" icon to the right of the popup window title.

Ignored if there is a "titleBar" facet as a child, or dialogTitle is not defined.

Defaults to true.


getWidgetVar

public java.lang.String getWidgetVar()
Deprecated. use getDialogVar instead.

An alias for the "dialogVar" property.

Specified by:
getWidgetVar in interface org.apache.myfaces.custom.dojo.DojoWidget

setWidgetVar

public void setWidgetVar(java.lang.String widgetVar)
Specified by:
setWidgetVar in interface org.apache.myfaces.custom.dojo.DojoWidget


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.