File: w_main.srw
Size: 25661
Date: Tue, 22 Aug 2017 17:30:58 +0200
$PBExportHeader$w_main.srw
forward
global type w_main from window
end type
type mdi_1 from mdiclient within w_main
end type
type st_splitbar from u_splitbar_vertical within w_main
end type
type st_treeview from statictext within w_main
end type
type dw_props from u_base_datawindow within w_main
end type
type st_entityname from statictext within w_main
end type
type tv_tree from treeview within w_main
end type
type str_point from structure within w_main
end type
type str_minmaxinfo from structure within w_main
end type
end forward

type str_point from structure
   long     lx
   long     ly
end type

type str_minmaxinfo from structure
   str_point      ptreserved
   str_point      ptmaxsize
   str_point      ptmaxposition
   str_point      ptmintracksize
   str_point      ptmaxtracksize
end type

global type w_main from window
integer width = 3474
integer height = 2068
boolean titlebar = true
string title = "JagMan Repository Editor"
string menuname = "m_main"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
windowtype windowtype = mdihelp!
long backcolor = 67108864
string icon = "AppIcon!"
event ue_minmaxinfo pbm_getminmaxinfo
event ue_print ( boolean ab_options )
event m_editproperty ( )
event m_addproperty ( )
event m_deleteproperty ( )
mdi_1 mdi_1
st_splitbar st_splitbar
st_treeview st_treeview
dw_props dw_props
st_entityname st_entityname
tv_tree tv_tree
end type
global w_main w_main

type prototypes
Subroutine GetMinMaxInfo ( &
   Ref str_minmaxinfo d, &
   long s, &
   long l &
   ) Library "kernel32.dll" Alias For "RtlMoveMemory"

Subroutine SetMinMaxInfo ( &
   long d, &
   str_minmaxinfo s, &
   long l &
   ) Library "kernel32.dll" Alias For "RtlMoveMemory"

end prototypes
type variables
Long il_root

end variables

forward prototypes
public subroutine wf_load_conncache (long al_handle)
public subroutine wf_load_package (long al_handle)
public subroutine wf_load_server (long al_handle)
public subroutine wf_parse_csv (string as_list, ref string as_array[])
public subroutine wf_load_webcomponent (long al_handle, string as_webapplication)
public subroutine wf_load_webapplication (long al_handle)
public subroutine wf_load_application (long al_handle)
public subroutine wf_load_serverfolders (long al_handle, string as_server)
public subroutine wf_load_properties (string as_entitytype, string as_entityname)
public subroutine wf_load_component (long al_handle, string as_package)
end prototypes

event ue_minmaxinfo;str_minmaxinfo lstr_minmaxinfo

// copy the data to local structure
Getminmaxinfo(lstr_minmaxinfo, minmaxinfo, 40)

// set the minimum size for our window
lstr_minmaxinfo.ptMinTrackSize.lx = 400
lstr_minmaxinfo.ptMinTrackSize.ly = 300

// set the maximum size for our window
//lstr_minmaxinfo.ptMaxTrackSize.lx = 700
//lstr_minmaxinfo.ptMaxTrackSize.ly = 500

// copy the structure back into memory
Setminmaxinfo(minmaxinfo, lstr_minmaxinfo, 40)

// important: must return 0
Return 0

end event

event ue_print(boolean ab_options);s_print_options lstr_opt

If dw_props.RowCount() > 0 Then
   If ab_options Then
      OpenWithParm(w_report_options, dw_props)
      lstr_opt = Message.PowerObjectParm
      If lstr_opt.b_ok Then
         dw_props.Print()
      End If
   Else
      dw_props.Print()
   End If
End If

end event

event m_editproperty();// edit selected property

Long ll_row

ll_row = dw_props.GetRow()
If ll_row > 0 Then
   OpenWithParm(w_edit_property, ll_row)
End If

end event

event m_addproperty();// add a new property

If dw_props.RowCount() > 0 Then
   OpenWithParm(w_edit_property, 0)
End If

end event

