creaImageIO_lib
creaImageIO::WxTreeView Class Reference

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

#include <creaImageIOWxTreeView.h>

Inheritance diagram for creaImageIO::WxTreeView:
Collaboration diagram for creaImageIO::WxTreeView:

Classes

struct  LevelType
 

Public Member Functions

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

Protected Member Functions

TreeHandlerGetTreeHandler ()
 
GimmickViewGetGimmickView ()
 

Private Types

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

Private Member Functions

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

Private Attributes

wxBoxSizer * msizer
 
std::vector< LevelTypemLevelList
 The vector of levels : one for each level of the tree. More...
 
int mColumnSelected
 Currently Selected Column. More...
 
long mLastSelected
 The last selected item on the list (left click) More...
 
long mLastRightSelected
 The last selected item on the list (right click) More...
 
int mLastRightLevel
 The last selected level (by right click) More...
 
ColorMap mColorMap
 
std::vector< std::string > mColorPalette
 Initial color palette. More...
 
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 65 of file creaImageIOWxTreeView.h.

Member Typedef Documentation

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

The color map.

Definition at line 207 of file creaImageIOWxTreeView.h.

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

Definition at line 208 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 122 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, OnAnonymizer(), 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.

126  : wxPanel(parent,id),
127  TreeView(handler, gimmick)
128  {
129  GimmickDebugMessage(1,"WxTreeView::WxTreeView"
130  <<std::endl);
131 
132 
133  // Split part below toolbar into notebook for views and panel
134  // for preview, messages...
135  // TO DO : Splitter
136  // mSplitter = new wxSplitterWindow( this , -1);
137 
138  // Global sizer
139  msizer = new wxBoxSizer(wxHORIZONTAL);
140 
141  int ctrl_style = wxLC_REPORT | wxLC_VRULES;
142  int col_style = wxLIST_FORMAT_LEFT;
143 
144  // Creating the ListCtrl for the levels > 0 (not for Root level)
145  for (int i = 0;
146  i < handler->GetTree().GetNumberOfLevels() -1;
147  ++i)
148  {
149  GimmickDebugMessage(5,"Creating view for level "<<i
150  <<std::endl);
151  LevelType level;
152  level.SelectedUpToDate = true;
153  level.SortColumn = 0;
154 
155  // If the first level : parent = this
156  wxWindow* sparent = this;
157  // else parent = last splitter
158  if (i>0)
159  sparent = mLevelList[i-1].wxSplitter;
160 
161  level.wxSplitter = new wxSplitterWindow( sparent , -1);
162  if(i!=0)
163  {
164  level.wxSplitter->Show(false);
165  }
166  // level.wxSplitter->SetMinimumPaneSize(100);
167 
168  wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
169  i,
170  wxDefaultPosition,
171  wxDefaultSize,
172  ctrl_style);
173  level.wxCtrl = ctrl;
174  level.wxSplitter->Initialize(ctrl);
175 
176  // Create the columns : one for each attribute of the level
177  int col = 0;
178  std::string title;
179 
180  tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
181  for (a = handler->GetTree().GetAttributeDescriptorList(i+1).begin();
182  a != handler->GetTree().GetAttributeDescriptorList(i+1).end();
183  ++a)
184 
185 {
186 
187  GimmickDebugMessage(5,"Creating column "<<col<<" : "
188  <<a->GetName()
189  <<std::endl);
190 
192  {
193 
194  if(a->GetName()=="UNKNOWN")
195  {
196  title = "#";
197  title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
198  if (title[title.size()-1]!='s')
199  title += "s";
200 
201  }
202  else
203  {
204  title=a->GetName();
205  }
206  std::string temp = a->GetKey();
207  if (temp.compare("ID") != 0)
208  {
209 
210  ctrl->InsertColumn(col,
211  crea::std2wx(title),
212  col_style);
213  col++;
214  }
215  level.key.push_back(a->GetKey());
216  }
217 
218  }
219 
220  mLevelList.push_back(level);
221  }
222 
223 #if wxUSE_MENUS
224 
225  // Column Menu
226  menu =new wxMenu;
227  wxMenuItem* m1=menu->Append(wxID_ANY, _T("&Sort ascending"));
228  wxMenuItem* m2=menu->Append(wxID_ANY, _T("&Sort descending"));
229  wxMenuItem* m3=menu->Append(wxID_ANY, _T("&Filter"));
230  mAscendingID=m1->GetId();
231  mDescendingID=m2->GetId();
232  mFilterID=m3->GetId();
233  Connect( mAscendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
234  Connect( mDescendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
235  Connect( mFilterID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupFilter) );
236 
237 
239  subExportMenu = new wxMenu;
240  wxMenuItem *subExp1 = subExportMenu->Append(wxID_ANY, _T("&Export to Storage"));
241  Connect( subExp1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnExportToStorage) );
242 
243  //ItemMenu
244  menuItem =new wxMenu;
245 
246 
247  wxMenuItem* m2Item=menuItem->Append(wxID_ANY, _T("&Local Copy"));
248  wxMenuItem* m3Item=menuItem->Append(wxID_ANY, _T("&Edit Fields"));
249  wxMenuItem* m4Item=menuItem->Append(wxID_ANY, _T("&Display Dicom Tags"));
250  menuItem->AppendSubMenu(subExportMenu, wxT("&Export"));
251 
252 
253  wxMenuItem* m1Item=menuItem->Append(wxID_ANY, _T("&Anonymize"));
254  mAnonymizingID=m1Item->GetId();
255  Connect( mAnonymizingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnAnonymizer) );
256 
257  mLocalCopyID=m2Item->GetId();
258  mEditFieldID=m3Item->GetId();
259  mDumpID=m4Item->GetId();
260 
261 
262  Connect( mLocalCopyID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnLocalCopy) );
263  Connect( mEditFieldID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnEditField) );
264  Connect( mDumpID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnDumpTags) );
265 
266 
267 
268 #endif // wxUSE_MENUS
269 
270 
271  msizer->Add( mLevelList[0].wxSplitter ,1, wxGROW ,0);
272  // mColumnSelected=1;
273  mLastSelected=0;
274  mLastLevel=0;
275  // mDirection=true;
276 
277  mIgnoreSelectedChanged = false;
278 
279  //CreateColorPalette();
280  UpdateLevel(1);
281 
282  SetSizer( msizer );
283  SetAutoLayout(true);
284  Layout();
285 
286  }

