123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- $PBExportHeader$uo_tv_aifmb_class.sru
- forward
- global type uo_tv_aifmb_class from treeview
- end type
- end forward
- global type uo_tv_aifmb_class from treeview
- integer width = 773
- integer height = 1024
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- boolean hideselection = false
- string picturename[] = {"Application!","Structure5!","UserObject5!"}
- long picturemaskcolor = 536870912
- long statepicturemaskcolor = 536870912
- event ue_retrieve_all ( )
- event ue_retrieve ( )
- end type
- global uo_tv_aifmb_class uo_tv_aifmb_class
- type variables
- private:
- datastore ds_classgroup
- datastore ds_classnode
- datastore ds_relation
- long ins_root = 0
- end variables
- forward prototypes
- public subroutine uf_build_tree ()
- private subroutine pf_build_child (long arg_handle)
- public function s_aifmb_tvi pf_getdata (long arg_handle)
- public subroutine pf_getnodeid (long arg_handle, ref long arg_nodeid_arr[])
- end prototypes
- event ue_retrieve_all();uo_aifmb = Create uo_aifmb
- String ls_msg
- IF uo_aifmb.uf_sync_node(ls_msg) <> 1 THEN
- MessageBox('ERROR', ls_msg)
- GOTO ext
- END IF
- uf_build_tree()
- ext:
- Destroy uo_aifmb
- end event
- event ue_retrieve();uo_aifmb = Create uo_aifmb
- String ls_msg
- IF uo_aifmb.uf_sync_node_bytime(ls_msg) <> 1 THEN
- MessageBox('ERROR', ls_msg)
- GOTO ext
- END IF
- uf_build_tree()
- ext:
- Destroy uo_aifmb
- end event
- public subroutine uf_build_tree ();IF ins_root > 0 THEN
- This.DeleteItem(ins_root)
- END IF
- ds_classgroup.SetTransObject(sqlca)
- ds_classnode.SetTransObject(sqlca)
- ds_relation.SetTransObject(sqlca)
- ds_classgroup.Retrieve()
- ds_classnode.Retrieve()
- ds_relation.Retrieve()
- pf_build_child(0)
- ExpandAll(ins_root)
- SetFirstVisible(ins_root)
- end subroutine
- private subroutine pf_build_child (long arg_handle);s_aifmb_tvi s_data
- treeviewitem tvi
- Long ll_handles[]
- Long ll_cnt = 0, ll_handle
- Long i, j
- IF arg_handle = 0 THEN
- s_data.reltype = 1
- s_data.relid = 0
- tvi.Data = s_data
- tvi.PictureIndex = 1
- tvi.SelectedPictureIndex = 1
- tvi.Label = '全部类别'
- ll_handle = This.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- ins_root = ll_handle
- END IF
- ELSE
- s_data = pf_getdata(arg_handle)
- IF s_data.reltype = 1 THEN
- ds_classgroup.SetFilter("parentid = " + String(s_data.relid))
- ds_classgroup.Filter()
- ds_relation.SetFilter("classid = " + String(s_data.relid))
- ds_relation.Filter()
-
- FOR i = 1 To ds_classgroup.RowCount()
- s_data.reltype = 1
- s_data.relid = ds_classgroup.Object.classid[i]
- tvi.Data = s_data
- tvi.PictureIndex = 2
- tvi.SelectedPictureIndex = 2
- tvi.Label = ds_classgroup.Object.ClassName[i]
- ll_handle = This.InsertItemLast(arg_handle, tvi)
- IF ll_handle > 0 THEN
- ll_cnt++
- ll_handles[ll_cnt] = ll_handle
- END IF
- NEXT
-
- FOR i = 1 To ds_relation.RowCount()
- j = ds_classnode.Find("nodeid = " + String(ds_relation.Object.nodeid[i]), 1, ds_classnode.RowCount())
- IF j > 0 THEN
- s_data.reltype = 2
- s_data.relid = ds_relation.Object.nodeid[i]
- tvi.Data = s_data
- tvi.PictureIndex = 3
- tvi.SelectedPictureIndex = 3
- tvi.Label = ds_classnode.Object.nodename[j] + '['+ds_classnode.Object.nodecode[j]+']'
- ll_handle = This.InsertItemLast(arg_handle, tvi)
- END IF
- NEXT
- END IF
- END IF
- FOR i = 1 To ll_cnt
- pf_build_child(ll_handles[i])
- NEXT
- end subroutine
- public function s_aifmb_tvi pf_getdata (long arg_handle);s_aifmb_tvi rslt
- rslt.reltype = 0
- rslt.relid = 0
- treeviewitem tvi
- IF arg_handle > 0 THEN
- IF This.GetItem(arg_handle, tvi) = 1 THEN
- IF Not IsNull(tvi.Data) THEN
- rslt = tvi.Data
- END IF
- END IF
- END IF
- RETURN rslt
- end function
- public subroutine pf_getnodeid (long arg_handle, ref long arg_nodeid_arr[]);s_aifmb_tvi s_data
- s_data = pf_getdata(arg_handle)
- Long i, j
- i = UpperBound(arg_nodeid_arr)
- IF s_data.reltype = 0 THEN
- arg_nodeid_arr[1] = 0
- ELSEIF s_data.reltype = 1 THEN
- Long ll_first
- ll_first = FindItem(ChildTreeItem!, arg_handle)
- DO WHILE ll_first > 0
- pf_getnodeid(ll_first, arg_nodeid_arr)
- ll_first = FindItem(NextTreeItem!, ll_first)
- LOOP
- ELSEIF s_data.reltype = 2 THEN
- FOR j = 1 To i
- IF arg_nodeid_arr[j] = s_data.relid THEN
- RETURN
- END IF
- NEXT
- arg_nodeid_arr[j] = s_data.relid
- END IF
- end subroutine
- on uo_tv_aifmb_class.create
- end on
- on uo_tv_aifmb_class.destroy
- end on
- event constructor;ds_classgroup = Create datastore
- ds_classnode = Create datastore
- ds_relation = Create datastore
- ds_classgroup.DataObject = 'ds_aifmb_classgroup'
- ds_classnode.DataObject = 'ds_aifmb_classnode'
- ds_relation.DataObject = 'ds_aifmb_relation'
- uf_build_tree()
- end event
- event destructor;Destroy ds_classgroup
- Destroy ds_classnode
- Destroy ds_relation
- end event
|