2008年2月9日土曜日

やはり最後は。

自分が風邪を。
一日4時間睡眠を考えると二日分寝る事になる。すごいな。睡眠時間て。
いろいろやりたいことあるのになー。
でもそんなのかんけいなく眠い。
そういえばビリーとあってないな。
コシマワリがふよついてきたな。
外は大雪。
大変だ。

ねよ。

2008年2月7日木曜日

ExtJs-4(Widgetsの1)

今日はウィジェット。
チュートリアルをなめるだけだけど、毎日少しづつやるだけでも
気分がよい。

早速、
■MessageBox
メッセージボックスが出た。
なにせ、パラメータが多い。でも、いろいろ備わってて面白い。
サンプル貼り付けるだけで満足だわな。
モーダル、モードレスもあるし、
シングルライン、マルチラインのIFも持っててコールバックで取れるし。
面白くなってきた。

        //--- onReadyの分割テスト ---
Ext.onReady(
function()
{
var processResult = function( btn, text )
{
Ext.MessageBox.alert( btn + text )

}
//--- チュートリアル3(イベントハンドらに名前をつける) ---
//--- イベントハンドラを別定義 ---
var highlight = function()
{
Ext.select('p').highlight();
}
//--- 引数つきのイベントハンドラ ---
var highlight_arg = function(e)
{
//Ext.get( e.target ).highlight
//--- チュートリアル ---
var paragraph = Ext.get(e.target);
paragraph.highlight();
// Ext.MessageBox.show(
// {
// title: 'Paragraph Clicked',
// msg: paragraph.dom.innerHTML,
// width:400,
// buttons: Ext.MessageBox.OK,
// animEl: paragraph
// }
// );

//--- リファレンスサンプル ---
//alert( String title, String msg, [Function fn], [Object scope] )
//title : String
//The title bar text
//msg : String
//The message box body text
//fn : Function
//(optional) The callback function invoked after the message box is closed
//scope : Object
//(optional) The scope of the callback function
// Basic alert:
// Ext.Msg.alert('Status', 'Changes saved successfully.');

// Prompt for user data and process the result using a callback:
// Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
// if (btn == 'ok'){
// // process text value and close...
// }
// });

// Showメソッドのパラメータは多いなぁ。
//Property Type Description
//---------------- --------------- -----------------------------------------------------------------------------
//animEl String/Element An id or Element from which the message box should animate as it opens and
// closes (defaults to undefined)
//buttons Object/Boolean A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',
// cancel:'Bar'}), or false to not show any buttons (defaults to false)
//closable Boolean False to hide the top-right close button (defaults to true). Note that
// progress and wait dialogs will ignore this property and always hide the
// close button as they can only be closed programmatically.
//cls String A custom CSS class to apply to the message box element
//defaultTextHeight Number The default height in pixels of the message box's multiline textarea if
// displayed (defaults to 75)
//fn Function A callback function to execute after closing the dialog. The arguments to the
// function will be btn (the name of the button that was clicked, if applicable,
// e.g. "ok"), and text (the value of the active text field, if applicable).
// Progress and wait dialogs will ignore this option since they do not respond to
// user actions and can only be closed programmatically, so any required function
// should be called by the same code after it closes the dialog.
//icon String A CSS class that provides a background image to be used as an icon for
// the dialog (e.g., Ext.MessageBox.WARNING or 'custom-class', defaults to '')
//maxWidth Number The maximum width in pixels of the message box (defaults to 600)
//minWidth Number The minimum width in pixels of the message box (defaults to 100)
//modal Boolean False to allow user interaction with the page while the message box is
// displayed (defaults to true)
//msg String A string that will replace the existing message box body text (defaults
// to the XHTML-compliant non-breaking space character ' ')
//multiline Boolean True to prompt the user to enter multi-line text (defaults to false)
//progress Boolean True to display a progress bar (defaults to false)
//progressText String The text to display inside the progress bar if progress = true (defaults to '')
//prompt Boolean True to prompt the user to enter single-line text (defaults to false)
//proxyDrag Boolean True to display a lightweight proxy while dragging (defaults to false)
//title String The title text
//value String The string value to set into the active textbox element if displayed
//wait Boolean True to display a progress bar (defaults to false)
//waitConfig Object A Ext.ProgressBar.waitConfig object (applies only if wait = true)
//width Number The width of the dialog in pixels
// Show a dialog using config options:
Ext.Msg.show({
title:'Save Changes?',
msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
buttons: Ext.Msg.YESNOCANCEL,
fn: processResult,
animEl: 'elId',
icon: Ext.MessageBox.QUESTION,
modal:true,
prompt: true
}
);



}
//--- pタグのイベントハンドラ ---
//Ext.select('p').on('click', highlight );
Ext.select('p').on('click', highlight_arg );
}//function
);//OnReaady