event m_deleteproperty();// delete selected property

Integer li_rc
Long ll_row
String ls_entitytype, ls_entityname, ls_property, ls_msg

ll_row = dw_props.GetRow()
If ll_row = 0 Then Return

ls_entitytype = dw_props.GetItemString(ll_row, "entitytype")
ls_entityname = dw_props.GetItemString(ll_row, "entityname")
ls_property   = dw_props.GetItemString(ll_row, "property")

ls_msg  = "Are you sure you want to delete "
ls_msg += "'" + ls_property + "'?"

li_rc = MessageBox(this.title + " - Warning", ls_msg, &
            Question!, YesNo!)
If li_rc = 1 Then
   gn_conn.of_del_jagproperty(ls_entitytype, ls_entityname, ls_property)
   wf_load_properties(ls_entitytype, ls_entityname)
End If

end event

public subroutine wf_load_conncache (long al_handle);View l_conncache
TreeViewItem ltvi_item
Long ll_row, ll_max

SetPointer(HourGlass!)

// get a view of all connection caches
TRY
   l_conncache = g_repository.Items("ConnCache", "")
CATCH ( lookuperror lue_cnc )
   MessageBox("ConnCache Items Error - " + lue_cnc.reason, &
            lue_cnc.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_conncache.Item)
FOR ll_row = 1 TO ll_max
   // add connection cache to tree
   ltvi_item.Label = l_conncache.Item[ll_row].Item[3]
   ltvi_item.Data = al_handle
   ltvi_item.PictureIndex = 7
   ltvi_item.SelectedPictureIndex = 7
   tv_tree.InsertItemLast(al_handle, ltvi_item)
NEXT

end subroutine

public subroutine wf_load_package (long al_handle);View l_package
TreeViewItem ltvi_item
Long ll_row, ll_max

SetPointer(HourGlass!)

// get a view of all packages
TRY
   l_package = g_repository.Items("Package", "")
CATCH ( lookuperror lue_pkg )
   MessageBox("Package Items Error - " + lue_pkg.reason, &
            lue_pkg.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_package.Item)
FOR ll_row = 1 TO ll_max
   // add package to tree
   ltvi_item.Label = l_package.Item[ll_row].Item[3]
   ltvi_item.Data = al_handle
   ltvi_item.PictureIndex = 4
   ltvi_item.SelectedPictureIndex = 4
   ltvi_item.Children = True
   tv_tree.InsertItemLast(al_handle, ltvi_item)
NEXT

end subroutine

public subroutine wf_load_server (long al_handle);View l_server
TreeViewItem ltvi_item
Long ll_row, ll_max, ll_handle

SetPointer(HourGlass!)

// get a view of all servers
TRY
   l_server = g_repository.Items("Server", "")
CATCH ( lookuperror lue_srv )
   MessageBox("Server Items Error - " + lue_srv.reason, &
            lue_srv.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_server.Item)
FOR ll_row = 1 TO ll_max
   // add server to tree
   ltvi_item.Label = l_server.Item[ll_row].Item[3]
   ltvi_item.Data = al_handle
   ltvi_item.PictureIndex = 8
   ltvi_item.SelectedPictureIndex = 8
   ltvi_item.Children = True
   ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)
NEXT

end subroutine

public subroutine wf_parse_csv (string as_list, ref string as_array[]);// parse out comma separated values into array

Long ll_pos, ll_cnt, ll_start
String ls_empty[]
Integer li_next

as_array = ls_empty
as_list = Trim(as_list)
If Right(as_list, 1) <> "," Then
   as_list = as_list + ","
End If

ll_start = 1
ll_pos = Pos(as_list, ",", ll_start)
do while ll_pos > 1
   li_next = UpperBound(as_array) + 1
   as_array[li_next] = Mid(as_list, ll_start, (ll_pos - ll_start))
   ll_start = ll_pos + 1
   ll_pos = Pos(as_list, ",", ll_start)
loop

end subroutine

