NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CFileLoadManager Class Reference

Search Toolkit Book for CFileLoadManager

CFileLoadManager CFileLoadManager - a Loader Manager implementing "File" option in "Open" dialog. More...

#include <gui/core/ui_file_load_manager.hpp>

+ Inheritance diagram for CFileLoadManager:
+ Collaboration diagram for CFileLoadManager:

Classes

class  CFileDescriptor
 
class  CFilePage
 

Public Types

typedef CTimeMRUList< CFileDescriptorTMRUPathList
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 
- Public Types inherited from IUIToolManager
enum  EAction { eBack = 0 , eNext , eSkip }
 

Public Member Functions

 CFileLoadManager ()
 CFileLoadManager. More...
 
void LoadRegisteredManagers ()
 
void SetDialog (COpenDlg *dlg)
 
virtual void AddFileFormat (IFileFormatLoaderManager *manager)
 
virtual void SetFilenames (vector< wxString > &filenames)
 
vector< wxString > GetFilenames () const
 
virtual void OnFormatChanged ()
 called by File Format panel when a user selects a format More...
 
IUIToolManager interface implementation
virtual void SetServiceLocator (IServiceLocator *srv_locator)
 Sets / unsets Service Locator. More...
 
virtual void SetParentWindow (wxWindow *parent)
 
virtual const IUIObjectGetDescriptor () const
 Returns the object describing this tool (UI meta data). More...
 
virtual void InitUI ()
 Initializes the Manager before using it in UI. More...
 
virtual void CleanUI ()
 CleanUI() is called after the host finished using the manager. More...
 
virtual wxPanel * GetCurrentPanel ()
 Return the panel corresponding to the current state of Tool Manager. More...
 
virtual bool CanDo (EAction action)
 Indicates whether given transition is possible in the current state. More...
 
virtual bool IsFinalState ()
 True if Tool Manager has reached its final state, i.e. More...
 
virtual bool IsCompletedState ()
 Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred and validated. More...
 
virtual bool DoTransition (EAction action)
 Performs transition if possible and returns true, otherwise the function shall warn the user about the problem preventing the transition (such as insufficient or invalid input) and return false. More...
 
virtual IAppTaskGetTask ()
 Once parameters are gathered and validated this function is called to produce the final Task object that will be executed to do the actual computational work. More...
 
virtual IExecuteUnitGetExecuteUnit ()
 
virtual IWizardPageGetFirstPage ()
 Returns first options page (if any) of the tool to be shown in wizard dialog. More...
 
virtual void SetPrevPage (IWizardPage *prevPage)
 Sets a wizard page which should show before the first page of the tool. More...
 
virtual IUIToolManagerGetAlternateToolManager ()
 If a transition fails, it may make sense to switch to a different tool manger When a tool manager identifies a more appropriate manager for a task, it returns it here, otherwise NULL. More...
 
virtual void ResetState ()
 
IToolWizard interface implementation
virtual string GetLabel () const
 
IRegSettings interface implementation
virtual void SetRegistryPath (const string &path)
 
virtual void LoadSettings ()
 
virtual void SaveSettings () const
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 
- Public Member Functions inherited from IUIToolManager
virtual wxPanel * GetMaxPanel ()
 Return the panel that occupies max size on display, to calculate dialog window size. More...
 
virtual IWizardPageGetOptionsPage ()
 Returns page for tool options (long wizard path via "Options" button) More...
 
virtual void SetNextPage (IWizardPage *)
 Sets a wizard page which should show after the last page of the tool. More...
 
virtual void RestoreDefaults ()
 Restores the default options for the current panel. More...
 
virtual bool UsesSingleOMScope ()
 
virtual ~IUIToolManager ()
 
- Public Member Functions inherited from IToolWizard
virtual ~IToolWizard ()
 
virtual IWizardPageGetOptionsPage ()
 Returns page for tool options (long wizard path via "Options" button) More...
 
virtual void SetNextPage (IWizardPage *)
 Sets a wizard page which should show after the last page of the tool. More...
 
- Public Member Functions inherited from IRegSettings
virtual ~IRegSettings ()
 

Protected Types

enum  EState {
  eInvalid = -1 , eSelectFiles , eFormatDefined , eSelectProjects ,
  eCompleted
}
 
typedef CIRef< IFileFormatLoaderManagerTFormatMgrRef
 
using TProjectId = objects::CGBProjectHandle::TId
 

Protected Member Functions

void x_AutoGuessFormat ()
 
TProjectId x_CreateNewProject (const string &new_prj_name)
 
CFileLoadOptionPanelx_GetOptionsPanel ()
 
void x_UpdateWizardPages ()
 
bool x_CanLeavePage (bool forward)
 
bool x_CheckFormatConflict (const vector< wxString > &filenames, TFormatMgrRef &manager)
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

