Loading Form, center integer columns, use sequence field, simplify, fix layout

This commit is contained in:
Jonathan Jenne
2022-07-14 11:49:41 +02:00
parent a9dcf0a7ed
commit 0958e46eab
15 changed files with 663 additions and 267 deletions

171
GUIs.Monitor/GridLoader.vb Normal file
View File

@@ -0,0 +1,171 @@
Imports DevExpress.Utils
Imports DevExpress.XtraEditors.Controls
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraTreeList
Imports DigitalData.GUIs.Common
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Public Class GridLoader
Inherits BaseClass
Public Const STATE_SUCCESS As String = "SUCCESS"
Public Const STATE_FAILURE As String = "FAILURE"
Public Const STATE_WARNING As String = "WARNING"
Public Const STATE_WAITING As String = "WAITING"
Public Const STATE_HIGHLIGHT As String = "HIGHLIGHT"
Public ReadOnly Property SvgImageCollection As SvgImageCollection
Public ReadOnly Property GridBuilder As GridBuilder
Private ReadOnly StateIcons As New Dictionary(Of String, NodeImage) From {
{STATE_SUCCESS, NodeImage.Success},
{STATE_FAILURE, NodeImage.Failure}
}
Private Enum NodeImage
[Default] = 0
SQL = 1
File = 2
Mail = 3
Success = 4
Failure = 5
Warning = 6
Waiting = 7
User = 8
Highlight = 9
End Enum
Public Sub New(pLogConfig As LogConfig, pSvgImageCollection As SvgImageCollection)
MyBase.New(pLogConfig)
Me.SvgImageCollection = pSvgImageCollection
Me.GridBuilder = New GridBuilder()
End Sub
Public Function InitTreeList() As TreeList
Dim oTreeList = New TreeList() With {
.Name = "TreeListResults",
.Visible = False
}
oTreeList.ForceInitialize()
oTreeList.KeyFieldName = "GUID"
oTreeList.ParentFieldName = "PARENT_ID"
GridBuilder.SetDefaults(oTreeList)
GridBuilder.SetClipboardHandler(oTreeList)
GridBuilder.SetReadOnlyOptions(oTreeList)
Return oTreeList
End Function
Public Function InitGrid() As GridControl
Dim oGrid = New GridControl() With {
.Name = "GridViewResults",
.Visible = False
}
oGrid.ForceInitialize()
Dim oView = DirectCast(oGrid.DefaultView, GridView)
GridBuilder.SetDefaults(oView)
GridBuilder.SetClipboardHandler(oView)
GridBuilder.SetReadOnlyOptions(oView)
Return oGrid
End Function
Public Sub InitTreeListColumns(pTreeList As TreeList, pMaxLength As Integer)
Dim oColumn1 = pTreeList.Columns.Item("COLUMN1")
Dim oColumn2 = pTreeList.Columns.Item("COLUMN2")
Dim oColumn3 = pTreeList.Columns.Item("COLUMN3")
Dim oAddedWhenColumn = pTreeList.Columns.Item("ADDED_WHEN")
Dim oStateColumn = pTreeList.Columns.Item("STATE")
Dim oIconColumn = pTreeList.Columns.Item("ICON")
Dim oStateEdit As RepositoryItemImageComboBox = GetStateEdit()
Dim oIconEdit As RepositoryItemImageComboBox = GetIconEdit()
oColumn1.VisibleIndex = 0
oStateColumn.VisibleIndex = 1
oIconColumn.VisibleIndex = 2
Dim oColumnLength = pMaxLength * 5
With oColumn1
.Caption = "Titel"
.MinWidth = oColumnLength
.MaxWidth = oColumnLength
.Width = oColumnLength
.OptionsColumn.AllowSize = False
.OptionsColumn.AllowSort = False
End With
With oColumn2
.Caption = "Wert 1"
End With
With oColumn3
.Caption = "Wert 2"
End With
With oAddedWhenColumn
.Caption = "Datum"
End With
With oStateColumn
.ColumnEdit = oStateEdit
.MaxWidth = 25
.MinWidth = 25
.Width = 25
.Caption = " "
.OptionsColumn.AllowSize = False
.OptionsColumn.AllowSort = False
.ImageOptions.Image = SvgImageCollection.GetImage(NodeImage.Success)
End With
With oIconColumn
.ColumnEdit = oIconEdit
.MaxWidth = 25
.MinWidth = 25
.Width = 25
.Caption = " "
.OptionsColumn.AllowSize = False
.OptionsColumn.AllowSort = False
.ImageOptions.Image = SvgImageCollection.GetImage(NodeImage.SQL)
End With
End Sub
Private Function GetIconEdit() As RepositoryItemImageComboBox
Dim oIconEdit As New RepositoryItemImageComboBox With {
.SmallImages = SvgImageCollection,
.GlyphAlignment = HorzAlignment.Near
}
oIconEdit.Buttons.Clear()
oIconEdit.Items.AddRange(New List(Of ImageComboBoxItem) From {
New ImageComboBoxItem("Email", "MAIL", NodeImage.Mail),
New ImageComboBoxItem("SQL", "SQL", NodeImage.SQL),
New ImageComboBoxItem("File", "FILE", NodeImage.File)
})
Return oIconEdit
End Function
Private Function GetStateEdit() As RepositoryItemImageComboBox
Dim oStateEdit As New RepositoryItemImageComboBox With {
.SmallImages = SvgImageCollection,
.GlyphAlignment = HorzAlignment.Near
}
oStateEdit.Buttons.Clear()
oStateEdit.Items.AddRange(New List(Of ImageComboBoxItem) From {
New ImageComboBoxItem("Success", "SUCCESS", NodeImage.Success),
New ImageComboBoxItem("Failure", "FAILURE", NodeImage.Failure),
New ImageComboBoxItem("Warning", "WARNING", NodeImage.Warning),
New ImageComboBoxItem("Waiting", "WAITING", NodeImage.Waiting),
New ImageComboBoxItem("Default", "DEFAULT", NodeImage.Default),
New ImageComboBoxItem("User", "USER", NodeImage.User),
New ImageComboBoxItem("Highlight", "HIGHLIGHT", NodeImage.Highlight)
})
Return oStateEdit
End Function
End Class