打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Prototype Window Class
 

Overview

Window Class

Main class to handle windows

Window.keepMultiModalWindow Constant for multi modal window behavior.

By default (Window.keepMultiModalWindow=false), a new modal window will hide the previous one. if Window.keepMultiModalWindow=true, a new modal window will move the previous one under the overlay.

initialize(id, options) Window constructor used when creating new window (new Window(id, options))

id DOM id of the window must be unique

options Hash map of window options, here is the key list:

Key Default Description
className dialog Class name prefix
title none Window‘s title
url none URL of window content (use an iframe)
parent body Parent node of the window
top | bottom top:0 Top or bottom position of the window in pixels
right | left left:0 Right or left position of the window in pixels
width / height 100 width and height of the window
maxWidth / maxHeight none Maximum width and height of the window
minWidth / minHeight 100/20 Minimum width and height of the window
resizable true Specify if the window can be resized
closable true Specify if the window can be closed
minimizable true Specify if the window can be minimized
maximizable true Specify if the window can be maximized
draggable true Specify if the window can be moved
showEffect Effect.Appear or
Element.show
Show effect function. The default value depends if effect.js of script.aculo.us is included
hideEffect Effect.Fade or
Element.hide
Hide effect function. The default value depends if effect.js of script.aculo.us is included
showEffectOptions none Show effect options (see script.aculo.us documentation).
hideEffectOptions none Hid effect options (see script.aculo.us documentation).
effectOptions none Show and hide effect options (see script.aculo.us documentation).
onload none Onload function of the main window div or iframe
opacity 1 Window opacity
recenterModal true Recenter modal window

destroy() Window destructor

getId() Returns current window id

setDestroyOnClose() The window will be destroy by clicking on close button instead of being hidden

setDelegate(delegate) Sets window delegate

delegate Window delegate, should have canClose(window) function

getDelegate() Returns current window delegate

setContent(id, autoresize, autoposition) Sets window content using an existing element (does not work woth url/iframe)

id Element id to insert in the window

autoresize (default false) Resizes the window to fit with its content

autoposition (default false) Sets the current window position to the specified input element

setAjaxContent(url, options, showCentered, showModal) Sets window content using an Ajax request. The request must return HTML code. See script.aculo.us Ajax.request documentation for details. When the response is received, the window is shown.

url Ajax request URL

options Ajax request options

showCentered (default false) Displays window centered when response is received

showModal (default false) Displays window in modal mode when response is received

getContent() Returns current window content (a div or an iframe)

setCookie(name, expires, path, domain, secure) Sets cookie informations to store window size and position

name (default window‘s id) Cookie name

expires, path, domain, secure Cookie attributes

setLocation(top, left) Sets window top-left position

top Top position in pixels

bottom Bottom position in pixels

getSize() Gets window content size. Return an hash with width and height as keys

setSize(width, height) Sets window content size

width Width in pixels

height Height in pixels

updateWidth() Recompute window width, useful when you change window content and do not want scrolling

updateHeight() Recompute window height, useful when you change window content and do not want scrolling

toFront() Brings current window in front of all others

toFront() Brings current window in front of all others

show(modal) Shows window at its current position

modal (default false) Modal mode

showCenter(modal, top, left) Shows window in page‘s center. You can set top (or left) if you want to center only left (or top) value

modal (default false) top (default null) left (default null) Modal mode

minimize() Minimizes the window, only top bar will be displayed

maximize() Maximizes the window, the window will fit the viewable area of the page

isMinimized() Returns true if the window is minimized

isMaximized() Returns true if the window is maximized

setOpacity(opacity) Sets window opacity

opacity Float value between 0 and 1

setZIndex(zindex) Sets window zindex

zindex Int value

setTitle(title) Sets window title

title Window title (can be null)

setStatusBar(element) Sets window status bar

element Can be HTML code or an element

Dialog module

Dialog factory to open alert/confirm/info modal panels

confirm(content, options) Opens a modal dialog with two buttons (ok/cancel for example)

content - If the content is a string, it will be the message displayed in the dialog (HTML code)
- If the content is an hash map, it will be used for setting content with an AJAX request. The hashmap must have url key and an optional options key (ajax options request)

options Hash map of dialog options, here is the key list:

Key Default Description
top null Top position
left null Left position
okLabel Ok Ok button label
cancelLabel Cancel Cancel button label
ok none Ok callback function called on ok button
cancel none Cancel callback function called on ok button
buttonClass none Ok/Cancel button css class name
windowParameters (hash map) none Window constructor options

alert(content, options) Opens a modal alert with one button (ok for example)

content - If the content is a string, it will be the message displayed in the dialog (HTML code)
- If the content is an hash map, it will be used for setting content with an AJAX request. The hashmap must have url key and an optional options key (ajax options request)

options Hash map of dialog options, here is the key list:

Key Default Description
top null Top position
left null Left position
okLabel Ok Ok button label
okCallback none Ok callback function called on ok button
buttonClass none Ok/Cancel button css class name
windowParameters (hash map) none Window constructor options

info(content, options) Opens a modal info panel without any button. It can have a progress image (Used to display submit waiting message for example)

content - If the content is a string, it will be the message displayed in the dialog (HTML code)
- If the content is an hash map, it will be used for setting content with an AJAX request. The hashmap must have url key and an optional options key (ajax options request)

options Hash map of dialog options, here is the key list:

Key Default Description
top null Top position
left null Left position
showProgress false Add a progress image (info found in the css file)
windowParameters (hash map) none Window constructor options

setInfoMessage(message) Sets info message (Used to display waiting information like 32% done for example)

message New info message

closeInfo() Closes the current modal dialog

Windows

Windows factory. Handles created windows, and windows observers

addObserver(observer) Registers a new windows observer. Should be able to respond to onStartResize(), onEndResize(), onStartMove(), onEndMove(), onClose(), onDestroy(), onMaximize(), onMinimize(), onFocus(), onHide(), onShow() functions

observer Observer object

removeObserver(observer) Unregisters a windows observer.

observer Observer object

closeAll() Closes all closeable windows.

getFocusedWindow() Returns the last focused window.

Add-ons

Add-on behaviors to PWC

WindowsStore.init(cookieName, expired) Save automatically show/hide window status. Just add WindowsStore.init() at the end of you HTML file.

cookieName Cookie name used to store window information (default: __window_store__)

expired Cookie expiration date (default: In 3 years!!)

WindowCloseKey.init(keyCode) Handlea key to close windows or dialogs. Just add WindowsStore.init() at the end of you HTML file.

keyCode Key used to close windows (default: Event.KEY_ESC)

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
sysbench压测tdsql分布式实例 注意事项
07.Setting Articulate Storyline Options
run "cscript /?"
宽带加速2倍的方法
g_object_notify的使用方法
No more Windows XP - are you ready for it?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服