blob: 821b20f51b90228d40b99a8a2586fd475dd793d5 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<library>
<!--- private class for turnOverList only. -->
<class name="innerList" layout="axis:y;spacing:1" />
<!--- common TurnOverList view class. -->
<class name="turnOverList" extends="view" >
<attribute name="start" value="0" type="number" />
<attribute name="step" value="100" type="number" />
<attribute name="orderby" value="firstname" type="string" />
<attribute name="asc" value="true" type="boolean" />
<attribute name="records" value="0" type="number" />
<attribute name="_selected" value="null"/>
<attribute name="currentSelectedOrder" value="null" />
<attribute name="mainBgColor" value="0xEEF0EB" />
<event name="oncallnext" />
<event name="oncallpre" />
<event name="ondblclickedItem" />
<event name="onUpdateOrder" />
<method name="callfirst">
this.start = 0;
this.oncallnext.sendEvent();
</method>
<method name="clearSelection">
if (this._selected != null) {
this._selected.deselect();
}
</method>
<handler name="onclickedItem" args="itemObj">
if (this._selected != null) {
this._selected.deselect();
}
this._selected = itemObj;
this._selected.select();
</handler>
<method name="calllast">
var newMaxPages = Math.floor(this.records/this.step);
if ($debug) Debug.write("calllast 1 ",newMaxPages);
this.start = newMaxPages*this.step;
if ($debug) Debug.write("calllast 2 ",this.start);
if (this.start == this.records) {
this.start = this.records-this.step;
}
if ($debug) Debug.write("calllast 3 ",this.start);
if ($debug) Debug.write("calllast 4 ",this.records);
this.oncallnext.sendEvent();
this.onload.sendEvent();
//this.start = this.records-this.step;
//this.oncallnext.sendEvent();
</method>
<method name="callnext">
this._next1.setAttribute('enabled',false);
this._pre2.setAttribute('enabled',false);
if (this.records>(this.start+this.step)){
this.start+=this.step;
}
this.oncallnext.sendEvent();
</method>
<method name="callpre">
this._next1.setAttribute('enabled',false);
this._pre2.setAttribute('enabled',false);
if (this.start>0){
this.start-=this.step;
}
this.oncallpre.sendEvent();
</method>
<method name="initValues" args="rec">
<![CDATA[
this.records = rec;
if (this.records>(this.start+this.step)){
this._next1.setAttribute('enabled',true);
} else {
this._next1.setAttribute('enabled',false);
}
if (this.start>0){
this._pre2.setAttribute('enabled',true);
} else {
this._pre2.setAttribute('enabled',false);
}
this._records.setAttribute('text',this.start + ' - ' +(this.start+this.step) + ' ' + canvas.getLabelName(272) + ' ' + this.records);
]]>
</method>
<method name="addHeaderItem" args="labelid,width" >
new lz.turnOverListHeaderItem(this._innerlisthead._inn,{labelid:labelid,width:width,subviewsid:this._innerlisthead._inn.subviews.length});
</method>
<method name="addHeaderItemOrdered" args="labelid,width,orderBy,asc,isSelected" >
new lz.turnOverListHeaderItemOrdered(this._innerlisthead._inn,{
labelid:labelid,width:width,
orderBy:orderBy,asc:asc,isSelected:isSelected,
subviewsid:this._innerlisthead._inn.subviews.length
});
</method>
<method name="updateOrder" args="itemRef">
<![CDATA[
//only do that if the previous orderBy != new orderby
//if (this.currentSelectedOrder == null ||
// this.currentSelectedOrder.orderBy != itemRef.orderBy){
if (itemRef.isSelected) {
itemRef.asc = !itemRef.asc;
} else {
itemRef.isSelected = true;
}
if (itemRef.asc) {
itemRef._sortUp.setAttribute('visibility','hidden');
itemRef._sortDown.setAttribute('visibility','visible');
} else {
itemRef._sortUp.setAttribute('visibility','visible');
itemRef._sortDown.setAttribute('visibility','hidden');
}
//do not perform search on initial Selection
var isInitSelect = false;
if (this.currentSelectedOrder != null) {
if (this.currentSelectedOrder.orderBy != itemRef.orderBy) {
this.currentSelectedOrder.isSelected = false;
this.currentSelectedOrder._sortUp.setAttribute('visibility','hidden');
this.currentSelectedOrder._sortDown.setAttribute('visibility','hidden');
}
} else {
isInitSelect = true;
}
this.currentSelectedOrder = itemRef;
if ($debug) Debug.write("updateOrder: ",itemRef,itemRef.orderBy,itemRef.asc,isInitSelect);
this.setAttribute('orderby',itemRef.orderBy);
this.setAttribute('asc',itemRef.asc);
if (!isInitSelect){
this.onUpdateOrder.sendEvent(itemRef);
}
//}
]]>
</method>
<method name="sendInitialWidthUpdate">
for (var eg in this._innerlisthead._inn.subviews) {
this._innerlisthead._inn.subviews[eg].onwidth.sendEvent(this._innerlisthead._inn.subviews[eg].width);
}
</method>
<method name="sendWidthUpdate" args="w,subviewsid" >
<![CDATA[
////Debug.write(w,subviewsid,this._innerlist._inn);
for (var i=0;i<this._innerlist._inn._inn.subviews.length;i++){
this._innerlist._inn._inn.subviews[i].subviews[subviewsid].setAttribute('width',w);
}
]]>
</method>
<method name="clearList">
this._selected = null;
this._innerlist._inn._inn.destroy();
new lz.innerList(this._innerlist._inn,{name:'_inn'});
</method>
<!-- ========= Control area =========-->
<labelText name="_records" x="2" resize="true" />
<!-- 368:goto first -->
<blueButton name="_pre1" y="0" x="$once{ parent.width-188 }" resourceItem="step_back_two_arrow"
x_insetResource="2" y_insetResource="2" width="20" height="20"
width_insetResource="16" height_insetResource="16" >
<handler name="onclick">
parent.callfirst();
</handler>
<labelTooltip labelid="368" />
</blueButton>
<!-- 369:goto previous -->
<blueButton name="_pre2" y="0" x="$once{ parent.width-166 }" resourceItem="step_back_arrow"
x_insetResource="2" y_insetResource="2" width="20" height="20"
width_insetResource="16" height_insetResource="16">
<handler name="onclick">
parent.callpre();
</handler>
<labelTooltip labelid="369" />
</blueButton>
<!-- combobox to decide the step number -->
<resetCombobox name="languages" width="96" x="$once{ parent.width-144 }"
editable="false" height="20" >
<attribute name="sendEventToReload" value="false" type="boolean" />
<textlistitem value="10" text="10" />
<textlistitem value="25" text="25" />
<textlistitem value="50" text="50" />
<textlistitem value="75" text="75" />
<textlistitem value="100" text="100" />
<textlistitem value="200" text="200" />
<handler name="onselect">
if (this.sendEventToReload){
parent.setAttribute('step',Number(this.getValue()));
}
</handler>
<handler name="oninit">
this.selectItem(String(parent.step));
this.sendEventToReload = true;
</handler>
</resetCombobox>
<!-- 370:goto next -->
<blueButton name="_next1" y="0" x="$once{ parent.width-44 }" resourceItem="step_fwd_arrow"
x_insetResource="2" y_insetResource="2" width="20" height="20"
width_insetResource="16" height_insetResource="16">
<handler name="onclick">
parent.callnext();
</handler>
<labelTooltip labelid="370" />
</blueButton>
<!-- 371:goto last -->
<blueButton name="_next2" y="0" x="$once{ parent.width-21 }" resourceItem="step_fwd_two_arrow"
x_insetResource="2" y_insetResource="2" width="20" height="20"
width_insetResource="16" height_insetResource="16">
<handler name="onclick">
parent.calllast();
</handler>
<labelTooltip labelid="371" />
</blueButton>
<!-- ========= BgArea area =========-->
<view width="$once{ parent.width }" bgcolor="$once{ canvas.getThemeColor('mainBorderColor') }"
height="${ parent.height-20 }" x="0" y="20">
<view width="$once{ parent.width-2 }" bgcolor="$once{ parent.parent.mainBgColor }"
height="${ parent.height-2 }" x="1" y="1"></view>
</view>
<!-- ========= List Header area =========-->
<view name="_innerlisthead" height="20" x="1" width="$once{ parent.width-2 }"
y="22" clip="true">
<view name="_inn" x="${ parent.parent._innerlist._inn.x }" layout="axis:x;spacing:0" />
</view>
<!-- ========= List Contents area =========-->
<view name="_innerlist" height="${ parent.height-43 }" x="1" width="$once{ parent.width-2 }"
y="42" clip="true" bgcolor="$once{ parent.mainBgColor }">
<view name="_inn" >
<innerList name="_inn" />
</view>
<om_vscrollbar />
<om_hscrollbar />
</view>
</class>
</library>