Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

creaImageIO::WxTreeView Class Reference
[View]

Abstract class that handles the view of a Tree through its TreeHandler. More...

#include <creaImageIOWxTreeView.h>

Inheritance diagram for creaImageIO::WxTreeView:
Inheritance graph
[legend]
Collaboration diagram for creaImageIO::WxTreeView:
Collaboration graph
[legend]

List of all members.

Classes

struct  LevelType

Public Member Functions

 WxTreeView (TreeHandler *, GimmickView *, wxWindow *parent, const wxWindowID id)
 Ctor.
virtual ~WxTreeView ()
 Virtual destructor.
virtual void UpdateLevel (int)
 Updates the view of a level given the selected items of upper level.
virtual void RemoveSelected (std::string &i_save)
 Removes selected nodes on given level.
virtual unsigned int GetLastSelectedLevel ()
 Returns the last selected level.
void OnItemSelected (wxListEvent &event)
 Callback for item selection.
void OnItemDeSelected (wxListEvent &event)
 Callback for item deselection.
void OnColClick (wxListEvent &event)
 Callback for column click.
void OnPopupSort (wxCommandEvent &event)
 Callback when the user needs the items sorted.
void OnPopupFilter (wxCommandEvent &event)
 Callback when the user need the items filtered.
void OnLocalCopy (wxCommandEvent &event)
 Callback when the user needs the item copied to the local disk.
void OnAnonymizer (wxCommandEvent &event)
 Callback when the user needs the item copied to the local disk.
void OnEditField (wxCommandEvent &event)
 Callback when the user needs to edit a field.
void OnDumpTags (wxCommandEvent &event)
 Callback when the user needs to display alll dicom tags for a file.
void OnExportToStorage (wxCommandEvent &event)
 Callback when the user needs to transfer data from storage to storage.
void OnMouseClick (wxMouseEvent &event)
 Callback on mouse click.
void OnItemMenu (wxListEvent &event)
 Displays a menu for items.
void GetAttributes (std::vector< std::string > &areShown, std::vector< std::string > &notShown, int level)
 Gets the attributes that are being shown and the ones that have been blocked on a specific level.
void SetNonVisibleAttributes (const std::vector< std::string > &notShown, int level)
 Sets the non visible attributes and refreshes the GUI.
void CreateCtrl (std::vector< std::string > &notShown, int nlevel)
 Creates a new listctrl.
bool IsAttributeVisible (const std::string &val, int level)
 Returns true if the attribute passed as a parameter is visible or not.
virtual void ValidateSelectedImages ()
 Validates the selected images.

Protected Member Functions

TreeHandlerGetTreeHandler ()
GimmickViewGetGimmickView ()

Private Types

typedef std::map< tree::Node
*, wxColour > 
ColorMap
 The color map.
typedef std::pair< tree::Node
*, wxColour > 
NodeColorPair

Private Member Functions

wxListCtrl * GetCtrl (int l)
 return the wxListCtrl of one level
wxSplitterWindow * GetSplitter (int l)
 return the wxSplitter of one level
int GetNumberOfLevels ()
 Returns the maximum number of levels.
const std::vector< tree::Node * > & GetSelected (int level)
void SetSelectedUpToDate (int l, bool v)
 Set the bool SelectedUpToDate for level l.
bool GetSelectedUpToDate (int l)
 Get the bool SelectedUpToDate for level l.
void ValidateSelectedImages (bool isSelection)
 Validates the selected images.
void GetSelectedAsString (std::vector< std::string > &s)
 Gets selected filenames.
void GetFilenamesAsString (const std::vector< tree::Node * > &nodes, std::vector< std::string > &s)
 Gets the filenames of the given nodes and returns them on the given vector. Is recursive.
void GetNodes (std::vector< tree::Node * > &nodes, bool direction)
 Gets the next nodes on the list, be it up(true) or down(false).
virtual void RecursiveUpdateLevel (int)
 Recursive method called upon by UpdateLevel to refresh all windows.
void SelectAll (int level)
 Selects all the elements of a level.
void UnSelectAll (int level)
 UnSelects all the elements of a level.
void OnKeyDown (wxListEvent &event)
void SortLevel (int level)
 Sorts the level.

Private Attributes

wxBoxSizer * msizer
std::vector< LevelTypemLevelList
 The vector of levels : one for each level of the tree.
int mColumnSelected
 Currently Selected Column.
long mLastSelected
 The last selected item on the list (left click).
long mLastRightSelected
 The last selected item on the list (right click).
int mLastRightLevel
 The last selected level (by right click).
ColorMap mColorMap
std::vector< std::string > mColorPalette
 Initial color palette.
wxMenu * menu
wxObject * senderCtrl
int mAscendingID
int mDescendingID
int mFilterID
unsigned int mLastLevel
wxMenu * menuItem
wxMenu * subExportMenu
int mAnonymizingID
int mLocalCopyID
int mEditFieldID
int mDumpID
int mExportID
int mExport2StorageID
bool mIgnoreSelectedChanged

Detailed Description

Abstract class that handles the view of a Tree through its TreeHandler.

Definition at line 38 of file creaImageIOWxTreeView.h.


Member Typedef Documentation

typedef std::map<tree::Node*,wxColour> creaImageIO::WxTreeView::ColorMap [private]

The color map.

Definition at line 180 of file creaImageIOWxTreeView.h.

typedef std::pair<tree::Node*,wxColour> creaImageIO::WxTreeView::NodeColorPair [private]

Definition at line 181 of file creaImageIOWxTreeView.h.


Constructor & Destructor Documentation

creaImageIO::WxTreeView::WxTreeView ( TreeHandler handler,
GimmickView gimmick,
wxWindow *  parent,
const wxWindowID  id 
)

Ctor.

Initialize the first level splitter

Definition at line 95 of file creaImageIOWxTreeView.cpp.