public subroutine wf_load_webcomponent (long al_handle, string as_webapplication);View l_webcomponents
TreeViewItem ltvi_item
Long ll_row, ll_max

SetPointer(HourGlass!)

// get a view of all components in the webapp
TRY
   l_webcomponents = g_repository.Items("Servlet", as_webapplication)
CATCH ( lookuperror lue_cmp )
   MessageBox("Web Component Items Error - " + lue_cmp.reason, &
            lue_cmp.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_webcomponents.Item)
FOR ll_row = 1 TO ll_max
   // add component to tree
   ltvi_item.Label = l_webcomponents.Item[ll_row].Item[2]
   ltvi_item.Data = al_handle
   ltvi_item.PictureIndex = 13
   ltvi_item.SelectedPictureIndex = 13
   tv_tree.InsertItemLast(al_handle, ltvi_item)
NEXT

end subroutine

public subroutine wf_load_webapplication (long al_handle);View l_webapplication
TreeViewItem ltvi_item
Long ll_row, ll_max

SetPointer(HourGlass!)

// get a view of all applications
TRY
   l_webapplication = g_repository.Items("WebApplication", "")
CATCH ( lookuperror lue_apl )
   MessageBox("Web Application Items Error - " + lue_apl.reason, &
            lue_apl.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_webapplication.Item)
FOR ll_row = 1 TO ll_max
   // add application cache to tree
   ltvi_item.Label = l_webapplication.Item[ll_row].Item[3]
   ltvi_item.Data = al_handle
   ltvi_item.PictureIndex = 12
   ltvi_item.SelectedPictureIndex = 12
   ltvi_item.Children = True
   tv_tree.InsertItemLast(al_handle, ltvi_item)
NEXT

end subroutine

public subroutine wf_load_application (long al_handle);View l_application
TreeViewItem ltvi_item
String ls_list, ls_array[]
Integer li_row, li_max
Long ll_row, ll_max, ll_handle

SetPointer(HourGlass!)

// get a view of all applications
TRY
   l_application = g_repository.Items("Application", "")
CATCH ( lookuperror lue_apl )
   MessageBox("Application Items Error - " + lue_apl.reason, &
            lue_apl.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_application.Item)
FOR ll_row = 1 TO ll_max
   // add application to tree
   ltvi_item.Label = l_application.Item[ll_row].Item[3]
   ltvi_item.Data = al_handle
   ltvi_item.PictureIndex = 9
   ltvi_item.SelectedPictureIndex = 9
   ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)
   // load list
   ls_list = gn_conn.of_get_jagproperty("Application", &
            l_application.Item[ll_row].Item[3], &
            "com.sybase.jaguar.application.packages")
   wf_parse_csv(ls_list, ls_array)
   li_max = UpperBound(ls_array)
   for li_row = 1 to li_max
      ltvi_item.Label = ls_array[li_row]
      ltvi_item.Data = ll_handle
      ltvi_item.PictureIndex = 4
      ltvi_item.SelectedPictureIndex = 4
      ltvi_item.Children = True
      tv_tree.InsertItemLast(ll_handle, ltvi_item)
      ltvi_item.Children = False
   next
   // load list
   ls_list = gn_conn.of_get_jagproperty("Application", &
            l_application.Item[ll_row].Item[3], &
            "com.sybase.jaguar.application.webapplications")
   wf_parse_csv(ls_list, ls_array)
   li_max = UpperBound(ls_array)
   for li_row = 1 to li_max
      ltvi_item.Label = ls_array[li_row]
      ltvi_item.Data = ll_handle
      ltvi_item.PictureIndex = 12
      ltvi_item.SelectedPictureIndex = 12
      ltvi_item.Children = True
      tv_tree.InsertItemLast(ll_handle, ltvi_item)
      ltvi_item.Children = False
   next
NEXT

end subroutine

public subroutine wf_load_serverfolders (long al_handle, string as_server);TreeViewItem ltvi_item
String ls_list, ls_array[], ls_subarray[]
Long ll_row, ll_max, ll_handle, ll_apphandle
Integer li_row, li_max