いんふるえんざ

昨晩、残業して終電。
夜中の一時ごろ嫁さんが降りてきて
熱があるととのこと。
39ども。


入社したてで有給のない私にとって
休むことはぺなるてぃだがそうもいってられない。
ので本日は休みをとって
家事全般を。

普段嫁さんがどんだけつかれてんのかっていうのを
身をもって感じた。

長女の世話
次女の世話
朝食
掃除
洗濯
昼食作り
次女の世話
長女お迎え
長女、次女の相手
風呂掃除
夕食作り
風呂入れ(長女、次女)
夕食
夕食かたずけ
寝かしつけ
明日の長女の準備等

本日思う限りやった成果だが、
おそらくまだ抜けがあるだろう。
われながらよくドライブできたなぁ。と。

ちなみに夕食はシチューと
炒め物。さいころステーキ。と
三品作った。明日もだめそうだからってことで作りおき。

夜、嫁さん実家の母がきてくれた。
業務期日、リソースが逼迫してきている中での
この事件はいたすぎる。

2008年2月6日水曜日

ExtJs-3(イベントハンドラ)

■インラインじゃないイベントハンドラ
function定義の中に直接実装するインラインのほかにちゃんと
いべんとはんどらに名前を持たせることができるということ。

■OnReadyをまたぐとだめ。
スコープは同一のOnReady内。
先日のOnReadyを分割して記述してみるって書いたけど、
イベントハンドラ実装と使用箇所は同一のOnReady内で記載されなければならない。
っぽい。

使用したオブジェクトを指定された場合は
・OnReady
・イベントハンドラ実装
・イベント実装
のセットで吐き出してあげる必要があるってことかな?

■イベントハンドらのパラメータ3つあるらしい。
チュートリアルより
・発生したイベント
・イベントID(?)
・いまいちわからん

■その他として
・elementのSet/GetのX,Yで位置をずらせるってことがわかった。
 これだけでもすごい収穫。
・TabPanelが思った以上に簡単にできることにおどろいた。
 これもつかえるなぁ。。
 (APIリファレンス多すぎ。。。)
 var tabs = new Ext.TabPanel({
renderTo: 'my-tabs',
activeTab: 0,
items:[
{contentEl:'tab1', title:'Tab 1'},
{contentEl:'tab2', title:'Tab 2'}
]
});

HTML側で
<div id="my-tabs"></div>
<div id="tab1" class="x-hide-display">
<p>タブ1</p>
</div>
<div id="tab2" class="x-hide-display">
<p>タブ1</p>
</div>


■構成イメージ
ASPX側でDBからオブジェクト情報拾って
その分のDivタグを生成してみる
その際、X、Y座標等も当然DBにて管理
OnReady内でElement取得してDB情報を反映

2008年2月5日火曜日

ExtJs-2(OnReadyは多重で書いても関係ない)

イベントハンドラのサンプルを試す。
きになったのでOnReadyを分割してみる。
問題ない。

