TaskFlow/app/DD_PM_WINDREAM/ModuleControlProperties.vb
2018-06-21 15:26:17 +02:00

330 lines
8.8 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
Private _default_value
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
<Category("Daten")>
Public Property DefaultValue() As String
Get
Return _default_value
End Get
Set(value As String)
_default_value = value
End Set
End Property
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