References creaImageIO::tree::Tree::GetAttributeDescriptorList(), creaImageIO::tree::Tree::GetLevelDescriptor(), creaImageIO::tree::LevelDescriptor::GetName(), creaImageIO::tree::Tree::GetNumberOfLevels(), creaImageIO::TreeHandler::GetTree(), GimmickDebugMessage, creaImageIO::WxTreeView::LevelType::key, mAnonymizingID, mAscendingID, mDescendingID, mDumpID, mEditFieldID, menu, menuItem, mFilterID, mIgnoreSelectedChanged, mLastLevel, mLastSelected, mLevelList, mLocalCopyID, msizer, OnDumpTags(), OnEditField(), OnExportToStorage(), OnLocalCopy(), OnPopupFilter(), OnPopupSort(), creaImageIO::tree::AttributeDescriptor::PRIVATE, creaImageIO::WxTreeView::LevelType::SelectedUpToDate, creaImageIO::WxTreeView::LevelType::SortColumn, subExportMenu, UpdateLevel(), creaImageIO::WxTreeView::LevelType::wxCtrl, and creaImageIO::WxTreeView::LevelType::wxSplitter.

    : wxPanel(parent,id),
      TreeView(handler, gimmick)
  {
    GimmickDebugMessage(1,"WxTreeView::WxTreeView"
                        <<std::endl);

    
    // Split part below toolbar into notebook for views and panel
    // for preview, messages...
    // TO DO : Splitter
    //    mSplitter = new wxSplitterWindow( this , -1);

    // Global sizer
    msizer = new wxBoxSizer(wxHORIZONTAL);
    
    int ctrl_style = wxLC_REPORT | wxLC_VRULES;
    int col_style = wxLIST_FORMAT_LEFT;

    // Creating the ListCtrl for the levels > 0 (not for Root level)
    for (int i = 0;
         i < handler->GetTree().GetNumberOfLevels() -1;
         ++i)
      {
        GimmickDebugMessage(5,"Creating view for level "<<i
                            <<std::endl);
        LevelType level;
        level.SelectedUpToDate = true;
        level.SortColumn = 0;

        // If the first level : parent = this
        wxWindow* sparent = this;
        // else parent = last splitter
        if (i>0) 
                sparent = mLevelList[i-1].wxSplitter;

        level.wxSplitter = new wxSplitterWindow( sparent , -1);
        if(i!=0)
        {
        level.wxSplitter->Show(false);
        }
        //          level.wxSplitter->SetMinimumPaneSize(100);
        
        wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
                                          i,
                                          wxDefaultPosition, 
                                          wxDefaultSize,
                                          ctrl_style);
        level.wxCtrl = ctrl;
        level.wxSplitter->Initialize(ctrl);
   
        // Create the columns : one for each attribute of the level
        int col = 0;
        std::string title;

        tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
        for (a  = handler->GetTree().GetAttributeDescriptorList(i+1).begin();
             a != handler->GetTree().GetAttributeDescriptorList(i+1).end();
             ++a)

{
        
            GimmickDebugMessage(5,"Creating column "<<col<<" : "
                                <<a->GetName()
                                <<std::endl);
            
            if(a->GetFlags()!=creaImageIO::tree::AttributeDescriptor::PRIVATE)
              {
                
                if(a->GetName()=="UNKNOWN")
                  {
                    title = "#";
                    title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
                    if (title[title.size()-1]!='s')
                      title += "s";
                    
                  }
                else
                  {
                    title=a->GetName();
                  }
                  std::string temp = a->GetKey();
                  if (temp.compare("ID") != 0)
                  {
                
                ctrl->InsertColumn(col, 
                                   crea::std2wx(title),
                                   col_style);
                col++;
                  }
                level.key.push_back(a->GetKey());
              }
                
          }
          
        mLevelList.push_back(level);
      }
    
#if wxUSE_MENUS

         // Column Menu
    menu =new wxMenu;
        wxMenuItem* m1=menu->Append(wxID_ANY, _T("&Sort ascending"));
        wxMenuItem* m2=menu->Append(wxID_ANY, _T("&Sort descending"));
        wxMenuItem* m3=menu->Append(wxID_ANY, _T("&Filter"));
        mAscendingID=m1->GetId();
        mDescendingID=m2->GetId();
        mFilterID=m3->GetId();
        Connect( mAscendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
        Connect( mDescendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
        Connect( mFilterID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupFilter) );


        subExportMenu = new wxMenu;
        wxMenuItem *subExp1 = subExportMenu->Append(wxID_ANY, _T("&Export to Storage"));
        Connect( subExp1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnExportToStorage) );

        //ItemMenu
        menuItem =new wxMenu;


        wxMenuItem* m2Item=menuItem->Append(wxID_ANY, _T("&Local Copy"));
        wxMenuItem* m3Item=menuItem->Append(wxID_ANY, _T("&Edit Fields"));
        wxMenuItem* m4Item=menuItem->Append(wxID_ANY, _T("&Display Dicom Tags"));
        menuItem->AppendSubMenu(subExportMenu, wxT("&Export"));

#if defined(USE_GDCM_ANOM)
        wxMenuItem* m1Item=menuItem->Append(wxID_ANY, _T("&Anonymize"));
        mAnonymizingID=m1Item->GetId();
        Connect( mAnonymizingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnAnonymize) );
#endif
        mLocalCopyID=m2Item->GetId();
        mEditFieldID=m3Item->GetId();
        mDumpID=m4Item->GetId();
        
        
        Connect( mLocalCopyID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnLocalCopy) );
        Connect( mEditFieldID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnEditField) );
        Connect( mDumpID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnDumpTags) );
        

        
#endif // wxUSE_MENUS

          
        msizer->Add( mLevelList[0].wxSplitter ,1, wxGROW  ,0);
        //      mColumnSelected=1;
        mLastSelected=0;
        mLastLevel=0;
        //      mDirection=true;

        mIgnoreSelectedChanged = false;

        //CreateColorPalette();
    UpdateLevel(1);

    SetSizer( msizer );     
    SetAutoLayout(true);
    Layout();

  }

Here is the call graph for this function:

creaImageIO::WxTreeView::~WxTreeView (  )  [virtual]

Virtual destructor.

Destructor.

Definition at line 264 of file creaImageIOWxTreeView.cpp.

References GimmickDebugMessage, menu, and menuItem.

  {
    GimmickDebugMessage(1,"WxTreeView::~WxTreeView"
                        <<std::endl);
        delete menu;
        delete menuItem;

  }


Member Function Documentation

void creaImageIO::WxTreeView::CreateCtrl ( std::vector< std::string > &  notShown,
int  nlevel 
) [virtual]

Creates a new listctrl.

Reimplemented from creaImageIO::TreeView.

Definition at line 1199 of file creaImageIOWxTreeView.cpp.

