DocumentResultList: Layout et al
This commit is contained in:
@@ -64,36 +64,57 @@ Public Class AttributeControls
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function LoadControlsForAttributes(pObjectId As Long, pAttributes As List(Of Attribute), LayoutRoot As LayoutControlGroup) As Task
|
||||
Public Sub LoadControlsForAttributes(pAttributes As List(Of Attribute), LayoutRoot As LayoutControlGroup)
|
||||
LayoutRoot.Clear()
|
||||
|
||||
Dim oUserAttributeGroup = LayoutRoot.AddGroup()
|
||||
oUserAttributeGroup.Text = "Benutzer Attribute"
|
||||
|
||||
Dim oSystemAttributeGroup = LayoutRoot.AddGroup()
|
||||
oSystemAttributeGroup.Text = "System Attribute"
|
||||
|
||||
For Each oAttribute As Attribute In pAttributes
|
||||
Dim oEditable = ShouldControlBeEditable(oAttribute)
|
||||
Dim oControl = GetControlForAttribute(oAttribute, Not oEditable)
|
||||
|
||||
Dim oParentGroup = oSystemAttributeGroup
|
||||
' Add new control
|
||||
Dim oItem As LayoutControlItem = LayoutRoot.AddItem()
|
||||
|
||||
If oAttribute.IsSystem = False Then
|
||||
oParentGroup = oUserAttributeGroup
|
||||
End If
|
||||
|
||||
Dim oItem As LayoutControlItem = oParentGroup.AddItem()
|
||||
oItem.Text = oAttribute.Title
|
||||
oItem.Name = oAttribute.Title
|
||||
oItem.Control = oControl
|
||||
Next
|
||||
End Sub
|
||||
|
||||
For Each oItem As LayoutControlItem In LayoutRoot.Items
|
||||
If TypeOf oItem.Control Is BaseEdit Then
|
||||
Dim oValue = Await GetAttributeValue(oItem.Name, pObjectId)
|
||||
Dim oEdit = DirectCast(oItem.Control, BaseEdit)
|
||||
Public Async Function LoadControlValuesForAttributes(pObjectId As Long, LayoutRoot As LayoutControlGroup) As Task
|
||||
For Each oItem As BaseLayoutItem In LayoutRoot.Items
|
||||
If TypeOf oItem Is LayoutControlGroup Then
|
||||
Await LoadControlValuesForAttributes(pObjectId, oItem)
|
||||
|
||||
oEdit.EditValue = oValue
|
||||
ElseIf TypeOf oItem Is LayoutControlItem Then
|
||||
Dim oControlItem As LayoutControlItem = oItem
|
||||
|
||||
AddHandler oEdit.EditValueChanged, Sub() RaiseEvent EditValueChanged(oItem, Nothing)
|
||||
If TypeOf oControlItem.Control Is BaseEdit Then
|
||||
Dim oEdit = DirectCast(oControlItem.Control, BaseEdit)
|
||||
oEdit.EditValue = Nothing
|
||||
|
||||
ElseIf TypeOf oItem.Control Is GridControl Then
|
||||
Dim oValueTable = Await GetAttributeValueAsTable(oItem.Name, pObjectId)
|
||||
Dim oGrid = DirectCast(oItem.Control, GridControl)
|
||||
oGrid.DataSource = oValueTable
|
||||
Dim oValue = Await GetAttributeValue(oItem.Name, pObjectId)
|
||||
oEdit.EditValue = oValue
|
||||
|
||||
AddHandler oEdit.EditValueChanged, Sub() RaiseEvent EditValueChanged(oItem, Nothing)
|
||||
ElseIf TypeOf oControlItem.Control Is GridControl Then
|
||||
Dim oValueTable = Await GetAttributeValueAsTable(oItem.Name, pObjectId)
|
||||
Dim oGrid = DirectCast(oControlItem.Control, GridControl)
|
||||
|
||||
oGrid.DataSource = Nothing
|
||||
|
||||
oGrid.DataSource = oValueTable
|
||||
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
@@ -59,6 +59,7 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Me.XtraTabPageAttributeHistory = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.GridValueHistory = New DevExpress.XtraGrid.GridControl()
|
||||
Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView()
|
||||
Me.XtraTabPageVersions = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.BarManager1 = New DevExpress.XtraBars.BarManager(Me.components)
|
||||
Me.d = New DevExpress.XtraBars.Bar()
|
||||
Me.cmbEntityId = New DevExpress.XtraBars.BarEditItem()
|
||||
@@ -67,7 +68,6 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Me.barDockControlBottom = New DevExpress.XtraBars.BarDockControl()
|
||||
Me.barDockControlLeft = New DevExpress.XtraBars.BarDockControl()
|
||||
Me.barDockControlRight = New DevExpress.XtraBars.BarDockControl()
|
||||
Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage()
|
||||
BarStaticItem1 = New DevExpress.XtraBars.BarStaticItem()
|
||||
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.XtraTabControl1.SuspendLayout()
|
||||
@@ -126,7 +126,7 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPageObject
|
||||
Me.XtraTabControl1.Size = New System.Drawing.Size(505, 693)
|
||||
Me.XtraTabControl1.TabIndex = 2
|
||||
Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPageObject, Me.XtraTabPageAttributes, Me.XtraTabPageAttributeHistory, Me.XtraTabPage1})
|
||||
Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPageAttributes, Me.XtraTabPageObject, Me.XtraTabPageAttributeHistory, Me.XtraTabPageVersions})
|
||||
'
|
||||
'XtraTabPageObject
|
||||
'
|
||||
@@ -431,7 +431,7 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Me.LayoutControl2.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.LayoutControl2.Location = New System.Drawing.Point(0, 0)
|
||||
Me.LayoutControl2.Name = "LayoutControl2"
|
||||
Me.LayoutControl2.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = New System.Drawing.Rectangle(551, 406, 650, 400)
|
||||
Me.LayoutControl2.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = New System.Drawing.Rectangle(624, 268, 650, 400)
|
||||
Me.LayoutControl2.Root = Me.Root
|
||||
Me.LayoutControl2.Size = New System.Drawing.Size(503, 668)
|
||||
Me.LayoutControl2.TabIndex = 0
|
||||
@@ -467,6 +467,13 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Me.GridView2.GridControl = Me.GridValueHistory
|
||||
Me.GridView2.Name = "GridView2"
|
||||
'
|
||||
'XtraTabPageVersions
|
||||
'
|
||||
Me.XtraTabPageVersions.Name = "XtraTabPageVersions"
|
||||
Me.XtraTabPageVersions.PageEnabled = False
|
||||
Me.XtraTabPageVersions.Size = New System.Drawing.Size(503, 668)
|
||||
Me.XtraTabPageVersions.Text = "Versionen"
|
||||
'
|
||||
'BarManager1
|
||||
'
|
||||
Me.BarManager1.Bars.AddRange(New DevExpress.XtraBars.Bar() {Me.d})
|
||||
@@ -540,12 +547,6 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Me.barDockControlRight.Manager = Me.BarManager1
|
||||
Me.barDockControlRight.Size = New System.Drawing.Size(0, 693)
|
||||
'
|
||||
'XtraTabPage1
|
||||
'
|
||||
Me.XtraTabPage1.Name = "XtraTabPage1"
|
||||
Me.XtraTabPage1.Size = New System.Drawing.Size(503, 668)
|
||||
Me.XtraTabPage1.Text = "Versionen"
|
||||
'
|
||||
'ctrlObjectPropertyDialog
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
@@ -644,5 +645,5 @@ Partial Class ctrlObjectPropertyDialog
|
||||
Friend WithEvents barDockControlBottom As DevExpress.XtraBars.BarDockControl
|
||||
Friend WithEvents barDockControlLeft As DevExpress.XtraBars.BarDockControl
|
||||
Friend WithEvents barDockControlRight As DevExpress.XtraBars.BarDockControl
|
||||
Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage
|
||||
Friend WithEvents XtraTabPageVersions As DevExpress.XtraTab.XtraTabPage
|
||||
End Class
|
||||
|
||||
@@ -5,6 +5,7 @@ Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
Imports DevExpress.XtraSplashScreen
|
||||
|
||||
Public Class ctrlObjectPropertyDialog
|
||||
Implements IBaseForm
|
||||
@@ -18,7 +19,15 @@ Public Class ctrlObjectPropertyDialog
|
||||
Private Property ObjectId As Long
|
||||
|
||||
Private ReadOnly Changes As New Dictionary(Of String, Object)
|
||||
Private Property Loading As Boolean = False
|
||||
|
||||
|
||||
Private Loading As Boolean = False
|
||||
|
||||
Private LastEntityId As Integer = 0
|
||||
|
||||
Private Sub ctrlObjectPropertyDialog_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
XtraTabControl1.SelectedTabPage = XtraTabPageAttributes
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize(pLogConfig As LogConfig, pHostForm As Form, pClient As Client, pEnv As Environment)
|
||||
LogConfig = pLogConfig
|
||||
@@ -44,6 +53,8 @@ Public Class ctrlObjectPropertyDialog
|
||||
|
||||
Public Async Function LoadObject(pObjectId As Long, pEntityId As Long) As Task(Of Boolean)
|
||||
Loading = True
|
||||
Dim oLoadingHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||||
|
||||
Try
|
||||
ObjectId = pObjectId
|
||||
|
||||
@@ -59,12 +70,27 @@ Public Class ctrlObjectPropertyDialog
|
||||
Dim oObjectProperties = Await GetPropertiesForObjectId(ObjectId)
|
||||
ShowObjectProperties(oObjectProperties)
|
||||
|
||||
' Load Attribute controls and values
|
||||
|
||||
' Load All attributes for current entity id
|
||||
Dim oAttributes = Await ControlManager.GetAttributesForBusinessEntity(cmbEntityId.EditValue)
|
||||
Await ControlManager.LoadControlsForAttributes(ObjectId, oAttributes, Root)
|
||||
|
||||
' Load Attribute controls
|
||||
If pEntityId <> LastEntityId Then
|
||||
ControlManager.LoadControlsForAttributes(oAttributes, Root)
|
||||
End If
|
||||
|
||||
' Load values for all controls
|
||||
Await ControlManager.LoadControlValuesForAttributes(pObjectId, Root)
|
||||
|
||||
' Save the current entity id
|
||||
LastEntityId = pEntityId
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
Finally
|
||||
SplashScreenManager.CloseOverlayForm(oLoadingHandle)
|
||||
Loading = False
|
||||
End Try
|
||||
End Function
|
||||
@@ -166,15 +192,17 @@ Public Class ctrlObjectPropertyDialog
|
||||
Return oResult.Table
|
||||
End Function
|
||||
|
||||
Private Async Sub Load_Attributes(pObject As Long, pBusinessEntityId As Long)
|
||||
Private Async Sub Load_Attributes(pObjectId As Long, pBusinessEntityId As Long)
|
||||
Try
|
||||
Dim oAttributes = Await ControlManager.GetAttributesForBusinessEntity(pBusinessEntityId)
|
||||
|
||||
If oAttributes.Count = 0 Then
|
||||
MsgBox($"Es konnten keine Attribute für das Objekt '{pObject}' geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
MsgBox($"Es konnten keine Attribute für das Objekt '{pObjectId}' geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
|
||||
Await ControlManager.LoadControlsForAttributes(pObject, oAttributes, Root)
|
||||
|
||||
|
||||
ControlManager.LoadControlsForAttributes(oAttributes, Root)
|
||||
Await ControlManager.LoadControlValuesForAttributes(pObjectId, Root)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
@@ -184,7 +212,7 @@ Public Class ctrlObjectPropertyDialog
|
||||
Dim oEntityId As Long
|
||||
|
||||
If Integer.TryParse(cmbEntityId.EditValue, oEntityId) AndAlso Loading = False Then
|
||||
LoadObject(ObjectId, oEntityId)
|
||||
Await LoadObject(ObjectId, oEntityId)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -151,7 +151,8 @@ Public Class frmObjectPropertyDialog
|
||||
MsgBox($"Es konnten keine Attribute für das Objekt '{ObjectId}' geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
|
||||
Await ControlManager.LoadControlsForAttributes(ObjectId, oAttributes, AttributeLayout)
|
||||
ControlManager.LoadControlsForAttributes(oAttributes, AttributeLayout)
|
||||
Await ControlManager.LoadControlValuesForAttributes(ObjectId, AttributeLayout)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user