<commit_before>/*
* Copyright 2010-2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
 * @toc {User Interface} Dialog
 * @featureID blackberry.ui.dialog
 * @namespace The Dialog object contains functions for manipulating system dialog boxes.
 * <p/>
 * The functionality in this object allows you to integrate standard system dialog boxes into your BlackBerry WebWorks Application and control your application flow based on user responses.
 */
blackberry.ui.dialog ={
		
		/**
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {String[]} choices Array of string choices that will be presented to the user in the form of buttons.
		 * @param {Number} [defaultChoice = 0] Optional parameter that specifies what choice should be selected by default. This is a number value representing the index of the choice provided in the choices parameter.
		 * @param {Boolean} [globalStatus = false] If set to true it adds a screen to the queue of displayed global status screens. Global status screens appear on top of all other screens on the PlayBook, even if the current application is not in the foreground. If no other status screens are currently displayed, your provided screen appears immediately. <p> NOTE: If the app is in the background and globalStatus is set to true, the app WILL NOT be brought to the foreground.
		 * @description Creates a dialog to ask the user a question. The dialog uses the standard question mark bitmap. The function will block execution and when the user selects an option it will return the index of the choice selected by the user.
		 * @returns {Number} The index of the choice selected by the user.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function globalDialog() {
		 *   var ss = ["Saab", "Volvo", "BMW", "Subaru"];
		 *   var ret = blackberry.ui.dialog.customAsk("Select your favorite car", ss, 2, true);
		 *     
		 *   document.getElementById('carSelect').innerHTML = ss[ret]
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		customAsk : function(message, choices,defaultChoice,globalStatus){},

		/**
         * @function
		 * @description Creates an asynchronous custom dialog to ask the user a question.
		 * <p/>
		 * Uses the custom dialog. The function is an asynchronous call and will not block execution. It will return the 0-based index of the user's choice.
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {String[]} buttons Array of string choices that will be presented to the user in the form of buttons.
		 * @callback {function} [onOptionSelected] Optional callback function that will be invoked when the user makes a selection. Expected signature: function onOptionSelected(selectedButtonIndex).
		 * @callback {Number} [onOptionSelected.index] The index of the selection the user has made.
		 * @param {Object} [settings = null] Optional Object literal that allows the user to manipulate the size, location, title of the dialog, and whether this is a global dialog (your application cannot be minimized when a global dialog is active; by default when the 'global' flag is not passed, dialog will be modal only for your application). It is not required to provide all parameters, and these do not have to be specified in any particular order.
		 * @param {String} [settings.title] Desired title of the dialog.
		 * @param {String[]} [settings.size] Desired size of the dialog.
		 * @param {String[]} [settings.position] Desired position of the dialog.
		 * @PB10
		 * @RIPPLE
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function dialogCallBack(index){
		 *   alert(index);
		 * }  
		 * 
		 * function customDialog() {
		 *   try {
		 *     var buttons = ["Yes", "No", "Sometimes", "NA"];
		 *     var ops = {title : "Choose the answer that describes you best", size : blackberry.ui.dialog.SIZE_TALL, position : blackberry.ui.dialog.LOC_CENTER};
		 *     blackberry.ui.dialog.customAskAsync("Do you routinely work out?", buttons, dialogCallBack, ops);
		 *   } catch(e) {
		 *     alert("Exception in customDialog: " + e);
		 *   }
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		customAskAsync : function(message,buttons,onOptionSelected,settings){},
		
		/**
		 * @param {Number} specifies the type of standard dialog. Constants starting with D_*.
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {Number} [defaultChoice = 0] Optional parameter that specifies what choice should be selected by default. For the standard dialogs, these options can be one of the constants starting with C_*.
		 * @param {Boolean} [globalStatus = false] If set to true it adds a screen to the queue of displayed global status screens. Global status screens appear on top of all other screens on the PlayBook, even if the current application is not in the foreground. If no other status screens are currently displayed, your provided screen appears immediately. <p> NOTE: If the app is in the background and globalStatus is set to true, the app WILL NOT be brought to the foreground.
		 * @description Creates a standard dialog to ask the user a question.
		 * @returns {Number} The index of the choice selected by the user.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 *
		 * function launchDialog() {
		 *   setTimeout(globalDialog, 5000);
		 *   return;
		 * }
		 *
		 * function globalDialog() {
		 *   var ss = ["Saab", "Volvo", "BMW"];
		 *   var ret = blackberry.ui.dialog.customAsk("Select your favorite car", ss, 2, true);
		 *   blackberry.ui.dialog.standardAsk(blackberry.ui.dialog.D_OK, "You selected " + ss[ret], 0, true);
		 * }
		 *
		 * &lt;/script"&gt;
		 */
		standardAsk : function(type, message, defaultChoice, globalStatus){},
		
		/**
		 * @description Creates an asynchronous standard dialog to ask the user a question.
		 * <p/> Uses the standard dialog. The function is an asynchronous call and will not block execution. It will return the 0-based index of the user's choice.
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {Number} type  Parameter that specifies the type of standard dialog. Constants starting with D_*.
		 * @callback {function} [onOptionSelected] Optional callback function that will be invoked when the user makes a selection. Expected signature: function onOptionSelected(selectedButtonIndex).
		 * @callback {Number} [onOptionSelected.index] The index of the selection the user has made.
		 * @param {Object} [settings = null] Optional Object literal that allows the user to manipulate the size, location, title of the dialog, and whether this is a global dialog (your application cannot be minimized when a global dialog is active; by default when the 'global' flag is not passed, dialog will be modal only for your application). It is not required to provide all parameters, and these do not have to be specified in any particular order.
		 * @param {String} [settings.title] Desired title of the dialog.
		 * @param {String[]} [settings.size] Desired size of the dialog.
		 * @param {String[]} [settings.position] Desired position of the dialog.
		 * @PB10
		 * @RIPPLE
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function dialogCallBack(index){
		 *   alert(index);
		 * }  
		 * 
		 * function standardDialog() {
		 *   try {
		 *     blackberry.ui.dialog.standardAskAsync("Save?", blackberry.ui.dialog.D_SAVE, dialogCallBack, {title : "Save Dialog", size: blackberry.ui.dialog.SIZE_MEDIUM, position : blackberry.ui.dialog.LOC_BOTTOM});
		 *   }catch (e) {
		 *     alert("Exception in standardDialog: " + e);
		 *   }
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		standardAskAsync : function(message,type,onOptionSelected,settings){},
        
        /**
		 * @description Creates an asynchronous dialog to allow user to select one or many items in a list.
		 * <p/>The function is an asynchronous call and will not block JavaScript execution. It will return array of indexes that user selected.
		 * @param {Boolean} allowMultiple If true, the dialog will allow multiple selection.
		 * @param {Object[]} options Array of objects representing the select items and their states.
         * @param {String} options.label The value of an item in the dropdown list
         * @param {Boolean} options.selected Flag that indicates whether an item should be rendered as currently selected
         * @param {Boolean} options.enabled Flag that indicates whether an item should be enabled for selection
         * @param {String} options.type Can be either "group" or "option" to indicate whether an item is a group header or an option
		 * @callback {String} onSelected A string containing the fully qualified name of a globally-accessible callback function. It will be invoked with the user's choices from the native UI. 
		 * @callback {Number[]} onSelected.indices The indices of the user's selections.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function onSelected(indices){
		 *   alert(indices.join(','));
		 * }  
		 * 
		 * function selectAsync() {
		 *   try {
		 *     blackberry.ui.dialog.selectAsync(false, 
         *                                      [ { label : "Animals", selected : false, enabled : false, type : "group"},
                                                  { label : "cat", selected : true, enabled : true, type : "option"},
         *                                        { label : "dog", selected : false, enabled : true}, type : "option",
         *                                        { label : "mouse", selected : false, enabled : true, type : "option"},
         *                                        { label : "raccoon", selected : false, enabled : true, type : "option"}
         *                                      ], 
         *                                      "window.onSelected");
		 *   }catch (e) {
		 *     alert("Exception in selectAsync: " + e);
		 *   }
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		selectAsync : function(allowMultiple, options, onSelected){},
        
        /**
		 * @description Creates an asynchronous dialog to allow user to select a date/time for an HTML 5 input of types: date, datetime, datetime-local, month, time
		 * <p/>The function is an asynchronous call and will not block execution. It will return the value selected by the user.
		 * @param {String} type One of: "date", "datetime", "datetime-local", "month", "time".
		 * @param {Object} options The current state of the input control.
         * @param {String} options.value String representation of the current date/time displayed in the field
         * @param {String} options.min String representation of the minimum date/time allowed in the field
         * @param {String} options.max String representation of the maximum date/time allowed in the field
		 * @callback {String} onDateTimeSelected A string containing the fully qualified name of a globally-accessible callback function. It will be invoked with the user's choices from the native UI.
		 * @callback {String} onSelected.datetime The date/time user user has selected.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;<commit_msg>Reverted selectAsync and dateTimeAsync to use a function-reference callback instead of a string<commit_after>/*
* Copyright 2010-2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
 * @toc {User Interface} Dialog
 * @featureID blackberry.ui.dialog
 * @namespace The Dialog object contains functions for manipulating system dialog boxes.
 * <p/>
 * The functionality in this object allows you to integrate standard system dialog boxes into your BlackBerry WebWorks Application and control your application flow based on user responses.
 */
blackberry.ui.dialog ={
		
		/**
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {String[]} choices Array of string choices that will be presented to the user in the form of buttons.
		 * @param {Number} [defaultChoice = 0] Optional parameter that specifies what choice should be selected by default. This is a number value representing the index of the choice provided in the choices parameter.
		 * @param {Boolean} [globalStatus = false] If set to true it adds a screen to the queue of displayed global status screens. Global status screens appear on top of all other screens on the PlayBook, even if the current application is not in the foreground. If no other status screens are currently displayed, your provided screen appears immediately. <p> NOTE: If the app is in the background and globalStatus is set to true, the app WILL NOT be brought to the foreground.
		 * @description Creates a dialog to ask the user a question. The dialog uses the standard question mark bitmap. The function will block execution and when the user selects an option it will return the index of the choice selected by the user.
		 * @returns {Number} The index of the choice selected by the user.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function globalDialog() {
		 *   var ss = ["Saab", "Volvo", "BMW", "Subaru"];
		 *   var ret = blackberry.ui.dialog.customAsk("Select your favorite car", ss, 2, true);
		 *     
		 *   document.getElementById('carSelect').innerHTML = ss[ret]
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		customAsk : function(message, choices,defaultChoice,globalStatus){},

		/**
         * @function
		 * @description Creates an asynchronous custom dialog to ask the user a question.
		 * <p/>
		 * Uses the custom dialog. The function is an asynchronous call and will not block execution. It will return the 0-based index of the user's choice.
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {String[]} buttons Array of string choices that will be presented to the user in the form of buttons.
		 * @callback {function} [onOptionSelected] Optional callback function that will be invoked when the user makes a selection. Expected signature: function onOptionSelected(selectedButtonIndex).
		 * @callback {Number} [onOptionSelected.index] The index of the selection the user has made.
		 * @param {Object} [settings = null] Optional Object literal that allows the user to manipulate the size, location, title of the dialog, and whether this is a global dialog (your application cannot be minimized when a global dialog is active; by default when the 'global' flag is not passed, dialog will be modal only for your application). It is not required to provide all parameters, and these do not have to be specified in any particular order.
		 * @param {String} [settings.title] Desired title of the dialog.
		 * @param {String[]} [settings.size] Desired size of the dialog.
		 * @param {String[]} [settings.position] Desired position of the dialog.
		 * @PB10
		 * @RIPPLE
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function dialogCallBack(index){
		 *   alert(index);
		 * }  
		 * 
		 * function customDialog() {
		 *   try {
		 *     var buttons = ["Yes", "No", "Sometimes", "NA"];
		 *     var ops = {title : "Choose the answer that describes you best", size : blackberry.ui.dialog.SIZE_TALL, position : blackberry.ui.dialog.LOC_CENTER};
		 *     blackberry.ui.dialog.customAskAsync("Do you routinely work out?", buttons, dialogCallBack, ops);
		 *   } catch(e) {
		 *     alert("Exception in customDialog: " + e);
		 *   }
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		customAskAsync : function(message,buttons,onOptionSelected,settings){},
		
		/**
		 * @param {Number} specifies the type of standard dialog. Constants starting with D_*.
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {Number} [defaultChoice = 0] Optional parameter that specifies what choice should be selected by default. For the standard dialogs, these options can be one of the constants starting with C_*.
		 * @param {Boolean} [globalStatus = false] If set to true it adds a screen to the queue of displayed global status screens. Global status screens appear on top of all other screens on the PlayBook, even if the current application is not in the foreground. If no other status screens are currently displayed, your provided screen appears immediately. <p> NOTE: If the app is in the background and globalStatus is set to true, the app WILL NOT be brought to the foreground.
		 * @description Creates a standard dialog to ask the user a question.
		 * @returns {Number} The index of the choice selected by the user.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 *
		 * function launchDialog() {
		 *   setTimeout(globalDialog, 5000);
		 *   return;
		 * }
		 *
		 * function globalDialog() {
		 *   var ss = ["Saab", "Volvo", "BMW"];
		 *   var ret = blackberry.ui.dialog.customAsk("Select your favorite car", ss, 2, true);
		 *   blackberry.ui.dialog.standardAsk(blackberry.ui.dialog.D_OK, "You selected " + ss[ret], 0, true);
		 * }
		 *
		 * &lt;/script"&gt;
		 */
		standardAsk : function(type, message, defaultChoice, globalStatus){},
		
		/**
		 * @description Creates an asynchronous standard dialog to ask the user a question.
		 * <p/> Uses the standard dialog. The function is an asynchronous call and will not block execution. It will return the 0-based index of the user's choice.
		 * @param {String} message Message to be displayed in the dialog.
		 * @param {Number} type  Parameter that specifies the type of standard dialog. Constants starting with D_*.
		 * @callback {function} [onOptionSelected] Optional callback function that will be invoked when the user makes a selection. Expected signature: function onOptionSelected(selectedButtonIndex).
		 * @callback {Number} [onOptionSelected.index] The index of the selection the user has made.
		 * @param {Object} [settings = null] Optional Object literal that allows the user to manipulate the size, location, title of the dialog, and whether this is a global dialog (your application cannot be minimized when a global dialog is active; by default when the 'global' flag is not passed, dialog will be modal only for your application). It is not required to provide all parameters, and these do not have to be specified in any particular order.
		 * @param {String} [settings.title] Desired title of the dialog.
		 * @param {String[]} [settings.size] Desired size of the dialog.
		 * @param {String[]} [settings.position] Desired position of the dialog.
		 * @PB10
		 * @RIPPLE
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function dialogCallBack(index){
		 *   alert(index);
		 * }  
		 * 
		 * function standardDialog() {
		 *   try {
		 *     blackberry.ui.dialog.standardAskAsync("Save?", blackberry.ui.dialog.D_SAVE, dialogCallBack, {title : "Save Dialog", size: blackberry.ui.dialog.SIZE_MEDIUM, position : blackberry.ui.dialog.LOC_BOTTOM});
		 *   }catch (e) {
		 *     alert("Exception in standardDialog: " + e);
		 *   }
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		standardAskAsync : function(message,type,onOptionSelected,settings){},
        
        /**
		 * @description Creates an asynchronous dialog to allow user to select one or many items in a list.
		 * <p/>The function is an asynchronous call and will not block JavaScript execution. It will return array of indexes that user selected.
		 * @param {Boolean} allowMultiple If true, the dialog will allow multiple selection.
		 * @param {Object[]} options Array of objects representing the select items and their states.
         * @param {String} options.label The value of an item in the dropdown list
         * @param {Boolean} options.selected Flag that indicates whether an item should be rendered as currently selected
         * @param {Boolean} options.enabled Flag that indicates whether an item should be enabled for selection
         * @param {String} options.type Can be either "group" or "option" to indicate whether an item is a group header or an option
		 * @callback {function} onSelected A callback that will be invoked with the user's choices from the native UI. 
		 * @callback {Number[]} onSelected.indices The indices of the user's selections.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
		 * 
		 * function onSelected(indices){
		 *   alert(indices.join(','));
		 * }  
		 * 
		 * function selectAsync() {
		 *   try {
		 *     blackberry.ui.dialog.selectAsync(false, 
         *                                      [ { label : "Animals", selected : false, enabled : false, type : "group"},
                                                  { label : "cat", selected : true, enabled : true, type : "option"},
         *                                        { label : "dog", selected : false, enabled : true}, type : "option",
         *                                        { label : "mouse", selected : false, enabled : true, type : "option"},
         *                                        { label : "raccoon", selected : false, enabled : true, type : "option"}
         *                                      ], 
         *                                      "window.onSelected");
		 *   }catch (e) {
		 *     alert("Exception in selectAsync: " + e);
		 *   }
		 * }
		 * 
		 * &lt;/script&gt;
		 */
		selectAsync : function(allowMultiple, options, onSelected){},
        
        /**
		 * @description Creates an asynchronous dialog to allow user to select a date/time for an HTML 5 input of types: date, datetime, datetime-local, month, time
		 * <p/>The function is an asynchronous call and will not block execution. It will return the value selected by the user.
		 * @param {String} type One of: "date", "datetime", "datetime-local", "month", "time".
		 * @param {Object} options The current state of the input control.
         * @param {String} options.value String representation of the current date/time displayed in the field
         * @param {String} options.min String representation of the minimum date/time allowed in the field
         * @param {String} options.max String representation of the maximum date/time allowed in the field
		 * @callback {function} onDateTimeSelected A callback that will be invoked with the user's choices from the native UI.
		 * @callback {String} onSelected.datetime The date/time user user has selected.
		 * @BB50+
		 * @example
		 * &lt;script type="text/javascript"&gt;
{'fraction_non_alphanumeric': 0.09140198087431695, 'fraction_numerical': 0.0030737704918032786, 'mean_word_length': 3.1860257326661903, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1523814', 'n_tokens_mistral': 6494, 'n_tokens_neox': 5730, 'n_words': 2751}