first pass of new layout loading and editing
This commit is contained in:
parent
582e701492
commit
407a5979ac
@ -294,6 +294,8 @@
|
||||
<Compile Include="frmDesignerLayout.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmDesignerLayout\Loader.vb" />
|
||||
<Compile Include="frmDesignerLayout\Metadata.vb" />
|
||||
<Compile Include="frmDocView.Designer.vb">
|
||||
<DependentUpon>frmDocView.vb</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
84
app/DD_PM_WINDREAM/frmDesignerLayout.Designer.vb
generated
84
app/DD_PM_WINDREAM/frmDesignerLayout.Designer.vb
generated
@ -25,14 +25,14 @@ Partial Class frmDesignerLayout
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmDesignerLayout))
|
||||
Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl()
|
||||
Me.BarListItem1 = New DevExpress.XtraBars.BarListItem()
|
||||
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
|
||||
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl()
|
||||
Me.Root = New DevExpress.XtraLayout.LayoutControlGroup()
|
||||
Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl()
|
||||
Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.PropertyGridControl1 = New DevExpress.XtraVerticalGrid.PropertyGridControl()
|
||||
@ -43,25 +43,26 @@ Partial Class frmDesignerLayout
|
||||
Me.ToolboxItemMemoedit = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.ToolboxItemDatepicker = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.ToolboxItemCheckbox = New DevExpress.XtraToolbox.ToolboxItem()
|
||||
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.LayoutControlMain = New DevExpress.XtraLayout.LayoutControl()
|
||||
Me.LayoutControlGroupMain = New DevExpress.XtraLayout.LayoutControlGroup()
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainerControl1.SuspendLayout()
|
||||
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.XtraTabControl1.SuspendLayout()
|
||||
Me.XtraTabPage1.SuspendLayout()
|
||||
CType(Me.PropertyGridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.XtraTabPage2.SuspendLayout()
|
||||
CType(Me.LayoutControlMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.LayoutControlGroupMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'RibbonControl1
|
||||
'
|
||||
Me.RibbonControl1.ExpandCollapseItem.Id = 0
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarListItem1, Me.BarButtonItem1})
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarListItem1, Me.BarButtonItem1, Me.BarButtonItem2})
|
||||
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.RibbonControl1.MaxItemId = 3
|
||||
Me.RibbonControl1.MaxItemId = 4
|
||||
Me.RibbonControl1.Name = "RibbonControl1"
|
||||
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
|
||||
Me.RibbonControl1.Size = New System.Drawing.Size(1196, 158)
|
||||
@ -75,6 +76,18 @@ Partial Class frmDesignerLayout
|
||||
Me.BarListItem1.Name = "BarListItem1"
|
||||
Me.BarListItem1.RibbonStyle = DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText
|
||||
'
|
||||
'BarButtonItem1
|
||||
'
|
||||
Me.BarButtonItem1.Caption = "BarButtonItem1"
|
||||
Me.BarButtonItem1.Id = 2
|
||||
Me.BarButtonItem1.Name = "BarButtonItem1"
|
||||
'
|
||||
'BarButtonItem2
|
||||
'
|
||||
Me.BarButtonItem2.Caption = "Layout speichern"
|
||||
Me.BarButtonItem2.Id = 3
|
||||
Me.BarButtonItem2.Name = "BarButtonItem2"
|
||||
'
|
||||
'RibbonPage1
|
||||
'
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2})
|
||||
@ -84,6 +97,7 @@ Partial Class frmDesignerLayout
|
||||
'RibbonPageGroup1
|
||||
'
|
||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.BarListItem1)
|
||||
Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem2)
|
||||
Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
|
||||
Me.RibbonPageGroup1.Text = "RibbonPageGroup1"
|
||||
'
|
||||
@ -110,7 +124,7 @@ Partial Class frmDesignerLayout
|
||||
Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.SplitContainerControl1.Location = New System.Drawing.Point(0, 158)
|
||||
Me.SplitContainerControl1.Name = "SplitContainerControl1"
|
||||
Me.SplitContainerControl1.Panel1.Controls.Add(Me.LayoutControl1)
|
||||
Me.SplitContainerControl1.Panel1.Controls.Add(Me.LayoutControlMain)
|
||||
Me.SplitContainerControl1.Panel1.Text = "Panel1"
|
||||
Me.SplitContainerControl1.Panel2.Controls.Add(Me.XtraTabControl1)
|
||||
Me.SplitContainerControl1.Panel2.Text = "Panel2"
|
||||
@ -118,24 +132,6 @@ Partial Class frmDesignerLayout
|
||||
Me.SplitContainerControl1.SplitterPosition = 818
|
||||
Me.SplitContainerControl1.TabIndex = 8
|
||||
'
|
||||
'LayoutControl1
|
||||
'
|
||||
Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.LayoutControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.LayoutControl1.Name = "LayoutControl1"
|
||||
Me.LayoutControl1.Root = Me.Root
|
||||
Me.LayoutControl1.Size = New System.Drawing.Size(818, 440)
|
||||
Me.LayoutControl1.TabIndex = 0
|
||||
Me.LayoutControl1.Text = "LayoutControl1"
|
||||
'
|
||||
'Root
|
||||
'
|
||||
Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
|
||||
Me.Root.GroupBordersVisible = False
|
||||
Me.Root.Name = "Root"
|
||||
Me.Root.Size = New System.Drawing.Size(818, 440)
|
||||
Me.Root.TextVisible = False
|
||||
'
|
||||
'XtraTabControl1
|
||||
'
|
||||
Me.XtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
@ -223,11 +219,30 @@ Partial Class frmDesignerLayout
|
||||
Me.ToolboxItemCheckbox.Name = "ToolboxItemCheckbox"
|
||||
Me.ToolboxItemCheckbox.Tag = "Checkbox"
|
||||
'
|
||||
'BarButtonItem1
|
||||
'LayoutControlMain
|
||||
'
|
||||
Me.BarButtonItem1.Caption = "BarButtonItem1"
|
||||
Me.BarButtonItem1.Id = 2
|
||||
Me.BarButtonItem1.Name = "BarButtonItem1"
|
||||
Me.LayoutControlMain.AllowCustomization = False
|
||||
Me.LayoutControlMain.AllowDrop = True
|
||||
Me.LayoutControlMain.BackColor = System.Drawing.Color.Transparent
|
||||
Me.LayoutControlMain.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.LayoutControlMain.Location = New System.Drawing.Point(0, 0)
|
||||
Me.LayoutControlMain.Name = "LayoutControlMain"
|
||||
Me.LayoutControlMain.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = New System.Drawing.Rectangle(706, 255, 650, 400)
|
||||
Me.LayoutControlMain.OptionsCustomizationForm.ShowLayoutTreeView = False
|
||||
Me.LayoutControlMain.OptionsCustomizationForm.ShowLoadButton = False
|
||||
Me.LayoutControlMain.OptionsCustomizationForm.ShowSaveButton = False
|
||||
Me.LayoutControlMain.Root = Me.LayoutControlGroupMain
|
||||
Me.LayoutControlMain.Size = New System.Drawing.Size(818, 440)
|
||||
Me.LayoutControlMain.TabIndex = 3
|
||||
Me.LayoutControlMain.Text = "LayoutControl1"
|
||||
'
|
||||
'LayoutControlGroupMain
|
||||
'
|
||||
Me.LayoutControlGroupMain.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
|
||||
Me.LayoutControlGroupMain.GroupBordersVisible = False
|
||||
Me.LayoutControlGroupMain.Name = "Root"
|
||||
Me.LayoutControlGroupMain.Size = New System.Drawing.Size(818, 440)
|
||||
Me.LayoutControlGroupMain.TextVisible = False
|
||||
'
|
||||
'frmDesignerLayout
|
||||
'
|
||||
@ -244,13 +259,13 @@ Partial Class frmDesignerLayout
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerControl1.ResumeLayout(False)
|
||||
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.XtraTabControl1.ResumeLayout(False)
|
||||
Me.XtraTabPage1.ResumeLayout(False)
|
||||
CType(Me.PropertyGridControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.XtraTabPage2.ResumeLayout(False)
|
||||
CType(Me.LayoutControlMain, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.LayoutControlGroupMain, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
@ -263,8 +278,6 @@ Partial Class frmDesignerLayout
|
||||
Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar
|
||||
Friend WithEvents RibbonPage2 As DevExpress.XtraBars.Ribbon.RibbonPage
|
||||
Friend WithEvents SplitContainerControl1 As DevExpress.XtraEditors.SplitContainerControl
|
||||
Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl
|
||||
Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup
|
||||
Friend WithEvents XtraTabControl1 As DevExpress.XtraTab.XtraTabControl
|
||||
Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage
|
||||
Friend WithEvents XtraTabPage2 As DevExpress.XtraTab.XtraTabPage
|
||||
@ -277,4 +290,7 @@ Partial Class frmDesignerLayout
|
||||
Friend WithEvents BarListItem1 As DevExpress.XtraBars.BarListItem
|
||||
Friend WithEvents PropertyGridControl1 As DevExpress.XtraVerticalGrid.PropertyGridControl
|
||||
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents LayoutControlMain As DevExpress.XtraLayout.LayoutControl
|
||||
Friend WithEvents LayoutControlGroupMain As DevExpress.XtraLayout.LayoutControlGroup
|
||||
End Class
|
||||
|
||||
@ -1,26 +1,137 @@
|
||||
Public Class frmDesignerLayout
|
||||
Dim DT_Foms As DataTable
|
||||
Imports System.IO
|
||||
Imports System.Text.Encoding
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DevExpress.XtraLayout.Customization
|
||||
Imports DevExpress.XtraLayout.Dragging
|
||||
Imports DevExpress.XtraLayout.HitInfo
|
||||
Imports DevExpress.XtraToolbox
|
||||
|
||||
Public Class frmDesignerLayout
|
||||
Private SelectedLayoutId As Integer = 0
|
||||
Private FormsDatatable As DataTable
|
||||
Private _ControlLoader As ControlLoader
|
||||
|
||||
#Region "Drag Helper"
|
||||
Private _DragItem As BaseLayoutItem
|
||||
Private _Window As DragFrameWindow
|
||||
Private _DragController As LayoutItemDragController = Nothing
|
||||
|
||||
Protected ReadOnly Property DragFrameWindow As DragFrameWindow
|
||||
Get
|
||||
If _Window Is Nothing Then
|
||||
_Window = New DragFrameWindow(LayoutControlMain)
|
||||
End If
|
||||
Return _Window
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Sub ShowDragHelper()
|
||||
DragFrameWindow.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub HideDragHelper()
|
||||
DragFrameWindow.Reset()
|
||||
DragFrameWindow.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateDragHelper(p As Point)
|
||||
p = LayoutControlMain.PointToClient(p)
|
||||
_DragController = New LayoutItemDragController(_DragItem, LayoutControlMain.Root, New Point(p.X, p.Y))
|
||||
DragFrameWindow.DragController = _DragController
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "Drag Drop Actions"
|
||||
Private Sub ToolboxControlMain_DragItemDrop(sender As Object, e As ToolboxDragItemDropEventArgs) Handles ToolboxControlMain.DragItemDrop
|
||||
Dim oPosition As Point = LayoutControlMain.PointToClient(MousePosition)
|
||||
Dim oHitInfo As BaseLayoutItemHitInfo = LayoutControlMain.CalcHitInfo(oPosition)
|
||||
Dim oLayoutControl As LayoutControlItem = DirectCast(_DragItem, LayoutControlItem)
|
||||
Dim oControlName As String = oLayoutControl.Tag & Guid.NewGuid().ToString().GetHashCode().ToString("x")
|
||||
Dim oControl As Control = _ControlLoader.CreateLayoutControl(oLayoutControl.Tag, oControlName, 0)
|
||||
|
||||
If oLayoutControl IsNot Nothing Then
|
||||
HideDragHelper()
|
||||
oLayoutControl.Control = oControl
|
||||
|
||||
If (_DragController IsNot Nothing AndAlso _DragItem IsNot Nothing) Then
|
||||
If (_DragItem.Owner Is Nothing OrElse _DragItem.Parent Is Nothing) Then
|
||||
_DragController.DragWildItem()
|
||||
Else
|
||||
_DragController.Drag()
|
||||
End If
|
||||
Focus()
|
||||
End If
|
||||
HideDragHelper()
|
||||
'_DragItem = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ToolboxControlMain_DragItemStart(sender As Object, e As ToolboxDragItemStartEventArgs) Handles ToolboxControlMain.DragItemStart
|
||||
_DragItem = CreateLayoutControlItem(e.Item.Tag)
|
||||
End Sub
|
||||
|
||||
Private Sub ToolboxControlMain_DragItemMove(sender As Object, e As DevExpress.XtraToolbox.ToolboxDragItemMoveEventArgs) Handles ToolboxControlMain.DragItemMove
|
||||
If (CType(LayoutControlMain, ILayoutControl)).EnableCustomizationMode OrElse Me.DesignMode Then Return
|
||||
Dim oFormPosition As Point = PointToClient(e.Location)
|
||||
Dim oLayoutPosition As Point = LayoutControlMain.PointToClient(e.Location)
|
||||
|
||||
If LayoutControlMain.Bounds.Contains(oFormPosition) Then
|
||||
|
||||
If Not DragFrameWindow.Visible Then
|
||||
DragFrameWindow.Visible = True
|
||||
Return
|
||||
End If
|
||||
|
||||
UpdateDragHelper(e.Location)
|
||||
Else
|
||||
DragFrameWindow.Visible = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function CreateLayoutControlItem(Id As String) As LayoutControlItem
|
||||
Return New LayoutControlItem() With {.Tag = Id}
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
Private Sub frmDesignerLayout_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
_ControlLoader = New ControlLoader(LOGCONFIG, LayoutControlGroupMain)
|
||||
|
||||
Dim oSQL = "Select * from TBIDB_LAYOUT_CONFIG"
|
||||
DT_Foms = ClassDatabase.Return_Datatable_ConStr(oSQL, CONNECTION_STRING_IDB)
|
||||
If Not IsNothing(DT_Foms) Then
|
||||
For Each oRow As DataRow In DT_Foms.Rows
|
||||
BarListItem1.Strings.Add(oRow.Item("TITLE"))
|
||||
FormsDatatable = ClassDatabase.Return_Datatable_ConStr(oSQL, CONNECTION_STRING_IDB)
|
||||
If Not IsNothing(FormsDatatable) Then
|
||||
For Each oRow As DataRow In FormsDatatable.Rows
|
||||
Dim oItem As New BarButtonItem(RibbonControl1.Manager, oRow.Item("TITLE"))
|
||||
oItem.Tag = oRow.Item("GUID")
|
||||
AddHandler oItem.ItemClick, AddressOf Item_Click
|
||||
|
||||
BarListItem1.ItemLinks.Add(oItem)
|
||||
Next
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in FormLoad:" & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub BarListItem1_ListItemClick(sender As Object, e As DevExpress.XtraBars.ListItemClickEventArgs) Handles BarListItem1.ListItemClick
|
||||
Dim barlistItem = e.Item
|
||||
' Dim oSelectedText = e.Item.str
|
||||
Private Sub Item_Click(sender As Object, e As ItemClickEventArgs)
|
||||
SelectedLayoutId = e.Item.Tag
|
||||
Dim oRow As DataRow = FormsDatatable.Select($"GUID = {SelectedLayoutId}").First()
|
||||
'Dim oXml = oRow.Item("XML_CONTENT")
|
||||
Dim b As Byte() = System.Convert.FromBase64String(oRow.Item("XML_CONTENT"))
|
||||
|
||||
Using oStream As New MemoryStream(b, False)
|
||||
LayoutControlMain.RestoreLayoutFromStream(oStream)
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
LayoutControl1.sa
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
Using oStream As New MemoryStream()
|
||||
LayoutControlMain.SaveLayoutToStream(oStream)
|
||||
Dim oBase64 = System.Convert.ToBase64String(oStream.ToArray())
|
||||
'Dim oXml As String = UTF8.GetString(oStream.ToArray())
|
||||
Dim oSql As String = $"UPDATE TBIDB_LAYOUT_CONFIG SET XML_CONTENT = '{oBase64}' WHERE GUID = {SelectedLayoutId}"
|
||||
|
||||
ClassDatabase.Execute_non_Query_ConStr(oSql, CONNECTION_STRING_IDB)
|
||||
End Using
|
||||
End Sub
|
||||
End Class
|
||||
110
app/DD_PM_WINDREAM/frmDesignerLayout/Loader.vb
Normal file
110
app/DD_PM_WINDREAM/frmDesignerLayout/Loader.vb
Normal file
@ -0,0 +1,110 @@
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
|
||||
Public Class ControlLoader
|
||||
Public Const CONTROL_TEXTEDIT = "TextBox"
|
||||
Public Const CONTROL_MEMOEDIT = "Memoedit"
|
||||
Public Const CONTROL_COMBOEDIT = "Combobox"
|
||||
Public Const CONTROL_CHECKEDIT = "Checkbox"
|
||||
Public Const CONTROL_RADIOEDIT = "Radiobutton"
|
||||
Public Const CONTROL_DATEEDIT = "Datepicker"
|
||||
|
||||
Private _LayoutControlGroup As LayoutControlGroup
|
||||
Private _LayoutControls As List(Of BaseEdit)
|
||||
Private _LogConfig As LogConfig
|
||||
Private _LOgger As Logger
|
||||
|
||||
Public ReadOnly Property LayoutControls As List(Of BaseEdit)
|
||||
Get
|
||||
If _LayoutControls Is Nothing Then
|
||||
_LayoutControls = New List(Of BaseEdit)
|
||||
End If
|
||||
Return _LayoutControls
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, LayoutControlGroup As LayoutControlGroup)
|
||||
_LayoutControlGroup = LayoutControlGroup
|
||||
_LogConfig = LogConfig
|
||||
_LOgger = LogConfig.GetLogger
|
||||
End Sub
|
||||
|
||||
Public Sub AddControl(Name As String, Value As String, LayoutControlGroup As LayoutControlGroup)
|
||||
Dim oTextEdit As New SimpleLabelItem() With {
|
||||
.Name = Name,
|
||||
.Text = Name & " - " & Value
|
||||
}
|
||||
|
||||
LayoutControlGroup.AddItem(oTextEdit)
|
||||
End Sub
|
||||
Public Sub AddControl(Name As String, Value As String)
|
||||
AddControl(Name, Value, _LayoutControlGroup)
|
||||
End Sub
|
||||
|
||||
Public Sub AddSeparator(LayoutControlGroup As LayoutControlGroup)
|
||||
Dim oSeparator = New SimpleSeparator()
|
||||
|
||||
LayoutControlGroup.AddItem(oSeparator)
|
||||
End Sub
|
||||
Public Sub AddSeparator()
|
||||
AddSeparator(_LayoutControlGroup)
|
||||
End Sub
|
||||
|
||||
Public Sub LoadControls(Datatable As DataTable, LayoutControlGroup As LayoutControlGroup)
|
||||
For Each oRow As DataRow In Datatable.Rows
|
||||
Dim oCaption As String = oRow.Item("COLNAME")
|
||||
Dim oControlType As String = oRow.Item("CTRLTYPE")
|
||||
Dim oControlId As Int64 = oRow.Item("RECORD_ID")
|
||||
Dim oEditor As BaseEdit = CreateLayoutControl(oControlType, oControlId, oControlId)
|
||||
|
||||
If oEditor Is Nothing Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
oEditor.Tag = New Metadata() With {
|
||||
.Id = oControlId,
|
||||
.Type = oControlType,
|
||||
.Caption = oCaption
|
||||
}
|
||||
|
||||
LayoutControls.Add(oEditor)
|
||||
LayoutControlGroup.AddItem(oCaption, oEditor)
|
||||
Next
|
||||
|
||||
LayoutControlGroup.AddItem(New EmptySpaceItem())
|
||||
End Sub
|
||||
Public Sub LoadControls(Datatable As DataTable)
|
||||
LoadControls(Datatable, _LayoutControlGroup)
|
||||
End Sub
|
||||
|
||||
Public Function CreateLayoutControl(Type As String, Name As String, Id As Int64)
|
||||
Dim oEditor As BaseEdit = Nothing
|
||||
|
||||
LOGGER.Debug("Create new Control of type {0} with name {1}", Type, Name)
|
||||
|
||||
Select Case Type
|
||||
Case CONTROL_TEXTEDIT
|
||||
Dim oTextEdit As New TextEdit() With {.Name = Name}
|
||||
oEditor = oTextEdit
|
||||
Case CONTROL_MEMOEDIT
|
||||
Dim oMemoEdit As New MemoEdit() With {.Name = Name}
|
||||
oEditor = oMemoEdit
|
||||
Case CONTROL_DATEEDIT
|
||||
Dim oDateEdit As New DateEdit() With {.Name = Name}
|
||||
oEditor = oDateEdit
|
||||
Case CONTROL_CHECKEDIT
|
||||
Dim oCheckEdit As New CheckEdit() With {.Name = Name}
|
||||
oEditor = oCheckEdit
|
||||
Case Else
|
||||
oEditor = Nothing
|
||||
End Select
|
||||
|
||||
Return oEditor
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
|
||||
5
app/DD_PM_WINDREAM/frmDesignerLayout/Metadata.vb
Normal file
5
app/DD_PM_WINDREAM/frmDesignerLayout/Metadata.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public Class Metadata
|
||||
Public Id As Int64
|
||||
Public Type As String
|
||||
Public Caption As String
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user