NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
CQueryParsePanel Class Reference

Search Toolkit Book for CQueryParsePanel

CQueryParsePanel. More...

#include <gui/widgets/data/query_parse_panel.hpp>

+ Inheritance diagram for CQueryParsePanel:
+ Collaboration diagram for CQueryParsePanel:

Classes

class  CQueryJob
 Job class used to run query on separate thread. More...
 

Public Types

enum  ECommands {
  eCmdStartQuery =eBaseCmdLast + 2750 , eCmdStopQuery , eCmdSelQuery , eCmdNext ,
  eCmdPrevious , eCmdCaseSensitive , eCmdHelp , eCmdFilter ,
  eCmdStringMatchType , eCmdLast
}
 
typedef vector< pair< string, string > > TNamedQueries
 
- Public Types inherited from CEventHandler
enum  EDispatch { eDispatch_SelfOnly , eDispatch_AllHandlers , eDispatch_FirstHandler , eDispatch_Default = eDispatch_AllHandlers }
 enum controlling dispatching strategies More...
 
enum  EPoolName {
  ePool_Default = 0 , ePool_Parent , ePool_Child , ePool_Sibling ,
  ePool_NextAvailable
}
 Identifiers for standard pools. More...
 
typedef vector< CEventHandler * > TListeners
 
typedef map< int, TListenersTPools
 
typedef list< AutoPtr< SPostRequest > > TPostRequests
 
typedef std::map< CEventHandler *, intTHandlerToCount
 
typedef void(* FOnPostCallback) ()
 

Public Member Functions

 CQueryParsePanel (IQueryWidget *w, IQueryDataSource *ds=NULL)
 Ctor requires a data source derived from IQueryDataSource and a view of that data source derived from IQueryWidget. More...
 
virtual ~CQueryParsePanel ()
 
virtual void Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 Create window. More...
 
void Init ()
 Initialises member variables. More...
 
void CreateControls ()
 Creates the controls and sizers. More...
 
void SetDataSource (IQueryDataSource *ds)
 Set or update data source. More...
 
void AddQueryText (const string &query_mod)
 Add given string to currently displayed query text. More...
 
void CompleteQuery (CMacroQueryExec *qexec, const string &status)
 
bool IsSelectAll ()
 Return true if select all checkbox is checked. More...
 
void HideSelectAll (void)
 Hide the Select All checkbox. More...
 
void SetDefaultQueries (const TNamedQueries &q)
 Set the set of default queries for the current data source. More...
 
TNamedQueries GetDefaultQueries () const
 Retrieve the current defualt queries for the data source. More...
 
string GetLastQuery () const
 Get the text for the most recently executed query. More...
 
void OnIdle (wxIdleEvent &event)
 
IRegSettings interface implementation
virtual void SetRegistryPath (const string &reg_path)
 
virtual void LoadSettings ()
 
virtual void SaveSettings () const
 
Command handlers
void OnSearchctrlTextEnter (wxCommandEvent &evt)
 
void OnQuerySel (wxCommandEvent &evt)
 
void OnButtonNext (wxCommandEvent &evt)
 
void OnButtonPrevious (wxCommandEvent &evt)
 
void OnSearchctrlSearchButtonClick (wxCommandEvent &evt)
 
void OnCtrlKillFocus (wxFocusEvent &evt)
 
void OnSearchctrlSearchStop (wxCommandEvent &evt)
 
void OnSearchHelp (wxCommandEvent &evt)
 
void OnToggleSelectAll (wxCommandEvent &evt)
 
void OnToggleHideUnselected (wxCommandEvent &evt)
 
void OnContextMenu (wxContextMenuEvent &)
 
void OnRecentQuery (wxCommandEvent &evt)
 
void OnStringMatchTypeBtn (wxCommandEvent &evt)
 
void OnStringMatchTypeSelected (wxCommandEvent &evt)
 
- Public Member Functions inherited from CEventHandler
 CEventHandler ()
 CEventHandler. More...
 
virtual ~CEventHandler ()
 
virtual void AddListener (CEventHandler *listener, int pool_name=ePool_Default)
 Add a listener. More...
 
virtual void RemoveListener (CEventHandler *listener)
 Remove a listener. More...
 
virtual void RemoveAllListeners (void)
 
virtual bool HasListener (CEventHandler *listener, int pool_name=ePool_Default) const
 returns "true" if the given listener belongs to the specified pool More...
 
virtual const TListenersGetListeners (int pool_name=ePool_Default) const
 returns a set of listeners fro the specified pool More...
 
