NCBI C++ ToolKit
task_view.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: task_view.cpp 47479 2023-05-02 13:24:02Z ucko $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
40 
44 
46 
48 
49 
50 #include <wx/artprov.h>
51 #include <wx/sizer.h>
52 #include <wx/panel.h>
53 #include <wx/menu.h>
54 #include <wx/toolbar.h>
55 #include <wx/statline.h>
56 
57 
59 
60 /// register the factory
62  decl("view_manager_service::view_factory", new CTaskViewFactory());
63 
64 ///////////////////////////////////////////////////////////////////////////////
65 /// CTaskView
66 
68 : m_TaskService(manager)
69 {
70  m_Names[eDescription] = "Description";
71  m_Names[eState] = "State";
72  m_Names[eStatus] = "Status";
73  m_Names[eTime] = "Time";
74 
75  m_TimeFormat.SetFormat("b D, H:m:s p");
76 
77  m_Filter.resize(IAppTask::eLastState, true);
78 }
79 
80 
82 {
83  return static_cast<int>(m_Records.size());
84 }
85 
86 
88 {
89  return eMaxCols;
90 }
91 
92 
93 string sToUserFriendlyString(const CTimeSpan& span)
94 {
95  long sec = span.GetCompleteSeconds();
96  const char* fmt = "$d days $h hrs $m min $h sec";
97  if(sec < 60) {
98  fmt = "$s sec";
99  } else if(sec < 3600) {
100  fmt = "$m min $s sec";
101  } else if(sec < 3600 * 24) {
102  fmt = "$h hrs $m min $m sec";
103  }
105  string s = span.AsString(format);
106  return s;
107 }
108 
109 
110 wxVariant CTaskViewModel::GetValueAt(int row, int col) const
111 {
112  TRecordRef rec = m_Records[row];
113  IAppTask& task = *rec->m_Task;
114 
115  switch (col) {
116  case eDescription: {
117  string s = task.GetDescr();
118  return wxString::FromUTF8(s.c_str());
119  }
120  case eState: {
122  string s = CAppTask::StateToString(state);
123  return ToWxString(s);
124  }
125  case eStatus: {
126  string s = task.GetStatusText();
127  return wxString::FromUTF8(s.c_str());
128  }
129  case eTime: {
130  if(task.GetState() != IAppTask::eInvalid) {
131  CTimeSpan span;
133  CTime t1(rec->m_StartTime);
134  span = t2 - t1;
135  string str = sToUserFriendlyString(span);
136  return ToWxString(str);
137  } else {
138  return wxT("");
139  }
140  }
141  default:
142  _ASSERT(false);
143  return wxT("");
144  }
145  return wxT("Error");
146 }
147 
148 
149 wxString CTaskViewModel::GetColumnType( int col ) const
150 {
151  return wxT("string");
152 }
153 
154 
155 wxString CTaskViewModel::GetColumnName(int col) const
156 {
157  return ToWxString(m_Names[col]);
158 }
159 
160 
162 {
163  m_Filter[state] = show;
164  if(up) {
165  UpdateTable();
166  }
167 }
168 
169 
171 {
172  return state == IAppTask::eInvalid ? true : m_Filter[state];
173 }
174 
175 
177 {
178  return m_Records[row]->m_Task;
179 }
180 
181 
183 {
184  m_Records.clear();
185 
186  if(m_TaskService) {
187  TRecRefVec recs;
189  x_AddTasks(recs);
190 
191  recs.clear();
193  x_AddTasks(recs);
194  }
196 }
197 
198 
200 {
201  time_t curr = CTime(CTime::eCurrent).GetTimeT();
202 
203  for( size_t i = 0; i < recs.size(); i++ ) {
204  TRecordRef rec = recs[i];
205  IAppTask& task = *rec->m_Task;
206  if(task.IsVisible()) {
207  // don't show task before it is "mature" enough
208  // to avoid excessive blinking for very quick jobs
209  int display_delay = task.GetStatusDisplayDelay();
210  if (display_delay > 0) {
211  int time_diff = static_cast<int>(curr - rec->m_StartTime);
212  if (time_diff < display_delay) {
213  continue;
214  }
215  }
216  int state = task.GetState();
217 
218  _ASSERT(state >= 0 && state < (int) m_Filter.size());
219 
221  m_Records.push_back(rec);
222  }
223  }
224  }
225 }
226 
227 ///////////////////////////////////////////////////////////////////////////////
228 /// CTaskTablePanel
229 #define ID_TABLE 10001
230 #define ID_TOOLBAR 10002
231 
232 static int kEventTimerID = 1;
233 static int kTimerPeriod = 5000;
234 
235 BEGIN_EVENT_TABLE(CTaskTablePanel, wxPanel)
236  EVT_CONTEXT_MENU(CTaskTablePanel::OnContextMenu)
237 
238 #ifdef __WXMAC__
239  EVT_BUTTON(eCmdDetails, CTaskTablePanel::OnDetails)
240 #endif
241  // Needed for context menu AND (if not mac) toolbar
243 
247 
248  EVT_LIST_ITEM_ACTIVATED(ID_TABLE, CTaskTablePanel::OnItemActivated)
251 
252 
254 : wxPanel(),
255  m_TaskService(NULL),
256  m_EventTimer(this, kEventTimerID),
257  m_Model(NULL),
258  m_Table(NULL)
259 {
260  Init();
261 }
262 
263 
265 {
266  m_EventTimer.Stop();
267 }
268 
269 
270 void CTaskTablePanel::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
271 {
272 #ifdef __WXOSX_COCOA__ // GB-8581
273  SetBackgroundStyle(wxBG_STYLE_COLOUR);
274  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
275 #endif
276 
277  wxPanel::Create(parent, id, pos, size);
278  CreateControls();
279 }
280 
281 
283 {
284  m_Model = NULL;
285  m_Table = NULL;
286 }
287 
288 
290 {
291  wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
292  SetSizer(sizer);
293 
294  // Create tool bar
295  wxToolBar* tool_bar = new wxToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
296  wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT |wxTB_NOICONS | wxTB_HORZ_LAYOUT );
297 #ifdef __WXMAC__
298  wxButton* b = new wxButton(tool_bar, eCmdDetails, _("Details"),
299  wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
300  b->SetToolTip(wxT("Show event details"));
301  tool_bar->AddControl(b);
302 #else
303  wxBitmap bm_empty;
304  tool_bar->AddTool(eCmdDetails, wxT("Details"), bm_empty, wxT("Show event details"));
305 #endif
306 
307  tool_bar->Realize();
308  sizer->Add(tool_bar, 0, wxEXPAND);
309 
310  // separation line before the table
311  wxStaticLine* line =
312  new wxStaticLine(this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
313 
314  sizer->Add(line, 0, wxEXPAND);
315 
316  // Create Table
317  long style = wxLC_REPORT | wxLC_VIRTUAL | wxBORDER_NONE;
318 
319  m_Table =
320  new CwxTableListCtrl(this, ID_TABLE, wxDefaultPosition, wxDefaultSize, style);
321  WindowSetText(*m_Table, wxT("task_TABLE"));
322 
323  m_Table->SetSingleStyle(wxLC_SINGLE_SEL);
325  sizer->Add(m_Table, 1, wxEXPAND);
326 }
327 
328 
330 {
331  _ASSERT(! m_Model);
332 
333  if(task_srv) {
334  m_TaskService = task_srv;
337 
338  m_Table->SetColumnWidth(CTaskViewModel::eDescription, 250);
339  m_Table->SetColumnWidth(CTaskViewModel::eState, 140);
340  m_Table->SetColumnWidth(CTaskViewModel::eStatus, 250);
341  m_Table->SetColumnWidth(CTaskViewModel::eTime, 100);
342 
343  m_Model->UpdateTable();
344 
345  m_EventTimer.Start(kTimerPeriod);
346  }
347 }
348 
349 
351 {
352  m_EventTimer.Stop();
353 
354  m_Table->RemoveModel();
355 
356  delete m_Model;
357  m_Model = NULL;
358 }
359 
360 
362 {
363  // save selection
364  vector<TTaskRef> tasks;
365  x_GetSelectedTasks(tasks);
366 
367  m_Model->UpdateTable();
368 
369  // restore selection (to preserve it)
370  x_SetSelectedTasks(tasks);
371 
372  // Refresh(); //TODO
373 }
374 
375 
376 void CTaskTablePanel::x_GetSelectedTasks(vector<TTaskRef>& tasks)
377 {
378  if(m_Model) {
379  vector<int> rows;
381 
382  for( size_t i = 0; i < rows.size(); i++ ) {
383  TTaskRef task = m_Model->GetTask(rows[i]);
384  tasks.push_back(task);
385  }
386  }
387 }
388 
389 
390 void CTaskTablePanel::x_SetSelectedTasks(vector<TTaskRef>& tasks)
391 {
392  if(m_Model) {
393  vector<int> rows;
394 
395  int n = m_Model->GetNumRows();
396  for( int row = 0; row < n; row++ ) {
397  TTaskRef task = m_Model->GetTask(row);
398 
399  vector<TTaskRef>::iterator it = std::find(tasks.begin(), tasks.end(), task);
400  if(it != tasks.end()) {
401  rows.push_back(row);
402  }
403  }
404 
405 
407  }
408 }
409 
410 void CTaskTablePanel::AppendMenuItems( wxMenu& aMenu )
411 {
412  aMenu.Append( wxID_SEPARATOR, wxT("Actions") );
413  aMenu.Append(eCmdCancel, wxT("Cancel Task"));
414 
415  aMenu.Append( wxID_SEPARATOR, wxT("Settings") );
416  aMenu.Append( eCmdDetails, wxT("Details") );
417 }
418 
419 void CTaskTablePanel::OnContextMenu(wxContextMenuEvent& anEvent)
420 {
421  wxMenu* menu;
422 
423  void* data = anEvent.GetClientData();
424  menu = data ? (wxMenu*)data : new wxMenu();
425 
426  AppendMenuItems( *menu );
427 
428  if( /*ShouldPropagate()*/ false ){
429  anEvent.SetClientData( menu );
430  anEvent.Skip();
431  return;
432  }
433 
434  anEvent.SetClientData( NULL );
435 
436 
437  unique_ptr<wxMenu> main_menu( CreateContextMenuBackbone() );
438  Merge( *main_menu.get(), *menu );
439 
440  CleanupSeparators( *main_menu );
441  PopupMenu( main_menu.get() );
442 
443  delete menu;
444 }
445 
446 
447 void CTaskTablePanel::OnDetails(wxCommandEvent& event)
448 {
449  _ASSERT(m_Table);
450 
451  long sel_index = m_Table->GetFirstSelected();
452  _ASSERT(sel_index != -1);
453 
454  OnShowDetailsDialog(sel_index);
455 }
456 
457 
458 void CTaskTablePanel::OnItemActivated(wxListEvent &event)
459 {
460  OnShowDetailsDialog(event.GetIndex());
461 }
462 
463 
465 {
466  int data_index = static_cast<int>(m_Table->RowVisibleToData(static_cast<int>(vis_index)));
467 
468  CTaskDetailsDlg dlg(this);
469 
470  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, "Details Dialog");
471  dlg.SetRegistryPath(reg_path);
472 
473  wxVariant var = m_Model->GetValueAt(data_index, CTaskViewModel::eDescription);
474  dlg.SetTaskTitle(var.GetString());
475 
476  var = m_Model->GetValueAt(data_index, CTaskViewModel::eState);
477  dlg.SetState(var.GetString());
478 
479  var = m_Model->GetValueAt(data_index, CTaskViewModel::eStatus);
480  dlg.SetStatus(var.GetString());
481 
482  var = m_Model->GetValueAt(data_index, CTaskViewModel::eTime);
483  dlg.SetTime(var.GetString());
484 
485  dlg.ShowModal();
486 }
487 
488 
489 void CTaskTablePanel::OnUpdateDetails(wxUpdateUIEvent& event)
490 {
491  event.Enable(m_Table && m_Table->GetSelectedItemCount() == 1);
492 }
493 
494 
495 void CTaskTablePanel::OnCancel(wxCommandEvent& event)
496 {
497  _ASSERT(m_Table);
498 
499  if (m_Table->GetSelectedItemCount() == 1) {
500  auto sel_index = m_Table->GetFirstSelected();
501  int data_index = m_Table->RowVisibleToData(static_cast<int>(sel_index));
502  CTaskViewModel::TTaskRef task = m_Model->GetTask(data_index);
503 
504  m_TaskService->CancelTask(*task);
505  }
506 }
507 
508 
509 void CTaskTablePanel::OnUpdateCancel(wxUpdateUIEvent& event)
510 {
511  bool en = false;
512  if(m_Table && m_Table->GetSelectedItemCount() == 1) {
513  long sel_index = m_Table->GetFirstSelected();
514  int data_index = m_Table->RowVisibleToData(static_cast<int>(sel_index));
515  CTaskViewModel::TTaskRef task = m_Model->GetTask(data_index);
516  en = (task->GetState() == IAppTask::eBackgrounded);
517  }
518  event.Enable(en);
519 }
520 
521 
522 void CTaskTablePanel::OnEventTimer(wxTimerEvent& event)
523 {
524  UpdateTable();
525 }
526 
527 
528 void CTaskTablePanel::SetRegistryPath(const string& path)
529 {
530  m_RegPath = path; // store for later use
531 }
532 
533 
535 {
536  if( ! m_RegPath.empty()) {
538  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
539 
540  m_Table->SaveTableSettings(view);
541  }
542 }
543 
544 
546 {
547  if( ! m_RegPath.empty()) {
549  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
550 
551  m_Table->LoadTableSettings(view);
552 
553  m_Model->UpdateTable();
554  }
555 }
556 
557 ///////////////////////////////////////////////////////////////////////////////
558 /// CTaskView
559 
563 
564 CViewTypeDescriptor CTaskView::m_TypeDescr(
565  "Task View", // type name
566  "task_view", // icon alias
567  "Task View displays a list of application task such as running commands and tools.",
568  "Task View displays a list of application task such as running commands and tools.",
569  "TASK_VIEW", // help ID
570  "System", // category
571  true); // singleton
572 
573 
575 : m_TaskService(NULL),
576  m_Panel(NULL)
577 {
578 }
579 
580 
582 {
583 }
584 
585 
587 {
588  return m_TypeDescr;
589 }
590 
591 
593 {
594  if(workbench) {
595  m_TaskService = workbench->GetAppTaskService();
596  m_TaskService->AddListener(this);
598  } else {
599  if (m_TaskService) {
602  m_TaskService = 0;
603  }
604  }
605 }
606 
607 void CTaskView::CreateViewWindow(wxWindow* parent)
608 {
609  m_Panel = new CTaskTablePanel();
610  m_Panel->Create(parent, wxID_ANY);
611 }
612 
614 {
615  if(m_Panel) {
616  m_Panel->Destroy();
617  m_Panel = NULL;
618  }
619 }
620 
622 {
623  m_Panel->UpdateTable();
624 }
625 
627 {
628  return m_Panel;
629 }
630 
631 
633 {
634  return m_TypeDescr.GetLabel();
635 }
636 
637 
639 {
640  return m_TypeDescr.GetIconAlias();
641 }
642 
643 
645 {
646  return NULL;
647 }
648 
649 
651 {
652  // do nothing
653 }
654 
655 
656 const wxMenu* CTaskView::GetMenu()
657 {
658  return NULL;
659 }
660 
661 
662 void CTaskView::UpdateMenu(wxMenu& root_menu)
663 {
664 }
665 
666 
668 {
669  return CFingerprint(m_TypeDescr.GetLabel(), true);
670 }
671 
672 
673 static const char* kPanelSection = ".Panel";
674 
675 void CTaskView::SetRegistryPath(const string& path)
676 {
677  m_RegPath = path; // store for later use
679 }
680 
681 
683 {
685 }
686 
687 
689 {
691 }
692 
693 
694 ///////////////////////////////////////////////////////////////////////////////
695 /// CTaskViewFactory
696 
698 {
699  string alias = GetViewTypeDescriptor().GetIconAlias();
700  provider.RegisterFileAlias(ToWxString(alias), wxT("task_view.png"));
701 }
702 
703 
705 {
706  return CTaskView::m_TypeDescr;
707 }
708 
709 
711 {
712  return new CTaskView();
713 }
714 
715 
717 {
719  if(print == fingerprint) {
720  return new CTaskView();
721  }
722  return NULL;
723 }
724 
725 
727 {
728  static string sid("task_view_factory");
729  return sid;
730 }
731 
732 
734 {
735  static string slabel("Task View Factory");
736  return slabel;
737 }
738 
739 
EVT_UPDATE_UI(eCmdAlnShowMethodsDlg, CAlnMultiWidget::OnUpdateShowMethodDlg) EVT_UPDATE_UI(eCmdMethodProperties
CAppTaskService - Application Task Service.
static string StateToString(ETaskState state)
virtual void SetRegistryPath(const string &path)
Definition: dialog.cpp:59
CEventHandler.
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
CExtensionDeclaration - static declaration helper.
static string MakeKey(const string &section, const string &key, const string &delim=CGuiRegistry::kDecimalDot)
create a key from a section and a subkey
Definition: registry.cpp:504
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
CRef –.
Definition: ncbiobj.hpp:618
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
CTaskTablePanel - panel that owns a Table and a Table Model, this is the window for CTaskView.
Definition: task_view.hpp:122
CTaskViewFactory.
Definition: task_view.hpp:250
CTaskViewModel - table model for Task View.
Definition: task_view.hpp:70
CTaskView - IView, that uses CTaskTablePanel as its window.
Definition: task_view.hpp:198
CTimeFormat –.
Definition: ncbitime.hpp:131
CTimeSpan.
Definition: ncbitime.hpp:1313
CTime –.
Definition: ncbitime.hpp:296
CViewTypeDescriptor - holds description of a view type.
Definition: view.hpp:98
virtual void x_FireDataChanged()
CwxTableListCtrl - generic wxListCtrl-based Table Control.
void SetContextMenuEventPropagation(bool flag)
int RowVisibleToData(int aRow) const
/////////// Row staff /////////////////
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
wxArrayInt GetDataRowsSelected() const
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
void SetModel(IwxTableModel *data_model, bool own=false)
void SetDataRowsSelected(const vector< int > &rows)
IAppTask.
Definition: app_task.hpp:83
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
ELabel
Different flavors of label types for different GUI aspects.
Definition: wm_client.hpp:80
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
#define _(proto)
Definition: ct_nlmzip_i.h:78
#define true
Definition: bool.h:35
static void Init(void)
Definition: cursor6.c:76
static const char * str(char *buf, int n)
Definition: stats.c:84
char data[12]
Definition: iconv.c:80
#define NULL
Definition: ncbistd.hpp:225
bool CancelTask(IAppTask &task, bool throw_on_error=true)
Places a request to cancel a backgrounded task.
virtual void SetRegistryPath(const string &path)
Definition: task_view.cpp:528
virtual void CreateModel(CAppTaskService *task_srv)
Definition: task_view.cpp:329
virtual void SaveSettings() const
Definition: task_view.cpp:682
virtual void SaveSettings() const
Definition: task_view.cpp:534
virtual int GetStatusDisplayDelay()=0
returns delay in seconds used for certain fast (and not very important tasks) to only show its status...
virtual void SetColor(const CRgbaColor &color)
returns a color associated with the client
Definition: task_view.cpp:650
CAppTaskService * m_TaskService
Definition: task_view.hpp:110
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
Definition: task_view.cpp:726
void OnUpdateDetails(wxUpdateUIEvent &event)
Definition: task_view.cpp:489
string m_Names[eMaxCols]
Definition: task_view.hpp:107
virtual wxString GetColumnName(int col) const
Returns a default name for the column using spreadsheet conventions: A, B, C, ...
Definition: task_view.cpp:155
virtual wxString GetColumnType(int col) const
Tries to extract actual type from row 0 value if it exists.
Definition: task_view.cpp:149
CAppTaskService * m_TaskService
Definition: task_view.hpp:180
virtual void DestroyViewWindow()
destroy Window corresponding to the view
Definition: task_view.cpp:613
CTaskTablePanel * m_Panel
Definition: task_view.hpp:241
virtual const CViewTypeDescriptor & GetTypeDescriptor() const
return an object providing meta information about thei view type
Definition: task_view.cpp:586
virtual CFingerprint GetFingerprint() const
returns a fingerprint identifying the client
Definition: task_view.cpp:667
virtual ~CTaskTablePanel()
Definition: task_view.cpp:264
void SetState(wxString value)
virtual void DestroyModel()
Definition: task_view.cpp:350
virtual string GetClientLabel(IWMClient::ELabel ltype=IWMClient::eDefault) const
returns the client label (name) to be displayed in UI
Definition: task_view.cpp:632
virtual void Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
Definition: task_view.cpp:270
void OnEventTimer(wxTimerEvent &event)
Definition: task_view.cpp:522
void OnUpdateCancel(wxUpdateUIEvent &event)
Definition: task_view.cpp:509
virtual string GetStatusText() const =0
returns human-readable text describing the current task state
virtual void LoadSettings()
Definition: task_view.cpp:545
virtual int GetNumRows() const
Returns the number of rows in the model.
Definition: task_view.cpp:81
void ShowTasksByState(IAppTask::ETaskState state, bool show, bool up=true)
Definition: task_view.cpp:161
CwxTableListCtrl * m_Table
Definition: task_view.hpp:185
virtual void SetWorkbench(IWorkbench *workbench)
connect / disconnect this view with / from Workbench
Definition: task_view.cpp:592
CAppTaskService::TRecRefVec TRecRefVec
Definition: task_view.hpp:74
virtual const wxMenu * GetMenu()
returns a menu (must be deleted by the caller) menu injections should follow a separator named "Contr...
Definition: task_view.cpp:656
virtual wxVariant GetValueAt(int row, int col) const
Definition: task_view.cpp:110
virtual void LoadSettings()
Definition: task_view.cpp:688
void SetTaskTitle(wxString value)
void x_AddTasks(TRecRefVec &tasks)
Definition: task_view.cpp:199
CAppTaskService * m_TaskService
Definition: task_view.hpp:238
void GetBackgroundedTasks(TRecRefVec &tasks)
virtual void AppendMenuItems(wxMenu &aMenu)
Definition: task_view.cpp:410
virtual void RegisterIconAliases(wxFileArtProvider &provider)
CTaskViewFactory.
Definition: task_view.cpp:697
string m_RegPath
Definition: task_view.hpp:239
virtual const CRgbaColor * GetColor() const
returns a color associated with the client, n/a if NULL
Definition: task_view.cpp:644
virtual wxWindow * GetWindow()
returns a pointer to the wxWindow representing the client
Definition: task_view.cpp:626
CTimeFormat m_TimeFormat
Definition: task_view.hpp:108
virtual void Init()
Initializes member variables.
Definition: task_view.cpp:282
vector< TRecordRef > m_Records
Definition: task_view.hpp:112
wxTimer m_EventTimer
Definition: task_view.hpp:182
virtual ETaskState GetState()=0
returns the current task state
void x_SetSelectedTasks(vector< TTaskRef > &tasks)
Definition: task_view.cpp:390
void x_OnUpdate(CEvent *)
Definition: task_view.cpp:621
ETaskState
List of task states defining the task management FSM.
Definition: app_task.hpp:87
bool IsStateShown(IAppTask::ETaskState state)
Definition: task_view.cpp:170
void SetTime(wxString value)
static CViewTypeDescriptor m_TypeDescr
CTaskView.
Definition: task_view.hpp:236
TTaskRef GetTask(int row)
Definition: task_view.cpp:176
CTaskViewModel(CAppTaskService *task_srv)
CTaskView.
Definition: task_view.cpp:67
void SetStatus(wxString value)
void UpdateTable()
Definition: task_view.cpp:182
void OnCancel(wxCommandEvent &event)
Definition: task_view.cpp:495
virtual int GetNumColumns() const
Returns the number of columns in the model.
Definition: task_view.cpp:87
virtual void UpdateTable()
Definition: task_view.cpp:361
void OnShowDetailsDialog(long vis_index)
Definition: task_view.cpp:464
virtual string GetIconAlias() const
returns an icon alias that can be used to retrieve the client's icon
Definition: task_view.cpp:638
void OnDetails(wxCommandEvent &event)
Definition: task_view.cpp:447
void OnItemActivated(wxListEvent &event)
Definition: task_view.cpp:458
void x_GetSelectedTasks(vector< TTaskRef > &tasks)
Definition: task_view.cpp:376
virtual void CreateControls()
Creates the controls and sizers.
Definition: task_view.cpp:289
virtual void UpdateMenu(wxMenu &root_menu)
Definition: task_view.cpp:662
vector< bool > m_Filter
Definition: task_view.hpp:111
CTaskViewModel * m_Model
Definition: task_view.hpp:184
virtual void CreateViewWindow(wxWindow *parent)
create Window corresponding to the view
Definition: task_view.cpp:607
virtual CAppTaskService * GetAppTaskService()=0
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
Definition: task_view.cpp:733
virtual string GetDescr() const =0
returns a human-readable description of the Task (optional)
void OnContextMenu(wxContextMenuEvent &event)
Definition: task_view.cpp:419
void GetPendingTasks(TRecRefVec &tasks)
Inspection interface - supposed to be used from the main UI thread only.
virtual void SetRegistryPath(const string &path)
Definition: task_view.cpp:675
virtual IView * CreateInstanceByFingerprint(const TFingerprint &fingerprint) const
if fingerprint is recognized - creates and returns a new instance
Definition: task_view.cpp:716
virtual ~CTaskView()
Definition: task_view.cpp:581
virtual IView * CreateInstance() const
creates a view instance
Definition: task_view.cpp:710
virtual bool IsVisible()=0
returns true if the task should be visible in UI visible task shall represent operations understood b...
virtual const CViewTypeDescriptor & GetViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
Definition: task_view.cpp:704
@ eMaxCols
this must be the last!
Definition: task_view.hpp:82
@ eBackgrounded
task is executing in background
Definition: app_task.hpp:91
@ eInvalid
Definition: app_task.hpp:88
@ eLastState
Definition: app_task.hpp:95
virtual void RemoveListener(CEventHandler *listener)
Remove a listener.
virtual const string & GetIconAlias() const
Definition: ui_object.cpp:130
#define ON_EVENT(type, id, handler)
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void AddListener(CEventHandler *listener, int pool_name=ePool_Default)
Add a listener.
virtual const string & GetLabel() const
Definition: ui_object.cpp:124
string GetLabel(const CSeq_id &id)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
void SetFormat(const char *fmt, TFlags flags=fDefault)
Set the current time format.
Definition: ncbitime.hpp:2230
time_t GetTimeT(void) const
Get time in time_t format.
Definition: ncbitime.cpp:1396
string AsString(const CTimeFormat &fmt=kEmptyStr) const
Transform time span to string.
Definition: ncbitime.cpp:2681
long GetCompleteSeconds(void) const
Get number of complete seconds.
Definition: ncbitime.hpp:2559
@ eCurrent
Use current time. See also CCurrentTime.
Definition: ncbitime.hpp:300
@ eGmt
GMT (Greenwich Mean Time)
Definition: ncbitime.hpp:308
n background color
END_EVENT_TABLE()
int i
yy_size_t n
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
unsigned int a
Definition: ncbi_localip.c:102
static Format format
Definition: njn_ioutil.cpp:53
wxMenu * CreateContextMenuBackbone()
static static static wxID_ANY
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
#define row(bind, expected)
Definition: string_bind.c:73
static int kTimerPeriod
Definition: task_view.cpp:233
static int kEventTimerID
Definition: task_view.cpp:232
static CExtensionDeclaration decl("view_manager_service::view_factory", new CTaskViewFactory())
register the factory
string sToUserFriendlyString(const CTimeSpan &span)
Definition: task_view.cpp:93
#define ID_TABLE
CTaskTablePanel.
Definition: task_view.cpp:229
#define ID_TOOLBAR
Definition: task_view.cpp:230
static const char * kPanelSection
Definition: task_view.cpp:673
#define _ASSERT
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
Definition: wx_utils.cpp:579
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
void WindowSetText(const wxWindow &win, const wxChar *text)
Windows specific function, equivalent of SetWindowText() WinAPI.
Definition: wx_utils.cpp:794
void CleanupSeparators(wxMenu &menu)
Removes extra separators (in the begining or at the end of the menu, ot those that precede other sepa...
Definition: wx_utils.cpp:668
Modified on Wed May 15 15:03:28 2024 by modify_doxy.py rev. 669887