SetPointer(HourGlass!)

// add folder to tree
ltvi_item.Label = "Listeners"
ltvi_item.Data = al_handle
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)

// load list
ls_list = gn_conn.of_get_jagproperty("Server", &
         as_server, "com.sybase.jaguar.server.listeners")
wf_parse_csv(ls_list, ls_array)
ll_max = UpperBound(ls_array)
for ll_row = 1 to ll_max
   ltvi_item.Label = ls_array[ll_row]
   ltvi_item.Data = ll_handle
   ltvi_item.PictureIndex = 10
   ltvi_item.SelectedPictureIndex = 10
   tv_tree.InsertItemLast(ll_handle, ltvi_item)
next

// add folder to tree
ltvi_item.Label = "Installed Applications"
ltvi_item.Data = al_handle
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)

// load list
ls_list = gn_conn.of_get_jagproperty("Server", &
         as_server, "com.sybase.jaguar.server.applications")
wf_parse_csv(ls_list, ls_array)
ll_max = UpperBound(ls_array)
for ll_row = 1 to ll_max
   ltvi_item.Label = ls_array[ll_row]
   ltvi_item.Data = ll_handle
   ltvi_item.PictureIndex = 9
   ltvi_item.SelectedPictureIndex = 9
   ll_apphandle = tv_tree.InsertItemLast(ll_handle, ltvi_item)
   // load list
   ls_list = gn_conn.of_get_jagproperty("Application", &
            ls_array[ll_row], &
            "com.sybase.jaguar.application.packages")
   wf_parse_csv(ls_list, ls_subarray)
   li_max = UpperBound(ls_subarray)
   for li_row = 1 to li_max
      ltvi_item.Label = ls_subarray[li_row]
      ltvi_item.Data = ll_apphandle
      ltvi_item.PictureIndex = 4
      ltvi_item.SelectedPictureIndex = 4
      ltvi_item.Children = True
      tv_tree.InsertItemLast(ll_apphandle, ltvi_item)
      ltvi_item.Children = False
   next
   // load list
   ls_list = gn_conn.of_get_jagproperty("Application", &
            ls_array[ll_row], &
            "com.sybase.jaguar.application.webapplications")
   wf_parse_csv(ls_list, ls_subarray)
   li_max = UpperBound(ls_subarray)
   for li_row = 1 to li_max
      ltvi_item.Label = ls_subarray[li_row]
      ltvi_item.Data = ll_apphandle
      ltvi_item.PictureIndex = 12
      ltvi_item.SelectedPictureIndex = 12
      ltvi_item.Children = True
      tv_tree.InsertItemLast(ll_apphandle, ltvi_item)
      ltvi_item.Children = False
   next
next

// add folder to tree
ltvi_item.Label = "Installed Packages"
ltvi_item.Data = al_handle
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)

// load list
ls_list = gn_conn.of_get_jagproperty("Server", &
         as_server, "com.sybase.jaguar.server.packages")
wf_parse_csv(ls_list, ls_array)
ll_max = UpperBound(ls_array)
for ll_row = 1 to ll_max
   ltvi_item.Label = ls_array[ll_row]
   ltvi_item.Data = ll_handle
   ltvi_item.PictureIndex = 4
   ltvi_item.SelectedPictureIndex = 4
   ltvi_item.Children = True
   tv_tree.InsertItemLast(ll_handle, ltvi_item)
   ltvi_item.Children = False
next

// add folder to tree
ltvi_item.Label = "Installed Web Applications"
ltvi_item.Data = al_handle
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)

// load list
ls_list = gn_conn.of_get_jagproperty("Server", &
         as_server, "com.sybase.jaguar.server.webapplications")
wf_parse_csv(ls_list, ls_array)
ll_max = UpperBound(ls_array)
for ll_row = 1 to ll_max
   ltvi_item.Label = ls_array[ll_row]
   ltvi_item.Data = ll_handle
   ltvi_item.PictureIndex = 12
   ltvi_item.SelectedPictureIndex = 12
   ltvi_item.Children = True
   tv_tree.InsertItemLast(ll_handle, ltvi_item)
   ltvi_item.Children = False
