86 #include <wx/button.h>
88 #include <wx/animate.h>
89 #include <wx/collpane.h>
90 #include <wx/statline.h>
91 #include <wx/tglbtn.h>
92 #include <wx/stattext.h>
93 #include <wx/toolbar.h>
94 #include <wx/hyperlink.h>
95 #include <wx/srchctrl.h>
96 #include <wx/choice.h>
103 #define ID_TABLE 10001
104 #define ID_TOOLBAR 10002
105 #define ID_COMBOBOX 10003
106 #define ID_TEXT 11414
107 #define ID_BUTTON 10005
109 #define ID_ANIMATIONCTRL1 10007
110 #define ID_COMBOBOX1 10008
111 #define ID_BUTTON1 10009
112 #define ID_COMBOBOX_UPDATE 10111
114 #define ID_HYPERLINKCTRL 10999
157 m_bInitialized(
false),
161 m_SearchInProgress(
false),
179 replace(toolID.begin(), toolID.end(),
' ',
'-');
181 vector <string> subsections;
182 subsections.push_back(toolID);
230 SetBackgroundStyle(wxBG_STYLE_COLOUR);
231 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
234 wxPanel::Create(parent,
id, pos,
size);
245 PopEventHandler(
true );
248 return wxPanel::Destroy();
298 wxBoxSizer* main_sizer =
new wxBoxSizer(wxVERTICAL);
302 long styles = wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT | wxTB_HORZ_LAYOUT;
304 wxDefaultPosition, wxSize(-1, -1), styles);
307 wxStaticText* tool_text =
new wxStaticText(
m_ToolBar, wxID_STATIC,
308 wxT(
" Search Tool: "));
313 wxDefaultPosition, wxSize(180,-1),
314 0, (
const wxString*)
NULL);
319 wxBitmap bmp_start = wxArtProvider::GetBitmap(
wxT(
"menu::dm_start"));
322 wxBitmap bmp_stop = wxArtProvider::GetBitmap(
wxT(
"menu::dm_stop"));
327 wxDefaultPosition, wxSize(22, 22));
336 wxBitmap bmp_range = wxArtProvider::GetBitmap(
wxT(
"menu::dm_range"));
338 wxNullBitmap,
wxT(
"Limit searches by selected range when possible"));
341 wxBitmap bmp_filter = wxArtProvider::GetBitmap(
wxT(
"menu::dm_filter"));
343 wxNullBitmap,
wxT(
"Filter search results"));
348 wxBitmap bmp_query = wxArtProvider::GetBitmap(
wxT(
"menu::dm_query"));
350 wxNullBitmap,
wxT(
"Show / Hide query pane"));
354 main_sizer->Add(
m_ToolBar, 0, wxEXPAND );
363 main_sizer->Add(
m_Status, 0, wxEXPAND);
367 wxStaticLine* line =
new wxStaticLine(
m_ParentPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
368 main_sizer->Add(line, 0, wxEXPAND);
377 wxBoxSizer* frame_sizer =
new wxBoxSizer(wxHORIZONTAL);
379 SetSizerAndFit(frame_sizer);
405 string query_str =
query->ToString();
406 if (query_str.empty()) {
407 LOG_POST(
Info <<
"DataMining Filter for " << tool_name);
409 LOG_POST(
Info <<
"DataMining Search Execute for " << tool_name
410 <<
"\n QUERY: " << query_str );
413 tool->StartSearch(*
query, *
this);
425 tool->CancelSearch(*
this);
436 if (event.IsChecked()) {
447 m_Form->SetRangeLimit(event.IsChecked());
460 if (dlg.ShowModal() == wxID_OK) {
496 if( !clip_str.IsEmpty() ){
512 string strMsg =
"Search is completed at ";
528 if (
result.IsIncomplete()) {
537 catch (std::exception& e) {
538 LOG_POST(
Error <<
"CDataMiningPanel::OnSearchFinished(): Unexpected OLW Error" << e.
what());
553 m_Status->SetStatusText(
wxT(
"Search has been cancelled"));
578 m_Status->SetStatusText(
wxT(
"Please wait, search is in progress..."));
597 if (service ==
NULL) {
606 vector<string>
names;
608 if( !
names.empty()) {
679 aMenu.Append( wxID_SEPARATOR,
wxT(
"Actions") );
702 wxMenu* ccMenu =
NULL;
707 wxMenu* menu = cmd_reg.
CreateMenu(kContextMenu);
710 if (m_ListWidget->GetItemCount() && m_ListWidget->GetSelectedItemCount()) {
711 ccMenu =
new wxMenu();
713 int cols = m_ListWidget->GetColumnCount();
715 for (
int i=0;
i<cols &&
i<10;
i++) {
716 const int mod_ix = m_ListWidget->ColumnIndexToModel(
i);
717 ccMenu->Append(eCmdCopy1 + mod_ix, m_ListWidget->GetColumnNameByModel(mod_ix));
719 menu->Append(
wxID_ANY,
wxT(
"Copy Column"), ccMenu);
723 AppendMenuItems( *menu );
726 anEvent.SetClientData( menu );
731 anEvent.SetClientData(
NULL );
735 Merge( *main_menu.get(), *menu );
739 m_Service->GetContributors();
741 if (!contrib.empty()) {
742 for(
size_t i = 0;
i < contrib.size();
i++ ) {
745 Merge(*main_menu.get(), *c_menu);
750 PopupMenu( main_menu.get() );
766 if (!GetEventHandler()->ProcessEvent(event)) {
771 if (!contrib.empty()) {
772 for(
size_t i = 0;
i < contrib.size();
i++ ) {
774 wxMenuItem * menu_item =
779 wxEvtHandler * contrib_handler =
780 dynamic_cast<wxEvtHandler *
>(contributor);
785 bool bHandled =
false;
787 if (contrib_handler) {
788 bHandled = contrib_handler->ProcessEvent(event);
790 else if (contrib_win) {
791 wxWindow* window = contrib_win->
GetWindow();
793 bHandled = window->GetEventHandler()->ProcessEvent(event);
796 bHandled = wxTheApp->GetTopWindow()->GetEventHandler()->ProcessEvent(event);
836 event.Enable(!
conv.options.empty());
856 string label = tool->GetName() +
" tool results";
857 string comments =
"";
862 if (dlg.ShowModal() == wxID_OK) {
910 vector<string>
names;
913 for(
size_t i = 0;
i <
names.size();
i++ ) {
914 if(
names[
i] == tool_name) {
920 LOG_POST(
Error <<
"CDataMiningPanel::SelectTool() - invalid tool name " << tool_name);
962 m_Timer.Start(500, wxTIMER_ONE_SHOT);
974 vector<string>
names;
1014 tool->PullSearch( *
query, *
this );
1016 catch( std::exception& e ){
1017 LOG_POST(
Error <<
"CDataMiningPanel - Attempt to retreive cached results for a tool failed." << e.what());
1026 m_Timer.Start(1000, wxTIMER_ONE_SHOT);
1050 string mvalue =
m_Form->GetMainValue();
1051 if (mvalue!=
"#empty#") {
1059 m_Form = tool->CreateSearchForm();
1060 m_Form->SetController(
this);
1070 m_Form->UpdateContexts();
1075 if (
m_Form && dynamicForm) {
1076 m_FormSizer->Add(dynamicForm, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
1116 string status_text =
"Ready";
1128 string label,
string comment)
1146 for (
size_t i = 0;
i <
m_Objs.size();
i++ ) {
1157 const objects::CSeq_loc * seq_loc =
1158 dynamic_cast<const objects::CSeq_loc*
>(
m_Objs[
i].object.GetPointer());
1160 const objects::CSeq_feat * seq_feat =
1161 dynamic_cast<const objects::CSeq_feat*
>(
m_Objs[
i].object.GetPointer());
1163 const objects::CVariation * snp_search =
1164 dynamic_cast<const objects::CVariation*
>(
m_Objs[
i].object.GetPointer());
1166 const objects::CVcfVariant * vcf_search =
1167 dynamic_cast<const objects::CVcfVariant*
>(
m_Objs[
i].object.GetPointer());
1184 else if (snp_search) {
1188 NCBI_ASSERT(snp_search->CanGetPlacements(),
"Unexpected absence of placements in SNP Search Result!");
1189 const objects::CVariation::TPlacements& Placements(snp_search->GetPlacements());
1190 NCBI_ASSERT(Placements.size(),
"Unexpected number of placements in SNP Search Result!");
1200 else if (vcf_search) {
1203 seq_loc->
Assign(vcf_search->GetLocation());
1211 if (sl_item.
Empty()) {
1218 annot->
SetDesc().Set().push_back(descr);
1242 feat->
SetData().SetRegion() =
"region";
1245 annot->
SetData().SetFtable().push_back(feat);
1248 else if (seq_feat) {
1249 if (sl_item.
Empty()) {
1256 annot->
SetDesc().Set().push_back(descr);
1262 annot->
SetData().SetFtable().push_back(feat);
1267 if (!sl_item.
Empty()) {
1283 if(db_name ==
"nucleotide" || db_name ==
"protein") {
1286 obj.
Reset(
id.GetPointer());
1287 }
else if(db_name ==
"assembly") {
1290 if (a_acc != doc_sum.
end())
1293 if (!id_str.empty()) {
1302 string msg =
"Failed to retrieve gencoll assembly for ";
1308 string msg =
"The object doesn't contain assembly information.";
1311 }
else if(db_name ==
"gene") {
1322 return "Add search results to project...";
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CLocalRange< TOffset > TRange
define for the fundamental building block of sequence ranges
CDMSearchResult - result object delivered using job progress object.
void AddProjectItem(objects::CProjectItem &item)
CRef< objects::CScope > m_Scope
CDataLoadingAppTask - a task that executes CDataLoadingAppJob.
CFixGenericListCtrl m_FixGenericListCtrl
virtual void OnSearchFinished(CDMSearchResult &result)
static const int scm_ModeCmd
virtual void OnSearchCanceled()
virtual void SetWorkbench(IWorkbench *workbench)
virtual void AppendMenuItems(wxMenu &aMenu)
virtual void LoadSettings()
virtual void SaveSettings() const
void OnMenuEvent(wxCommandEvent &event)
void OnButtonClicked(wxCommandEvent &event)
virtual void OnSearchFailed(const string &error)
wxChoice * m_TargetChoice
virtual void OnSearchProgress(CDMSearchResult &result, const string &prg_text)
void OnSelectionChanged(wxListEvent &event)
virtual CDataMiningService * GetDataMiningService()
void GetSelection(TConstScopedObjects &buf) const
void x_InitCurrentWidget()
CObjectListWidget * m_ListWidget
void OnListItemActivate(wxListEvent &event)
wxAnimationCtrl * m_Animation
void OnTargetChanged(wxCommandEvent &event)
void SetRange(objects::CSeq_loc::TRange &range)
void OnSearchButton(wxCommandEvent &event)
void OnCreateFeature(wxCommandEvent &event)
virtual void OnSearchEnabled(bool benable)
void OnCustomCopy(wxCommandEvent &event)
void SetService(CDataMiningService *service)
void Init()
Initialises member variables.
EDisplayMode x_GetModeByCommand(TCmdID cmd)
void x_AddToProject(TConstScopedObjects &obj, string label="", string comment="")
void OnContextMenu(wxContextMenuEvent &event)
void x_SyncTableSettings(bool bWrite) const
void OnColumnEndDrag(wxListEvent &event)
void OnUpdateNeeded(wxCommandEvent &event)
virtual void SelectToolByName(const string &tool_name)
CIRef< IDMSearchForm > m_Form
virtual ~CDataMiningPanel()
void OnAutorun(wxTimerEvent &event)
void OnAddToNew(wxCommandEvent &event)
void x_UpdateWidgetAndTool()
void HandleTool(wxCommandEvent &event)
virtual void Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
void OnUpdateCreateFeature(wxUpdateUIEvent &event)
void OnEnableCmdRclick(wxUpdateUIEvent &event)
void CreateControls()
Creates the controls and sizers.
void x_SearchInProgress(bool bYes=true)
CDataMiningService * m_Service
virtual void SetRegistryPath(const string ®_path)
objects::CSeq_loc::TRange m_Range
void OnHyperlinkctrlClicked(wxHyperlinkEvent &event)
vector< IDMContextMenuContributor * > TContributors
virtual void GetToolNames(vector< string > &names) const
virtual CIRef< IDMSearchTool > GetToolByName(const string &name)
TContributors & GetContributors()
static CRef< objects::CEntrezgene > CreateGene_Gene(const xml::node &ds)
static CRef< objects::CSeq_id > CreateId_Nuc_Prot(const xml::node &ds)
CEvent - generic event implementation TODO TODO - Attachments.
wxString GetComments() const
void SetLbl(wxString value)
void SetIO(TConstScopedObjects &in, TConstScopedObjects &out)
void SetConstraints(vector< objects::CSeqFeatData::ESubtype > &options, objects::CSeqFeatData::ESubtype selected)
IDMSearchTool::TFilters & GetFilters()
void ConnectToControl(wxListCtrl &listCtrl)
CRef< CSerialObject > x_Convert(const xml::node &doc_sum, const string &db_name)
TConstScopedObjects m_Objs
virtual void x_CreateProjectItems()
override this function in derived classes and populate m_Items.
CGBankLoadingJob(TConstScopedObjects &objs, string label="", string comment="")
CGBankLoadingJob.
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
static CRef< CGencollSvc > GetInstance(void)
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
CObjectList Data structure representing a list of CObjects with associated Scopes and other optional ...
const CSerialObject * GetObject() const
retrieve the object pointed to as a CObject*
void SetObject(CSerialObject &object)
wrapper for setting the object pointed to by this item
CProjectService - a service providing API for operations with Workspaces and Projects.
class CRegistryReadView provides a nested hierarchical view at a particular key.
string GetString(const string &key, const string &default_val=kEmptyStr) const
void GetStringList(const string &key, list< string > &val) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
void Set_CreateNewProject(const string &folder=kEmptyStr)
namespace ncbi::objects::
static CSimpleClipboard & Instance()
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
CUICommandRegistry is a centralized registry where all application commands should be registered.
wxMenu * CreateMenu(const SwxMenuItemRec *items)
create a menu from a static definition (see WX_*_MENU macros)
@ eWidgetSelectionChanged
a view has been destroyed
const std::string & GetDBName() const
const xml::node & GetNode() const
void SetContextMenuEventPropagation(bool flag)
void AssignModel(IwxTableModel *data_model)
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
wxVariant GetValueVisibleAt(int row, int col) const
IWClient - abstract Window Manager client.
virtual wxWindow * GetWindow()=0
returns a pointer to the wxWindow representing the client
IWorkbench is the central interface in the application framework.
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
The xml::node::const_iterator provides a way to access children nodes similar to a standard C++ conta...
The xml::node class is used to hold information about one XML node.
iterator end(void)
Get an iterator that points one past the last child for this node.
iterator find(const char *name, const ns *nspace=NULL)
Find the first child node that has the given name and namespace.
const char * get_content(void) const
Get the content for this text node.
static const char * kAutocomplete
static const char * kSelectedTool
#define ID_ANIMATIONCTRL1
#define ID_COMBOBOX_UPDATE
std::ofstream out("events_result.xml")
main entry point for tests
static const struct name_t names[]
static const char * column
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_ASSERT(expr, mess)
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
virtual wxFrame * GetMainWindow()=0
returns a pointer to the main application frame window
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
void AddTask(IAppTask &task)
Add a task to the queue.
virtual CAppTaskService * GetAppTaskService()=0
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
static void SetLabelByData(objects::CProjectItem &item, objects::CScope *scope=NULL)
vector< SConstScopedObject > TConstScopedObjects
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
@ eEvent_Message
message from one class to another
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static const char label[]
void SetLabel(const TLabel &value)
Assign a value to Label data member.
void SetLocation(TLocation &value)
Assign a value to Location data member.
void SetData(TData &value)
Assign a value to Data data member.
void SetData(TData &value)
Assign a value to Data data member.
void SetName(const TName &value)
Assign a value to Name data member.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
TName & SetName(void)
Select the variant.
TComment & SetComment(void)
Select the variant.
void SetLoc(TLoc &value)
Assign a value to Loc data member.
CMinPanelContainer::OnRestoreWindow EVT_UPDATE_UI_RANGE(eCmdCloseDockPanel, eCmdWindowRestore, CMinPanelContainer::OnUpdateWindowCommand) CMinPanelContainer
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
std::istream & in(std::istream &in_, double &x_)
wxMenu * CreateContextMenuBackbone()
EVT_MENU_RANGE(MID_SHOW_TITLES, MID_HIDE_TITLES, ViewerWindowBase::OnTitleView) EVT_MENU_RANGE(MID_ENABLE_EDIT
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
#define WX_DEFINE_MENU(name)
New macros for defining menus for use with CUICommandRegistry.
#define WX_MENU_SEPARATOR_L(label)
void SetFocus(CRef< objects::CSeq_entry > entry)
wxFileArtProvider * GetDefaultFileArtProvider()
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)
void CleanupSeparators(wxMenu &menu)
Removes extra separators (in the begining or at the end of the menu, ot those that precede other sepa...