68 #include <wx/aui/aui.h>
69 #include <wx/button.h>
70 #include <wx/filedlg.h>
71 #include <wx/msgdlg.h>
72 #include <wx/filename.h>
86 const wxString& fullPathName)
87 : wxAuiToolBar(parent,
wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT|wxBORDER_NONE),
88 m_View(view), m_ServiceLocator(service_locator), m_ValidateObj(validateObj), m_JobId(
CAppJobDispatcher::eInvalidJobID), m_ValidationInProgress(
false),
92 m_MegaButton =
dynamic_cast<wxButton*
>(AddControl(
new wxButton(
this,
ID_TB_MegaButton,
"Mega Report", wxDefaultPosition, wxDefaultSize, 0))->GetWindow());
94 m_SaveButton =
dynamic_cast<wxButton*
>(AddControl(
new wxButton(
this,
ID_TB_SaveButton,
"Save", wxDefaultPosition, wxDefaultSize, 0))->GetWindow());
96 m_CloseButton =
dynamic_cast<wxButton*
>(AddControl(
new wxButton(
this,
ID_TB_CloseButton,
"Close", wxDefaultPosition, wxDefaultSize, 0))->GetWindow());
99 wxFileName
file(fullPathName);
174 wxWindow* main_window =
NULL;
185 if (!textPanel)
return;
192 x_Save(*so, fname.GetFullPath());
195 if (!projectService)
return;
199 if (doc) doc->SetDataModified(
false);
206 if (!textPanel)
return;
212 if (!filePath.IsEmpty()) {
215 wxFileName
file(filePath);
226 if (!projectService)
return path;
232 if (!doc)
return path;
237 int pitemId = (*bit)->GetId();
242 wxFileName fullpath(filePath);
243 path = fullpath.GetPath();
280 wxString cdir = wxGetCwd();
285 wxFileDialog dlg(
this,
wxT(
"Select a file"), cdir,
wxT(
""),
288 wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
289 if (dlg.ShowModal() != wxID_OK)
290 return wxEmptyString;
292 return dlg.GetPath();
305 catch (
const exception& e) {
309 if (!errMsg.empty()) {
310 wxMessageBox(
wxT(
"File: ") + fileName +
wxT(
"\nError: ") +
ToWxString(errMsg),
311 wxT(
"Failed to save file"), wxOK | wxICON_ERROR);
318 if (!projectService)
return;
332 }
catch (
const exception& ex) {
335 if (!errMsg.empty()) {
336 wxMessageBox(errMsg,
wxT(
"Smart client communication error"), wxOK|wxICON_ERROR);
360 if (errs && errs->GetData().size() != 0)
369 if (
info != 0 || warn != 0 ||
error != 0 || reject != 0)
373 wxMessageDialog dlg(
this,
wxT(
"Submission failed validation tests with:\n") +
ToWxString(
msg),
_(
"Validation failed"), wxYES_NO | wxCANCEL | wxICON_QUESTION);
374 dlg.SetYesNoLabels(
_(
"Continue"),
_(
"Review errors"));
375 switch (dlg.ShowModal())
377 case wxID_YES :
break;
392 string err_msg =
"Failed: ";
394 err_msg +=
error->GetText();
396 err_msg +=
"Unknown fatal error";
398 wxMessageDialog dlg(
this,
ToWxString(err_msg),
_(
"Validation failed"), wxOK| wxCANCEL |wxICON_ERROR);
399 dlg.SetOKLabel(
_(
"Continue"));
400 if (dlg.ShowModal() != wxID_OK)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CAppJobNotification Notification send by CAppJobEventTranslator.
static CDiscrepancyDlg * OpenDiscrepancyDlg(EReportType type, CScope &scope, IWorkbench *workbench, const wxString &workDir=wxEmptyString)
CEvent - generic event implementation TODO TODO - Attachments.
static wxString GetDialogFilter(EFileType fileType)
void Save(const wxString &abs_path)
wxString GetFileName() const
CProjectItem * FindProjectItemById(CProjectItem::TId id)
CProjectService - a service providing API for operations with Workspaces and Projects.
void CreateNewWorkspace()
void RemoveProject(CGBDocument &doc)
CRef< objects::CGBWorkspace > GetGBWorkspace()
Base class for all serializable objects.
void OnJobNotification(CEvent *evt)
class CSmartFileTextToolbar
SConstScopedObject m_ValidateObj
void OnMegaBtn(wxCommandEvent &)
void x_Save(const CSerialObject &so, const wxString &fileName)
string x_GetProject_Path(int projid)
CSmartFileTextToolbar(wxWindow *parent, IProjectView &view, IServiceLocator *service_locator, SConstScopedObject validateObj, const wxString &fullPathName)
class CSmartFileTextToolbar
void OnSaveBtn(wxCommandEvent &)
wxButton * m_ValidateButton
void OnSaveAsBtn(wxCommandEvent &)
void OnJobNotification(CEvent *evt)
wxButton * m_SaveAsButton
IServiceLocator * m_ServiceLocator
wxString x_AskForFileName()
CRef< CEventProxy > m_EventProxy
void OnUpdateSaveBtn(wxUpdateUIEvent &event)
void OnUpdateValidateBtn(wxUpdateUIEvent &event)
void OnValidateBtn(wxCommandEvent &)
void OnUpdateSaveAsBtn(wxUpdateUIEvent &event)
void OnCloseBtn(wxCommandEvent &)
void OnUpdateCloseBtn(wxUpdateUIEvent &event)
bool m_ValidationInProgress
static void SetDoInference(objects::CUser_object ¶ms, bool val)
static void SetDoAlignment(objects::CUser_object ¶ms, bool val)
virtual const CObject * GetOrigObject() const
Template class for iteration on objects of class C.
static void GetInstance(wxWindow *parent, IWorkbench *workbench, CRef< objects::CUser_object > params, wxWindowID id=17000, const wxString &caption=_("Validation Errors"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(900, 600), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxTAB_TRAVERSAL)
CWorkbench - default implementation of IWorkbench.
class IProjectView defines the abstract interface for views observing projects.
virtual TProjectId GetProjectId() const =0
IServiceLocator - an abstract mechanism for locating services.
virtual wxWindow * GetWindow()=0
returns a pointer to the wxWindow representing the client
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Critical
Critical error message.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
virtual wxFrame * GetMainWindow()
returns a pointer to the main application frame window
CConstIRef< IAppJobError > GetError() const
returns non-null pointer only if job Failed
CRef< objects::CScope > scope
static CAppJobDispatcher & GetInstance()
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
bool DeleteJob(TJobID job_id)
when a Job is deleted the listener is not notified
#define ON_EVENT(type, id, handler)
#define END_EVENT_MAP()
Ends definition of Command Map.
CConstRef< CObject > object
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
TJobState GetState() const
#define MSerial_AsnText
I/O stream manipulators –.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
requires std::integral< TNumeric > std::floating_point< TNumeric > static std::convertible_to< TNumeric, Int8 > string NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
list< CRef< CProjectItem > > TItems
bool CanGetItems(void) const
Check if it is safe to call GetItems method.
const TItems & GetItems(void) const
Get the Items member data.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static const string sValidateViewType("Validate Table View")
wxString ToWxString(const string &s)