Zooflow: Search Improvements, Multiple Tokens
This commit is contained in:
@@ -6,7 +6,6 @@ Imports DigitalData.GUIs.ZooFlow.Search.SearchToken
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
|
||||
Public Class frmSearchNeu
|
||||
Private Search As Search.Search
|
||||
Private Database As DatabaseWithFallback
|
||||
|
||||
Private TokenListDefault As New Dictionary(Of String, Object)
|
||||
@@ -17,13 +16,12 @@ Public Class frmSearchNeu
|
||||
|
||||
Private Sub XtraForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Database = New DatabaseWithFallback(My.LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
|
||||
Search = New Search.Search(My.LogConfig, My.Application.User, Database)
|
||||
|
||||
Dim oTokens = Search.GetAttributeTokens()
|
||||
AddTokens(SearchControl2, oTokens)
|
||||
'Dim oTokens = Search.GetAttributeTokens()
|
||||
'AddTokens(SearchControl2, oTokens)
|
||||
|
||||
GridControl1.DataSource = Search.Query
|
||||
cmbSelect.SelectedIndex = 0
|
||||
'GridControl1.DataSource = Search.Query
|
||||
'cmbSelect.SelectedIndex = 0
|
||||
End Sub
|
||||
|
||||
Private Sub SetTokens(Editor As TokenEdit, Tokens As Dictionary(Of String, Object))
|
||||
@@ -52,69 +50,69 @@ Public Class frmSearchNeu
|
||||
End Sub
|
||||
|
||||
Private Sub SetNewTokens(pEditor As TokenEdit)
|
||||
Dim oLastToken = pEditor.GetTokenList().LastOrDefault()
|
||||
pEditor.Properties.BeginUpdate()
|
||||
'Dim oLastToken = pEditor.GetTokenList().LastOrDefault()
|
||||
'pEditor.Properties.BeginUpdate()
|
||||
|
||||
If oLastToken IsNot Nothing Then
|
||||
Select Case oLastToken.Value.GetType
|
||||
'If oLastToken IsNot Nothing Then
|
||||
' Select Case oLastToken.Value.GetType
|
||||
|
||||
Case GetType(AttributeKeyToken)
|
||||
' After the attribute key comes an operator
|
||||
SetTokens(pEditor, Search.GetOperatorTokens(GetType(String)))
|
||||
Search.InputMode = InputMode.Operator
|
||||
' Case GetType(AttributeKeyToken)
|
||||
' ' After the attribute key comes an operator
|
||||
' SetTokens(pEditor, Search.GetOperatorTokens(GetType(String)))
|
||||
' Search.InputMode = InputMode.Operator
|
||||
|
||||
Case GetType(AttributeOperatorToken)
|
||||
' After the attribute operator comes a value
|
||||
SetTokens(pEditor, TokenListAttrValues)
|
||||
Search.InputMode = InputMode.Value
|
||||
' Case GetType(AttributeOperatorToken)
|
||||
' ' After the attribute operator comes a value
|
||||
' SetTokens(pEditor, TokenListAttrValues)
|
||||
' Search.InputMode = InputMode.Value
|
||||
|
||||
Case GetType(AttributeValueToken)
|
||||
' After the attribute value comes another value
|
||||
SetTokens(pEditor, TokenListAttrValues)
|
||||
Search.InputMode = InputMode.Value
|
||||
' Case GetType(AttributeValueToken)
|
||||
' ' After the attribute value comes another value
|
||||
' SetTokens(pEditor, TokenListAttrValues)
|
||||
' Search.InputMode = InputMode.Value
|
||||
|
||||
Case Else
|
||||
SetTokens(pEditor, TokenListDefault)
|
||||
Search.InputMode = InputMode.Default
|
||||
' Case Else
|
||||
' SetTokens(pEditor, TokenListDefault)
|
||||
' Search.InputMode = InputMode.Default
|
||||
|
||||
End Select
|
||||
Else
|
||||
SetTokens(pEditor, TokenListDefault)
|
||||
Search.InputMode = InputMode.Default
|
||||
End If
|
||||
' End Select
|
||||
'Else
|
||||
' SetTokens(pEditor, TokenListDefault)
|
||||
' Search.InputMode = InputMode.Default
|
||||
'End If
|
||||
|
||||
pEditor.Properties.EndUpdate()
|
||||
'pEditor.Properties.EndUpdate()
|
||||
End Sub
|
||||
|
||||
Private Sub SearchControl2_CustomDrawTokenGlyph(sender As Object, e As TokenEditCustomDrawTokenGlyphEventArgs) Handles SearchControl2.CustomDrawTokenGlyph
|
||||
' Set Background according to token type
|
||||
Select Case e.Value.GetType()
|
||||
Case GetType(AttributeKeyToken)
|
||||
e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#F87171")), e.Bounds)
|
||||
'' Set Background according to token type
|
||||
'Select Case e.Value.GetType()
|
||||
' Case GetType(AttributeKeyToken)
|
||||
' e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#F87171")), e.Bounds)
|
||||
|
||||
Case GetType(AttributeOperatorToken)
|
||||
e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#34D399")), e.Bounds)
|
||||
' Case GetType(AttributeOperatorToken)
|
||||
' e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#34D399")), e.Bounds)
|
||||
|
||||
Case GetType(AttributeValueToken)
|
||||
e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#60A5FA")), e.Bounds)
|
||||
Case Else
|
||||
End Select
|
||||
' Case GetType(AttributeValueToken)
|
||||
' e.Graphics.FillRectangle(New SolidBrush(ColorTranslator.FromHtml("#60A5FA")), e.Bounds)
|
||||
' Case Else
|
||||
'End Select
|
||||
|
||||
' Draw the glyph on top
|
||||
' This fixes: https://supportcenter.devexpress.com/ticket/details/t215578/tokenedit-glyph-is-not-visible-when-customdrawtokentext-is-used
|
||||
e.DefaultDraw()
|
||||
'' Draw the glyph on top
|
||||
'' This fixes: https://supportcenter.devexpress.com/ticket/details/t215578/tokenedit-glyph-is-not-visible-when-customdrawtokentext-is-used
|
||||
'e.DefaultDraw()
|
||||
End Sub
|
||||
|
||||
Private Sub SearchControl2_KeyUp(sender As Object, e As KeyEventArgs) Handles SearchControl2.KeyUp
|
||||
If Search.InputMode = InputMode.Value And e.KeyCode = Keys.Enter And SearchControl2.IsPopupOpen Then
|
||||
Search.Query.Add(New SearchCriteria With {
|
||||
.ParenLeft = False,
|
||||
.Key = "test",
|
||||
.Op = OperatorToken.Equals,
|
||||
.Value = "test",
|
||||
.ParentRight = False
|
||||
})
|
||||
End If
|
||||
'If Search.InputMode = InputMode.Value And e.KeyCode = Keys.Enter And SearchControl2.IsPopupOpen Then
|
||||
' Search.Query.Add(New SearchCriteria With {
|
||||
' .ParenLeft = False,
|
||||
' .Key = "test",
|
||||
' .Op = OperatorToken.Equals,
|
||||
' .Value = "test",
|
||||
' .ParentRight = False
|
||||
' })
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
|
||||
|
||||
Reference in New Issue
Block a user