From 180bbd0ffeb8d39eec7f31258ad367d74c15b52c Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 26 Oct 2021 16:57:02 +0200 Subject: [PATCH] ZooFlow: new search form --- GUIs.ZooFlow/Search/XtraForm1.Designer.vb | 171 ++++++++++++++++++++++ GUIs.ZooFlow/Search/XtraForm1.resx | 120 +++++++++++++++ GUIs.ZooFlow/Search/XtraForm1.vb | 138 +++++++++++++++++ 3 files changed, 429 insertions(+) create mode 100644 GUIs.ZooFlow/Search/XtraForm1.Designer.vb create mode 100644 GUIs.ZooFlow/Search/XtraForm1.resx create mode 100644 GUIs.ZooFlow/Search/XtraForm1.vb diff --git a/GUIs.ZooFlow/Search/XtraForm1.Designer.vb b/GUIs.ZooFlow/Search/XtraForm1.Designer.vb new file mode 100644 index 00000000..bffaa4df --- /dev/null +++ b/GUIs.ZooFlow/Search/XtraForm1.Designer.vb @@ -0,0 +1,171 @@ + +Partial Class XtraForm1 + Inherits DevExpress.XtraEditors.XtraForm + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() + Me.SearchControl2 = New DevExpress.XtraEditors.TokenEdit() + Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit() + Me.PanelControl1 = New DevExpress.XtraEditors.PanelControl() + Me.SidePanel1 = New DevExpress.XtraEditors.SidePanel() + Me.NavBarControl1 = New DevExpress.XtraNavBar.NavBarControl() + Me.NavBarGroup1 = New DevExpress.XtraNavBar.NavBarGroup() + Me.NavBarItem1 = New DevExpress.XtraNavBar.NavBarItem() + Me.NavBarItem2 = New DevExpress.XtraNavBar.NavBarItem() + Me.NavBarItem3 = New DevExpress.XtraNavBar.NavBarItem() + Me.NavBarGroup2 = New DevExpress.XtraNavBar.NavBarGroup() + Me.NavBarGroup3 = New DevExpress.XtraNavBar.NavBarGroup() + CType(Me.SearchControl2.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.PanelControl1.SuspendLayout() + Me.SidePanel1.SuspendLayout() + CType(Me.NavBarControl1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'SearchControl2 + ' + Me.SearchControl2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.SearchControl2.Location = New System.Drawing.Point(227, 5) + Me.SearchControl2.Name = "SearchControl2" + Me.SearchControl2.Properties.Appearance.BackColor = System.Drawing.Color.Transparent + Me.SearchControl2.Properties.Appearance.Font = New System.Drawing.Font("Segoe UI", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.SearchControl2.Properties.Appearance.Options.UseBackColor = True + Me.SearchControl2.Properties.Appearance.Options.UseFont = True + Me.SearchControl2.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple + Me.SearchControl2.Properties.EditMode = DevExpress.XtraEditors.TokenEditMode.Manual + Me.SearchControl2.Properties.PopupFilterMode = DevExpress.XtraEditors.TokenEditPopupFilterMode.Contains + Me.SearchControl2.Properties.Separators.AddRange(New String() {",", "-", "ODER", "OR", "AND", "UND"}) + Me.SearchControl2.Size = New System.Drawing.Size(894, 44) + Me.SearchControl2.TabIndex = 0 + ' + 'ComboBoxEdit1 + ' + Me.ComboBoxEdit1.Location = New System.Drawing.Point(5, 5) + Me.ComboBoxEdit1.Name = "ComboBoxEdit1" + Me.ComboBoxEdit1.Properties.Appearance.BackColor = System.Drawing.Color.Transparent + Me.ComboBoxEdit1.Properties.Appearance.Font = New System.Drawing.Font("Segoe UI", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.ComboBoxEdit1.Properties.Appearance.Options.UseBackColor = True + Me.ComboBoxEdit1.Properties.Appearance.Options.UseFont = True + Me.ComboBoxEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple + Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) + Me.ComboBoxEdit1.Properties.Items.AddRange(New Object() {"Alle", "Belege", "Rechnungen", "Lieferscheine", "Aufträge", "Angebote", "Kunde Schaum", "Kunde medacom"}) + Me.ComboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor + Me.ComboBoxEdit1.Size = New System.Drawing.Size(223, 44) + Me.ComboBoxEdit1.TabIndex = 1 + ' + 'PanelControl1 + ' + Me.PanelControl1.AutoSize = True + Me.PanelControl1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.PanelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder + Me.PanelControl1.Controls.Add(Me.ComboBoxEdit1) + Me.PanelControl1.Controls.Add(Me.SearchControl2) + Me.PanelControl1.Dock = System.Windows.Forms.DockStyle.Top + Me.PanelControl1.Location = New System.Drawing.Point(0, 0) + Me.PanelControl1.Name = "PanelControl1" + Me.PanelControl1.Size = New System.Drawing.Size(1126, 52) + Me.PanelControl1.TabIndex = 2 + ' + 'SidePanel1 + ' + Me.SidePanel1.Controls.Add(Me.NavBarControl1) + Me.SidePanel1.Dock = System.Windows.Forms.DockStyle.Left + Me.SidePanel1.Location = New System.Drawing.Point(0, 52) + Me.SidePanel1.Name = "SidePanel1" + Me.SidePanel1.Size = New System.Drawing.Size(228, 566) + Me.SidePanel1.TabIndex = 3 + Me.SidePanel1.Text = "SidePanel1" + ' + 'NavBarControl1 + ' + Me.NavBarControl1.ActiveGroup = Me.NavBarGroup1 + Me.NavBarControl1.Dock = System.Windows.Forms.DockStyle.Fill + Me.NavBarControl1.Groups.AddRange(New DevExpress.XtraNavBar.NavBarGroup() {Me.NavBarGroup1, Me.NavBarGroup2, Me.NavBarGroup3}) + Me.NavBarControl1.Items.AddRange(New DevExpress.XtraNavBar.NavBarItem() {Me.NavBarItem1, Me.NavBarItem2, Me.NavBarItem3}) + Me.NavBarControl1.Location = New System.Drawing.Point(0, 0) + Me.NavBarControl1.Name = "NavBarControl1" + Me.NavBarControl1.OptionsNavPane.ExpandedWidth = 227 + Me.NavBarControl1.Size = New System.Drawing.Size(227, 566) + Me.NavBarControl1.TabIndex = 0 + Me.NavBarControl1.Text = "NavBarControl1" + ' + 'NavBarGroup1 + ' + Me.NavBarGroup1.Caption = "NavBarGroup1" + Me.NavBarGroup1.Expanded = True + Me.NavBarGroup1.ItemLinks.AddRange(New DevExpress.XtraNavBar.NavBarItemLink() {New DevExpress.XtraNavBar.NavBarItemLink(Me.NavBarItem1), New DevExpress.XtraNavBar.NavBarItemLink(Me.NavBarItem2), New DevExpress.XtraNavBar.NavBarItemLink(Me.NavBarItem3)}) + Me.NavBarGroup1.Name = "NavBarGroup1" + ' + 'NavBarItem1 + ' + Me.NavBarItem1.Caption = "NavBarItem1" + Me.NavBarItem1.Name = "NavBarItem1" + ' + 'NavBarItem2 + ' + Me.NavBarItem2.Caption = "NavBarItem2" + Me.NavBarItem2.Name = "NavBarItem2" + ' + 'NavBarItem3 + ' + Me.NavBarItem3.Caption = "NavBarItem3" + Me.NavBarItem3.Name = "NavBarItem3" + ' + 'NavBarGroup2 + ' + Me.NavBarGroup2.Caption = "NavBarGroup2" + Me.NavBarGroup2.Name = "NavBarGroup2" + ' + 'NavBarGroup3 + ' + Me.NavBarGroup3.Caption = "NavBarGroup3" + Me.NavBarGroup3.Name = "NavBarGroup3" + ' + 'XtraForm1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(1126, 618) + Me.Controls.Add(Me.SidePanel1) + Me.Controls.Add(Me.PanelControl1) + Me.Name = "XtraForm1" + Me.Text = "XtraForm1" + CType(Me.SearchControl2.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).EndInit() + Me.PanelControl1.ResumeLayout(False) + Me.SidePanel1.ResumeLayout(False) + CType(Me.NavBarControl1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents SearchControl2 As DevExpress.XtraEditors.TokenEdit + Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit + Friend WithEvents PanelControl1 As DevExpress.XtraEditors.PanelControl + Friend WithEvents SidePanel1 As DevExpress.XtraEditors.SidePanel + Friend WithEvents NavBarControl1 As DevExpress.XtraNavBar.NavBarControl + Friend WithEvents NavBarGroup1 As DevExpress.XtraNavBar.NavBarGroup + Friend WithEvents NavBarItem1 As DevExpress.XtraNavBar.NavBarItem + Friend WithEvents NavBarItem2 As DevExpress.XtraNavBar.NavBarItem + Friend WithEvents NavBarItem3 As DevExpress.XtraNavBar.NavBarItem + Friend WithEvents NavBarGroup2 As DevExpress.XtraNavBar.NavBarGroup + Friend WithEvents NavBarGroup3 As DevExpress.XtraNavBar.NavBarGroup +End Class diff --git a/GUIs.ZooFlow/Search/XtraForm1.resx b/GUIs.ZooFlow/Search/XtraForm1.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/GUIs.ZooFlow/Search/XtraForm1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUIs.ZooFlow/Search/XtraForm1.vb b/GUIs.ZooFlow/Search/XtraForm1.vb new file mode 100644 index 00000000..a9326cfb --- /dev/null +++ b/GUIs.ZooFlow/Search/XtraForm1.vb @@ -0,0 +1,138 @@ +Imports DevExpress.Utils +Imports DevExpress.XtraEditors +Imports DevExpress.XtraEditors.Repository + +Public Class XtraForm1 + Private ReadOnly TokenListAttributes As New Dictionary(Of String, Object) From { + {"Rechnungsnummer", New AttributeToken(7411)}, + {"Rechnungsdatum", New AttributeToken(7412)}, + {"Kundennummer", New AttributeToken(7413)} + } + + Private ReadOnly TokenListAttrValues As New Dictionary(Of String, Object) From { + {"{1233}", New AttributeValueToken(1233)}, + {"{1234}", New AttributeValueToken(1234)}, + {"{1235}", New AttributeValueToken(1235)} + } + + Private ReadOnly TokenListDate As New Dictionary(Of String, Object) From { + {"heute", New DateToken(Date.Now)}, + {"gestern", New DateToken(Date.Now.AddDays(-1))}, + {"letzte Woche", New DateToken(TimeSpan.FromDays(-7))}, + {"letzter Monat", New DateToken(TimeSpan.FromDays(-30))} + } + + Private TokenListDefault As Dictionary(Of String, Object) + Private TokenListAll As Dictionary(Of String, Object) + + Private Sub XtraForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Dim TokenList As New Dictionary(Of String, Object) + TokenListAll = TokenList. + Concat(TokenListAttributes). + Concat(TokenListAttrValues). + Concat(TokenListDate). + ToDictionary(Function(a) a.Key, Function(a) a.Value) + + TokenListDefault = TokenList. + Concat(TokenListAttributes). + Concat(TokenListDate). + ToDictionary(Function(a) a.Key, Function(a) a.Value) + + AddTokens(SearchControl2, TokenListDefault) + + ComboBoxEdit1.SelectedIndex = 0 + End Sub + + Public Enum [ValueType] + AttributeName + AttributeValue + End Enum + + Public Enum [InputMode] + [Default] + Value + End Enum + + Public Class TokenValue + Public Value As Object + Public Type As [ValueType] + + Public Overrides Function ToString() As String + Return Value.ToString() + End Function + End Class + + Public Class AttributeToken + Inherits TokenValue + + Public Sub New(pValue As Object) + Value = pValue + Type = ValueType.AttributeName + End Sub + End Class + + Public Class AttributeValueToken + Inherits TokenValue + + Public Sub New(pValue As Object) + Value = pValue + Type = ValueType.AttributeValue + End Sub + End Class + + Public Class DateToken + Inherits TokenValue + + Public Sub New(pValue As Object) + Value = pValue + Type = ValueType.AttributeValue + End Sub + End Class + + + + Private Sub AddTokens(Editor As TokenEdit, Tokens As Dictionary(Of String, Object)) + For Each oToken In Tokens + Editor.Properties.Tokens.Add(New DevExpress.XtraEditors.TokenEditToken With { + .Description = oToken.Key, + .Value = oToken.Value + }) + Next + End Sub + + Private Sub SearchControl2_Properties_TokenAdded(sender As Object, e As DevExpress.XtraEditors.TokenEditTokenAddedEventArgs) Handles SearchControl2.Properties.TokenAdded + Dim oEditor As TokenEdit = sender + SetNewTokens(oEditor) + End Sub + + Private Sub SearchControl2_Properties_TokenRemoved(sender As Object, e As TokenEditTokenRemovedEventArgs) Handles SearchControl2.Properties.TokenRemoved + Dim oEditor As TokenEdit = sender + SetNewTokens(oEditor) + End Sub + + Private Sub SetNewTokens(pEditor As TokenEdit) + Dim oLastToken = pEditor.GetTokenList().LastOrDefault() + pEditor.Properties.BeginUpdate() + + If oLastToken IsNot Nothing Then + pEditor.Properties.Tokens.Clear() + + Select Case oLastToken.Value.GetType + Case GetType(AttributeToken) + AddTokens(pEditor, TokenListAttrValues) + + Case GetType(AttributeValueToken) + AddTokens(pEditor, TokenListAll) + + Case Else + AddTokens(pEditor, TokenListDefault) + + End Select + + pEditor.Properties.EndUpdate() + Else + pEditor.Properties.Tokens.Clear() + AddTokens(pEditor, TokenListDefault) + End If + End Sub +End Class \ No newline at end of file