next

// add folder to tree
ltvi_item.Label = "Installed Services"
ltvi_item.Data = al_handle
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ll_handle = tv_tree.InsertItemLast(al_handle, ltvi_item)

// load list
ls_list = gn_conn.of_get_jagproperty("Server", &
         as_server, "com.sybase.jaguar.server.services")
wf_parse_csv(ls_list, ls_array)
ll_max = UpperBound(ls_array)
for ll_row = 1 to ll_max
   ltvi_item.Label = ls_array[ll_row]
   ltvi_item.Data = ll_handle
   ltvi_item.PictureIndex = 11
   ltvi_item.SelectedPictureIndex = 11
   tv_tree.InsertItemLast(ll_handle, ltvi_item)
next

end subroutine

public subroutine wf_load_properties (string as_entitytype, string as_entityname);Properties l_properties
String ls_prop, ls_value
Long ll_rc, ll_cnt, ll_max, ll_newrow

dw_props.SetRedraw(False)
dw_props.Reset()

st_entityname.text = Wordcap(as_entitytype) + ": " + as_entityname

// get all properties for the entity
TRY
   l_properties = g_repository.Lookup(as_entitytype, as_entityname)
CATCH ( lookuperror lue_prp )
   dw_props.SetRedraw(True)
   MessageBox("Property Lookup Error - " + lue_prp.reason, &
            lue_prp.GetMessage())
   Return
END TRY

// load properties into datawindow
ll_max = UpperBound(l_properties.Item)
FOR ll_cnt = 1 TO ll_max
   ls_prop  = l_properties.Item[ll_cnt].Name
   ls_value = l_properties.Item[ll_cnt].Value
   ll_newrow = dw_props.InsertRow(0)
   dw_props.SetItem(ll_newrow, "entitytype", as_entitytype)
   dw_props.SetItem(ll_newrow, "entityname", as_entityname)
   dw_props.SetItem(ll_newrow, "property", ls_prop)
   dw_props.SetItem(ll_newrow, "value", ls_value)
NEXT

// sort the properties and select first
dw_props.Sort()
dw_props.ScrollToRow(1)
dw_props.Event RowFocusChanged(1)
dw_props.SetRedraw(True)

end subroutine

public subroutine wf_load_component (long al_handle, string as_package);View l_components
TreeViewItem ltvi_item
Long ll_row, ll_max, ll_component
String ls_type

SetPointer(HourGlass!)

// get a view of all components in the package
TRY
   l_components = g_repository.Items("Component", as_package)
CATCH ( lookuperror lue_cmp )
   MessageBox("Component Items Error - " + lue_cmp.reason, &
            lue_cmp.GetMessage())
   Return
END TRY

ll_max = UpperBound(l_components.Item)
FOR ll_row = 1 TO ll_max
   // get component type
   ls_type = gn_conn.of_get_jagproperty("Component", &
         l_components.Item[ll_row].Item[3], &
         "com.sybase.jaguar.component.type")
   // add component to tree
   ltvi_item.Label = l_components.Item[ll_row].Item[2]
   ltvi_item.Data = al_handle
   If ls_type = "pb" Then
      ltvi_item.PictureIndex = 5
      ltvi_item.SelectedPictureIndex = 5
   Else
      ltvi_item.PictureIndex = 6
      ltvi_item.SelectedPictureIndex = 6
   End If
   ll_component = tv_tree.InsertItemLast(al_handle, ltvi_item)
NEXT

end subroutine

on w_main.create
if this.MenuName = "m_main" then this.MenuID = create m_main
this.mdi_1=create mdi_1
this.st_splitbar=create st_splitbar
this.st_treeview=create st_treeview
this.dw_props=create dw_props
this.st_entityname=create st_entityname
this.tv_tree=create tv_tree
this.Control[]={this.mdi_1,&
this.st_splitbar,&
this.st_treeview,&
this.dw_props,&
this.st_entityname,&
this.tv_tree}
end on

