376 lines
11 KiB
VB.net
376 lines
11 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.Drawing.Design
|
|
Imports System.Globalization
|
|
|
|
Public Module ModuleControlProperties
|
|
Public Enum IndexTypes
|
|
SimpleIndex = 0
|
|
VectorIndex = 1
|
|
End Enum
|
|
|
|
Public Class BaseProperties
|
|
Private _id As Integer
|
|
Private _name As String
|
|
Private _location As Point
|
|
Private _size As Size
|
|
Private _font As Font
|
|
Private _text_color As Color
|
|
Private _changed_at As Date
|
|
Private _changed_who As String
|
|
|
|
<Category("Allgemein")>
|
|
<[ReadOnly](True)>
|
|
Public Property ChangedAt As Date
|
|
Get
|
|
Return _changed_at
|
|
End Get
|
|
Set(value As Date)
|
|
_changed_at = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Allgemein")>
|
|
<[ReadOnly](True)>
|
|
Public Property ChangedWho As String
|
|
Get
|
|
Return _changed_who
|
|
End Get
|
|
Set(value As String)
|
|
_changed_who = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Allgemein")>
|
|
<[ReadOnly](True)>
|
|
Public Property ID() As Integer
|
|
Get
|
|
Return _id
|
|
End Get
|
|
Set(value As Integer)
|
|
_id = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Allgemein")>
|
|
Public Property Name() As String
|
|
Get
|
|
Return _name
|
|
End Get
|
|
Set(value As String)
|
|
_name = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Anzeige")>
|
|
Public Property Location() As Point
|
|
Get
|
|
Return _location
|
|
End Get
|
|
Set(value As Point)
|
|
_location = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Anzeige")>
|
|
Public Property Size() As Size
|
|
Get
|
|
Return _size
|
|
End Get
|
|
Set(value As Size)
|
|
If (value.Height <= 0) Then
|
|
value.Height = 1
|
|
End If
|
|
|
|
If (value.Width <= 20) Then
|
|
value.Width = 20
|
|
End If
|
|
|
|
_size = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Anzeige")>
|
|
<TypeConverter(GetType(FontConverter))>
|
|
Public Overridable Property Font As Font
|
|
Get
|
|
Return _font
|
|
End Get
|
|
Set(value As Font)
|
|
_font = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Anzeige")>
|
|
Public Property TextColor As Color
|
|
Get
|
|
Return _text_color
|
|
End Get
|
|
Set(value As Color)
|
|
_text_color = value
|
|
End Set
|
|
End Property
|
|
|
|
Class FontConverter
|
|
Inherits TypeConverter
|
|
|
|
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object
|
|
Dim font = DirectCast(value, Font)
|
|
Return $"{font.Name}, {font.Size}"
|
|
End Function
|
|
End Class
|
|
End Class
|
|
|
|
Public Class InputProperties
|
|
Inherits BaseProperties
|
|
|
|
Private _required As Boolean
|
|
Private _read_only As Boolean
|
|
Private _index_type As String
|
|
Private _indicies As List(Of String)
|
|
Private _index As String
|
|
Private _sql_command As String
|
|
|
|
Public Property Required() As Boolean
|
|
Get
|
|
Return _required
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
_required = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property [ReadOnly]() As Boolean
|
|
Get
|
|
Return _read_only
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
_read_only = value
|
|
End Set
|
|
End Property
|
|
|
|
<Browsable(False)>
|
|
<Category("Indexierung")>
|
|
Public Property IndexType() As IndexTypes
|
|
Get
|
|
Return _index_type
|
|
End Get
|
|
Set(ByVal value As IndexTypes)
|
|
_index_type = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Diese Eigenschaft enthält die auswählbaren Indicies, die für das Control verfügbar sind. Wird nicht direkt angezeigt.
|
|
''' </summary>
|
|
<Browsable(False)>
|
|
Public Property Indicies() As List(Of String)
|
|
Get
|
|
Return _indicies
|
|
End Get
|
|
Set(ByVal value As List(Of String))
|
|
_indicies = value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Diese Eigenschaft enthält des ausgewählten Index
|
|
''' </summary>
|
|
<Category("Indexierung")>
|
|
<TypeConverter(GetType(IndexListConverter))>
|
|
Public Property Index() As String
|
|
Get
|
|
Return _index
|
|
End Get
|
|
Set(value As String)
|
|
_index = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Daten")>
|
|
Public Property SQLCommand() As SQLValue
|
|
Get
|
|
Return New SQLValue(NotNull(_sql_command, ""))
|
|
End Get
|
|
Set(ByVal value As SQLValue)
|
|
_sql_command = value.Value
|
|
End Set
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Sorgt dafür, dass die Liste von Indicies aus dem gleichnamigen Feld ausgelesen wird
|
|
''' </summary>
|
|
Public Class IndexListConverter
|
|
Inherits TypeConverter
|
|
|
|
Public Overrides Function GetStandardValuesSupported(context As ITypeDescriptorContext) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
Public Overrides Function GetStandardValues(context As ITypeDescriptorContext) As StandardValuesCollection
|
|
Dim indexList = DirectCast(context.Instance, InputProperties).Indicies
|
|
Dim values As New StandardValuesCollection(indexList)
|
|
Return values
|
|
End Function
|
|
|
|
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object
|
|
If IsNothing(value) Then
|
|
Return ""
|
|
Else
|
|
Return value.ToString()
|
|
End If
|
|
End Function
|
|
End Class
|
|
|
|
Public Class SQLTypeConverter
|
|
Inherits TypeConverter
|
|
|
|
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As Globalization.CultureInfo, value As Object, destinationType As Type) As Object
|
|
'Return MyBase.ConvertTo(context, culture, value, destinationType)
|
|
Dim sqlvalue As SQLValue = DirectCast(value, SQLValue)
|
|
Return sqlvalue.Value
|
|
End Function
|
|
End Class
|
|
|
|
''' <summary>
|
|
''' Hilfsklasse, die für das anzeigen und abspeichern von SQL-Befehlen verwendet wird
|
|
''' </summary>
|
|
<Editor(GetType(ClassSQLEditor), GetType(UITypeEditor))>
|
|
<TypeConverter(GetType(SQLTypeConverter))>
|
|
Public Class SQLValue
|
|
Private _value As String
|
|
|
|
Public Sub New(value As String)
|
|
Me.Value = value
|
|
End Sub
|
|
|
|
Public Property Value As String
|
|
Get
|
|
Return _value
|
|
End Get
|
|
Set(value As String)
|
|
_value = value
|
|
End Set
|
|
End Property
|
|
End Class
|
|
End Class
|
|
|
|
Public Class TextboxProperties
|
|
Inherits InputProperties
|
|
|
|
End Class
|
|
|
|
Public Class LabelProperties
|
|
Inherits BaseProperties
|
|
|
|
Private _text As String
|
|
|
|
<Category("Allgemein")>
|
|
Public Property Text() As String
|
|
Get
|
|
Return _text
|
|
End Get
|
|
Set(value As String)
|
|
_text = value
|
|
End Set
|
|
End Property
|
|
End Class
|
|
|
|
Public Class CheckboxProperties
|
|
Inherits InputProperties
|
|
|
|
Private _text As String
|
|
|
|
<Category("Allgemein")>
|
|
Public Property Text() As String
|
|
Get
|
|
Return _text
|
|
End Get
|
|
Set(value As String)
|
|
_text = value
|
|
End Set
|
|
End Property
|
|
End Class
|
|
|
|
Public Class ComboboxProperties
|
|
Inherits InputProperties
|
|
|
|
Private _text As String
|
|
Private _choice_list As String
|
|
Private _choice_lists As List(Of String)
|
|
|
|
<Category("Allgemein")>
|
|
Public Property Text() As String
|
|
Get
|
|
Return _text
|
|
End Get
|
|
Set(value As String)
|
|
_text = value
|
|
End Set
|
|
End Property
|
|
|
|
<Browsable(False)>
|
|
Public Property ChoiceLists() As List(Of String)
|
|
Get
|
|
Return _choice_lists
|
|
End Get
|
|
Set(value As List(Of String))
|
|
_choice_lists = value
|
|
End Set
|
|
End Property
|
|
|
|
<Category("Daten")>
|
|
<TypeConverter(GetType(ChoiceListConverter))>
|
|
Public Property ChoiceList() As String
|
|
Get
|
|
Return _choice_list
|
|
End Get
|
|
Set(value As String)
|
|
_choice_list = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Class ChoiceListConverter
|
|
Inherits TypeConverter
|
|
|
|
Public Overrides Function GetStandardValuesSupported(context As ITypeDescriptorContext) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
Public Overrides Function GetStandardValues(context As ITypeDescriptorContext) As StandardValuesCollection
|
|
Dim choiceListList = DirectCast(context.Instance, ComboboxProperties).ChoiceLists
|
|
Dim values As New StandardValuesCollection(choiceListList)
|
|
Return values
|
|
End Function
|
|
|
|
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object
|
|
If IsNothing(value) Then
|
|
Return ""
|
|
Else
|
|
Return value.ToString()
|
|
End If
|
|
End Function
|
|
End Class
|
|
End Class
|
|
|
|
Public Class DatepickerProperties
|
|
Inherits InputProperties
|
|
End Class
|
|
|
|
Public Class GridViewProperties
|
|
Inherits InputProperties
|
|
End Class
|
|
|
|
Public Class LineLabelProperties
|
|
Inherits BaseProperties
|
|
|
|
<Browsable(False)>
|
|
Public Overrides Property Font As Font
|
|
Get
|
|
Return Nothing
|
|
End Get
|
|
Set(value As Font)
|
|
End Set
|
|
End Property
|
|
End Class
|
|
End Module
|