<hlayout height="160px" width="260px">
<listbox id="candidateLb" hflex="1" vflex="true" multiple="true" rows="8">
<listhead>
<listheader label="合同成品" width="80px" ></listheader>
</listhead>
</listbox>
<vbox spacing="10px" width="24px">
<image style="cursor:pointer" id="chooseAllBtn" src="/img/rightrightarrow_g.png" />
<image style="cursor:pointer" id="chooseBtn" src="/img/rightarrow_g.png" />
<image style="cursor:pointer" id="removeBtn" src="/img/leftarrow_g.png" />
<image style="cursor:pointer" id="removeAllBtn" src="/img/leftleftarrow_g.png" />
</vbox>
<listbox id="chosenLb" hflex="1" vflex="true" multiple="true" rows="8">
<listhead>
<listheader label="已選成品" width="80px"></listheader>
</listhead>
<template name="model">
<listitem>
</listitem>
</template>
</listbox>
</hlayout>
java页面处理
public void onClick$chooseBtn() throws Exception{
if(candidateLb.getSelectedIndex()<0) {
MyMessagebox.info("請選中合同成品資料.");
return;
}
String files=this.candidateLb.getSelectedItem().getValue();
candidateLb.removeItemAt(candidateLb.getSelectedIndex());
chosenLb.appendItem(files,files);
}
public void onClick$removeBtn() throws Exception{
if(chosenLb.getSelectedIndex()<0){
MyMessagebox.info("請選中已選成品資料.");
return;
}
String files=this.chosenLb.getSelectedItem().getValue();
chosenLb.removeItemAt(chosenLb.getSelectedIndex());
candidateLb.appendItem(files,files);
}
public void onClick$chooseAllBtn() throws Exception{
if(lstcontractno.getSelectedIndex()<0) return;
chosenLb.getItems().clear();
String parax=lstcontractno.getSelectedItem().getValue().toString().toUpperCase();
JdbcDao dao=JdbcFactory.getDgWofeJdbcDao(plant);
String sql=" select sequenceno||'.'||itemno as consumelst from ct_t_contractitem where class='0' AND contractid='"+parax+"'";
ArrayList<LinkedHashMap> lstRet= dao.query(sql);
for(LinkedHashMap map: lstRet){
chosenLb.appendItem((String)map.get("CONSUMELST"),(String)map.get("CONSUMELST"));
}
candidateLb.getItems().clear();
}
public void onClick$removeAllBtn() throws Exception{
onSelect$lstcontractno(); //查询出来的所有资料
chosenLb.getItems().clear();
}
获得已选资料的笔数 this.chosenLb.getItems().size();
获得已选资料 (因我的资料是两个栏位合成,所有有进行字符截取)
String sequence_no="",item_no="";
List<Listitem> list = this.chosenLb.getItems();
if(list != null){
int index = 0;
double c = ((double) list.size())/5;
index=(int) Math.ceil(c);
for(int i = 0; i < list.size(); i++){
String itemx = list.get(i).getValue();
String a[] = itemx.split("\\."); //截取字符串
if(i < list.size()-1){
sequence_no+="'"+a[0]+"',";
item_no+="'"+a[1]+"',";
}else{
sequence_no+="'"+a[0]+"'";
item_no+="'"+a[1]+"'";
}
}
}