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
|
||||
|
||||
Reference in New Issue
Block a user