on w_main.destroy
if IsValid(MenuID) then destroy(MenuID)
destroy(this.mdi_1)
destroy(this.st_splitbar)
destroy(this.st_treeview)
destroy(this.dw_props)
destroy(this.st_entityname)
destroy(this.tv_tree)
end on

event open;TreeViewItem ltvi_item
Integer li_xpos, li_ypos, li_width, li_height
String ls_state

SetPointer(HourGlass!)

// restore window position/size
ls_state = gn_conn.of_get_ini("window", "state", "normal")
If ls_state = "maximized" Then
   this.WindowState = Maximized!
Else
   this.WindowState = Normal!
   li_xpos = Integer(gn_conn.of_get_ini("window", "xpos", String(this.x)))
   li_ypos = Integer(gn_conn.of_get_ini("window", "ypos", String(this.y)))
   Move(li_xpos, li_ypos)
   li_width = Integer(gn_conn.of_get_ini("window", "width", String(this.width)))
   li_height = Integer(gn_conn.of_get_ini("window", "height", String(this.height)))
   Resize(li_width, li_height)
End If

// initialize splitbar
st_splitbar.of_set_leftobject(st_treeview)
st_splitbar.of_set_leftobject(tv_tree)
st_splitbar.of_set_rightobject(st_entityname)
st_splitbar.of_set_rightobject(dw_props)
st_splitbar.of_get_location()

// add 'Jaguar' to tree
ltvi_item.Label = "Jaguar"
ltvi_item.Data = 0
ltvi_item.PictureIndex = 1
ltvi_item.SelectedPictureIndex = 1
ltvi_item.Expanded = True
ltvi_item.Selected = True
il_root = tv_tree.InsertItemLast(0, ltvi_item)

// add 'Servers' folder to tree
ltvi_item.Label = "Servers"
ltvi_item.Data = il_root
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ltvi_item.Expanded = False
ltvi_item.Selected = False
ltvi_item.Children = True
tv_tree.InsertItemLast(il_root, ltvi_item)

// add 'Applications' folder to tree
ltvi_item.Label = "Applications"
ltvi_item.Data = il_root
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ltvi_item.Expanded = False
ltvi_item.Selected = False
ltvi_item.Children = True
tv_tree.InsertItemLast(il_root, ltvi_item)

// add 'Packages' folder to tree
ltvi_item.Label = "Packages"
ltvi_item.Data = il_root
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ltvi_item.Expanded = False
ltvi_item.Selected = False
ltvi_item.Children = True
tv_tree.InsertItemLast(il_root, ltvi_item)

// add 'Web Applications' folder to tree
ltvi_item.Label = "Web Applications"
ltvi_item.Data = il_root
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ltvi_item.Expanded = False
ltvi_item.Selected = False
ltvi_item.Children = True
tv_tree.InsertItemLast(il_root, ltvi_item)

// add 'Connection Caches' folder to tree
ltvi_item.Label = "Connection Caches"
ltvi_item.Data = il_root
ltvi_item.PictureIndex = 2
ltvi_item.SelectedPictureIndex = 3
ltvi_item.Expanded = False
ltvi_item.Selected = False
ltvi_item.Children = True
tv_tree.InsertItemLast(il_root, ltvi_item)

end event

event resize;// set control height
tv_tree.height       = this.height - 528
st_splitbar.height   = this.height - 528
dw_props.height      = this.height - 528

// set contol width
dw_props.width = (this.width - st_splitbar.x) - 70

end event

event close;// save splitbar location
st_splitbar.of_set_location()

// save window position/size
If this.WindowState = Maximized! Then
   gn_conn.of_set_ini("window", "state", "maximized")
Else
   gn_conn.of_set_ini("window", "state", "normal")
   gn_conn.of_set_ini("window", "xpos", String(this.x))
   gn_conn.of_set_ini("window", "ypos", String(this.y))
   gn_conn.of_set_ini("window", "width", String(this.width))
   gn_conn.of_set_ini("window", "height", String(this.height))
End If

end event

type mdi_1 from mdiclient within w_main
long BackColor=268435456
end type

type st_splitbar from u_splitbar_vertical within w_main
integer x = 1225
integer y = 256
integer height = 1572
end type

type st_treeview from statictext within w_main
integer x = 18
integer y = 176
integer width = 1207
integer height = 76
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Repository Structure:"
boolean focusrectangle = false
end type

type dw_props from u_base_datawindow within w_main
integer x = 1243
integer y = 256
integer width = 2162
integer height = 1572
integer taborder = 10
string dataobject = "d_properties"
boolean vscrollbar = true
end type

event resize;call super::resize;Long ll_property, ll_value

ll_property = (6/10) * (this.width - 108)
ll_value = (this.width - 108) - ll_property

this.Object.property.Width = ll_property
this.Object.value.Width = ll_value

end event

event constructor;call super::constructor;// turn on sort arrows
this.of_gridsort_arrows(st_splitbar.of_get_syscolor(16))

end event

event doubleclicked;call super::doubleclicked;Parent.Event m_editproperty()

end event

type st_entityname from statictext within w_main
integer x = 1243
integer y = 176
integer width = 2999
integer height = 76
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
boolean focusrectangle = false
end type

type tv_tree from treeview within w_main
integer x = 18
integer y = 256
integer width = 1207
integer height = 1572
integer taborder = 10
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
boolean linesatroot = true
string picturename[] = {"jagmanager.ico","folder.ico","foldero.ico","package.ico","UserObject5!","component.ico","conncache.ico","jagserver.ico","application.ico","listener.ico","service.ico","webapplication.ico","webcomponent.ico","idl_interface.ico","method.ico"}
long picturemaskcolor = 12632256
long statepicturemaskcolor = 536870912
end type

event selectionchanged;TreeViewItem ltvi_item, ltvi_parent

// get treeview item info
this.GetItem(newhandle, ltvi_item)

// load properties
choose case ltvi_item.PictureIndex
   case 4
      wf_load_properties("package", ltvi_item.Label)
   case 5, 6
      // get parent item info
      this.GetItem(Long(ltvi_item.Data), ltvi_parent)
      wf_load_properties("component", &
            ltvi_parent.Label + "/" + ltvi_item.Label)
   case 7
      wf_load_properties("conncache", ltvi_item.Label)
   case 8
      wf_load_properties("server", ltvi_item.Label)
   case 9
      wf_load_properties("application", ltvi_item.Label)
   case 10
      wf_load_properties("listener", ltvi_item.Label)
   case 11
      wf_load_properties("component", ltvi_item.Label)
   case 12
      wf_load_properties("webapplication", ltvi_item.Label)
   case 13
      // get parent item info
      this.GetItem(Long(ltvi_item.Data), ltvi_parent)
      wf_load_properties("servlet", &
            ltvi_parent.Label + "/" + ltvi_item.Label)
   case 14, 15
      // handle idl here...
   case else
      // reset property datawindow
      dw_props.Reset()
      st_entityname.text = ""
end choose

end event

event itempopulate;TreeViewItem ltvi_item

// get treeview item info
this.GetItem(handle, ltvi_item)

choose case ltvi_item.Label
   case "Servers"
      // load list of servers
      wf_load_server(handle)
   case "Applications"
      // load list of applications
      wf_load_application(handle)
   case "Packages"
      // load list of packages
      wf_load_package(handle)
   case "Web Applications"
      // load list of web applications
      wf_load_webapplication(handle)
   case "Connection Caches"
      // load list of connection caches
      wf_load_conncache(handle)
   case else
      choose case ltvi_item.PictureIndex
         case 4
            // load list of components
            wf_load_component(handle, ltvi_item.Label)
         case 8
            // load server folders
            wf_load_serverfolders(handle, ltvi_item.Label)
         case 12
            // load list of components
            wf_load_webcomponent(handle, ltvi_item.Label)
         case else
      end choose
end choose

end event