123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- dojo.provide("bux.dialogs.CalculationDialog");
- dojo.require("bux.dialogs.BaseCustomContentDialog");
- dojo.require("bux.layout.TableContainer");
- dojo.require("dijit.form.NumberTextBox");
- dojo.require("dijit.form.Button");
- dojo.declare("viewer.dialogs.CalculationDialog", bux.dialogs.BaseCustomContentDialog, {
- sTitle: null,
- sLabel: null,
- sDescription: null,
- sContentLocale: null,
- okHandler: null,
- cancelHandler:null,
- startup: function() {
- this.updateTitle(this.sTitle);
- this.inherited(arguments);
- var tableContainer = new bux.layout.TableContainer({
-
- classname: "bux-InformationDialog"
- },this.contentContainer);
- var cell = null, row = null;
- if (this.sDescription) {
- row = new bux.layout.TableContainerRow({
- parentContainer: tableContainer
- });
- cell = new bux.layout.TableContainerCell({
- classname: "bux-dialog-info",
- parentContainer: row
- });
- cell.addContent(document.createTextNode(this.sDescription));
- dijit.setWaiState(this._buxBaseDialog.domNode, "describedBy", cell.id);
- }
- row = new bux.layout.TableContainerRow({
- parentContainer: tableContainer
- });
- cell = new bux.layout.TableContainerCell({
- classname: "bux-dialog-label",
- parentContainer: row
- });
- this._calculationField = new dijit.form.NumberTextBox({
- required:true,
- onBlur:function() {
- if(!this._cancelled && !this.isValid() ) {
- this.focus();
- }
- },
- _setOKBtnDisabled : function(oButtons, bDisabled) {
-
- if(oButtons && oButtons[0] && oButtons[0].label === RV_RES.IDS_JS_OK) {
- oButtons[0].set("disabled", bDisabled);
- }
- },
- isValid: function(){
-
- var bIsValid = this.validator(this.get("displayedValue"), this.get("constraints"));
- this._setOKBtnDisabled(this.oDlgBtns, !bIsValid);
- return bIsValid;
- }
- });
- if (this.sContentLocale != null) {
- dojo.requireLocalization("dojo.cldr", "number", this.sContentLocale);
- this._calculationField.constraints = {
- locale: this.sContentLocale
- };
- }
- var _label = document.createElement("label");
- _label.appendChild(document.createTextNode(this.sLabel));
- _label.setAttribute("for", this._calculationField.id);
- cell.addContent(_label);
- row = new bux.layout.TableContainerRow({
- parentContainer: tableContainer
- });
- cell = new bux.layout.TableContainerCell({
- classname: "bux-dialog-field",
- parentContainer: row
- });
- cell.addContent(this._calculationField.domNode);
- this._calculationField.oDlgBtns = this._buxBaseDialog._aButtonObjects;
- },
- onOK : function()
- {
- if (this._calculationField.state != "Error")
- {
- this.inherited(arguments);
- this.okHandler(this._calculationField.get("value"));
- this.hide();
- }
- },
- onCancel : function() {
-
-
- this._calculationField._cancelled = true;
- this.inherited( arguments );
- }
- });
|