※使用したいメソッドをのレンダリング情報生成の際、
OnReadyの開始と終了を把握して作成しなくてもよいということ。

 //--- ライブラリ定義 ---

<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
<script type="text/javascript" src="./ext-2.0.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="./ext-2.0.1/ext-all-debug.js"></script>
<link rel="stylesheet" type="text/css" href="./ext-2.0.1/resources/css/ext-all.css" />

<script type="text/javascript"><!--
Ext.onReady(
function(){
//--- チュートリアル ---
var myDiv = Ext.get('myDiv');
myDiv.highlight(); // 要素の背景が黄色にハイライトされ、もとの色に戻っていきます
myDiv.addClass('red'); // カスタムCSSクラスを追加します(ExtStart.cssで定義してある)
myDiv.center(); // 要素をセンタリングします
myDiv.setOpacity(.25); // 要素を部分透過にします

//--- チュートリアル2(select) ---
Ext.select('p').highlight();

//--- ボタンイベントハンドラ定義 ---
Ext.get('myButton').on('click',
function()
{
alert("You clicked the button");
}
);
}//function
);//OnReaady

//--- onReadyの分割テスト ---
Ext.onReady(
function(){
//--- pタグのイベントハンドラ ---
Ext.select('p').on('click',
function()
{
alert("You clicked a paragraph");
}
);
}//function
);//OnReaady
//--></script>

2008年2月4日月曜日

雪の影響

昨日からのゆきで自転車が出せず。
バスも遅れて、かつ考え事してたら降りるバス停乗り過ごした。
しまいにゃ凍った路面で滑りそうになり、
向こうから自転車で走ってきた野球部らしい学生を焦らせ、学生も若干スリップしてお互い微妙に恥ずかしくなったりと
雪による影響は大きい。

ExtJs-1(イントロダクションとExt.get)

会社ではWebアプリをやり始めた。
もう四年のブランクがある。

で、ASP.NETの学習を久々に。
その過程で
会社のYさんにExtJSの存在をおしえてもらった。
ので学習しよう。


(XOOPS,OPenPNE)の学習ももちろん。
浮気だ。

■Ext JS
http://extjs.com/
イントロダクションから。
http://homepage3.nifty.com/a-itou/javascript/introduction-ext.html

■やりたいこと
・ASP.NETサイドでHTMLレンダリング情報の生成
・ExtJS使って動的操作(ASP.NETでリテラル排出)
というしくがつくってみたい。
それでで、D&DでDB情報を加工できるボックスを作りたい。
この仕組みさえできればやりたいことがどんどん可能に?

■環境はもちろんVS2008で。
JavaScriptデバッグ機能使ってみたいし。
さらっと動かしてみてブレイク、ウォッチができるのはめからうろこ。

で、Extなんだけど、
①ライブラリ読み込み
②チュートリアル
var myDiv = Ext.get('myDiv');
myDiv.highlight(); // 要素の背景が黄色にハイライトされ、もとの色に戻っていきます
myDiv.addClass('red'); // カスタムCSSクラスを追加します(ExtStart.cssで定義してある)
myDiv.center(); // 要素をセンタリングします
myDiv.setOpacity(.25); // 要素を部分透過にします

冒頭のこれで結構感動。
サンプルでもかんどうしてたけど、所詮は作ってもらったものをみただけ。
ただコピペしただけだけど、実際じぶんでやってみると、面白いぞこれ。

サンプルは山ほどあるので
少し筒噛み砕いて形づくっていこう。

node + ejs + Socket.io のサンプル

まずい。。 一年間、一回も更新してない!!! つまり、、 趣味の時間がほぼ皆無ということの現れです。 業務と子育てに追われた一年でしたね。。。。。 危なく年をこすところだった。あぶない。なぶあい。 話を変えて。 今月初旬に 社内でちょっとしたプレゼンをする事に...