28/01/2014 MCAFEE SECURE 認證的網站

https://www.mcafeesecure.com/RatingVerify?ref=www.HongKongCupid.com

2013年6月11日 星期二

^*Dynamic create script to execute~~*{ 动态创建要执行的脚本 }**~^



*Dynamic create script to execute~~
*{ 动态创建要执行的脚本  }*~^*TestComposer.java*










<zk>
 <window apply="pkg$.Test
Composer">
  <div id="div" />
  <textbox id="tb" rows="3" value=
"input any script you want
 here"></textbox>
  <div />
  <button id="btn" label="click
me to execute the script
above"></button>
 </window>
</zk>



*Textbox input restriction sample*
**文本框輸入限制樣品**
*<textbox id="telNo" xmlns:w
="client" >
  <attribute w:name=
"doKeyPress_">
    function(evt){
         if(this.getValue().length > 0 ){
           if (!this._shallIgnore(evt, "0123456789"))
              this.$doKeyPress_(evt);
         }else{
           if (!this._shallIgnore
(evt, "05"))
              this.$doKeyPress_(evt);
         }
    }
  </attribute>
</textbox>               *


*Require user to enter uppercase 
 chars only in textbox*
*要求用戶只有文本框輸入大寫字符*
*
< xmlns:w="client">
  <textbox id="Test" >
    <attribute w:name="doKeyPress_">
      function(evt){
           if (!this._shallIgnore(evt, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
              this.$doKeyPress_(evt);
      }
    </attribute>
   
  </textbox>
</zk>
*


*ckeditor startup with source mode*
*CKEDITOR源模式啟動*
*<  xmlns:w="
2005/zk/client">

 <ckeditor>
  <attribute w:name="bind_">
   function () {
    // set the startup mode
    CKEDITOR.config.startupMode =
 'source';
    //call the original method
    this.$bind_();
   }
  </attribute>
 </ckeditor>
</       *



*修改列表框選擇狀態組成*
*<zk>
  <window border="normal" title="hello" apply="pkg$.TestComposer">
 
   <div>Welcome to ZK Fiddle , run it right now!</div>
 
  <listbox id="box" multiple="true">
        <listhead sizable="true">
            <listheader label="label one" sort="auto" />
            <listheader label="label two" sort="auto" />
        </listhead>
        <listitem>
            <listcell label="data 1-1" />
            <listcell label="data 1-2" />
        </listitem>
        <listitem>
            <listcell label="data 2-1" />
            <listcell label="data 2-2" />
        </listitem>
        <listitem>
            <listcell label="data 3-1" />
            <listcell label="data 3-2" />
        </listitem>
        <listitem>
            <listcell label="data 4-1" />
            <listcell label="data 4-2" />
        </listitem>
    </listbox>
  </window>
</zk>
*


*Change Implementation of
Component, listbox getSelectedItem*
*更改組件,列表框getSelectedItem實施*
*<?init class="org.zkoss.zkplus.
databind.AnnotateDataBinderInit" ?>
<zk>
 <zscript>
  class customListbox extends org.zkoss.zul.Listbox {
   public Listitem getSelectedItem() {
    Listitem li = super.getSelectedItem();
    if (li == null) {
     // get first item if no one is selected
     li = getItemAtIndex(0);
    }
    if (li == null) {
     // create an invalid item if no 
 item in listbox
     li = new Listitem();
     People p = new People();
     p.setName("Invalid Name");
     p.setAge(999);
     li.setValue(p);
    }
    return li;
   }
  }
  page.getComponent
Definition("listbox", true).setImplementationClass(customListbox.class);
  // the class of people
  class People {
   String name;
   int age;
 
   public void setName
(String name) {
    this.name = name;
   }
   public void setAge(int age) {
    this.age = age;
   }
   public String getName() {
    return name;
   }
   public int getAge() {
    return age;
   }
  }
  // create data list
  List lpeoples = new ArrayList();
  List lpeoplesEmpty =
 new ArrayList();
  for (int i = 15;i != 20;i ++) {
   People p = new People();
   p.setName("Name "+i);
   p.setAge(i);
   lpeoples.add(p);
  }
 </zscript>
 <html><![CDATA[
  <ol>
   <li> check / uncheck the
&quot;clear data&quot;
 checkbox to clear
/ restore the data</li>
   <li> the value will show
 in textbox when header double
_clicked</li>
   <li> if an item selected,
 selected item is that one</li>
   <li> if no item selected,
 selected item is the first item</li>
   <li> if no item in listbox, will 
 create an invalid one</li>
  </ol>
  ]]>
 </html>
 <vbox>
  <checkbox label="clear data">
   <attribute name="onCheck">
    if (self.checked)
     listOfPeople.setModel(new BindingListModelList
(lpeoplesEmpty, true));
    else
     listOfPeople.setModel(new BindingListModelList(lpeoples, true));
   </attribute>
  </checkbox>
  <hbox>
   name: <textbox id="sName" />
  </hbox>
  <hbox>
   age: <textbox id="sAge" />
  </hbox>
 </vbox>
 <listbox id="listOfPeople"
 checkmark="true" multiple=
"true" model="@{lpeoples}"
  value="@{peopleData}"
 selectedItem="@{selectedPeople}">
  <listhead sizable="true">
   <attribute name="onDoubleClick">
    People p = (People)listOfPeople.getSelectedItem().
getValue();
    sName.setValue(p.getName());
    sAge.setValue(p.getAge().
toString());
   </attribute>
   <listheader label="Name"/>
   <listheader label="Age"/>
  </listhead>
  <listitem self="@{each=people}"
 value="@{people}">
   <listcell label="@{people.name}"/>
   <listcell label="@{people.age}"/>
  </listitem>
 </listbox>
</zk>        *


********************&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

沒有留言:

張貼留言


if you like make fds, wellcome you here~~anytime***

my free place for everyones who want the good software,

come & download them~ wellcome!!