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

Go to the SVN repository for this file.

1 /* $Id: rm_load_manager.cpp 38477 2017-05-15 21:10:59Z evgeniev $
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: Roman Katargin
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
31 
32 #include "rm_load_manager.hpp"
33 
35 
38 
39 #include <wx/filename.h>
40 
42 
43 
44 ///////////////////////////////////////////////////////////////////////////////
45 /// CRMLoader
47 : m_Descr("RepeatMasker files", ""),
48  m_SrvLocator(NULL),
49  m_ParentWindow(NULL)
50  //m_FinalState(false)
51 {
52  m_Descr.SetLogEvent("loaders");
53 }
54 
55 //
56 // IFileLoadPanelClient implementation
57 //
58 
59 string CRMLoader::GetLabel() const
60 {
61  return m_Descr.GetLabel();
62 }
63 
65 {
68 }
69 
70 //
71 // IUILoadManager implementation
72 //
73 
74 
76 {
77  m_SrvLocator = srv_locator;
78 }
79 
80 
81 void CRMLoader::SetParentWindow(wxWindow* parent)
82 {
83  m_ParentWindow = parent;
84 }
85 
86 
88 {
89  return m_Descr;
90 }
91 
92 
94 {
95 }
96 
97 
99 {
100 }
101 
102 
104 {
105  // we do not have any
106  return NULL;
107 }
108 
109 
110 bool CRMLoader::CanDo(EAction WXUNUSED(action))
111 {
112  return false; //! m_FinalState && action == eNext;
113 }
114 
115 
117 {
118  return true;//m_FinalState;
119 }
120 
121 
123 {
124  return true;//m_FinalState;
125 }
126 
127 
128 bool CRMLoader::DoTransition(EAction WXUNUSED(action))
129 {
130  _ASSERT(false); // we do not have panels and transitions
131  return false;
132 }
133 
134 
136 {
137  return nullptr;
138 }
139 
141 {
142  return new CRMObjectLoader(m_FileNames);
143 }
144 
145 
147 {
150 }
151 
152 
153 bool CRMLoader::ValidateFilenames(const vector<wxString>&)
154 {
155  // not implemented
156  return true;
157 }
158 
159 
160 void CRMLoader::SetFilenames(const vector<wxString>& filenames)
161 {
163 }
164 
165 void CRMLoader::GetFilenames(vector<wxString>& filenames) const
166 {
168 }
169 
171 {
172  return true;//! m_FinalState;
173 }
174 
175 
176 bool CRMLoader::RecognizeFormat(const wxString& filename)
177 {
178  wxString ext;
179  wxFileName::SplitPath(filename, 0, 0, &ext);
181 }
182 
184 {
185  return fmt == CFormatGuess::eRmo;
186 }
187 
189 {
190  static string sid("rm_format_load_manager");
191  return sid;
192 }
193 
194 
196 {
197  static string slabel("RepeatMasker output Format Load Manager");
198  return slabel;
199 }
200 
static bool RecognizeExtension(EFileType fileType, const wxString &extension)
static wxString GetDialogFilter(EFileType fileType)
EFormat
The formats are checked in the same order as declared here.
@ eRmo
RepeatMasker Output.
IAppTask.
Definition: app_task.hpp:83
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IUIObject - object that provides basic properties often required in a UI object.
Definition: ui_object.hpp:63
#define NULL
Definition: ncbistd.hpp:225
virtual void SetFilenames(const vector< wxString > &filenames)
initilize the manager with the given filenames
CUIObject m_Descr
virtual void CleanUI()
CleanUI() is called after the host finished using the manager.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual bool RecognizeFormat(const wxString &filename)
return true if the given file format is supported by this manager
virtual bool IsInitialState()
return true if the current state of the loader UI is the first valid state (first step in a wizard-li...
virtual const IUIObject & GetDescriptor() const
Returns the object describing this tool (UI meta data).
virtual bool IsCompletedState()
Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred an...
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual void GetFilenames(vector< wxString > &filenames) const
get actual filenames that will be opened
virtual bool IsFinalState()
True if Tool Manager has reached its final state, i.e.
IServiceLocator * m_SrvLocator
virtual void SetParentWindow(wxWindow *parent)
virtual IExecuteUnit * GetExecuteUnit()
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
virtual void InitUI()
Initializes the Manager before using it in UI.
virtual void SetServiceLocator(IServiceLocator *srv_locator)
Sets / unsets Service Locator.
virtual bool CanDo(EAction action)
Indicates whether given transition is possible in the current state.
virtual wxPanel * GetCurrentPanel()
Return the panel corresponding to the current state of Tool Manager.
CRMLoader()
CRMLoader.
virtual wxString GetFormatWildcard() const
return file wildcard for the format (example - "*.txt;*.tab" )
virtual bool ValidateFilenames(const vector< wxString > &filenames)
checks given filenames and returns true if the manager can handle them, otherwise - shows an error me...
virtual bool DoTransition(EAction action)
Performs transition if possible and returns true, otherwise the function shall warn the user about th...
virtual string GetLabel() const
vector< wxString > m_FileNames
wxWindow * m_ParentWindow
virtual void SetLogEvent(const string &log_event)
Definition: ui_object.cpp:118
virtual const string & GetLabel() const
Definition: ui_object.cpp:124
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define wxT(x)
Definition: muParser.cpp:41
static int filenames
Definition: pcregrep.c:172
#define _ASSERT
Modified on Tue May 28 05:49:45 2024 by modify_doxy.py rev. 669887