271 lines
9.7 KiB
VB.net
271 lines
9.7 KiB
VB.net
Imports DevExpress.LookAndFeel
|
|
Imports DevExpress.Utils
|
|
Imports DevExpress.Utils.Extensions
|
|
Imports DevExpress.XtraCharts
|
|
Imports DevExpress.XtraEditors
|
|
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.GUIs.Monitor.Constants
|
|
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
|
|
|
|
Public Event ChartControlClicked As EventHandler
|
|
|
|
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
|
|
DateTime = 10
|
|
Key = 11
|
|
Money = 12
|
|
Text = 13
|
|
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)
|
|
' TODO Spalten die nicht HyperLinks sind readonly machen
|
|
Return oGrid
|
|
End Function
|
|
|
|
Public Function InitChartViewResultContainer() As SplitContainerControl
|
|
' Vorbereiten der SplitContainer-Struktur inkl. der ChartControls
|
|
Dim oChartViewResultContainer As SplitContainerControl
|
|
Dim oSplitContainerTop As SplitContainerControl
|
|
Dim oSplitContainerBottom As SplitContainerControl
|
|
|
|
oChartViewResultContainer = New SplitContainerControl With {
|
|
.Name = "ChartViewResultContainer",
|
|
.Visible = False,
|
|
.Dock = DockStyle.Fill,
|
|
.Horizontal = False,
|
|
.IsSplitterFixed = True
|
|
}
|
|
|
|
oSplitContainerTop = New SplitContainerControl With {
|
|
.Name = "SplitContainerTop",
|
|
.Dock = DockStyle.Fill,
|
|
.Horizontal = True,
|
|
.IsSplitterFixed = True
|
|
}
|
|
|
|
oSplitContainerBottom = New SplitContainerControl With {
|
|
.Name = "SplitContainerBottom",
|
|
.Dock = DockStyle.Fill,
|
|
.Horizontal = True,
|
|
.IsSplitterFixed = True
|
|
}
|
|
|
|
oChartViewResultContainer.Panel1.AddControl(oSplitContainerTop)
|
|
oChartViewResultContainer.Panel2.AddControl(oSplitContainerBottom)
|
|
|
|
Dim oChartControlTopLeft As New ChartControl With {
|
|
.Name = "ChartControlTopLeft",
|
|
.Dock = DockStyle.Fill
|
|
}
|
|
Dim oChartControlTopRight As New ChartControl With {
|
|
.Name = "ChartControlTopRight",
|
|
.Dock = DockStyle.Fill
|
|
}
|
|
Dim oChartControlBottomLeft As New ChartControl With {
|
|
.Name = "ChartControlBottomLeft",
|
|
.Dock = DockStyle.Fill
|
|
}
|
|
Dim oChartControlBottomRight As New ChartControl With {
|
|
.Name = "ChartControlBottomRight",
|
|
.Dock = DockStyle.Fill
|
|
}
|
|
|
|
' Registrieren der Haus-eigenen Palette
|
|
oChartControlTopLeft.PaletteRepository.RegisterPalette(GetDDDefaulPalette())
|
|
oChartControlTopRight.PaletteRepository.RegisterPalette(GetDDDefaulPalette())
|
|
oChartControlBottomLeft.PaletteRepository.RegisterPalette(GetDDDefaulPalette())
|
|
oChartControlBottomRight.PaletteRepository.RegisterPalette(GetDDDefaulPalette())
|
|
|
|
AddHandler oChartControlTopLeft.Click, AddressOf ChartControl_Click
|
|
AddHandler oChartControlTopRight.Click, AddressOf ChartControl_Click
|
|
AddHandler oChartControlBottomLeft.Click, AddressOf ChartControl_Click
|
|
AddHandler oChartControlBottomRight.Click, AddressOf ChartControl_Click
|
|
|
|
oSplitContainerTop.Panel1.AddControl(oChartControlTopLeft)
|
|
oSplitContainerTop.Panel2.AddControl(oChartControlTopRight)
|
|
oSplitContainerBottom.Panel1.AddControl(oChartControlBottomLeft)
|
|
oSplitContainerBottom.Panel2.AddControl(oChartControlBottomRight)
|
|
|
|
Return oChartViewResultContainer
|
|
End Function
|
|
|
|
Private Sub ChartControl_Click(sender As Object, e As EventArgs)
|
|
RaiseEvent ChartControlClicked(sender, Nothing)
|
|
End Sub
|
|
|
|
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 = Nothing
|
|
End With
|
|
|
|
With oIconColumn
|
|
.ColumnEdit = oIconEdit
|
|
.MaxWidth = 25
|
|
.MinWidth = 25
|
|
.Width = 25
|
|
.Caption = " "
|
|
.OptionsColumn.AllowSize = False
|
|
.OptionsColumn.AllowSort = False
|
|
.ImageOptions.Image = Nothing
|
|
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),
|
|
New ImageComboBoxItem("User", "USER", NodeImage.User),
|
|
New ImageComboBoxItem("DateTime", "DATETIME", NodeImage.DateTime),
|
|
New ImageComboBoxItem("KeyValue", "KEYVALUE", NodeImage.Key),
|
|
New ImageComboBoxItem("Money", "MONEY", NodeImage.Money),
|
|
New ImageComboBoxItem("Text", "TEXT", NodeImage.Text)
|
|
})
|
|
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("Highlight", "HIGHLIGHT", NodeImage.Highlight)
|
|
})
|
|
|
|
Return oStateEdit
|
|
End Function
|
|
|
|
|
|
Public Function GetDDDefaulPalette() As Palette
|
|
' Digital Data Default Palette für Dark Mode
|
|
Dim palette As Palette = New Palette("DDDefault Palette")
|
|
palette.Add(ColorTranslator.FromHtml(DDDefaultColors.PALETTE_COLOR_1))
|
|
palette.Add(ColorTranslator.FromHtml(DDDefaultColors.PALETTE_COLOR_2))
|
|
palette.Add(ColorTranslator.FromHtml(DDDefaultColors.PALETTE_COLOR_3))
|
|
palette.Add(ColorTranslator.FromHtml(DDDefaultColors.PALETTE_COLOR_4))
|
|
palette.Add(ColorTranslator.FromHtml(DDDefaultColors.PALETTE_COLOR_5))
|
|
Return palette
|
|
End Function
|
|
|
|
End Class
|