References creaImageIO::tree::Tree::GetAttributeDescriptorList(), creaImageIO::TreeHandler::GetTree(), creaImageIO::TreeView::GetTreeHandler(), IsAttributeVisible(), mLevelList, creaImageIO::tree::AttributeDescriptor::PRIVATE, and UpdateLevel().

  {
        int ctrl_style = wxLC_REPORT | wxLC_VRULES;
    int col_style = wxLIST_FORMAT_LEFT;
        LevelType level;
        mLevelList[nlevel].SelectedUpToDate = true;
        mLevelList[nlevel].SortColumn = 0;
        mLevelList[nlevel].key.clear();
        
        mLevelList[nlevel].wxCtrl = new wxListCtrl(mLevelList[nlevel].wxSplitter,
                                          nlevel,
                                          wxDefaultPosition, 
                                          wxDefaultSize,
                                          ctrl_style);
        wxWindow* oldWin=mLevelList[nlevel].wxSplitter->GetWindow1();
        mLevelList[nlevel].wxSplitter->ReplaceWindow(oldWin,mLevelList[nlevel].wxCtrl);
        mLevelList[nlevel].wxSplitter->Initialize(mLevelList[nlevel].wxCtrl);
   
        // Create the columns : one for each attribute of the level
        int col = 0;
        std::string title;

        tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
        for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(nlevel+1).begin();
             a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(nlevel+1).end();
             ++a)

        {   
            if(a->GetFlags()!=creaImageIO::tree::AttributeDescriptor::PRIVATE && IsAttributeVisible(a->GetName(),nlevel+1))
              {
                  title=a->GetName();
                  std::string temp = a->GetKey();
                  if (temp.compare("ID") != 0)
                  {
                        mLevelList[nlevel].wxCtrl->InsertColumn(col, 
                                        crea::std2wx(title),
                                        col_style);
                        col++;
                  }
                mLevelList[nlevel].key.push_back(a->GetKey());
              }
                
          }
        oldWin->Destroy();
        UpdateLevel(1);
        }

Here is the call graph for this function:

void creaImageIO::WxTreeView::GetAttributes ( std::vector< std::string > &  areShown,
std::vector< std::string > &  notShown,
int  level 
) [virtual]

Gets the attributes that are being shown and the ones that have been blocked on a specific level.

Reimplemented from creaImageIO::TreeView.

Definition at line 1175 of file creaImageIOWxTreeView.cpp.

References creaImageIO::tree::AttributeDescriptor::EDITABLE, creaImageIO::tree::Tree::GetAttributeDescriptorList(), creaImageIO::TreeHandler::GetTree(), creaImageIO::TreeView::GetTreeHandler(), IsAttributeVisible(), and mLevelList.

  {
          areShown.clear();
          notShown.clear();
        tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
        for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(level).begin();
             a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(level).end();
             ++a)
        {
                if(a->GetFlags()==creaImageIO::tree::AttributeDescriptor::EDITABLE && IsAttributeVisible(a->GetName(),level))
            {
                        areShown.push_back(a->GetName());
                }
        }
        notShown=mLevelList[level-1].notShownAtts;
  }

Here is the call graph for this function:

wxListCtrl* creaImageIO::WxTreeView::GetCtrl ( int  l  )  [inline, private]

return the wxListCtrl of one level

Definition at line 137 of file creaImageIOWxTreeView.h.

References mLevelList.

Referenced by GetNodes(), GetSelected(), OnColClick(), OnDumpTags(), OnEditField(), OnExportToStorage(), OnItemDeSelected(), OnItemMenu(), OnItemSelected(), OnPopupFilter(), OnPopupSort(), RecursiveUpdateLevel(), SelectAll(), SortLevel(), and UpdateLevel().

{ return mLevelList[l].wxCtrl; }

Here is the caller graph for this function:

void creaImageIO::WxTreeView::GetFilenamesAsString ( const std::vector< tree::Node * > &  nodes,
std::vector< std::string > &  s 
) [private]

Gets the filenames of the given nodes and returns them on the given vector. Is recursive.

Definition at line 1153 of file creaImageIOWxTreeView.cpp.

References creaImageIO::TreeView::GetTreeHandler(), creaImageIO::TreeHandler::LoadChildren(), and mLevelList.

Referenced by OnAnonymizer(), OnExportToStorage(), and OnLocalCopy().

  {
    std::vector<tree::Node*>::const_iterator i;
    
    for (i=nodes.begin(); i!=nodes.end(); ++i)
      {
                  if((*i)->GetLevel()<mLevelList.size())
                  {
                         GetTreeHandler()->LoadChildren(*i,0);
                         GetFilenamesAsString((*i)->GetChildrenList(),s);
                  }
                  else
                  {
                        std::string filename=(*i)->GetAttribute("FullFileName");
                        s.push_back(filename);
                  }
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

GimmickView* creaImageIO::TreeView::GetGimmickView (  )  [inline, protected, inherited]
virtual unsigned int creaImageIO::WxTreeView::GetLastSelectedLevel (  )  [inline, virtual]

Returns the last selected level.

Reimplemented from creaImageIO::TreeView.

Definition at line 55 of file creaImageIOWxTreeView.h.

References mLastLevel.

{return mLastLevel;}

void creaImageIO::WxTreeView::GetNodes ( std::vector< tree::Node * > &  nodes,
bool  direction 
) [private, virtual]

Gets the next nodes on the list, be it up(true) or down(false).

Reimplemented from creaImageIO::TreeView.

Definition at line 1086 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), mLastSelected, and mLevelList.

  {
        long item = mLastSelected;
        int level=mLevelList.size()-1;
        //Gets current item data
        long adr = GetCtrl(level)->GetItemData(item);
        //Extracts the node
        tree::Node* nod = ((ItemData*)adr)->node;
    for ( ;; )
    {
                if(direction)
                {
                        item = GetCtrl(level)->GetNextItem(item,
                                     wxLIST_NEXT_ABOVE);
                }
                else
                {
                        item = GetCtrl(level)->GetNextItem(item,
                                     wxLIST_NEXT_BELOW);
                }
        if ( item == -1 || item==0  )
                {
            break;
                }
                if(GetCtrl(level)->GetItemState(item, wxLIST_STATE_SELECTED)==0 )
                {

                        adr = GetCtrl(level)->GetItemData(item);
                        nod = ((ItemData*)adr)->node;
                        nodes.push_back(nod);
                }
    }

  }

Here is the call graph for this function:

int creaImageIO::WxTreeView::GetNumberOfLevels (  )  [inline, private, virtual]

Returns the maximum number of levels.

Reimplemented from creaImageIO::TreeView.

Definition at line 141 of file creaImageIOWxTreeView.h.

References mLevelList.

{ return mLevelList.size(); }

const std::vector< tree::Node * > & creaImageIO::WxTreeView::GetSelected ( int  level  )  [private, virtual]

Gets the user selected data from the level passed as a parameter Updates the vector if necessary

Reimplemented from creaImageIO::TreeView.

Definition at line 277 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), creaImageIO::TreeView::GetTreeHandler(), and mLevelList.