virtual bool OnEvent (CEvent *evt)
 Processes en event. Returns "true" if event has been processed. More...
 
virtual bool Dispatch (CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
 Dispatches an event to the listeners (but does not handle it). More...
 
virtual bool Send (CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
 Sends an event synchronously. More...
 
virtual bool Send (CEvent *evt, int pool_name)
 
void Post (CRef< CEvent > evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
 Handles an event asynchronously (process and/or dispatch). More...
 
- Public Member Functions inherited from IRegSettings
virtual ~IRegSettings ()
 

Protected Member Functions

bool x_IsValidQuery (string query, bool casesensitive, vector< std::pair< size_t, size_t > > &fields)
 Return true if query parses correctly, putting field names in 'fields'. More...
 
void x_StartQueryJob (CRef< CMacroQueryExec > qexec, CQueryParseTree *qtree, macro::CMacroRep *macro_rep, bool casesensitive, const string &query)
 Submit query job for asynch execution. More...
 
void x_ExecuteQuery (int search_dir)
 Parse query and determine how to execute. More...
 
void x_CancelQueryInProgress ()
 If user presses cancel button, cancel running job. More...
 
void x_AddRecentQuery (const std::string &q)
 Add a query to the list of recently used queries, if it is unique. More...
 
- Protected Member Functions inherited from CEventHandler
virtual const SEvtMapGetEventMap () const
 
void x_DeclareDead ()
 Removes itself unavailable for async event delivery. More...
 
void x_AddListenerToPool (CEventHandler *listener, int pool_name)
 

Protected Attributes

CRichTextCtrlm_pSearch
 Widgets. More...
 
wxAnimationCtrl * m_Animation
 
wxToolBar * m_ToolBar
 
wxChoice * m_StringSearch
 
wxButton * m_StopQuery
 
wxCheckBox * m_pSelectAll
 
wxStaticText * m_SearchType
 
std::vector< std::pair< size_t, size_t > > m_SearchStringFields
 positions of dictionary fields in current search string More...
 
std::string m_SearchString
 current search string (as of previous update to m_pSearch) More...
 
vector< pair< string, string > > m_RecentQueries
 Set of recent queries. More...
 
vector< pair< string, string > > m_DefaultQueries
 Set of default queries. More...
 
IQueryWidgetm_QueryWidget
 Interface to widget which will display query results. More...
 
CIRef< IQueryDataSourcem_QueryDataSource
 Interface to data source that is being queried. More...
 
string m_PrevQuery
 String of query last time query was executed. More...
 
bool m_CaseSensitive
 Current value for case-sensitive. More...
 
bool m_PrevCaseSensitive
 Value of case-sensitive button last time query was executed. More...
 
CStringMatching::EStringMatching m_StringCompare
 How to compare strings in query - wildcards, exact match, etc. More...
 
CStringMatching::EStringMatching m_PrevStringCompare
 Value of string-matching selection last time query was executed. More...
 
CIRef< CQueryJobm_Job
 Current tree-query job. More...
 
job_future< void > m_Future
 
string m_RegPath
 Registry path for query panel. More...
 
string m_RegSection
 Registry section for specific current data source (derived from columns) More...
 
- Protected Attributes inherited from CEventHandler
TPools m_Pools
 

Static Protected Attributes

static bool m_IconsInitialized = false
 Only need to load icons into art provider once per run. More...
 
static const int m_MaxRecentQueries = 5
 Max number of recent queries to include in list. More...
 
static const int m_MaxDefaultQueries = 10
 
- Static Protected Attributes inherited from CEventHandler
static const SEvtMap sm_EvtMap
 

Private Member Functions

 DECLARE_EVENT_TABLE ()
 

Additional Inherited Members

- Static Public Member Functions inherited from CEventHandler
static bool HandlePostRequest ()
 
static void ClearPostQueue ()
 erases all events from the queue More...
 
static void DestroyPostQueue ()
 

Detailed Description

CQueryParsePanel.

This class represents a toolbar that allows the user to query against a data source and then to visualize the query results as selected elements within the attached view. In order to support the query toolbar, the developer must have a data source that is derived from IQueryDataSource which supports execution of the parsed query against the data. The developer must also provide a pointer to a widget (the view for the data source) which must implement the interface IQueryWidget.

The queries themselves are run as background jobs since they could take significant time in cases where network access is needed. At job completion a CQueryEvent event is sent to the IQueryWidget-derived widget.

Definition at line 83 of file query_parse_panel.hpp.

Member Typedef Documentation

◆ TNamedQueries

Definition at line 105 of file query_parse_panel.hpp.

Member Enumeration Documentation

◆ ECommands

Enumerator
eCmdStartQuery 
eCmdStopQuery 
eCmdSelQuery 
eCmdNext 
eCmdPrevious 
eCmdCaseSensitive 
eCmdHelp 
eCmdFilter 
eCmdStringMatchType 
eCmdLast 

Definition at line 91 of file query_parse_panel.hpp.

Constructor & Destructor Documentation

◆ CQueryParsePanel()

CQueryParsePanel::OnStringMatchTypeSelected CQueryParsePanel::CQueryParsePanel ( IQueryWidget w,
IQueryDataSource ds = NULL 
)

Ctor requires a data source derived from IQueryDataSource and a view of that data source derived from IQueryWidget.

Definition at line 210 of file query_parse_panel.cpp.

References Init(), and SetDataSource().

◆ ~CQueryParsePanel()

CQueryParsePanel::~CQueryParsePanel ( )
virtual

Member Function Documentation

◆ AddQueryText()

void CQueryParsePanel::AddQueryText ( const string query_mod)

◆ CompleteQuery()

void CQueryParsePanel::CompleteQuery ( CMacroQueryExec qexec,
const string status 
)

◆ Create()

void CQueryParsePanel::Create ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)
virtual

◆ CreateControls()

void CQueryParsePanel::CreateControls ( )

◆ DECLARE_EVENT_TABLE()

CQueryParsePanel::DECLARE_EVENT_TABLE ( )
private

◆ GetDefaultQueries()

TNamedQueries CQueryParsePanel::GetDefaultQueries ( ) const
inline

Retrieve the current defualt queries for the data source.

Definition at line 144 of file query_parse_panel.hpp.

References m_DefaultQueries.

◆ GetLastQuery()

string CQueryParsePanel::GetLastQuery ( ) const

Get the text for the most recently executed query.

Definition at line 515 of file query_parse_panel.cpp.

References m_RecentQueries.

Referenced by CPhyloTreeWidget::OnAddSelectionSet().

◆ HideSelectAll()

void CQueryParsePanel::HideSelectAll ( void  )

Hide the Select All checkbox.

Definition at line 803 of file query_parse_panel.cpp.

References m_pSelectAll.

Referenced by CGridWidget::x_InitGrid().

◆ Init()

void CQueryParsePanel::Init ( void  )

◆ IsSelectAll()

bool CQueryParsePanel::IsSelectAll ( )

Return true if select all checkbox is checked.

Definition at line 798 of file query_parse_panel.cpp.

References m_pSelectAll.

Referenced by CGridWidget::IterateSelection(), CPhyloTreeWidget::IterateSelection(), CPhyloTreeWidget::QueryEnd(), SetDataSource(), and CGridWidget::x_CompleteQuery().

◆ LoadSettings()

void CQueryParsePanel::LoadSettings ( )
virtual

◆ OnButtonNext()

void CQueryParsePanel::OnButtonNext ( wxCommandEvent &  evt)

Definition at line 784 of file query_parse_panel.cpp.

References IQueryWidget::IterateSelection(), and m_QueryWidget.

◆ OnButtonPrevious()

void CQueryParsePanel::OnButtonPrevious ( wxCommandEvent &  evt)

Definition at line 791 of file query_parse_panel.cpp.

References IQueryWidget::IterateSelection(), and m_QueryWidget.

◆ OnContextMenu()

void CQueryParsePanel::OnContextMenu ( wxContextMenuEvent &  evt)

Definition at line 604 of file query_parse_panel.cpp.

◆ OnCtrlKillFocus()

void CQueryParsePanel::OnCtrlKillFocus ( wxFocusEvent &  evt)

Definition at line 632 of file query_parse_panel.cpp.

References IQueryWidget::DlgOverlayFix(), and m_QueryWidget.

Referenced by CreateControls().

◆ OnIdle()

void CQueryParsePanel::OnIdle ( wxIdleEvent &  event)

◆ OnQuerySel()

void CQueryParsePanel::OnQuerySel ( wxCommandEvent &  evt)

◆ OnRecentQuery()

void CQueryParsePanel::OnRecentQuery ( wxCommandEvent &  evt)

◆ OnSearchctrlSearchButtonClick()

void CQueryParsePanel::OnSearchctrlSearchButtonClick ( wxCommandEvent &  evt)

◆ OnSearchctrlSearchStop()

void CQueryParsePanel::OnSearchctrlSearchStop ( wxCommandEvent &  evt)

◆ OnSearchctrlTextEnter()

void CQueryParsePanel::OnSearchctrlTextEnter ( wxCommandEvent &  evt)

◆ OnSearchHelp()

void CQueryParsePanel::OnSearchHelp ( wxCommandEvent &  evt)

◆ OnStringMatchTypeBtn()

void CQueryParsePanel::OnStringMatchTypeBtn ( wxCommandEvent &  evt)

◆ OnStringMatchTypeSelected()

void CQueryParsePanel::OnStringMatchTypeSelected ( wxCommandEvent &  evt)

◆ OnToggleHideUnselected()

void CQueryParsePanel::OnToggleHideUnselected ( wxCommandEvent &  evt)

◆ OnToggleSelectAll()

void CQueryParsePanel::OnToggleSelectAll ( wxCommandEvent &  evt)

◆ SaveSettings()

void CQueryParsePanel::SaveSettings ( ) const
virtual

◆ SetDataSource()

void CQueryParsePanel::SetDataSource ( IQueryDataSource ds)

◆ SetDefaultQueries()

void CQueryParsePanel::SetDefaultQueries ( const TNamedQueries q)

Set the set of default queries for the current data source.

Definition at line 505 of file query_parse_panel.cpp.

References m_DefaultQueries, and m_MaxDefaultQueries.

Referenced by CGridWidget::x_InitGrid().

◆ SetRegistryPath()

void CQueryParsePanel::SetRegistryPath ( const string reg_path)
virtual

◆ x_AddRecentQuery()

void CQueryParsePanel::x_AddRecentQuery ( const std::string q)
protected

Add a query to the list of recently used queries, if it is unique.

Definition at line 1373 of file query_parse_panel.cpp.

References m_MaxRecentQueries, and m_RecentQueries.

Referenced by x_ExecuteQuery().

◆ x_CancelQueryInProgress()

void CQueryParsePanel::x_CancelQueryInProgress ( )
protected

If user presses cancel button, cancel running job.

Definition at line 1361 of file query_parse_panel.cpp.

References job_future_base::cancel(), job_future_base::IsRunning(), m_Future, and m_PrevQuery.

Referenced by OnSearchctrlSearchStop().

◆ x_ExecuteQuery()

void CQueryParsePanel::x_ExecuteQuery ( int  search_dir)
protected

◆ x_IsValidQuery()

bool CQueryParsePanel::x_IsValidQuery ( string  query,
bool  casesensitive,
vector< std::pair< size_t, size_t > > &  fields 
)
protected

◆ x_StartQueryJob()

void CQueryParsePanel::x_StartQueryJob ( CRef< CMacroQueryExec qexec,
CQueryParseTree qtree,
macro::CMacroRep *  macro_rep,
bool  casesensitive,
const string query 
)
protected

Member Data Documentation

◆ m_Animation

wxAnimationCtrl* CQueryParsePanel::m_Animation
protected

Definition at line 288 of file query_parse_panel.hpp.

Referenced by CompleteQuery(), CreateControls(), Init(), and x_ExecuteQuery().

◆ m_CaseSensitive

bool CQueryParsePanel::m_CaseSensitive
protected

Current value for case-sensitive.

Definition at line 317 of file query_parse_panel.hpp.

Referenced by OnSearchctrlTextEnter(), OnStringMatchTypeBtn(), OnStringMatchTypeSelected(), OnToggleHideUnselected(), and x_ExecuteQuery().

◆ m_DefaultQueries

vector<pair<string,string> > CQueryParsePanel::m_DefaultQueries
protected

Set of default queries.

Definition at line 306 of file query_parse_panel.hpp.

Referenced by GetDefaultQueries(), OnQuerySel(), OnRecentQuery(), and SetDefaultQueries().

◆ m_Future

job_future<void> CQueryParsePanel::m_Future
protected

◆ m_IconsInitialized

bool CQueryParsePanel::m_IconsInitialized = false
staticprotected

Only need to load icons into art provider once per run.

Definition at line 283 of file query_parse_panel.hpp.

Referenced by Init().

◆ m_Job

CIRef<CQueryJob> CQueryParsePanel::m_Job
protected

Current tree-query job.

Definition at line 327 of file query_parse_panel.hpp.

Referenced by OnIdle(), and x_StartQueryJob().

◆ m_MaxDefaultQueries

const int CQueryParsePanel::m_MaxDefaultQueries = 10
staticprotected

Definition at line 307 of file query_parse_panel.hpp.

Referenced by SetDefaultQueries().

◆ m_MaxRecentQueries

const int CQueryParsePanel::m_MaxRecentQueries = 5
staticprotected

Max number of recent queries to include in list.

Definition at line 304 of file query_parse_panel.hpp.

Referenced by LoadSettings(), SaveSettings(), and x_AddRecentQuery().

◆ m_PrevCaseSensitive

bool CQueryParsePanel::m_PrevCaseSensitive
protected

Value of case-sensitive button last time query was executed.

Definition at line 319 of file query_parse_panel.hpp.

Referenced by OnToggleHideUnselected(), and x_ExecuteQuery().

◆ m_PrevQuery

string CQueryParsePanel::m_PrevQuery
protected

String of query last time query was executed.

Definition at line 315 of file query_parse_panel.hpp.

Referenced by OnToggleHideUnselected(), SetDataSource(), x_CancelQueryInProgress(), and x_ExecuteQuery().

◆ m_PrevStringCompare

CStringMatching::EStringMatching CQueryParsePanel::m_PrevStringCompare
protected

Value of string-matching selection last time query was executed.

Definition at line 324 of file query_parse_panel.hpp.

Referenced by OnToggleHideUnselected(), and x_ExecuteQuery().

◆ m_pSearch

CRichTextCtrl* CQueryParsePanel::m_pSearch
protected

◆ m_pSelectAll

wxCheckBox* CQueryParsePanel::m_pSelectAll
protected

◆ m_QueryDataSource

CIRef<IQueryDataSource> CQueryParsePanel::m_QueryDataSource
protected

Interface to data source that is being queried.

Definition at line 312 of file query_parse_panel.hpp.

Referenced by OnIdle(), SetDataSource(), x_ExecuteQuery(), x_IsValidQuery(), and x_StartQueryJob().

◆ m_QueryWidget

IQueryWidget* CQueryParsePanel::m_QueryWidget
protected

◆ m_RecentQueries

vector<pair<string,string> > CQueryParsePanel::m_RecentQueries
protected

Set of recent queries.

Definition at line 302 of file query_parse_panel.hpp.

Referenced by GetLastQuery(), LoadSettings(), OnQuerySel(), OnRecentQuery(), SaveSettings(), and x_AddRecentQuery().

◆ m_RegPath

string CQueryParsePanel::m_RegPath
protected

Registry path for query panel.

Definition at line 331 of file query_parse_panel.hpp.

Referenced by LoadSettings(), SaveSettings(), and SetRegistryPath().

◆ m_RegSection

string CQueryParsePanel::m_RegSection
protected

Registry section for specific current data source (derived from columns)

Definition at line 333 of file query_parse_panel.hpp.

Referenced by LoadSettings(), SaveSettings(), and SetDataSource().

◆ m_SearchString

std::string CQueryParsePanel::m_SearchString
protected

current search string (as of previous update to m_pSearch)

Definition at line 299 of file query_parse_panel.hpp.

Referenced by OnSearchctrlTextEnter().

◆ m_SearchStringFields

std::vector<std::pair<size_t, size_t> > CQueryParsePanel::m_SearchStringFields
protected

positions of dictionary fields in current search string

Definition at line 296 of file query_parse_panel.hpp.

Referenced by OnSearchctrlTextEnter().

◆ m_SearchType

wxStaticText* CQueryParsePanel::m_SearchType
protected

Definition at line 293 of file query_parse_panel.hpp.

Referenced by CreateControls(), and OnStringMatchTypeSelected().

◆ m_StopQuery

wxButton* CQueryParsePanel::m_StopQuery
protected

Definition at line 291 of file query_parse_panel.hpp.

◆ m_StringCompare

CStringMatching::EStringMatching CQueryParsePanel::m_StringCompare
protected

How to compare strings in query - wildcards, exact match, etc.

Definition at line 322 of file query_parse_panel.hpp.

Referenced by OnStringMatchTypeSelected(), OnToggleHideUnselected(), x_ExecuteQuery(), x_IsValidQuery(), and x_StartQueryJob().

◆ m_StringSearch

wxChoice* CQueryParsePanel::m_StringSearch
protected

Definition at line 290 of file query_parse_panel.hpp.

◆ m_ToolBar

wxToolBar* CQueryParsePanel::m_ToolBar
protected

The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:43 2024 by modify_doxy.py rev. 669887