Here is the call graph for this function:

creaImageIO::WxTreeView::~WxTreeView ( )
virtual

Virtual destructor.

Destructor.

Definition at line 291 of file creaImageIOWxTreeView.cpp.

References GimmickDebugMessage, menu, and menuItem.

292  {
293  GimmickDebugMessage(1,"WxTreeView::~WxTreeView"
294  <<std::endl);
295  delete menu;
296  delete menuItem;
297 
298  }

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 1226 of file creaImageIOWxTreeView.cpp.

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

1227  {
1228  int ctrl_style = wxLC_REPORT | wxLC_VRULES;
1229  int col_style = wxLIST_FORMAT_LEFT;
1230  LevelType level;
1231  mLevelList[nlevel].SelectedUpToDate = true;
1232  mLevelList[nlevel].SortColumn = 0;
1233  mLevelList[nlevel].key.clear();
1234 
1235  mLevelList[nlevel].wxCtrl = new wxListCtrl(mLevelList[nlevel].wxSplitter,
1236  nlevel,
1237  wxDefaultPosition,
1238  wxDefaultSize,
1239  ctrl_style);
1240  wxWindow* oldWin=mLevelList[nlevel].wxSplitter->GetWindow1();
1241  mLevelList[nlevel].wxSplitter->ReplaceWindow(oldWin,mLevelList[nlevel].wxCtrl);
1242  mLevelList[nlevel].wxSplitter->Initialize(mLevelList[nlevel].wxCtrl);
1243 
1244  // Create the columns : one for each attribute of the level
1245  int col = 0;
1246  std::string title;
1247 
1248  tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
1249  for (a = GetTreeHandler()->GetTree().GetAttributeDescriptorList(nlevel+1).begin();
1250  a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(nlevel+1).end();
1251  ++a)
1252 
1253  {
1254  if(a->GetFlags()!=creaImageIO::tree::AttributeDescriptor::PRIVATE && IsAttributeVisible(a->GetName(),nlevel+1))
1255  {
1256  title=a->GetName();
1257  std::string temp = a->GetKey();
1258  if (temp.compare("ID") != 0)
1259  {
1260  mLevelList[nlevel].wxCtrl->InsertColumn(col,
1261  crea::std2wx(title),
1262  col_style);
1263  col++;
1264  }
1265  mLevelList[nlevel].key.push_back(a->GetKey());
1266  }
1267 
1268  }
1269  oldWin->Destroy();
1270  UpdateLevel(1);
1271  }

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 1202 of file creaImageIOWxTreeView.cpp.

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

1203  {
1204  areShown.clear();
1205  notShown.clear();
1206  tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
1207  for (a = GetTreeHandler()->GetTree().GetAttributeDescriptorList(level).begin();
1208  a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(level).end();
1209  ++a)
1210  {
1211  if(a->GetFlags()==creaImageIO::tree::AttributeDescriptor::EDITABLE && IsAttributeVisible(a->GetName(),level))
1212  {
1213  areShown.push_back(a->GetName());
1214  }
1215  }
1216  notShown=mLevelList[level-1].notShownAtts;
1217  }

Here is the call graph for this function:

wxListCtrl* creaImageIO::WxTreeView::GetCtrl ( int  l)
inlineprivate

return the wxListCtrl of one level

Definition at line 164 of file creaImageIOWxTreeView.h.

References mLevelList.

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

164 { 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 1180 of file creaImageIOWxTreeView.cpp.

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

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

1181  {
1182  std::vector<tree::Node*>::const_iterator i;
1183 
1184  for (i=nodes.begin(); i!=nodes.end(); ++i)
1185  {
1186  if((*i)->GetLevel()<mLevelList.size())
1187  {
1188  GetTreeHandler()->LoadChildren(*i,0);
1189  GetFilenamesAsString((*i)->GetChildrenList(),s);
1190  }
1191  else
1192  {
1193  std::string filename=(*i)->GetAttribute("FullFileName");
1194  s.push_back(filename);
1195  }
1196  }
1197  }

Here is the call graph for this function:

Here is the caller graph for this function:

GimmickView* creaImageIO::TreeView::GetGimmickView ( )
inlineprotectedinherited
virtual unsigned int creaImageIO::WxTreeView::GetLastSelectedLevel ( )
inlinevirtual

Returns the last selected level.

Reimplemented from creaImageIO::TreeView.

Definition at line 82 of file creaImageIOWxTreeView.h.

References mLastLevel.

82 {return mLastLevel;}
void creaImageIO::WxTreeView::GetNodes ( std::vector< tree::Node * > &  nodes,
bool  direction 
)
privatevirtual

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

Reimplemented from creaImageIO::TreeView.

Definition at line 1113 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), mLastSelected, and mLevelList.

1114  {
1115  long item = mLastSelected;
1116  int level=(int)mLevelList.size()-1;
1117  //Gets current item data
1118  long adr = (long)GetCtrl(level)->GetItemData(item);
1119  //Extracts the node
1120  tree::Node* nod = ((ItemData*)adr)->node;
1121  for ( ;; )
1122  {
1123  if(direction)
1124  {
1125  item = GetCtrl(level)->GetNextItem(item,
1126  wxLIST_NEXT_ABOVE);
1127  }
1128  else
1129  {
1130  item = GetCtrl(level)->GetNextItem(item,
1131  wxLIST_NEXT_BELOW);
1132  }
1133  if ( item == -1 || item==0 )
1134  {
1135  break;
1136  }
1137  if(GetCtrl(level)->GetItemState(item, wxLIST_STATE_SELECTED)==0 )
1138  {
1139 
1140  adr = (long)GetCtrl(level)->GetItemData(item);
1141  nod = ((ItemData*)adr)->node;
1142  nodes.push_back(nod);
1143  }
1144  }
1145 
1146  }

Here is the call graph for this function:

int creaImageIO::WxTreeView::GetNumberOfLevels ( )
inlineprivatevirtual

Returns the maximum number of levels.

Reimplemented from creaImageIO::TreeView.

Definition at line 168 of file creaImageIOWxTreeView.h.

References mLevelList.

168 { return (int)mLevelList.size(); }
const std::vector< tree::Node * > & creaImageIO::WxTreeView::GetSelected ( int  level)
privatevirtual

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

Reimplemented from creaImageIO::TreeView.

Definition at line 304 of file creaImageIOWxTreeView.cpp.

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

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

305  {
306  std::vector<tree::Node*>& sel = mLevelList[0].Selected;
307  // if (GetSelectedUpToDate(level))
308  int l = level - 1;
309  // the selection of upper level
310  if(mLevelList.size() == level -1)
311  sel = mLevelList.back().Selected;
312  else
313  sel= mLevelList[l].Selected;
314  if (sel.size() > 0)
315  {
316  sel.clear();
317  }
318  if (level == 1)
319  {
320  sel.push_back(GetTreeHandler()->GetTree().GetTree());
321  }
322  else if (level < mLevelList.size()+2 )
323  {
324  long item = -1;
325  for ( ;; )
326  {
327  item = GetCtrl(l-1)->GetNextItem(item,
328  wxLIST_NEXT_ALL,
329  wxLIST_STATE_SELECTED);
330  if ( item == -1 )
331  break;
332  long adr = (long)GetCtrl(l-1)->GetItemData(item);
333  tree::Node* n = ((ItemData*)adr)->node;
334  /* FCY 18-04-2011: don't understand the real purpose of these lines,
335  if uncomment add last frame in first place
336  if(mLastSelected==item)
337  {
338  std::vector<tree::Node*>::iterator it;
339  it = sel.begin();
340  it = sel.insert ( it , n );
341  }
342  else
343  {*/
344 
345  sel.push_back(n);
346  //}
347 
348  }
349  /*int n = GetCtrl(l-1)->GetItemCount();
350  for (int i = 0; i<n; i++)
351  {
352  std::cout<<GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED)<<std::endl;
353  if ( GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED))
354  {
355  long adr = GetCtrl(l-1)->GetItemData(i);
356  tree::Node* n = ((ItemData*)adr)->node;
357  if(mLastSelected==i)
358  {
359  std::vector<tree::Node*>::iterator it;
360  it = sel.begin();
361  it = sel.insert ( it , n );
362  }
363  else
364  {
365 
366  sel.push_back(n);
367  }
368  }
369  }*/
370  }
371  else
372  {
373  // NOTHING
374  }
375 
376  // return mLevelList[level-1].Selected;
377  return sel;
378  }

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)
privatevirtual

Gets selected filenames.

Reimplemented from creaImageIO::TreeView.

Definition at line 1164 of file creaImageIOWxTreeView.cpp.

References GetSelected(), and mLevelList.

1165  {
1166  int level= (int)mLevelList.size();
1167  const std::vector<tree::Node*>& sel=GetSelected(level+1);
1168  std::vector<tree::Node*>::const_iterator i;
1169 
1170  for (i=sel.begin(); i!=sel.end(); ++i)
1171  {
1172  std::string filename=(*i)->GetAttribute("FullFileName");
1173  s.push_back(filename);
1174  }
1175  }

Here is the call graph for this function:

bool creaImageIO::WxTreeView::GetSelectedUpToDate ( int  l)
inlineprivate

Get the bool SelectedUpToDate for level l.

Definition at line 175 of file creaImageIOWxTreeView.h.

References mLevelList.

175 { return mLevelList[l].SelectedUpToDate; }
wxSplitterWindow* creaImageIO::WxTreeView::GetSplitter ( int  l)
inlineprivate

return the wxSplitter of one level

Definition at line 166 of file creaImageIOWxTreeView.h.

References mLevelList.

Referenced by UpdateLevel().

166 { return mLevelList[l].wxSplitter; }

Here is the caller graph for this function:

TreeHandler* creaImageIO::TreeView::GetTreeHandler ( )
inlineprotectedinherited
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 1274 of file creaImageIOWxTreeView.cpp.

References mLevelList.

Referenced by CreateCtrl(), and GetAttributes().

1275  {
1276  std::vector<std::string> ns=mLevelList[level-1].notShownAtts;
1277  std::vector<std::string>::iterator it;
1278  bool found=false;
1279  for(it=ns.begin();it!=ns.end()&&!found;++it)
1280  {
1281  if(val.compare(*it)==0)
1282  {
1283  found=true;
1284  }
1285  }
1286  return !found;
1287  }

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 846 of file creaImageIOWxTreeView.cpp.

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

Referenced by WxTreeView().

847  {
848  wxBusyCursor busy;
849  std::vector<std::string> filesname;
850  std::vector<tree::Node*> nodes;
851  nodes.push_back(((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node);
852  if(nodes.size() != 0)
853  {
854  GetFilenamesAsString(nodes,filesname);
855  GetGimmickView()->Anonymize(filesname,0);
856  }
857 
858  }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Callback for column click.

Definition at line 723 of file creaImageIOWxTreeView.cpp.

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

724  {
725  mColumnSelected = event.m_col;
726  wxPoint clientpt;
727  clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
728  clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
729  senderCtrl = event.GetEventObject();
730  unsigned int level = 0;
731  for (level = 0; level<mLevelList.size(); ++level)
732  {
733  if ( GetCtrl(level) == senderCtrl ) break;
734  }
735  PopupMenu(menu, clientpt);
736 
737  }

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 947 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().

948  {
949  if(mLastRightSelected!=-1)
950  {
951  tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
952  tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
953  std::vector<std::string> names;
954  std::vector<std::string> keys;
957  ++a)
958  {
959  if(a->GetKey()=="FullFileName")
960  {
961  GetGimmickView()->DumpTags(node->GetAttribute("FullFileName"));
962  return;
963  }
964  }
965  }
966  }

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 908 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().

909  {
910  if(mLastRightSelected!=-1)
911  {
912  tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
913  tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
914  std::vector<std::string> names;
915  std::vector<std::string> keys;
918  ++a)
919  {
921  {
922  names.push_back(a->GetName());
923  keys.push_back(a->GetKey());
924  }
925  }
926  GetGimmickView()->CreateEditFieldsDialog(node,names,keys);
927  }
928  }

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 934 of file creaImageIOWxTreeView.cpp.

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

Referenced by WxTreeView().

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

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 616 of file creaImageIOWxTreeView.cpp.

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

617  {
619  GetTreeHandler()->GetTree().GetLabel()
620  <<" WxTreeView::OnItemDeselected"<<std::endl);
621  // retrieve the level
622  wxObject* obj = event.GetEventObject();
623  unsigned int level = 0;
624  for (level = 0; level<mLevelList.size(); ++level)
625  {
626  if ( GetCtrl(level) == obj ) break;
627  }
628  SetSelectedUpToDate(level,false);
629  // to allow a first selection in images TreeView
630  if (level==mLevelList.size()-1)
631  OnItemSelected(event);
632  }

Here is the call graph for this function:

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

Displays a menu for items.

Definition at line 742 of file creaImageIOWxTreeView.cpp.

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

743  {
744  wxPoint clientpt;
745  clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
746  clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
747  senderCtrl = event.GetEventObject();
748  unsigned int level = 0;
749  for (level = 0; level<mLevelList.size(); ++level)
750  {
751  if ( GetCtrl(level) == senderCtrl ) break;
752  }
753  long* ptr=0;
754  int flag;
755  mLastRightLevel=level;
756  mLastRightSelected=GetCtrl(level)->HitTest(wxPoint(0,clientpt.y-8),flag,ptr);
757  PopupMenu(menuItem, clientpt);
758 
759  }

Here is the call graph for this function:

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

Callback for item selection.

Definition at line 636 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().

637  {
638 
640  GetTreeHandler()->GetTree().GetLabel()
641  <<" WxTreeView::OnItemSelected"<<std::endl);
642 
644  {
646  " mIgnoreSelectedChanged true: returning"
647  <<std::endl);
648  return;
649  }
650 
651 
652 
653  wxListItem info;
654  info.m_itemId = event.m_itemIndex;
655  mLastSelected = event.m_itemIndex;
656  // retrieve the level
657  wxObject* obj = event.GetEventObject();
658  unsigned int level = 0;
659  for (level = 0; level<mLevelList.size(); ++level)
660  {
661  if ( GetCtrl(level) == obj ) break;
662  }
663  mLastLevel=level;
665  " Level "<<level+1
666  <<std::endl);
667 
668  // Update the children level (if selection not at last level)
669  if (level<mLevelList.size()-1)
670  {
671 
672  UpdateLevel( level + 2 );
673  // Reset the viewer setting the default image
675  }
676  // Select all images if the selection is at series level
677  if (level==mLevelList.size()-2)
678  SelectAll(level+1);
679  // Validate selected images if the selection is at image level
680  if (level==(mLevelList.size()-1)) //&&mProcess)
681  {
682  if(event.GetEventType()==wxEVT_COMMAND_LIST_ITEM_SELECTED)
683  {
684  ValidateSelectedImages (true);
685  }
686  else
687  {
688  ValidateSelectedImages (false);
689  }
690  }
691 
692  }

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 1149 of file creaImageIOWxTreeView.cpp.

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

1150  {
1151  if(event.GetKeyCode() == WXK_DELETE)
1152  {
1153  wxBusyCursor busy;
1154  std::string temp = "0";
1155  RemoveSelected(temp);
1157  }
1158 
1159  }

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 861 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().

862  {
863  wxBusyCursor busy;
864 
865  unsigned int tempLevel = mLastLevel;
866  mLastLevel+=1;
867  const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
868 
869  if(sel.size() != 0)
870  {
871  bool copy=false;
872  std::stringstream out;
873  std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
874  out<<"Copy ";
875  out<<sel.size();
876  if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
877  {
878  out<<" "<<levelName;
879  out<<"s to .creaImageIO?";
880  }
881  else
882  {
883  out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<" to .creaImageIO?";
884  }
885  if (wxMessageBox(crea::std2wx(out.str()),
886  _T("Remove Files"),
887  wxYES_NO,this ) == wxYES)
888  {
889  copy = true;
890  }
891  if(copy)
892  {
893  std::vector<std::string> s;
894  GetFilenamesAsString(sel,s);
896  }
897  }
898  else
899  {
900  mLastLevel = tempLevel;
901  }
902 
903 
904  }

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 764 of file creaImageIOWxTreeView.cpp.

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

Referenced by WxTreeView().

765  {
766  wxBusyCursor busy;
768  "WxTreeView::OnEndLabelEdit"
769  <<std::endl);
770  unsigned int level = 0;
771  for (level = 0; level<mLevelList.size(); ++level)
772  {
773  if ( GetCtrl(level) == senderCtrl ) break;
774  }
775  std::string filter = crea::wx2std(wxGetTextFromUser(_T("Enter the filter to apply"), _T("Filter On Column")));
776 
777  std::string att;
778 
779  long it = -1;
780  UpdateLevel(level+1);
781 
782  std::vector<long> items;
783  bool in=false;
784  int del=0;
785  for ( ;; )
786  {
787  it = GetCtrl(level)->GetNextItem(it,
788  wxLIST_NEXT_ALL);
789  if ( it == -1 )
790  break;
791 
792  long adr = (long)GetCtrl(level)->GetItemData(it);
793  tree::Node* nod = ((ItemData*)adr)->node;
794  att=(*nod).GetAttribute(mLevelList[level].key[mColumnSelected]);
795 
796 
797  if(att.find(filter)>900)
798  {
799 
800  if(!in)
801  {
802  in=true;
803  }
804  else
805  {
806  del+=1;
807  }
808 
809  items.push_back(it-del);
810  }
811 
812  }
813  std::vector<long>::iterator iter;
814  for(iter=items.begin();iter!=items.end();++iter)
815  {
816  GetCtrl(level)->DeleteItem(*iter);
817  }
819  }

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 823 of file creaImageIOWxTreeView.cpp.

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

Referenced by WxTreeView().

824  {
825  wxBusyCursor busy;
826  unsigned int level = 0;
827  for (level = 0; level<mLevelList.size(); ++level)
828  {
829  if ( GetCtrl(level) == senderCtrl ) break;
830  }
831  mLevelList[level].SortColumn = mColumnSelected;
832 
833  if(event.GetId()==mAscendingID)
834  {
835  mLevelList[level].SortAscending = true;
836  }
837  else if(event.GetId()==mDescendingID)
838  {
839  mLevelList[level].SortAscending = false;
840  }
841 
842  SortLevel(level);
843  }

Here is the call graph for this function:

Here is the caller graph for this function:

void creaImageIO::WxTreeView::RecursiveUpdateLevel ( int  level)
privatevirtual

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 498 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().

499  {
501  GetTreeHandler()->GetTree().GetLabel()
502  <<"WxTreeView::RecursiveUpdateLevel(level "
503  <<level
504  <<")"<<std::endl);
505 
506 
507  const std::vector<tree::Node*>& sel(GetSelected(level));
508 
509  int l = level - 1;
510 
511  // to speed up inserting we hide the control temporarily
512  GetCtrl(l)->Hide();
513  GetCtrl(l)->DeleteAllItems();
514 
515  std::vector<tree::Node*>::const_iterator i;
516 
517  for (i=sel.begin(); i!=sel.end(); ++i)
518  {
520  "adding children of '"
521  <<(*i)->GetLabel()
522  <<"'"
523  <<std::endl);
524  int _id=0;
525 
526  //Adds items and sets their attributes
527 
528  GetTreeHandler()->LoadChildren(*i,1);
529  tree::Node::ChildrenListType::reverse_iterator j;
530  for (j = (*i)->GetChildrenList().rbegin();
531  j!= (*i)->GetChildrenList().rend();
532  ++j)
533  {
535  "adding children "
536  <<(*j)->GetLabel()
537  <<"'"
538  <<std::endl);
539 
540  wxListItem item;
541  item.SetMask(wxLIST_MASK_STATE |
542  wxLIST_MASK_TEXT |
543  // wxLIST_MASK_IMAGE |
544  wxLIST_MASK_DATA |
545  // wxLIST_MASK_WIDTH |
546  wxLIST_MASK_FORMAT
547  );
548 
549  ItemData* data = new ItemData();
550  data->node = *j;
551  data->id = _id;
552 
553  item.SetId(_id);
554  item.SetData(data);
555 
556  _id++;
557  GetCtrl(l)->InsertItem(item);
558 
559  //Setting attributes
560  for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)
561  {
562  std::string val;
563  // Temporary correction : it works but no explanation about the problem FCY
564 
565  if(k==0 && level <3)
566  {
567  val = (*j)->GetAttribute("NumberOfChildren");
568  }
569  else
570  val = (*j)->GetAttribute(mLevelList[l].key[k]);
571  if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isDateEntry()) // Date
572  {
573  // std::cout << "["<<val<< "]" << std::endl;
574  std::string valtmp(val);
575  try
576  {
577  boost::gregorian::date d1(boost::gregorian::from_undelimited_string(val));
578  val = to_iso_extended_string(d1);
579  }
580  catch (...)
581  {
582  val = valtmp;
583  }
584  // std::cout << "["<<val<< "]" << std::endl;
585  }
586  else if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isTimeEntry()) // Time
587  {
588  if ((val.size()>6) &&
589  (val != "" || val != " "))
590  val = val.substr(0,2) + " : "
591  + val.substr(2,2) + " : "
592  + val.substr(4,2);
593  }
594  else
595  {
596  if (val.size()==0) val = "?";
597  }
598  if (val.size()==0) val = "X";
599  item.SetText( crea::std2wx(val));
600  item.SetColumn(k);
601 
602  GetCtrl(l)->SetItem(item);
603  }
604  item.Clear();
605 
606  }
607  }
608 
609  SortLevel(l);
610  GetCtrl(l)->Show();
611  }

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 385 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().

386  {
387  bool erase=false;
388 
389  unsigned int tempLevel = mLastLevel;
390  mLastLevel+=1;
391  const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
392  // if no selection, no remove action.
393  if(sel.size() != 0)
394  {
395 
396  std::stringstream out;
397  std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
398  out<<"Delete ";
399  out<<sel.size();
400  if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
401  {
402  out<<" "<<levelName;
403  out<<"s?";
404  }
405  else
406  {
408  }
409  if (wxMessageBox(crea::std2wx(out.str()),
410  _T("Remove Files"),
411  wxYES_NO,this ) == wxYES)
412  {
413  erase = true;
414  }
415  if(erase)
416  {
418  bool needRefresh=false;
419  std::vector<tree::Node*>::const_iterator i;
420  for (i=sel.begin(); i!=sel.end(); ++i)
421  {
422  GimmickMessage(1,
423  "deleting '"
424  <<(*i)->GetLabel()
425  <<"'"<<mLastLevel
426  <<std::endl);
427  if((*i)->GetParent()->GetNumberOfChildren()<2)
428  {
429  needRefresh=true;
430  }
431  //tree::Node* n = new (tree::Node*)(*i);
432  GetTreeHandler()->LoadChildren((*i),4);
434  GetTreeHandler()->Remove(*i);
435  }
436 
437  if(needRefresh && mLastLevel>1)
438  {
440  }
441  else if(mLastLevel>1)
442  {
444  }
445  else
446  {
448  }
449  }
450  }
451  else
452  {
453  // no need to incremente level
454  mLastLevel = tempLevel;
455  }
456 
457  if (erase && mLastLevel == 1 && i_save == "0")
458  {
459 
460  RemoveAlertDlg *dial = new RemoveAlertDlg(this, crea::std2wx("Remove files"), wxSize(370,100));
461  //dial->ShowModal();
462  if (dial->ShowModal() == wxID_OK)
463  {
464  i_save = dial->isChecked() == false? "0" : "1";
465  }
466 
467  }
468  }

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 696 of file creaImageIOWxTreeView.cpp.

References GetCtrl(), and mIgnoreSelectedChanged.

Referenced by OnItemSelected().

697  {
698  long item = -1;
699  // int level=mLevelList.size()-1;
700  for ( ;; )
701  {
702  item = GetCtrl(level)->GetNextItem(item,
703  wxLIST_NEXT_ALL);
704  if ( item == -1 )
705  break;
706 
707  if(item==(GetCtrl(level)->GetItemCount()-1))
708  {
709  mIgnoreSelectedChanged = false;//mProcess=true;
710  }
711  else
712  {
713  mIgnoreSelectedChanged = true;// mProcess=false;
714  }
715  GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE
716  | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
717  }
718  }

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 1220 of file creaImageIOWxTreeView.cpp.

References mLevelList.

1221  {
1222  mLevelList[nlevel].notShownAtts=notShown;
1223  }
void creaImageIO::WxTreeView::SetSelectedUpToDate ( int  l,
bool  v 
)
inlineprivate

Set the bool SelectedUpToDate for level l.

Definition at line 173 of file creaImageIOWxTreeView.h.

References mLevelList.

Referenced by OnItemDeSelected().

173 { 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 972 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().

973  {
975  "WxTreeView::SortLevel("
976  <<level<<")"
977  <<std::endl);
978  //Obtain the column name and the level that needs to be organized
979 
980  // int l = level - 1;
981  //Sets the data for the items to be sorted
982  // std::string att;
983  unsigned int ty=0;
984  int nbselected = 0;
985  int n = GetCtrl(level)->GetItemCount();
986  for (int i = 0; i < n; i++)
987  {
988 
989  //Gets current item data
990  ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
991 
992  //Extracts the node and the type of attribute
993  tree::Node* nod = data->node;
994  if(i==0)
995  {
996  (*nod).GetAttributeDescriptor
997  (mLevelList[level].key[mLevelList[level].SortColumn])
998  .DecodeType( ty );
999  }
1000  //Obtains the organizing attribute
1001  data->attr = & (*nod).GetAttribute
1002  (mLevelList[level].key[mLevelList[level].SortColumn]);
1003  //Selected ?
1004  data->selected = false;
1005  if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
1006  {
1007  data->selected = true;
1008  nbselected++;
1009  }
1010 
1011  }
1013  "WxTreeView::OnSort : "
1014  <<nbselected<<" selected before sorting"
1015  <<std::endl);
1016 
1017  mIgnoreSelectedChanged = true;
1018  //
1019  if (mLevelList[level].SortAscending)
1020  {
1021 
1022  if(ty==1)
1023  {
1024  GetCtrl(level)->SortItems(CompareFunctionInts, 0);
1025  }
1026  else
1027  {
1028  GetCtrl(level)->SortItems(CompareFunctionStrings, 0);
1029  }
1030 
1031  }
1032  else
1033  {
1034  if(ty==1)
1035  {
1036  GetCtrl(level)->SortItems(CompareFunctionInts, 1);
1037  }
1038  else
1039  {
1040  GetCtrl(level)->SortItems(CompareFunctionStrings, 1);
1041  }
1042  }
1043 
1044 
1045  // Reselects the unselected
1046  n = GetCtrl(level)->GetItemCount();
1047  int after = 0;
1048  for (int i = 0; i < n; i++)
1049  {
1050 
1051  //Gets current item data
1052  ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
1053 
1054  // long item = -1;
1055  // for ( ;; )
1056  // {
1057  // item = GetCtrl(level)->GetNextItem(item,wxLIST_NEXT_ALL);
1058  // if ( item == -1 ) break;
1059  //Gets current item data
1060  // ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(item);
1061  // was selected ?
1062 
1063  if (data->selected)
1064  {
1065  nbselected--;
1066  if (nbselected==0)
1067  {
1068  // if it is the last one we must process the selection
1069  mIgnoreSelectedChanged = false;
1070  }
1071  GetCtrl(level)->SetItemState(i,
1072  wxLIST_STATE_SELECTED,
1073  wxLIST_MASK_STATE
1074  | wxLIST_MASK_TEXT
1075  | wxLIST_MASK_IMAGE
1076  | wxLIST_MASK_DATA
1077  | wxLIST_MASK_WIDTH
1078  | wxLIST_MASK_FORMAT);
1079  }
1080  if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
1081  {
1082  after++;
1083  }
1084 
1085 
1086  }
1087  mIgnoreSelectedChanged = false;
1089  "WxTreeView::SortLevel : "
1090  <<after<<" selected after sorting"
1091  <<std::endl);
1092 
1093  }

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 473 of file creaImageIOWxTreeView.cpp.

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

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

474  {
476  GetTreeHandler()->GetTree().GetLabel()
477  <<"WxTreeView::UpdateLevel(level "
478  <<level
479  <<")"
480  <<std::endl);
481 
482  wxBusyCursor busy;
483  RecursiveUpdateLevel(level);
484  int i;
485  for (i=0; i<level-1; i++)
486  {
487  if (!GetSplitter(i)->IsSplit())
488  GetSplitter(i)->SplitVertically( GetCtrl(i), GetSplitter(i+1),
489  100 );
490  }
491  if (GetSplitter(i)->IsSplit()) GetSplitter(i)->Unsplit();
492 
493  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void creaImageIO::TreeView::ValidateSelectedImages ( )
inlinevirtualinherited

Validates the selected images.

Definition at line 68 of file creaImageIOTreeView.h.

References GimmickError.

Referenced by OnItemSelected().

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

Here is the caller graph for this function:

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

Validates the selected images.

Definition at line 1098 of file creaImageIOWxTreeView.cpp.

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

1099  {
1101  "WxTreeView::ValidateSelectedImages"
1102  <<std::endl);
1103  const std::vector<tree::Node*>& sel(GetSelected((int)mLevelList.size()+1));
1105  isSelection,(mLastSelected-1),
1107 
1108  }

Here is the call graph for this function:

Member Data Documentation

int creaImageIO::WxTreeView::mAnonymizingID
private

Definition at line 223 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

int creaImageIO::WxTreeView::mAscendingID
private

Definition at line 216 of file creaImageIOWxTreeView.h.

Referenced by OnPopupSort(), and WxTreeView().

ColorMap creaImageIO::WxTreeView::mColorMap
private

Definition at line 209 of file creaImageIOWxTreeView.h.

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

Initial color palette.

Definition at line 211 of file creaImageIOWxTreeView.h.

int creaImageIO::WxTreeView::mColumnSelected
private

Currently Selected Column.

Definition at line 197 of file creaImageIOWxTreeView.h.

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

int creaImageIO::WxTreeView::mDescendingID
private

Definition at line 217 of file creaImageIOWxTreeView.h.

Referenced by OnPopupSort(), and WxTreeView().

int creaImageIO::WxTreeView::mDumpID
private

Definition at line 226 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

int creaImageIO::WxTreeView::mEditFieldID
private

Definition at line 225 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

wxMenu* creaImageIO::WxTreeView::menu
private

Definition at line 213 of file creaImageIOWxTreeView.h.

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

wxMenu* creaImageIO::WxTreeView::menuItem
private

Definition at line 221 of file creaImageIOWxTreeView.h.

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

int creaImageIO::WxTreeView::mExport2StorageID
private

Definition at line 228 of file creaImageIOWxTreeView.h.

int creaImageIO::WxTreeView::mExportID
private

Definition at line 227 of file creaImageIOWxTreeView.h.

int creaImageIO::WxTreeView::mFilterID
private

Definition at line 218 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

bool creaImageIO::WxTreeView::mIgnoreSelectedChanged
private
unsigned int creaImageIO::WxTreeView::mLastLevel
private
int creaImageIO::WxTreeView::mLastRightLevel
private

The last selected level (by right click)

Definition at line 205 of file creaImageIOWxTreeView.h.

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

long creaImageIO::WxTreeView::mLastRightSelected
private

The last selected item on the list (right click)

Definition at line 202 of file creaImageIOWxTreeView.h.

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

long creaImageIO::WxTreeView::mLastSelected
private

The last selected item on the list (left click)

Definition at line 199 of file creaImageIOWxTreeView.h.

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

int creaImageIO::WxTreeView::mLocalCopyID
private

Definition at line 224 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 138 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().

wxObject* creaImageIO::WxTreeView::senderCtrl
private

Definition at line 215 of file creaImageIOWxTreeView.h.

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

wxMenu* creaImageIO::WxTreeView::subExportMenu
private

Definition at line 222 of file creaImageIOWxTreeView.h.

Referenced by WxTreeView().


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