⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 3 页
字号:
/*
 * Isomorphic SmartClient
 * Version 6.5 (2008-04-30)
 * Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 *
 * licensing@smartclient.com
 *
 * http://smartclient.com/license
 */
 //>	@class	Dialog//// Dialogs are a specialized version of +link{Window} used for small windows such as// alerts, prompts, and confirmations.  They can be modal or modeless (via the// +link{Window.isModal,isModal} property) and will contain various children by default// ("titlebar", "resizer", etc).// <P>// NOTE: If you are building a custom component that will add components to the Window via// +link{window.addItem(),addItem()}, in most cases it makes sense //////  @treeLocation Client Reference/Control//  @visibility external//<isc.ClassFactory.defineClass("Dialog", "Window");// add class propertiesisc.Dialog.addClassProperties({    //>	@classAttr	Dialog._openModalDialogs		(array : [] : IRWA)	// 			list of open modal Dialogs so we can keep track as we open them	//		@group	modal	//		@see	Dialog.show()	//<	_openModalDialogs : [],    //> @classAttr  Dialog.OK_BUTTON_TITLE  (HTML : "OK" : IRW)    // Title for the <code>"OK"</code> button.    // @see type:DialogButtons    // @group i18nMessages    // @visibility external    //<    OK_BUTTON_TITLE:"OK",    //> @classAttr  Dialog.APPLY_BUTTON_TITLE  (HTML : "Apply" : IRW)    // Title for the <code>"Apply"</code> button.    // @see type:DialogButtons    // @group i18nMessages    // @visibility external    //<    APPLY_BUTTON_TITLE:"Apply",    //> @classAttr  Dialog.YES_BUTTON_TITLE  (HTML : "Yes" : IRW)    // Title for the <code>"Yes"</code> button.    // @see type:DialogButtons    // @group i18nMessages    // @visibility external    //<        YES_BUTTON_TITLE:"Yes",    //> @classAttr  Dialog.NO_BUTTON_TITLE  (HTML : "No" : IRW)    // Title for the <code>"No"</code> button.    // @see type:DialogButtons    // @group i18nMessages    // @visibility external    //<        NO_BUTTON_TITLE:"No",    //> @classAttr  Dialog.CANCEL_BUTTON_TITLE  (HTML : "Cancel" : IRW)    // Title for the <code>"Cancel"</code> button.    // @see type:DialogButtons    // @group i18nMessages    // @visibility external    //<        CANCEL_BUTTON_TITLE:"Cancel",        // Default Titles for the prompt windows themselves        //> @classAttr  Dialog.CONFIRM_TITLE    (HTML : "Confirm" : IRW)    // Default title for the dialog displayed in response to the +link{isc.confirm()} method.    // Note that a custom title can be specified as the <code>title</code> attribute of the     // <code>properties</code> parameter passed to that method.    // @group i18nMessages    // @visibility external    //<    CONFIRM_TITLE:"Confirm",    //> @classAttr  Dialog.SAY_TITLE    (HTML : "Note" : IRW)    // Default title for the dialog displayed in response to the +link{isc.say()} method.    // Note that a custom title can be specified as the <code>title</code> attribute of the     // <code>properties</code> parameter passed to that method.    // @group i18nMessages    // @visibility external    //<        SAY_TITLE:"Note",    //> @classAttr  Dialog.WARN_TITLE    (HTML : "Note" : IRW)    // Default title for the dialog displayed in response to the +link{isc.warn()} method.    // Note that a custom title can be specified as the <code>title</code> attribute of the     // <code>properties</code> parameter passed to that method.    // @group i18nMessages    // @visibility external    //<            WARN_TITLE:"Note",        //> @classAttr  Dialog.ASK_TITLE    (HTML : "Question" : IRW)    // Default title for the dialog displayed in response to the +link{isc.ask()} method.    // Note that a custom title can be specified as the <code>title</code> attribute of the     // <code>properties</code> parameter passed to that method.    // @group i18nMessages    // @visibility external    //<            ASK_TITLE:"Question",    //> @classAttr  Dialog.ASK_FOR_VALUE_TITLE    (HTML : "Please enter a value" : IRW)    // Default title for the dialog displayed by +link{isc.askForValue()}.    // A custom title can alternatively be specified as the <code>title</code> attribute of the     // <code>properties</code> parameter passed to that method.    // @group i18nMessages    // @visibility external    //<            ASK_FOR_VALUE_TITLE:"Please enter a value",    //> @classAttr  Dialog.LOGIN_TITLE (HTML : "Please log in" : IRW)    // Default title for the dialog displayed by +link{isc.showLoginDialog()}.    // A custom title can alternatively be specified as the <code>title</code> attribute of the     // <code>properties</code> parameter passed to that method.    // @group i18nMessages    // @visibility external    //<            LOGIN_TITLE:"Please log in",    //> @classAttr  Dialog.USERNAME_TITLE (HTML : "Username" : IRW)    // Default title for the "username" field in the dialog displayed by     // +link{isc.showLoginDialog()}.     // @group i18nMessages    // @visibility external    //<            USERNAME_TITLE:"Username",    //> @classAttr  Dialog.PASSWORD_TITLE (HTML : "Password" : IRW)    // Default title for the "password" field in the dialog displayed by     // +link{isc.showLoginDialog()}.    // @group i18nMessages    // @visibility external    //<            PASSWORD_TITLE:"Password",    //> @classAttr  Dialog.LOGIN_BUTTON_TITLE (HTML : "Log in" : IRW)    // Default title for login button in the dialog displayed by     // +link{isc.showLoginDialog()}.    // @group i18nMessages    // @visibility external    //<            LOGIN_BUTTON_TITLE:"Log in",    //> @classAttr  Dialog.LOGIN_ERROR_MESSAGE (HTML : "Invalid username or password" : IRW)    // Default error message displayed on failed login in the dialog shown by     // +link{isc.showLoginDialog()}.    // @group i18nMessages    // @visibility external    //<            LOGIN_ERROR_MESSAGE:"Invalid username or password",	//>	@type   DialogButtons    // Default buttons that you can use in your Dialogs.	// <P>    // On click these call canonical methods that you can override in your Dialog.    // <P>    // Refer to these buttons via the syntax <code>isc.Dialog.OK</code> when passing them into    // +link{dialog.toolbarButtons} or into the <code>properties</code> argument of helper    // methods such as +link{isc.say()}.    //    // @value   OK  Button object to fire dialog's "okClick()" method on click.    //              Title derived from +link{Dialog.OK_BUTTON_TITLE}.	OK 		: {getTitle:function () {return isc.Dialog.OK_BUTTON_TITLE},                width:75, click: function () { this.topElement.okClick() } },    // @value   APPLY Button object to fire dialog's "applyClick()" method on click.    //              Title derived from +link{Dialog.APPLY_BUTTON_TITLE}.    	APPLY 	: {getTitle:function () {return isc.Dialog.APPLY_BUTTON_TITLE}, 	                width:75, click: function () { this.topElement.applyClick() } },    // @value   YES Button object to fire dialog's "yesClick()" method on click        //              Title derived from +link{Dialog.YES_BUTTON_TITLE}.    	YES 	: {getTitle:function () {return isc.Dialog.YES_BUTTON_TITLE}, 	                width:75, click: function () { this.topElement.yesClick() } },    // @value   NO  Button object to fire dialog's "noClick()" method on click.    //              Title derived from +link{Dialog.NO_BUTTON_TITLE}.	NO	 	: {getTitle:function () {return isc.Dialog.NO_BUTTON_TITLE}, 		                width:75, click: function () { this.topElement.noClick() } },    // @value   CANCEL  Button object to fire dialog's "cancelClick()" method on click.    //                  Title derived from +link{Dialog.CANCEL_BUTTON_TITLE}.	CANCEL 	: {getTitle:function () {return isc.Dialog.CANCEL_BUTTON_TITLE}, 	                width:75, click: function () { this.topElement.cancelClick() } }    // @visibility external    //<            });// add standard instance propertiesisc.Dialog.addProperties({	    //>	@attr	dialog.styleName	(CSSStyleName: "dialogBackground" : IRW)	//			Style of the Dialog background	//		@group	appearance    //      @visibility external	//<		styleName:"dialogBackground",			skinImgDir:"images/Dialog/",	canDragReposition : false,	canDragResize:false,	//>	@attr	dialog.autoCenter		(boolean : autoCenter : IRW)	//			if true, this dialog will automatically be centered on the page when shown	//			if false, it will show up wherever you (or the user) last put it	//		@group	appearance, location	//		@see	dialog.show()	//<	autoCenter : true,											// Body Settings	// ----------------------------------------------------------------------------------------    //>	@attr	dialog.bodyStyle	(string : "dialogBody" : IA)	// Style of the Window body	//		@group	appearance, header	//		@see	Window.makeBody()	//<		    bodyStyle:"dialogBody",  	    //>	@attr	dialog.bodyColor		(string : "windowBodyHilite" : IA)	//			Color of the Window body.	//			Overrides the background color specified in the style.	//		@group	appearance, header	//		@see	Window.makeBody()    //      @see    Window.flash()	//<	    bodyColor:"#DDDDDD",			    //>	@attr	dialog.hiliteBodyColor		(string : "windowBodyHilite" : IA)	// Highlight color for the Window body (shown when the body is flashed).	//		@group	appearance, header	//		@see	Window.makeBody()    //      @see    Window.flash()	//<	    hiliteBodyColor:"#FFFFFF",              // Header	// ----------------------------------------------------------------------------------------    //>	@attr	dialog.headerStyle	(string : "DialogHeader" : IA)	// Style of the Dialog header	//		@group	appearance, header	//		@see	Dialog.makeHeader()	//<    headerStyle:"dialogHeader",      //>	@attr	dialog.windowHeaderHilite	(string : "WindowHeader" : IA)	//			Highlight style for the Dialog header	//		@group	appearance, header	//		@see	Window.makeHeader()	//<											    hiliteHeaderStyle:"dialogHeaderHilite",      //>	@attr	dialog.headerLabelTextStyle	(string : "dialogHeaderText" : IA)	//			Style of the Dialog headerLabel text	//		@group	appearance, headerLabel	//		@see	Dialog.makeHeaderLabel()	//<    headerLabelDefaults : isc.addProperties({},                                            isc.Window.getInstanceProperty("headerLabelDefaults"),                                            {styleName:"dialogHeaderText"}),	// Header Icon	// ----------------------------------------------------------------------------------------	//>	@attr	dialog.showHeaderIcon		(boolean : false : IRW)	//			should we show a headerIcon in the header, 	//			clicking it dismisses the Dialog	//		@group	appearance, header	//		@see	Dialog.makeHeaderIcon()	//<			showHeaderIcon:false,	// Buttons	// ----------------------------------------------------------------------------------------	//>	@attr	Dialog.showMinimizeButton		(boolean : false : IRW)	// Should we show a minimizeButton in the header, clicking it dismisses the Dialog	//		@group	appearance, header	//		@see	Dialog.makeMinimizeButton()	//<	showMinimizeButton:false,    //>	@attr	Dialog.showMaximizeButton		(boolean : false : IRW)	// Should we show a maximizeButton in the header, clicking it dismisses the Dialog	//		@group	appearance, header	//		@see	Dialog.makeMaximizeButton()	//<									showMaximizeButton:false,					// Footer	// ----------------------------------------------------------------------------------------	//>	@attr	Dialog.showFooter		(boolean : false : IRW)	// Should we show a footer for this Dialog, including resizer, statusBar, etc?	//		@group	appearance, footer	//<	showFooter:false,		// Toolbar	// ----------------------------------------------------------------------------------------    //>	@attr	Dialog.showToolbar		(boolean : false : IRW)	// Whether to show a toolbar of buttons at the bottom of the Dialog.	//		@group	appearance, toolbar    // @visibility external	//<    		showToolbar:true,    //> @attr Dialog.toolbarButtons (Array of Button or Button Properties : null : IR)    // Array of Buttons to show in the +link{showToolbar,toolbar}, if shown.    // <P>    // The set of buttons to use is typically set by calling one of the shortcuts such as    // +link{isc.say()} or +link{isc.confirm()}.  A custom set of buttons can be passed to    // these shortcuts methods via the "properties" argument, or to a directly created Dialog.    // <P>    // In both cases, a mixture of +link{type:DialogButtons,built-in buttons}, custom buttons,    // and other components (such as a +link{LayoutSpacer}) can be passed.  Built-in buttons    // can be referred to as <code>isc.Dialog.OK</code>, for example:    // <pre>    // isc.Dialog.create({    //    toolbarButtons:[    //       isc.Dialog.OK,     //       isc.Dialog.CANCEL,     //       isc.LayoutSpacer.create({width:50}),     //       { title:"Not now", click:"doSomething()" }    //    ]    // })    // </pre>    // Built-in buttons will call standard methods on the Dialog itself, such as    // +link{dialog.cancelClick()}, as explained in the     // +link{type:DialogButtons,list of built-in buttons}.    //    // @visibility external    //<    // Body Icons    // ---------------------------------------------------------------------------------------    askIcon:"[SKIN]ask.png",    sayIcon:"[SKIN]say.png",    warnIcon:"[SKIN]warn.png",    confirmIcon:"[SKIN]confirm.png", // XXX misnamed media    // media exists, but no global helper, you have to call eg showMessage(message, "error")    notifyIcon:"[SKIN]notify.png", // XXX misnamed media    errorIcon:"[SKIN]error.png",    stopIcon:"[SKIN]stop.png"});	// END	isc.Dialog.addProperties()//!>Deferredisc.Dialog.addMethods({//>	@method	Dialog.saveData()	(A)// Method to save this Dialog's data. Called from <code>okClick()</code>, // <code>applyClick()</code>.// No default implementation - override to perform some action if required.//      //		@group	buttons//      @visibility external//      @see okClick()//      @see applyClick()//<saveData : function () {},//> @method Dialog.closeClick()// @include Window.closeClick()//<//>	@method	Dialog.cancelClick()// Handle a click on the 'cancel' button of this Dialog.// Default implementation is to return null and hide the Dialog.// Override to do something else.//		@group	buttons//      @visibility external//      @see type:DialogButtons//<cancelClick : function () {    return this.closeClick();},// reroute the close button to call cancelClick// (This way overrides to cancelClick will get fired - still falls through to closeClick())_closeButtonClick : function () { return this.cancelClick() },//>	@method	Dialog.okClick()	()// Handle a click on the 'ok' button of this Dialog.// Default implementation is to call <code>saveData()</code>, hide the Dialog, then return// <code>true</code>.  // Override to do something else.//		@group	buttons//      @visibility external//      @see type:DialogButtons

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -