Monorepo/GUIs.Common/SQLEditor/Placeholders.vb

145 lines
6.2 KiB
VB.net

Imports DevExpress.Utils.Svg
Imports DevExpress.XtraBars.Ribbon
Namespace SQLEditor
Public Class Placeholders
Public Const AUTO_INDEX_ZOOFLOW = "ATTR_A"
Public Const MAN_INDEX_ZOOFLOW = "ATTR_M"
Public Function GetInternalPlaceholders(AttributStore As String) As GalleryItemGroup
Dim oModule = "INT"
Dim oImage = My.Resources.electronics_desktopmac
Dim oImagePrivate = My.Resources._private
Dim oValue As String
If AttributStore = "WM" Then
oValue = "WMDocID"
Else
oValue = "IDBObjID"
End If
Dim oItems As New List(Of GalleryItem)() From {
GetGalleryItem(New Placeholder("USERNAME", "Benutzername", oModule, "USERNAME"), oImage),
GetGalleryItem(New Placeholder("MACHINE", "Aktuelles Datum", oModule, "MACHINE"), oImage),
GetGalleryItem(New Placeholder("DOMAIN", "Email-Adresse", oModule, "DOMAIN"), oImage),
GetGalleryItem(New Placeholder("DATE", "Vorname", oModule, "DATE"), oImage),
GetGalleryItem(New Placeholder(oValue, "UniqueObjectID", oModule, oValue), oImagePrivate)
}
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Intern"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetClipboardPlaceholder() As GalleryItemGroup
Dim oModule = "CLIP"
Dim oImage = My.Resources.electronics_desktopmac
Dim oItems As New List(Of GalleryItem)() From {
GetGalleryItem(New Placeholder("BOARD", "Zwischenablage", oModule, "BOARD"), oImage)
}
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Zwischenablage"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Friend Function GetWindreamPlaceholders(pPlaceholders As List(Of String)) As GalleryItemGroup
Dim oImage = My.Resources.bo_contract
Dim oItems As New List(Of GalleryItem)()
If pPlaceholders.Count > 0 Then
For Each oWindreamPlaceholder In pPlaceholders
Dim oPlaceholder = New Placeholder(oWindreamPlaceholder, "Windream Index", "WMI", oWindreamPlaceholder)
oItems.Add(GetGalleryItem(oPlaceholder, oImage))
Next
Else Return Nothing
End If
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Windream Indizies"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetManualPlaceholders(pPlaceholders As Dictionary(Of String, String), pPrefix As String, pTitle As String) As GalleryItemGroup
Dim oImage As SvgImage = My.Resources.handtool
Dim oItems As New List(Of GalleryItem)()
Dim oPrefix As String = pPrefix
If oPrefix Is Nothing Then
oPrefix = MAN_INDEX_ZOOFLOW
End If
If pPlaceholders.Count > 0 Then
For Each oManualPlaceholder In pPlaceholders
Dim oPlaceholder = New Placeholder(oManualPlaceholder.Key, pTitle, oPrefix, oManualPlaceholder.Value)
oItems.Add(GetGalleryItem(oPlaceholder, oImage))
Next
Else Return Nothing
End If
Dim oGroup1 = New GalleryItemGroup() With {.Caption = pTitle}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetAutomaticPlaceholders(pPlaceholders As Dictionary(Of String, String), pPrefix As String, pTitle As String) As GalleryItemGroup
Dim oImage As SvgImage = My.Resources.autoarrange
Dim oItems As New List(Of GalleryItem)()
Dim oPrefix As String = pPrefix
If oPrefix Is Nothing Then
oPrefix = AUTO_INDEX_ZOOFLOW
End If
If pPlaceholders.Count > 0 Then
For Each oManualPlaceholder In pPlaceholders
Dim oPlaceholder = New Placeholder(oManualPlaceholder.Key, pTitle, oPrefix, oManualPlaceholder.Value)
oItems.Add(GetGalleryItem(oPlaceholder, oImage))
Next
Else Return Nothing
End If
Dim oGroup1 = New GalleryItemGroup() With {.Caption = pTitle}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Public Function GetUserPlaceholders() As GalleryItemGroup
Dim oModule = "USER"
Dim oImage = My.Resources.actions_user
Dim oItems As New List(Of GalleryItem)() From {
GetGalleryItem(New Placeholder("PRENAME", "Vorname", oModule, "PRENAME"), oImage),
GetGalleryItem(New Placeholder("SURNAME", "Nachname", oModule, "SURNAME"), oImage),
GetGalleryItem(New Placeholder("EMAIL", "Email-Adresse", oModule, "EMAIL"), oImage),
GetGalleryItem(New Placeholder("USER_ID", "Benutzer-ID", oModule, "USER_ID"), oImage),
GetGalleryItem(New Placeholder("PROFILE_ID", "Profil-ID", oModule, "PROFILE_ID"), oImage),
GetGalleryItem(New Placeholder("PROFILE_TITLE", "Profil-Name", oModule, "PROFILE_TITLE"), oImage),
GetGalleryItem(New Placeholder("LANGUAGE", "Sprache", oModule, "LANGUAGE"), oImage)
}
Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Benutzer"}
oGroup1.Items.AddRange(oItems.ToArray)
Return oGroup1
End Function
Private Function GetGalleryItem(pPlaceholder As Placeholder) As GalleryItem
Return New GalleryItem(Nothing, pPlaceholder.Title, pPlaceholder.Description) With {
.Tag = pPlaceholder
}
End Function
Private Function GetGalleryItem(pPlaceholder As Placeholder, pImage As SvgImage) As GalleryItem
Dim oItem = New GalleryItem(Nothing, pPlaceholder.Title, pPlaceholder.Description) With {
.Tag = pPlaceholder
}
oItem.ImageOptions.SvgImage = pImage
Return oItem
End Function
End Class
End Namespace