CUIObject m_Descriptor
 
COpenDlgm_OpenDlg
 
IServiceLocatorm_SrvLocator
 
wxWindow * m_ParentWindow
 
EState m_State
 
string m_RegPath
 
TFormatMgrRef m_AutodetectFormat
 
vector< TFormatMgrRefm_FormatManagers
 
int m_CurrFormat
 
bool m_CheckFormat
 
IUIToolManagerm_AltToolManager
 If a file type is better handled by a different tool manager, set it here. More...
 
vector< wxString > m_Filenames
 
CFileLoadOptionPanelm_OptionPanel
 
CProjectSelectorPanelm_ProjectSelPanel
 
SProjectSelectorParams m_ProjectParams
 
TMRUPathList m_FileMRUList
 
CFilePage m_FilePage
 
IWizardPagem_OpenObjectsPage
 

Additional Inherited Members

- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 

Detailed Description

CFileLoadManager CFileLoadManager - a Loader Manager implementing "File" option in "Open" dialog.

CFileLoadManager combines IFileFormatLoaderManager for different file formats and acts as a Facade for them.

Definition at line 119 of file ui_file_load_manager.hpp.

Member Typedef Documentation

◆ TFormatMgrRef

Definition at line 206 of file ui_file_load_manager.hpp.

◆ TMRUPathList

Definition at line 151 of file ui_file_load_manager.hpp.

◆ TProjectId

using CFileLoadManager::TProjectId = objects::CGBProjectHandle::TId
protected

Definition at line 208 of file ui_file_load_manager.hpp.

Member Enumeration Documentation

◆ EState

enum CFileLoadManager::EState
protected
Enumerator
eInvalid 
eSelectFiles 
eFormatDefined 
eSelectProjects 
eCompleted 

Definition at line 198 of file ui_file_load_manager.hpp.

Constructor & Destructor Documentation

◆ CFileLoadManager()

CFileLoadManager::CFileLoadManager ( )

CFileLoadManager.

Definition at line 70 of file ui_file_load_manager.cpp.

Member Function Documentation

◆ AddFileFormat()

void CFileLoadManager::AddFileFormat ( IFileFormatLoaderManager manager)
virtual

Definition at line 167 of file ui_file_load_manager.cpp.

References _ASSERT, and m_FormatManagers.

Referenced by LoadRegisteredManagers().

◆ CanDo()

bool CFileLoadManager::CanDo ( EAction  action)
virtual

Indicates whether given transition is possible in the current state.

Implements IUIToolManager.

Definition at line 239 of file ui_file_load_manager.cpp.

References _ASSERT, IUIToolManager::eBack, eCompleted, eFormatDefined, IUIToolManager::eNext, eSelectFiles, eSelectProjects, m_CurrFormat, m_FormatManagers, and m_State.

◆ CleanUI()

void CFileLoadManager::CleanUI ( )
virtual

CleanUI() is called after the host finished using the manager.

This function shall free resources associated with the session and reset internal state.

Implements IUIToolManager.

Definition at line 152 of file ui_file_load_manager.cpp.

References IUIToolManager::CleanUI(), i, m_CurrFormat, m_FilePage, m_FormatManagers, m_OptionPanel, m_ProjectSelPanel, NULL, CWizardPage::Reset(), and IUIToolManager::SetServiceLocator().

◆ DoTransition()

bool CFileLoadManager::DoTransition ( EAction  action)
virtual

Performs transition if possible and returns true, otherwise the function shall warn the user about the problem preventing the transition (such as insufficient or invalid input) and return false.

Typically this function would take user input from the current panel, validate the input and go to the next state creating new UI panel if needed.

Implements IUIToolManager.

Definition at line 320 of file ui_file_load_manager.cpp.

References _ASSERT, IUIToolManager::eBack, eCompleted, eFormatDefined, IUIToolManager::eNext, eSelectFiles, eSelectProjects, CCompressedFile::FileExists(), filenames, CFileLoadOptionPanel::GetCheckFormat(), CFileAutoLoader::GetCurrentManager(), IFileFormatLoaderManager::GetFileLoaderId(), CFileLoadOptionPanel::GetFilenames(), CProjectSelectorPanel::GetParams(), CRef< C, Locker >::GetPointer(), CFileLoadOptionPanel::GetSelectedFormat(), ITERATE, m_AltToolManager, m_CurrFormat, m_FormatManagers, m_OptionPanel, m_ProjectParams, m_ProjectSelPanel, m_State, NcbiErrorBox(), NULL, CFileLoadOptionPanel::OnActivatePanel(), CProjectSelectorPanel::TransferDataFromWindow(), wxT, and x_CheckFormatConflict().

◆ GetAlternateToolManager()

virtual IUIToolManager* CFileLoadManager::GetAlternateToolManager ( )
inlinevirtual

If a transition fails, it may make sense to switch to a different tool manger When a tool manager identifies a more appropriate manager for a task, it returns it here, otherwise NULL.

Reimplemented from IUIToolManager.

Definition at line 175 of file ui_file_load_manager.hpp.

References m_AltToolManager.

◆ GetCurrentPanel()

wxPanel * CFileLoadManager::GetCurrentPanel ( )
virtual

◆ GetDescriptor()

const IUIObject & CFileLoadManager::GetDescriptor ( ) const
virtual

Returns the object describing this tool (UI meta data).

Implements IUIToolManager.

Definition at line 126 of file ui_file_load_manager.cpp.

References m_CurrFormat, m_Descriptor, and m_FormatManagers.

Referenced by GetLabel().

◆ GetExecuteUnit()

IExecuteUnit * CFileLoadManager::GetExecuteUnit ( )
virtual

Reimplemented from IUIToolManager.

Definition at line 475 of file ui_file_load_manager.cpp.

References m_CurrFormat, and m_FormatManagers.

◆ GetFilenames()

vector<wxString> CFileLoadManager::GetFilenames ( ) const
inline

Definition at line 193 of file ui_file_load_manager.hpp.

References m_Filenames.

Referenced by COpenDlg::x_DoTransition().

◆ GetFirstPage()

IWizardPage * CFileLoadManager::GetFirstPage ( )
virtual

Returns first options page (if any) of the tool to be shown in wizard dialog.

Reimplemented from IUIToolManager.

Definition at line 485 of file ui_file_load_manager.cpp.

References m_FilePage, and x_GetOptionsPanel().

◆ GetLabel()

virtual string CFileLoadManager::GetLabel ( void  ) const
inlinevirtual

Definition at line 181 of file ui_file_load_manager.hpp.

References GetDescriptor(), and IUIObject::GetLabel().

◆ GetTask()

IAppTask * CFileLoadManager::GetTask ( )
virtual

◆ InitUI()

void CFileLoadManager::InitUI ( )
virtual

Initializes the Manager before using it in UI.

This function shall reset Internal state of the tool.

Implements IUIToolManager.

Definition at line 137 of file ui_file_load_manager.cpp.

References eSelectFiles, i, IUIToolManager::InitUI(), m_FormatManagers, m_OptionPanel, m_ParentWindow, m_SrvLocator, m_State, CFileLoadOptionPanel::OnActivatePanel(), IUIToolManager::SetParentWindow(), and IUIToolManager::SetServiceLocator().

◆ IsCompletedState()

bool CFileLoadManager::IsCompletedState ( )
virtual

Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred and validated.

Typically this is the last state after Final state. This state does not have an associated UI panel. When manager reaches the “Completed” state the framework hides the dialog and calls GetTask() function.

Implements IUIToolManager.

Definition at line 273 of file ui_file_load_manager.cpp.

References eCompleted, and m_State.

◆ IsFinalState()

bool CFileLoadManager::IsFinalState ( )
virtual

True if Tool Manager has reached its final state, i.e.

the last page (panel) in the sequence is displayed and "Finish" button is shown. The framework calls this function to decide whether “Finish” or “Next” button needs to be shown.

Implements IUIToolManager.

Definition at line 267 of file ui_file_load_manager.cpp.

References eSelectProjects, and m_State.

◆ LoadRegisteredManagers()

void CFileLoadManager::LoadRegisteredManagers ( )

◆ LoadSettings()

void CFileLoadManager::LoadSettings ( )
virtual

◆ OnFormatChanged()

void CFileLoadManager::OnFormatChanged ( )
virtual

called by File Format panel when a user selects a format

Definition at line 188 of file ui_file_load_manager.cpp.

References _ASSERT, eSelectFiles, CFileLoadOptionPanel::GetSelectedFormat(), m_CurrFormat, m_OptionPanel, m_State, and x_UpdateWizardPages().

Referenced by CFileLoadOptionPanel::OnFormatListSelected().

◆ ResetState()

void CFileLoadManager::ResetState ( )
virtual

◆ SaveSettings()

void CFileLoadManager::SaveSettings ( ) const
virtual

◆ SetDialog()

void CFileLoadManager::SetDialog ( COpenDlg dlg)

Definition at line 108 of file ui_file_load_manager.cpp.

References m_OpenDlg.

Referenced by COpenDlg::InitDialog().

◆ SetFilenames()

void CFileLoadManager::SetFilenames ( vector< wxString > &  filenames)
virtual

◆ SetParentWindow()

void CFileLoadManager::SetParentWindow ( wxWindow *  parent)
virtual

Implements IUIToolManager.

Definition at line 120 of file ui_file_load_manager.cpp.

References m_ParentWindow.

