Overview

Window Class

Windowを操作するメインクラスです。

initialize(id, options) Windowクラスをnewするときのコンストラクタです。 (new Window(id, options))

id Windowに与えるDOM idです。ユニークでなければなりません。

options Windowインスタンスに与える連想配列です。以下にその一覧を記します:

キー 初期値 説明
className dialog クラス名の接頭辞
title none Windowのタイトル
url none WindowのURL(iframeを使います)
parent body Windowの親ノード
top | bottom top:0 トップから(もしくはボトムから)のWindowの位置(pixelで)
right | left left:0 右から(もしくは左から)のWindowの位置(pixelで)
width / height 100 Windowの高さ/幅
maxWidth / maxHeight none Windowの最大高
minWidth / minHeight 100/20 Windowの最小高
resizable true Windowがリサイズできるかどうか
closable true Windowにクローズボタンを付けるかどうか
minimizable true Windowに最小化ボタンを付けるかどうか
maximizable true Windowに最大化ボタンを付けるかどうか
draggable true Windowをドラッグできるようにするかどうか
showEffect Effect.Appear or
Element.show
Windowが表示されるときのエフェクト。script.aculo.usのeffect.jsがincludeされているかどうかに依存します。
hideEffect Effect.Fade or
Element.hide
Windowが非表示にされるときのエフェクト。script.aculo.usのeffect.jsがincludeされているかどうかに依存します。
showEffectOptions none 表示するときのエフェクト関数に与えるオプション(see script.aculo.us documentation).
hideEffectOptions none 非表示にするときのエフェクト関数に与えるオプション(see script.aculo.us documentation).
effectOptions none 表示/非表示のエフェクト関数に与えるオプション (see script.aculo.us documentation).
onload none Windowが表示されたときに実行する関数
opacity 1 Windowの不透明度
recenterModal true Recenter modal window

destroy() Windowのデストラクタ

getId()現在のwindowのDOM IDを得る

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

setDelegate(delegate) Windowのdelegateをセットする

delegate Windowのdelegateです。このdelegateはcanClose(window)関数を持っている必要があります。

getDelegate()現在のWindowのデリゲートを返す

setContent(id, autoresize, autoposition) Windowの内容を現在のDOM IDを用いてセットする (url/iframeには対応していない)

id windowに挿入したいコンテンツのID

autoresize (default false) そのコンテンツに合うようにwindowをリサイズするかどうか

autoposition (default false) Windowの位置をその挿入するDOM要素の位置にするかどうか

setAjaxContent(url, options, showCentered, showModal) Windowの中身ををAjaxで取ってくる。HTTPRequestで返されるものは HTMLコードである必要がある。詳しくは script.aculo.us のAjax.request 。HTTPレスポンスを受信した際にWindowは表示されます。

url 取りに行くURL

options Ajaxオブジェクトに与えるOption

showCentered (default false) HTTPRequestを受信した際にWindowを中央に表示するかどうか

showModal (default false) HTTPRequestを受信した際にWindowをモーダル風に表示するかどうか

getContent() 現在のWindowで表示されているコンテンツを返す( div か iframe)

setCookie(name, expires, path, domain, secure) windowサイズと位置の情報をCookieに保存する

name (初期値は windowの id) Cookie名

expires, path, domain, secure Cookieの各属性

setLocation(top, left)windowのトップと左からの位置をセット

top トップの位置(pixelで)

bottom ボトムの位置(pixelで)<?leftの誤記?>

getSize() Windowのコンテンツの大きさを取ります。 幅(width)と高さ(height)をキーにした連想配列で返します。

setSize(width, height)windowのコンテンツのサイズを設定します。

width Width in pixels

height Height in pixels

updateWidth() window の幅を再描画します。Windowのコンテンツを変えたときにスクローリングさせたくない場合に効果的でしょう。

updateHeight() window の高さを再描画します。Windowのコンテンツを変えたときにスクローリングさせたくない場合に効果的でしょう。

toFront() 現在のWindowを最前面に持ってきます。

show(modal) windowを現在の位置で表示させます。

modal (default false) モーダルウインドウとして扱うかどうか

showCenter(modal, top, left) window をページの中央に見せるかどうか。縦方向のみを中央にしたいか・横方向のみを中央にしたいかを選べます。

modal (default false) top (default null) left (default null) モーダルとして扱うか

minimize() windowの最小化。最上部のバーだけが表示されます。

maximize() windowの最大化。 windowは現在のページの表示部分全体に広がります。

isMinimized() window が最小化されているかどうか

isMaximized() windowが最大化されているかどうか

setOpacity(opacity) windowの透明度を設定する

opacity 0(透明)から1(非透明)までの少数を設定

setZIndex(zindex) windowのzindexを設定

zindex Int 値

setTitle(title) Sets window のタイトルを設定

title Windowのタイトル(nullもOK)

setStatusBar(element) windowのステータスバーを設定します

element HTMLかDOMエレメントを指定します

Dialog module

アラート/確認/情報表示のモーダルダイアログウインドウを作るファクトリクラスです

confirm(content, options)OKとCancelの二つのボタンつきのモーダルダイアログを表示します。

content - content が文字列(HTMLコード)の場合は、ダイアログの中に表示されます。
- content がハッシュの場合は、Ajaxリクエストとして設定されます。つまりハッシュにはキーとして「url」などのAjaxクラスのおなじみのオプションが使えると言うことです。

options ダイアログを表示する為のオプションハッシュです。

キー 初期値 説明
top null トップの位置
left null 左の位置
okLabel Ok Okボタンのラベル
cancelLabel Cancel Cancelボタンのラベル
ok none Okが押された時にコールバックされる関数
cancel none Cancelが押された時にコールバックされる関数
buttonClass none OkとCancelボタンのCSSのクラス名
windowParameters (hash map) none Windowのコンストラクタのオプション

alert(content, options) アラート風のモーダルウインドウを開く (OKボタンのみ)

content - content が文字列(HTMLコード)の場合は、ダイアログの中に表示されます。
- content がハッシュの場合は、Ajaxリクエストとして設定されます。つまりハッシュにはキーとして「url」などのAjaxクラスのおなじみのオプションが使えると言うことです。

options ダイアログを表示する為のオプションハッシュです。

キー 初期値 説明
top null トップの位置
left null 左の位置
okLabel Ok Ok ボタンのラベル
okCallback none Ok ボタンが押されたときにコールバックされる関数
buttonClass none OkボタンのCSSクラス命
windowParameters (hash map) none Windowのコンストラクタのオプション

info(content, options) ボタンのないモーダルウインドウを開きます。進捗具合を示すプログレスバーを表示したりするのに使われます。

content - content が文字列(HTMLコード)の場合は、ダイアログの中に表示されます。
- content がハッシュの場合は、Ajaxリクエストとして設定されます。つまりハッシュにはキーとして「url」などのAjaxクラスのおなじみのオプションが使えると言うことです。

options ダイアログを表示する為のオプションハッシュです。

キー 初期値 説明
top null トップの位置
left null 左の位置
showProgress false プログレスイメージをつけるかどうか。 (info found in the css file)
windowParameters (hash map) none Windowのコンストラクタのオプション

setInfoMessage(message) 情報メッセージを表示する (32%終了・・などの進捗状況を示すのに表示される)

message 情報メッセージ(次々と更新させられる)

closeInfo() ウインドウを閉じる

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.