00001 // This may look like C code, but it's really -*- C++ -*- 00002 /* 00003 * Copyright (C) 2009 Emweb bvba 00004 * 00005 * See the LICENSE file for terms of use. 00006 */ 00007 00008 #include <iostream> 00009 #include <stdlib.h> 00010 00011 #include <Wt/WContainerWidget> 00012 #include <Wt/WTreeView> 00013 #include <Wt/WStandardItemModel> 00014 00015 #include "FileItem.h" 00016 #include "SourceView.h" 00017 00021 class ExampleSourceViewer: public Wt::WContainerWidget 00022 { 00023 public: 00026 ExampleSourceViewer(const std::string& deployPath, 00027 const std::string& examplesRoot, 00028 const std::string& examplesType); 00029 00030 private: 00031 Wt::WTreeView *exampleView_; 00032 SourceView *sourceView_; 00033 00034 std::string deployPath_; 00035 std::string examplesRoot_; 00036 std::string examplesType_; 00037 00038 Wt::WStandardItemModel *model_; 00039 00040 void cppTraverseDir(Wt::WStandardItem* parent, 00041 const boost::filesystem::path& path); 00042 void javaTraverseDir(Wt::WStandardItem* parent, 00043 const boost::filesystem::path& path); 00044 void javaTraversePackages(Wt::WStandardItem *parent, 00045 const boost::filesystem::path& srcPath, 00046 const std::string packageName); 00047 00050 void showFile(); 00051 00052 void handlePathChange(); 00053 00054 void setExample(const std::string& exampleDir, 00055 const std::string& example); 00056 };