Referenced by GetSelectedAsString(), OnLocalCopy(), RecursiveUpdateLevel(), RemoveSelected(), and ValidateSelectedImages().

  {
          std::vector<tree::Node*>& sel = mLevelList[0].Selected;
    //  if (GetSelectedUpToDate(level)) 
    int l = level - 1;
    // the selection of upper level
        if(mLevelList.size() == level -1)
                 sel = mLevelList.back().Selected;
        else
                  sel=  mLevelList[l].Selected;
        if (sel.size() > 0)
        {
                sel.clear();
        }
          if (level == 1) 
      {
        sel.push_back(GetTreeHandler()->GetTree().GetTree());
      }
          else if (level < mLevelList.size()+2 ) 
    {
                long item = -1;
                for ( ;; )
                {
                        item = GetCtrl(l-1)->GetNextItem(item,
                                                                                 wxLIST_NEXT_ALL,
                                                                                 wxLIST_STATE_SELECTED);
                        if ( item == -1 )
                                break;
                        long adr = GetCtrl(l-1)->GetItemData(item);
                        tree::Node* n = ((ItemData*)adr)->node;
                        /* FCY 18-04-2011: don't understand the real purpose of these lines,
                         if uncomment add last frame in first place 
                                if(mLastSelected==item)
                        {
                                std::vector<tree::Node*>::iterator it;
                                it = sel.begin();
                                it = sel.insert ( it , n );
                        }
                        else
                        {*/
                                
                                sel.push_back(n);
                        //}                     
                        
                }
                /*int n = GetCtrl(l-1)->GetItemCount();
                for (int i = 0; i<n; i++)
                {
                        std::cout<<GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED)<<std::endl;
                        if ( GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED))
                        {
                                long adr = GetCtrl(l-1)->GetItemData(i);
                                tree::Node* n = ((ItemData*)adr)->node;
                                if(mLastSelected==i)
                                {
                                        std::vector<tree::Node*>::iterator it;
                                        it = sel.begin();
                                        it = sel.insert ( it , n );
                                }
                                else
                                {
                                        
                                        sel.push_back(n);
                                }
                        }
              }*/
          }
        else
        {
                // NOTHING
        }   
         
    //    return mLevelList[level-1].Selected;
    return sel;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::GetSelectedAsString ( std::vector< std::string > &  s  )  [private, virtual]

Gets selected filenames.

Reimplemented from creaImageIO::TreeView.

Definition at line 1137 of file creaImageIOWxTreeView.cpp.

References GetSelected(), and mLevelList.

  {
    int level=mLevelList.size();
    const std::vector<tree::Node*>& sel=GetSelected(level+1);
    std::vector<tree::Node*>::const_iterator i;
    
    for (i=sel.begin(); i!=sel.end(); ++i)
      {
        std::string filename=(*i)->GetAttribute("FullFileName");
        s.push_back(filename);
      }
  }

Here is the call graph for this function:

bool creaImageIO::WxTreeView::GetSelectedUpToDate ( int  l  )  [inline, private]

Get the bool SelectedUpToDate for level l.

Definition at line 148 of file creaImageIOWxTreeView.h.

References mLevelList.

{ return mLevelList[l].SelectedUpToDate; }

wxSplitterWindow* creaImageIO::WxTreeView::GetSplitter ( int  l  )  [inline, private]

return the wxSplitter of one level

Definition at line 139 of file creaImageIOWxTreeView.h.

References mLevelList.

Referenced by UpdateLevel().

{ return mLevelList[l].wxSplitter; }

Here is the caller graph for this function:

TreeHandler* creaImageIO::TreeView::GetTreeHandler (  )  [inline, protected, inherited]
bool creaImageIO::WxTreeView::IsAttributeVisible ( const std::string &  val,
int  level 
)

Returns true if the attribute passed as a parameter is visible or not.

Definition at line 1247 of file creaImageIOWxTreeView.cpp.

References mLevelList.

Referenced by CreateCtrl(), and GetAttributes().

  {
          std::vector<std::string> ns=mLevelList[level-1].notShownAtts;
          std::vector<std::string>::iterator it;
          bool found=false;
          for(it=ns.begin();it!=ns.end()&&!found;++it)
          {
                  if(val.compare(*it)==0)
                  {
                          found=true;
                  }
          }
          return !found;
  }

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnAnonymizer ( wxCommandEvent &  event  ) 

Callback when the user needs the item copied to the local disk.

Definition at line 819 of file creaImageIOWxTreeView.cpp.

References GetFilenamesAsString().

  {
           wxBusyCursor busy;
           std::vector<std::string> filesname;
           std::vector<tree::Node*> nodes;
//         nodes.push_back(((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node);
           if(nodes.size() != 0)
           {
                   GetFilenamesAsString(nodes,filesname);
                //   GetGimmickView()->Anonymize(filesname,0);
           }
        
  }

Here is the call graph for this function:

void creaImageIO::WxTreeView::OnColClick ( wxListEvent &  event  ) 

Callback for column click.

Definition at line 696 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), mColumnSelected, menu, mLevelList, and senderCtrl.

  { 
    mColumnSelected = event.m_col;
    wxPoint clientpt;
    clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
    clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
    senderCtrl = event.GetEventObject(); 
    unsigned int level = 0;
    for (level = 0; level<mLevelList.size(); ++level)
      {
        if ( GetCtrl(level) == senderCtrl ) break;
      }
    PopupMenu(menu, clientpt);
    
  }

Here is the call graph for this function:

void creaImageIO::WxTreeView::OnDumpTags ( wxCommandEvent &  event  ) 

Callback when the user needs to display alll dicom tags for a file.

Definition at line 920 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::DumpTags(), creaImageIO::tree::Node::GetAttribute(), creaImageIO::tree::Tree::GetAttributeDescriptorList(), GetCtrl(), creaImageIO::TreeView::GetGimmickView(), creaImageIO::TreeHandler::GetTree(), creaImageIO::TreeView::GetTreeHandler(), mLastRightLevel, and mLastRightSelected.

Referenced by WxTreeView().

  {
          if(mLastRightSelected!=-1)
        {
                tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
                tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
                std::vector<std::string> names;
                std::vector<std::string> keys;
                for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).begin();
                         a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).end();
                         ++a)
                        {
                                if(a->GetKey()=="FullFileName")
                                {
                                        GetGimmickView()->DumpTags(node->GetAttribute("FullFileName"));
                                        return;
                                }
                        }
          }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnEditField ( wxCommandEvent &  event  ) 

Callback when the user needs to edit a field.