◆ SetPrevPage()

void CFileLoadManager::SetPrevPage ( IWizardPage )
virtual

Sets a wizard page which should show before the first page of the tool.

Reimplemented from IUIToolManager.

Definition at line 491 of file ui_file_load_manager.cpp.

References m_OpenObjectsPage, and x_UpdateWizardPages().

◆ SetRegistryPath()

void CFileLoadManager::SetRegistryPath ( const string path)
virtual

◆ SetServiceLocator()

void CFileLoadManager::SetServiceLocator ( IServiceLocator srv_locator)
virtual

Sets / unsets Service Locator.

Tool Manager can use the locator to obtain the services necessary services.

Implements IUIToolManager.

Definition at line 114 of file ui_file_load_manager.cpp.

References m_SrvLocator.

◆ x_AutoGuessFormat()

void CFileLoadManager::x_AutoGuessFormat ( )
protected

◆ x_CanLeavePage()

bool CFileLoadManager::x_CanLeavePage ( bool  forward)
protected

◆ x_CheckFormatConflict()

bool CFileLoadManager::x_CheckFormatConflict ( const vector< wxString > &  filenames,
TFormatMgrRef manager 
)
protected

◆ x_CreateNewProject()

CFileLoadManager::TProjectId CFileLoadManager::x_CreateNewProject ( const string new_prj_name)
protected

◆ x_GetOptionsPanel()

CFileLoadOptionPanel * CFileLoadManager::x_GetOptionsPanel ( )
protected

◆ x_UpdateWizardPages()

void CFileLoadManager::x_UpdateWizardPages ( )
protected

Member Data Documentation

◆ m_AltToolManager

IUIToolManager* CFileLoadManager::m_AltToolManager
protected

If a file type is better handled by a different tool manager, set it here.

Definition at line 248 of file ui_file_load_manager.hpp.

Referenced by DoTransition(), and GetAlternateToolManager().

◆ m_AutodetectFormat

TFormatMgrRef CFileLoadManager::m_AutodetectFormat
protected

Definition at line 241 of file ui_file_load_manager.hpp.

Referenced by LoadRegisteredManagers(), and ResetState().

◆ m_CheckFormat

bool CFileLoadManager::m_CheckFormat
protected

Definition at line 245 of file ui_file_load_manager.hpp.

Referenced by LoadSettings(), and x_GetOptionsPanel().

◆ m_CurrFormat

int CFileLoadManager::m_CurrFormat
protected

◆ m_Descriptor

CUIObject CFileLoadManager::m_Descriptor
protected

Definition at line 233 of file ui_file_load_manager.hpp.

Referenced by GetDescriptor().

◆ m_FileMRUList

TMRUPathList CFileLoadManager::m_FileMRUList
protected

◆ m_Filenames

vector<wxString> CFileLoadManager::m_Filenames
protected

◆ m_FilePage

CFilePage CFileLoadManager::m_FilePage
protected

Definition at line 259 of file ui_file_load_manager.hpp.

Referenced by CleanUI(), and GetFirstPage().

◆ m_FormatManagers

vector<TFormatMgrRef> CFileLoadManager::m_FormatManagers
protected

◆ m_OpenDlg

COpenDlg* CFileLoadManager::m_OpenDlg
protected

Definition at line 234 of file ui_file_load_manager.hpp.

Referenced by SetDialog(), and x_UpdateWizardPages().

◆ m_OpenObjectsPage

IWizardPage* CFileLoadManager::m_OpenObjectsPage
protected

Definition at line 260 of file ui_file_load_manager.hpp.

Referenced by SetPrevPage(), and x_UpdateWizardPages().

◆ m_OptionPanel

CFileLoadOptionPanel* CFileLoadManager::m_OptionPanel
protected

◆ m_ParentWindow

wxWindow* CFileLoadManager::m_ParentWindow
protected

◆ m_ProjectParams

SProjectSelectorParams CFileLoadManager::m_ProjectParams
protected

Definition at line 255 of file ui_file_load_manager.hpp.

Referenced by DoTransition(), GetCurrentPanel(), and GetTask().

◆ m_ProjectSelPanel

CProjectSelectorPanel* CFileLoadManager::m_ProjectSelPanel
protected

Definition at line 253 of file ui_file_load_manager.hpp.

Referenced by CleanUI(), DoTransition(), and GetCurrentPanel().

◆ m_RegPath

string CFileLoadManager::m_RegPath
protected

Definition at line 239 of file ui_file_load_manager.hpp.

Referenced by LoadSettings(), SaveSettings(), and SetRegistryPath().

◆ m_SrvLocator

IServiceLocator* CFileLoadManager::m_SrvLocator
protected

◆ m_State

EState CFileLoadManager::m_State
protected

The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:29 2024 by modify_doxy.py rev. 669887