/
BusinessObjects.vb
83 lines (73 loc) · 3.04 KB
/
BusinessObjects.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Imports System
Imports System.ComponentModel
Imports DevExpress.XtraTreeList
Imports DevExpress.Spreadsheet
Imports DevExpress.Export.Xl
Imports System.IO
Namespace XLExportExamples
Public Class SpreadsheetNode
Private groups_Renamed As New GroupsOfSpreadsheetExamples()
Private owner_Renamed As GroupsOfSpreadsheetExamples
Public Sub New(ByVal name As String)
Me.Name = name
End Sub
<Browsable(False)> _
Public ReadOnly Property Groups() As GroupsOfSpreadsheetExamples
Get
Return groups_Renamed
End Get
End Property
Public Property Name() As String
<Browsable(False)> _
Public Property Owner() As GroupsOfSpreadsheetExamples
Get
Return owner_Renamed
End Get
Set(ByVal value As GroupsOfSpreadsheetExamples)
owner_Renamed = value
End Set
End Property
End Class
Public Class SpreadsheetExample
Inherits SpreadsheetNode
Public Sub New(ByVal name As String, ByVal action As Action(Of Stream, XlDocumentFormat))
MyBase.New(name)
Me.Action = action
End Sub
Private privateAction As Action(Of Stream, XlDocumentFormat)
Public Property Action() As Action(Of Stream, XlDocumentFormat)
Get
Return privateAction
End Get
Private Set(ByVal value As Action(Of Stream, XlDocumentFormat))
privateAction = value
End Set
End Property
End Class
Public Class GroupsOfSpreadsheetExamples
Inherits BindingList(Of SpreadsheetNode)
Implements TreeList.IVirtualTreeListData
Private Sub IVirtualTreeListData_VirtualTreeGetChildNodes(ByVal info As VirtualTreeGetChildNodesInfo) Implements TreeList.IVirtualTreeListData.VirtualTreeGetChildNodes
Dim obj As SpreadsheetNode = TryCast(info.Node, SpreadsheetNode)
info.Children = obj.Groups
End Sub
Protected Overrides Sub InsertItem(ByVal index As Integer, ByVal item As SpreadsheetNode)
item.Owner = Me
MyBase.InsertItem(index, item)
End Sub
Private Sub IVirtualTreeListData_VirtualTreeGetCellValue(ByVal info As VirtualTreeGetCellValueInfo) Implements TreeList.IVirtualTreeListData.VirtualTreeGetCellValue
Dim obj As SpreadsheetNode = TryCast(info.Node, SpreadsheetNode)
Select Case info.Column.Caption
Case "Name"
info.CellData = obj.Name
End Select
End Sub
Private Sub IVirtualTreeListData_VirtualTreeSetCellValue(ByVal info As VirtualTreeSetCellValueInfo) Implements TreeList.IVirtualTreeListData.VirtualTreeSetCellValue
Dim obj As SpreadsheetNode = TryCast(info.Node, SpreadsheetNode)
Select Case info.Column.Caption
Case "Name"
obj.Name = CStr(info.NewCellData)
End Select
End Sub
End Class
End Namespace