Tags:
create new tag
, view all tags
-- JoaoCarreira - 22 Dec 2009

Message Box

The MessageBox component allows the creation of dialog boxes to ask the user how to proceed on a given situation, presenting the choices as buttons.

This component allows the creation of the following types of message boxes:
Error:
messageBoxError.PNG
Question:
messageBoxQuestion.PNG
Info:
messageBoxInfo.PNG
Warning:
messageBoxWarning.PNG

You can declare several combinations of buttons (OK, YES/NO, YES/NO/CANCEL) or use custom buttons.

Message Box Component
Declaration
<xvw:messageBox></xvw:messageBox>
Properties
Property Type Description
id string Component Id
messageBoxType

Enumeration

MessageBox.MessageBoxType

Type of icon to be shown in the Dialog Box. The options are:

WARNING - Warning box

QUESTION - Interogation Box

INFO - Info Box

ERROR - Error Box

title string / EL The title of the message box
defaultConfirmButton string

Confirm button Id.

Sellected by default, if the user presses ENTER the button action is executed

defaultCancelButton string

Cancel button Id.

Sellected by default, if the user presses ESC, the button action is executed

message string / EL The content of the message box
buttons

Enumeration

MessageBox.MessageBoxButtons

Predefined button Template. Valid values are:

YES - Box with only one button with label YES

OK - Box with only one button with label OK

OKCANCEL - Box with two buttons, one with label OK and another one with label CANCEL

YESNO - Box with two buttons, one with label YES and another one with label NO

YESNOCANCEL - Box with 3 buttons, one with label YES, another with NO and one with CANCEL

actions JSON Array with EL Methods

JSON Array with same number of possitions as buttons defined in "buttons". Example,

if in buttons is defined OKCANCEL a array with two possitions should be build,

one for the action OK and one for CANCEL.

eg: ['#{viewBean.myOkAction}','#{viewBean.myCancelAction}'].

minWidth int The minimum width of the dialog box
Default value: 100
maxWidth int The maximum width of the dialog box
Default value: 600
top int  
left int  

Childs

This component can have xvw:menu components as child elements (representing custom buttons).

Examples
MessageBox Declaration in a viewer using predefined buttons.
<xvw:viewer (...)>
 <xeo:form id='formUser'>
  (...)
        <xvw:messageBox 
   id='myMessageBox' 
   messageBoxType='QUESTION'
   title='Message Box Title' 
   message='My Message Box text'
   buttons='OKCANCEL' 
   actions="['#{viewBean.ok}','#{viewBean.cancel}']"
  />
  (...) 

Show the DialogBox from an action of a viewer Bean:

 // Action which is necessary to be confirmed b the user
 public void arquiveQuestion() {
  Dialogs.showDialog( getViewRoot(), "formUser:myMessageBox" );
 }
 public void ok() {
  // The user pressed ok
  // Do Work
 }
 public void cancel() {
  // The user pressed cancel
  // Do Work
 }

If there is no action associated to a button, it closes the dialog box, without executing any action.

Declaring a MessageBox in a viewer using customized buttons.

The behavior is the same, but the attributes buttons and actions do not have to be defined in the MessageBox component,instead you use child xvw:menu components

<xvw:messageBox 
  id='myMessageBox' 
  messageBoxType='WARNING'
  title='Message Box Title' 
  defaultConfirmButton='btn2'
  defaultCancelButton='btn3'
  message='My Message Box text' 
>
 <xvw:menu text='Button 1' id='btn1' serverAction='#{viewBean.btn1Action}' />
 <xvw:menu text='Button 2' id='btn2' serverAction='#{viewBean.btn2Action}' />
 <xvw:menu text='Button 3' id='btn3' serverAction='#{viewBean.btn3Action}' />
</xvw:messageBox>
Topic attachments
I Attachment Action Size Date Who Comment
Unknown file formatPNG messageBoxError.PNG manage 3.9 K 2011-02-09 - 15:02 NicolauGrosskopf  
Unknown file formatPNG messageBoxInfo.PNG manage 3.8 K 2011-02-09 - 15:03 NicolauGrosskopf  
Unknown file formatPNG messageBoxQuestion.PNG manage 4.4 K 2011-02-09 - 15:03 NicolauGrosskopf  
Unknown file formatPNG messageBoxWarning.PNG manage 4.2 K 2011-02-09 - 15:03 NicolauGrosskopf  
Topic revision: r10 - 2013-03-27 - JoaoAires
 

No permission to view TWiki.WebTopBar

This site is powered by the TWiki collaboration platform Powered by Perl

No permission to view TWiki.WebBottomBar