44 #include <wx/datectrl.h>
46 #include <wx/statbox.h>
47 #include <wx/stattext.h>
48 #include <wx/radiobut.h>
49 #include <wx/textctrl.h>
50 #include <wx/datetime.h>
85 : m_CmdProcessor(cmdproc), m_Seh(seh)
99 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
100 wxPanel::Create( parent,
id, pos,
size, style );
105 GetSizer()->SetSizeHints(
this);
150 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
151 itemPanel1->SetSizer(itemBoxSizer2);
153 wxFlexGridSizer* itemFlexGridSizer1 =
new wxFlexGridSizer(0, 2, 0, 0);
154 itemBoxSizer2->Add(itemFlexGridSizer1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
156 wxStaticText* itemStaticText2 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"BioProject"), wxDefaultPosition, wxDefaultSize, 0 );
157 itemFlexGridSizer1->Add(itemStaticText2, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
159 wxStaticText* itemStaticText3 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"BioSample"), wxDefaultPosition, wxDefaultSize, 0 );
160 itemFlexGridSizer1->Add(itemStaticText3, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
163 itemFlexGridSizer1->Add(
m_Bioproject, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
166 itemFlexGridSizer1->Add(
m_Biosample, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 wxStaticBox* itemStaticBoxSizer1Static =
new wxStaticBox(itemPanel1,
wxID_ANY,
_(
"Release date"));
169 wxStaticBoxSizer* itemStaticBoxSizer1 =
new wxStaticBoxSizer(itemStaticBoxSizer1Static, wxVERTICAL);
170 itemBoxSizer2->Add(itemStaticBoxSizer1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
172 wxStaticText* itemStaticText1 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"When should this submission be released to the public?"), wxDefaultPosition, wxDefaultSize, 0 );
173 itemStaticBoxSizer1->Add(itemStaticText1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
175 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxVERTICAL);
176 itemStaticBoxSizer1->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
182 m_HUP =
new wxRadioButton( itemPanel1,
ID_SUBMITTER_HUP,
_(
"On specified date or upon publication, whichever is first:"), wxDefaultPosition, wxDefaultSize, 0 );
183 m_HUP->SetValue(
false);
184 itemBoxSizer3->Add(
m_HUP, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
186 m_Label =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Release date*"), wxDefaultPosition, wxDefaultSize, 0 );
188 itemBoxSizer3->Add(
m_Label, 0, wxALIGN_LEFT|wxALL|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 5);
190 m_Date =
new wxDatePickerCtrl( itemPanel1,
ID_DATEPICKERCTRL, wxDateTime(), wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN);
192 itemBoxSizer3->Add(
m_Date, 0, wxALIGN_LEFT|wxALL, 5);
194 wxStaticText* itemStaticText8 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Note: Please inform GenBank when the accession number or any portion\nof the sequence is published, as published data must be released."), wxDefaultPosition, wxDefaultSize, 0 );
195 itemStaticBoxSizer1->Add(itemStaticText8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
265 if (desc.IsUser() && desc.GetUser().GetObjectType() == objects::CUser_object::eObjectType_DBLink) {
275 m_HUP->SetValue(
false);
285 m_HUP->SetValue(
true);
289 m_Block->GetReldate().GetStd().IsSetYear()) {
290 const auto& reldate =
m_Block->GetReldate().GetStd();
294 if (reldate.IsSetYear())
295 year = reldate.GetYear();
296 if (reldate.IsSetMonth())
297 month = reldate.GetMonth();
298 if (reldate.IsSetDay())
299 day = reldate.GetDay();
300 wxDateTime dmy(day, wxDateTime::Month(wxDateTime::Jan + month - 1), year, 0, 0, 0, 0);
310 const objects::CUser_object& user =
m_Dblink->GetUser();
311 vector<string> bioprojects = objects::edit::CDBLink::GetBioProject(user);
312 string project_val =
NStr::Join(bioprojects,
";");
315 vector<string> biosamples = objects::edit::CDBLink::GetBioSample(user);
316 string biosample_val =
NStr::Join(biosamples,
";");
334 void SetField(objects::CUser_object& user,
const string& field_name,
const string& val)
336 vector<string> val_list;
338 if (val_list.size() > 0) {
339 objects::CUser_field& field = user.SetField(field_name);
341 for (
auto it : val_list) {
342 field.SetData().SetStrs().push_back(it);
346 user.RemoveNamedField(field_name);
354 if (!wxPanel::TransferDataFromWindow()) {
359 if (
m_HUP->GetValue()) {
361 wxDateTime dt =
m_Date->GetValue();
362 m_Block->SetReldate().SetStd().SetYear(dt.GetYear());
363 m_Block->SetReldate().SetStd().SetMonth(dt.GetMonth() - wxDateTime::Jan + 1);
364 m_Block->SetReldate().SetStd().SetDay(dt.GetDay());
372 objects::CUser_object& user =
m_Dblink->SetUser();
375 SetField(user,
"BioSample", biosample_val);
378 SetField(user,
"BioProject", bioproject_val);
389 empty->SetUser().SetObjectType(objects::CUser_object::eObjectType_DBLink);
395 bool any_changes =
false;
397 for (objects::CBioseq_CI bi(
m_Seh, objects::CSeq_inst::eMol_na); bi; ++bi)
400 for (objects::CSeqdesc_CI di(*bi, objects::CSeqdesc::e_User); di; ++di)
402 if (di && di->IsUser() && di->GetUser().GetObjectType() == objects::CUser_object::eObjectType_DBLink)
408 if (!di->Equals(*cpy))
411 cmd->AddCommand(*chg);
424 objects::CBioseq_set_Handle parent = bi->GetParentBioseq_set();
425 auto entry = bi->GetParentEntry();
426 if (parent && parent.IsSetClass() && parent.GetClass() == objects::CBioseq_set::eClass_nuc_prot)
427 entry = parent.GetParentEntry();
429 cmd->AddCommand(*cmdAddDesc);
virtual bool TransferDataToWindow()
virtual bool TransferDataFromWindow()
void OnSubmitterHupSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_SUBMITTER_HUP
CRef< objects::CSubmit_block > m_Block
CGeneralPanel()
Constructors.
void x_UpdateDescControls()
void x_UpdateBlockControls()
void OnSubmitterImmediateSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_SUBMITTER_IMMEDIATE
CRef< objects::CSeqdesc > m_Dblink
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
~CGeneralPanel()
Destructor.
static bool ShowToolTips()
Should we show tooltips?
wxDatePickerCtrl * m_Date
objects::CSeq_entry_Handle m_Seh
virtual void ApplySubmitBlock(objects::CSubmit_block &block)
wxRadioButton * m_ImmediateRelease
bool Create(wxWindow *parent, wxWindowID id=ID_CGENERALPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
virtual void ApplyCommand()
wxTextCtrl * m_Bioproject
ICommandProccessor * m_CmdProcessor
virtual void ApplyDescriptor(objects::CSeqdesc &desc)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void ApplyDescriptorCommand()
@ ID_SUBMITTER_BIOPROJECT
void Init()
Initialises member variables.
void CreateControls()
Creates the controls and sizers.
virtual void ApplySubmitCommand()=0
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
CSubmissionPageChangeListener * GetParentWizard(wxWindow *wnd) const
void SetField(objects::CUser_object &user, const string &field_name, const string &val)
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)