Definition at line 881 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::CreateEditFieldsDialog(), creaImageIO::tree::AttributeDescriptor::EDITABLE, creaImageIO::tree::Tree::GetAttributeDescriptorList(), GetCtrl(), creaImageIO::TreeView::GetGimmickView(), creaImageIO::TreeHandler::GetTree(), creaImageIO::TreeView::GetTreeHandler(), mLastRightLevel, and mLastRightSelected.

Referenced by WxTreeView().

  {
        if(mLastRightSelected!=-1)
        {
    tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
        tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
        std::vector<std::string> names;
        std::vector<std::string> keys;
        for (a  = GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).begin();
             a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).end();
             ++a)
        {
                if(a->GetFlags()==creaImageIO::tree::AttributeDescriptor::EDITABLE)
            {
                        names.push_back(a->GetName());
                        keys.push_back(a->GetKey());
                }
        }
        GetGimmickView()->CreateEditFieldsDialog(node,names,keys);
        }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnExportToStorage ( wxCommandEvent &  event  ) 

Callback when the user needs to transfer data from storage to storage.

Definition at line 907 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::ExportToStorage(), GetCtrl(), GetFilenamesAsString(), creaImageIO::TreeView::GetGimmickView(), mLastRightLevel, and mLastRightSelected.

Referenced by WxTreeView().

  {
        std::vector<std::string> filesname;
        std::vector<tree::Node*> nodes;
        nodes.push_back(((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node);
        GetFilenamesAsString(nodes,filesname);
        GetGimmickView()->ExportToStorage(filesname);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnItemDeSelected ( wxListEvent &  event  ) 

Callback for item deselection.

Definition at line 589 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), creaImageIO::TreeView::GetTreeHandler(), GimmickDebugMessage, mLevelList, OnItemSelected(), and SetSelectedUpToDate().

  { 
    GimmickDebugMessage(1,
                        GetTreeHandler()->GetTree().GetLabel()
                        <<" WxTreeView::OnItemDeselected"<<std::endl);
    // retrieve the level
    wxObject* obj = event.GetEventObject();   
    unsigned int level = 0;
    for (level = 0; level<mLevelList.size(); ++level)
      {
        if ( GetCtrl(level) == obj ) break;
      } 
    SetSelectedUpToDate(level,false);
    // to allow a first selection in images TreeView
    if (level==mLevelList.size()-1) 
      OnItemSelected(event);
  }

Here is the call graph for this function:

void creaImageIO::WxTreeView::OnItemMenu ( wxListEvent &  event  ) 

Displays a menu for items.

Definition at line 715 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), menuItem, mLastRightLevel, mLastRightSelected, mLevelList, and senderCtrl.

  {
         wxPoint clientpt;
    clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
    clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
    senderCtrl = event.GetEventObject();
    unsigned int level = 0;
    for (level = 0; level<mLevelList.size(); ++level)
      {
                if ( GetCtrl(level) == senderCtrl ) break;
      }
          long* ptr=0;
          int flag;
          mLastRightLevel=level;
          mLastRightSelected=GetCtrl(level)->HitTest(wxPoint(0,clientpt.y-8),flag,ptr);
    PopupMenu(menuItem, clientpt);
    
  }

Here is the call graph for this function:

void creaImageIO::WxTreeView::OnItemSelected ( wxListEvent &  event  ) 

Callback for item selection.

Definition at line 609 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::ClearSelection(), GetCtrl(), creaImageIO::TreeView::GetGimmickView(), creaImageIO::TreeView::GetTreeHandler(), GimmickDebugMessage, mIgnoreSelectedChanged, mLastLevel, mLastSelected, mLevelList, SelectAll(), UpdateLevel(), and creaImageIO::TreeView::ValidateSelectedImages().

Referenced by OnItemDeSelected().

  { 
          
    GimmickDebugMessage(1,
                        GetTreeHandler()->GetTree().GetLabel()
                        <<" WxTreeView::OnItemSelected"<<std::endl);

    if (mIgnoreSelectedChanged) 
      {
        GimmickDebugMessage(1,
                            " mIgnoreSelectedChanged true: returning"
                            <<std::endl);
        return;
      }
    

    
    wxListItem info;
    info.m_itemId = event.m_itemIndex;
    mLastSelected = event.m_itemIndex;
    // retrieve the level
    wxObject* obj = event.GetEventObject();   
    unsigned int level = 0;
    for (level = 0; level<mLevelList.size(); ++level)
      {
        if ( GetCtrl(level) == obj ) break;
      }
        mLastLevel=level;
    GimmickDebugMessage(1,
                        " Level "<<level+1
                        <<std::endl);
    
    // Update the children level (if selection not at last level)
    if (level<mLevelList.size()-1) 
      {
                
        UpdateLevel( level + 2 ); 
        // Reset the viewer setting the default image
        GetGimmickView()->ClearSelection();
      }
    // Select all images if the selection is at series level
    if (level==mLevelList.size()-2) 
                SelectAll(level+1);
    // Validate selected images if the selection is at image level
    if (level==(mLevelList.size()-1)) //&&mProcess) 
      {
        if(event.GetEventType()==wxEVT_COMMAND_LIST_ITEM_SELECTED)
          {
                  ValidateSelectedImages (true);
          }
        else
          {
                  ValidateSelectedImages (false);
          }
      }
    
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnKeyDown ( wxListEvent &  event  )  [private]

Definition at line 1122 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::ClearSelection(), creaImageIO::TreeView::GetGimmickView(), and RemoveSelected().

  {
          if(event.GetKeyCode() == WXK_DELETE)
          {
                   wxBusyCursor busy;
                   std::string temp = "0";
                   RemoveSelected(temp);
                   GetGimmickView()->ClearSelection();
          }
                  
  }

Here is the call graph for this function:

void creaImageIO::WxTreeView::OnLocalCopy ( wxCommandEvent &  event  ) 

Callback when the user needs the item copied to the local disk.

Definition at line 834 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::CopyFiles(), GetFilenamesAsString(), creaImageIO::TreeView::GetGimmickView(), creaImageIO::tree::Tree::GetLevelDescriptor(), creaImageIO::tree::LevelDescriptor::GetName(), GetSelected(), creaImageIO::TreeHandler::GetTree(), creaImageIO::TreeView::GetTreeHandler(), and mLastLevel.

Referenced by WxTreeView().

  {
    wxBusyCursor busy;
    
        unsigned int tempLevel = mLastLevel;
    mLastLevel+=1;
    const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
        
    if(sel.size() != 0)
        {
            bool copy=false;
            std::stringstream out;
            std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
            out<<"Copy ";
            out<<sel.size();
            if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
              {
                out<<" "<<levelName;
                out<<"s to .creaImageIO?";
              }
            else
              {
                out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<" to .creaImageIO?";
              }
            if (wxMessageBox(crea::std2wx(out.str()),
                             _T("Remove Files"),
                             wxYES_NO,this ) == wxYES)
              {
                copy = true;
              }
            if(copy)
                  {
                        std::vector<std::string> s;
                        GetFilenamesAsString(sel,s);
            GetGimmickView()->CopyFiles(s);
                  }
        }
        else
        {
                mLastLevel = tempLevel;
        }
    
    
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnMouseClick ( wxMouseEvent &  event  ) 

Callback on mouse click.

void creaImageIO::WxTreeView::OnPopupFilter ( wxCommandEvent &  event  ) 

Callback when the user need the items filtered.

Definition at line 737 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::ClearSelection(), GetCtrl(), creaImageIO::TreeView::GetGimmickView(), GimmickDebugMessage, mColumnSelected, mLevelList, senderCtrl, and UpdateLevel().

Referenced by WxTreeView().

  {
    wxBusyCursor busy;
    GimmickDebugMessage(7,
                        "WxTreeView::OnEndLabelEdit" 
                        <<std::endl);
    unsigned int level = 0;
    for (level = 0; level<mLevelList.size(); ++level)
      {
        if ( GetCtrl(level) == senderCtrl ) break;
      }
    std::string filter = crea::wx2std(wxGetTextFromUser(_T("Enter the filter to apply"), _T("Filter On Column")));
    
    std::string att;
    
    long it = -1;
    UpdateLevel(level+1);
    
    std::vector<long> items;
    bool in=false;
    int del=0;
    for ( ;; )
      {
        it = GetCtrl(level)->GetNextItem(it,
                                         wxLIST_NEXT_ALL);
        if ( it == -1 )
          break;
        
        long adr = GetCtrl(level)->GetItemData(it);
        tree::Node* nod = ((ItemData*)adr)->node;
        att=(*nod).GetAttribute(mLevelList[level].key[mColumnSelected]);
        
        
        if(att.find(filter)>900)
          {
            
            if(!in)
              {
                in=true;
              }
            else
              {
                del+=1;
              }
            
            items.push_back(it-del);
          }
        
      }
    std::vector<long>::iterator iter;
    for(iter=items.begin();iter!=items.end();++iter)
      {
        GetCtrl(level)->DeleteItem(*iter);
      }
    GetGimmickView()->ClearSelection();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::OnPopupSort ( wxCommandEvent &  event  ) 

Callback when the user needs the items sorted.

Definition at line 796 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), mAscendingID, mColumnSelected, mDescendingID, mLevelList, senderCtrl, and SortLevel().

Referenced by WxTreeView().

  {
    wxBusyCursor busy;
    unsigned int level = 0;
    for (level = 0; level<mLevelList.size(); ++level)
      {
        if ( GetCtrl(level) == senderCtrl ) break;
      }
    mLevelList[level].SortColumn = mColumnSelected;

    if(event.GetId()==mAscendingID)
      {
        mLevelList[level].SortAscending = true;
      }
    else if(event.GetId()==mDescendingID)
      {
        mLevelList[level].SortAscending = false;
      }
          
    SortLevel(level);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::RecursiveUpdateLevel ( int  level  )  [private, virtual]

Recursive method called upon by UpdateLevel to refresh all windows.

Updates the view of a level given the selected items of upper level Recursive method

Definition at line 471 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), GetSelected(), creaImageIO::TreeView::GetTreeHandler(), GimmickDebugMessage, creaImageIO::ItemData::id, creaImageIO::TreeHandler::LoadChildren(), mLevelList, creaImageIO::ItemData::node, and SortLevel().

Referenced by UpdateLevel().

  {
    GimmickDebugMessage(1,
                        GetTreeHandler()->GetTree().GetLabel()
                        <<"WxTreeView::RecursiveUpdateLevel(level "
                        <<level
                        <<")"<<std::endl);
    
    
    const std::vector<tree::Node*>& sel(GetSelected(level));
    
    int l = level - 1;
    
    // to speed up inserting we hide the control temporarily
    GetCtrl(l)->Hide();
    GetCtrl(l)->DeleteAllItems();
    
    std::vector<tree::Node*>::const_iterator i;
    
    for (i=sel.begin(); i!=sel.end(); ++i)
      {
        GimmickDebugMessage(1,
                            "adding children of '"
                            <<(*i)->GetLabel()
                            <<"'"
                            <<std::endl);
        int _id=0;
        
        //Adds items and sets their attributes 
        
        GetTreeHandler()->LoadChildren(*i,1);
        tree::Node::ChildrenListType::reverse_iterator j;
        for (j = (*i)->GetChildrenList().rbegin(); 
             j!= (*i)->GetChildrenList().rend(); 
             ++j)
          {
            GimmickDebugMessage(1,
                                "adding children "
                                <<(*j)->GetLabel()
                                <<"'"
                                <<std::endl);
            
            wxListItem item;
            item.SetMask(wxLIST_MASK_STATE | 
                         wxLIST_MASK_TEXT |
                         //                      wxLIST_MASK_IMAGE |
                         wxLIST_MASK_DATA |
                         //                      wxLIST_MASK_WIDTH |
                         wxLIST_MASK_FORMAT
                         );
            
                ItemData* data = new ItemData();
            data->node = *j;
            data->id = _id;
                
            item.SetId(_id);
            item.SetData(data);

            _id++;
            GetCtrl(l)->InsertItem(item);
            
            //Setting attributes
            for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)                          
              {
                std::string val;
                //  Temporary correction : it works but no explanation about the problem FCY
                
                if(k==0 && level <3)
                {
                  val = (*j)->GetAttribute("NumberOfChildren");
                }
                else
                  val = (*j)->GetAttribute(mLevelList[l].key[k]);
                if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isDateEntry()) // Date
                  {
                    //                                    std::cout << "["<<val<< "]" << std::endl;
                    std::string valtmp(val);
                    try
                      {
                        boost::gregorian::date d1(boost::gregorian::from_undelimited_string(val));                                 
                        val = to_iso_extended_string(d1);
                      }
                    catch (...)
                      {
                        val =  valtmp;
                      }
                    //                                    std::cout << "["<<val<< "]" << std::endl;     
                  }
                else if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isTimeEntry()) // Time
                  {
                    if ((val.size()>6) && 
                        (val != "" || val != " "))
                      val = val.substr(0,2) + " : " 
                        + val.substr(2,2) + " : " 
                        + val.substr(4,2);
                  }
                else
                  {
                    if (val.size()==0) val = "?";
                  }
                if (val.size()==0) val = "X";
                item.SetText( crea::std2wx(val));
                item.SetColumn(k);
                  
                  GetCtrl(l)->SetItem(item);
                  }
                item.Clear();
            
          }
      }
    
    SortLevel(l);
    GetCtrl(l)->Show();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::RemoveSelected ( std::string &  i_save  )  [virtual]

Removes selected nodes on given level.

Removes selected nodes on last selected level.

Reimplemented from creaImageIO::TreeView.

Definition at line 358 of file creaImageIOWxTreeView.cpp.

References creaImageIO::GimmickView::AddIgnoreFile(), creaImageIO::TreeView::GetGimmickView(), creaImageIO::tree::Tree::GetLevelDescriptor(), creaImageIO::tree::LevelDescriptor::GetName(), GetSelected(), creaImageIO::TreeHandler::GetTree(), creaImageIO::TreeView::GetTreeHandler(), GimmickMessage, creaImageIO::RemoveAlertDlg::isChecked(), creaImageIO::TreeHandler::LoadChildren(), mLastLevel, creaImageIO::GimmickView::modifyValidationSignal(), creaImageIO::TreeHandler::Remove(), and UpdateLevel().

Referenced by OnKeyDown().

  {
         bool erase=false;
         
         unsigned int tempLevel = mLastLevel;
    mLastLevel+=1;
    const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
        // if no selection, no remove action.
    if(sel.size() != 0)
        {
        
            std::stringstream out;
            std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
            out<<"Delete ";
            out<<sel.size();
            if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
              {
                out<<" "<<levelName;
                out<<"s?";
              }
            else
              {
                out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<"?";
              }
            if (wxMessageBox(crea::std2wx(out.str()),
                             _T("Remove Files"),
                             wxYES_NO,this ) == wxYES)
              {
                erase = true;
              }
            if(erase)
                  {
            GetGimmickView()->modifyValidationSignal(false);
                    bool needRefresh=false;
                    std::vector<tree::Node*>::const_iterator i;
                    for (i=sel.begin(); i!=sel.end(); ++i)
                      {
                        GimmickMessage(1,
                                       "deleting '"
                                       <<(*i)->GetLabel()
                                       <<"'"<<mLastLevel
                                       <<std::endl);
                        if((*i)->GetParent()->GetNumberOfChildren()<2)
                          {
                            needRefresh=true;
                          }
                          //tree::Node* n = new (tree::Node*)(*i);
                          GetTreeHandler()->LoadChildren((*i),4);
                          GetGimmickView()->AddIgnoreFile(*i);
                          GetTreeHandler()->Remove(*i);
                      }
                    
                    if(needRefresh && mLastLevel>1)
                      {
                        UpdateLevel(mLastLevel-2);
                      }
                    else if(mLastLevel>1)
                      {
                        UpdateLevel(mLastLevel-1);
                      }
                    else
                      {
                        UpdateLevel(mLastLevel);
                      }
                  }
        }
        else
        {
                // no need to incremente level
                mLastLevel = tempLevel;
        }
    
        if (erase && mLastLevel == 1 && i_save == "0")
        {
        
                RemoveAlertDlg *dial = new RemoveAlertDlg(this,  crea::std2wx("Remove files"), wxSize(370,100));
                //dial->ShowModal();
                if (dial->ShowModal() == wxID_OK)
                {
                        i_save = dial->isChecked() == false? "0" : "1";
                }
                
        }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::SelectAll ( int  level  )  [private]

Selects all the elements of a level.

Definition at line 669 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), and mIgnoreSelectedChanged.

Referenced by OnItemSelected().

  {
    long item = -1;
    //    int level=mLevelList.size()-1;
    for ( ;; )
      {
        item = GetCtrl(level)->GetNextItem(item,
                                           wxLIST_NEXT_ALL);
        if ( item == -1 )
          break;
        
        if(item==(GetCtrl(level)->GetItemCount()-1))
          {
            mIgnoreSelectedChanged = false;//mProcess=true;
          }
        else
          {
            mIgnoreSelectedChanged = true;//    mProcess=false;
          }
        GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
                                     | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
      }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::SetNonVisibleAttributes ( const std::vector< std::string > &  notShown,
int  level 
) [virtual]

Sets the non visible attributes and refreshes the GUI.

Reimplemented from creaImageIO::TreeView.

Definition at line 1193 of file creaImageIOWxTreeView.cpp.

References mLevelList.

  {
        mLevelList[nlevel].notShownAtts=notShown;
  }

void creaImageIO::WxTreeView::SetSelectedUpToDate ( int  l,
bool  v 
) [inline, private]

Set the bool SelectedUpToDate for level l.

Definition at line 146 of file creaImageIOWxTreeView.h.

References mLevelList.

Referenced by OnItemDeSelected().

{ mLevelList[l].SelectedUpToDate = v; }

Here is the caller graph for this function:

void creaImageIO::WxTreeView::SortLevel ( int  level  )  [private]

Sorts the level.

Definition at line 945 of file creaImageIOWxTreeView.cpp.

References creaImageIO::ItemData::attr, CompareFunctionInts(), CompareFunctionStrings(), creaImageIO::tree::AttributeDescriptor::DecodeType(), creaImageIO::tree::Node::GetAttributeDescriptor(), GetCtrl(), GimmickDebugMessage, mIgnoreSelectedChanged, mLevelList, creaImageIO::ItemData::node, and creaImageIO::ItemData::selected.

Referenced by OnPopupSort(), and RecursiveUpdateLevel().

  {       
    GimmickDebugMessage(1,
                        "WxTreeView::SortLevel(" 
                        <<level<<")"
                        <<std::endl);  
    //Obtain the column name and the level that needs to be organized
    
    //    int l = level - 1;
    //Sets the data for the items to be sorted
    //    std::string att;
    unsigned int ty=0;
    int nbselected = 0;
    int n = GetCtrl(level)->GetItemCount();
    for (int i = 0; i < n; i++)
      {
        
        //Gets current item data
        ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
        
        //Extracts the node and the type of attribute   
        tree::Node* nod = data->node;
        if(i==0)
          {
            (*nod).GetAttributeDescriptor
              (mLevelList[level].key[mLevelList[level].SortColumn])
              .DecodeType( ty );
          }
        //Obtains the organizing attribute
        data->attr = & (*nod).GetAttribute
          (mLevelList[level].key[mLevelList[level].SortColumn]);
        //Selected ?
        data->selected = false;
        if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
          {
            data->selected = true;
            nbselected++;
          }

      } 
    GimmickDebugMessage(1,
                        "WxTreeView::OnSort : " 
                        <<nbselected<<" selected before sorting"
                        <<std::endl);  

    mIgnoreSelectedChanged = true; 
    // 
    if (mLevelList[level].SortAscending)
      {
        
        if(ty==1)
          {
            GetCtrl(level)->SortItems(CompareFunctionInts, 0);
          }
        else
          {
            GetCtrl(level)->SortItems(CompareFunctionStrings, 0);
          }
        
      }
    else
      {
        if(ty==1)
          {
            GetCtrl(level)->SortItems(CompareFunctionInts, 1);
          }
        else
          {
            GetCtrl(level)->SortItems(CompareFunctionStrings, 1);
          }
      }
 

    // Reselects the unselected 
    n = GetCtrl(level)->GetItemCount();
    int after = 0;
    for (int i = 0; i < n; i++)
      {
        
        //Gets current item data
        ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
  
        //  long item = -1;
        //    for ( ;; )
        //      {
        //      item = GetCtrl(level)->GetNextItem(item,wxLIST_NEXT_ALL);
        //      if ( item == -1 ) break;
        //Gets current item data
        //      ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(item);
        // was selected ?
        
        if (data->selected)
          {
            nbselected--;
            if (nbselected==0)
              {
                // if it is the last one we must process the selection
                mIgnoreSelectedChanged = false;
              }
            GetCtrl(level)->SetItemState(i,
                                         wxLIST_STATE_SELECTED, 
                                         wxLIST_MASK_STATE 
                                         | wxLIST_MASK_TEXT 
                                         | wxLIST_MASK_IMAGE 
                                         | wxLIST_MASK_DATA 
                                         | wxLIST_MASK_WIDTH 
                                         | wxLIST_MASK_FORMAT);   
          }
        if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
          {
            after++;
          }

        
      }
    mIgnoreSelectedChanged = false; 
     GimmickDebugMessage(1,
                        "WxTreeView::SortLevel : " 
                        <<after<<" selected after sorting"
                        <<std::endl);  
  
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::UnSelectAll ( int  level  )  [private]

UnSelects all the elements of a level.

void creaImageIO::WxTreeView::UpdateLevel ( int  level  )  [virtual]

Updates the view of a level given the selected items of upper level.

Updates a level of the view (adds or removes children, etc.).

Reimplemented from creaImageIO::TreeView.

Definition at line 446 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), GetSplitter(), creaImageIO::TreeView::GetTreeHandler(), GimmickDebugMessage, and RecursiveUpdateLevel().

Referenced by CreateCtrl(), OnItemSelected(), OnPopupFilter(), RemoveSelected(), and WxTreeView().

  {
    GimmickDebugMessage(1,
                        GetTreeHandler()->GetTree().GetLabel()
                        <<"WxTreeView::UpdateLevel(level "
                        <<level
                        <<")"
                        <<std::endl);
    
    wxBusyCursor busy;
    RecursiveUpdateLevel(level);
    int i;
    for (i=0; i<level-1; i++)
      {
        if (!GetSplitter(i)->IsSplit()) 
          GetSplitter(i)->SplitVertically(  GetCtrl(i), GetSplitter(i+1),
                                            100 );
      }
    if (GetSplitter(i)->IsSplit()) GetSplitter(i)->Unsplit();    
    
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::ValidateSelectedImages ( bool  isSelection  )  [private]

Validates the selected images.

Definition at line 1071 of file creaImageIOWxTreeView.cpp.

References creaImageIO::TreeView::GetGimmickView(), GetSelected(), GimmickDebugMessage, mIgnoreSelectedChanged, mLastSelected, mLevelList, and creaImageIO::GimmickView::OnSelectionChange().

  {
    GimmickDebugMessage(7,
                        "WxTreeView::ValidateSelectedImages" 
                        <<std::endl);
    const std::vector<tree::Node*>& sel(GetSelected(mLevelList.size()+1));
    GetGimmickView()->OnSelectionChange(sel,
                                        isSelection,(mLastSelected-1),
                                        !mIgnoreSelectedChanged);
 
  }

Here is the call graph for this function:

virtual void creaImageIO::TreeView::ValidateSelectedImages (  )  [inline, virtual, inherited]

Validates the selected images.

Definition at line 40 of file creaImageIOTreeView.h.

References GimmickError.

Referenced by OnItemSelected().

          { GimmickError("INTERNAL ERROR : TreeView::ValidateSelected not overloaded");}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 196 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

Definition at line 189 of file creaImageIOWxTreeView.h.

Referenced by OnPopupSort(), and WxTreeView().

Definition at line 182 of file creaImageIOWxTreeView.h.

std::vector<std::string> creaImageIO::WxTreeView::mColorPalette [private]

Initial color palette.

Definition at line 184 of file creaImageIOWxTreeView.h.

Currently Selected Column.

Definition at line 170 of file creaImageIOWxTreeView.h.

Referenced by OnColClick(), OnPopupFilter(), and OnPopupSort().

Definition at line 190 of file creaImageIOWxTreeView.h.

Referenced by OnPopupSort(), and WxTreeView().

Definition at line 199 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

Definition at line 198 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

wxMenu* creaImageIO::WxTreeView::menu [private]

Definition at line 186 of file creaImageIOWxTreeView.h.

Referenced by OnColClick(), WxTreeView(), and ~WxTreeView().

Definition at line 194 of file creaImageIOWxTreeView.h.

Referenced by OnItemMenu(), WxTreeView(), and ~WxTreeView().

Definition at line 201 of file creaImageIOWxTreeView.h.

Definition at line 200 of file creaImageIOWxTreeView.h.

Definition at line 191 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

unsigned int creaImageIO::WxTreeView::mLastLevel [private]

The last selected level (by right click).

Definition at line 178 of file creaImageIOWxTreeView.h.

Referenced by OnDumpTags(), OnEditField(), OnExportToStorage(), and OnItemMenu().

The last selected item on the list (right click).

Definition at line 175 of file creaImageIOWxTreeView.h.

Referenced by OnDumpTags(), OnEditField(), OnExportToStorage(), and OnItemMenu().

The last selected item on the list (left click).

Definition at line 172 of file creaImageIOWxTreeView.h.

Referenced by GetNodes(), OnItemSelected(), ValidateSelectedImages(), and WxTreeView().

Definition at line 197 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

wxBoxSizer* creaImageIO::WxTreeView::msizer [private]

Actual processing of item selection/deselection Called by OnItemSelected and OnItemDeSelected

Definition at line 111 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

Definition at line 188 of file creaImageIOWxTreeView.h.

Referenced by OnColClick(), OnItemMenu(), OnPopupFilter(), and OnPopupSort().

Definition at line 195 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().


The documentation for this class was generated from the following files: