Main application class.
More...
Main application class.
Definition at line 237 of file TreeViewDragDrop.C.
◆ TreeViewDragDrop()
TreeViewDragDrop::TreeViewDragDrop |
( |
const WEnvironment & |
env | ) |
|
|
inline |
◆ ~TreeViewDragDrop()
virtual TreeViewDragDrop::~TreeViewDragDrop |
( |
| ) |
|
|
inlinevirtual |
◆ aboutDisplay()
WWidget* TreeViewDragDrop::aboutDisplay |
( |
| ) |
|
|
inlineprivate |
Creates the hints text.
Definition at line 457 of file TreeViewDragDrop.C.
458 WText *result =
new WText(WString::tr(
"about-text"));
459 result->setStyleClass(
"about");
◆ convertToDate()
void TreeViewDragDrop::convertToDate |
( |
WStandardItem * |
item | ) |
|
|
inlineprivate |
Convert a string to a date.
Definition at line 588 of file TreeViewDragDrop.C.
590 item->setData(boost::any(d), DisplayRole);
◆ convertToNumber()
void TreeViewDragDrop::convertToNumber |
( |
WStandardItem * |
item | ) |
|
|
inlineprivate |
Convert a string to a number.
Definition at line 595 of file TreeViewDragDrop.C.
596 int i = boost::lexical_cast<int>(item->text());
597 item->setData(boost::any(i), EditRole);
◆ createFolderItem()
WStandardItem* TreeViewDragDrop::createFolderItem |
( |
const WString & |
location, |
|
|
const std::string & |
folderId = std::string() |
|
) |
| |
|
inlineprivate |
Create a folder item.
Configures flags for drag and drop support.
Definition at line 632 of file TreeViewDragDrop.C.
635 WStandardItem *result =
new WStandardItem(location);
637 if (!folderId.empty()) {
638 result->setData(boost::any(folderId));
639 result->setFlags(result->flags() | ItemIsDropEnabled);
642 result->setFlags(result->flags().clear(ItemIsSelectable));
644 result->setIcon(
"icons/folder.gif");
◆ createTitle()
WText* TreeViewDragDrop::createTitle |
( |
const WString & |
title | ) |
|
|
inlineprivate |
Creates a title widget.
Definition at line 347 of file TreeViewDragDrop.C.
348 WText *result =
new WText(title);
349 result->setInline(
false);
350 result->setStyleClass(
"title");
◆ createUI()
void TreeViewDragDrop::createUI |
( |
| ) |
|
|
inlineprivate |
Setup the user interface.
Definition at line 311 of file TreeViewDragDrop.C.
312 WContainerWidget *w = root();
313 w->setStyleClass(
"maindiv");
318 WGridLayout *layout =
new WGridLayout();
322 layout->setColumnResizable(0);
327 WVBoxLayout *vbox =
new WVBoxLayout();
330 vbox->setResizable(0);
332 layout->addLayout(vbox, 1, 1);
339 layout->setRowStretch(1, 1);
340 layout->setColumnStretch(1, 1);
342 w->setLayout(layout);
◆ dialogDone()
void TreeViewDragDrop::dialogDone |
( |
| ) |
|
|
inlineprivate |
◆ editFile()
void TreeViewDragDrop::editFile |
( |
const WModelIndex & |
item | ) |
|
|
inlineprivate |
◆ fileView()
WTableView* TreeViewDragDrop::fileView |
( |
| ) |
|
|
inlineprivate |
Creates the file table view (a WTableView)
Definition at line 386 of file TreeViewDragDrop.C.
387 WTableView *tableView =
new WTableView();
389 tableView->setAlternatingRowColors(
true);
392 tableView->setSelectionMode(ExtendedSelection);
393 tableView->setDragEnabled(
true);
395 tableView->setColumnWidth(0, 100);
396 tableView->setColumnWidth(1, 150);
397 tableView->setColumnWidth(2, 100);
398 tableView->setColumnWidth(3, 60);
399 tableView->setColumnWidth(4, 100);
400 tableView->setColumnWidth(5, 100);
402 WItemDelegate *delegate =
new WItemDelegate(
this);
404 tableView->setItemDelegateForColumn(4, delegate);
405 tableView->setItemDelegateForColumn(5, delegate);
407 tableView->setColumnAlignment(3, AlignRight);
408 tableView->setColumnAlignment(4, AlignRight);
409 tableView->setColumnAlignment(5, AlignRight);
411 tableView->sortByColumn(1, AscendingOrder);
◆ folderChanged()
void TreeViewDragDrop::folderChanged |
( |
| ) |
|
|
inlineprivate |
Change the filter on the file view when the selected folder changes.
Definition at line 466 of file TreeViewDragDrop.C.
470 WModelIndex selected = *
folderView_->selectedIndexes().begin();
471 boost::any d = selected.data(UserRole);
473 std::string folder = boost::any_cast<std::string>(d);
◆ folderView()
WTreeView* TreeViewDragDrop::folderView |
( |
| ) |
|
|
inlineprivate |
Creates the folder WTreeView.
Definition at line 357 of file TreeViewDragDrop.C.
367 treeView->setAttributeValue
369 "event.cancelBubble = true; event.returnValue = false; return false;");
371 treeView->resize(200, WLength::Auto);
372 treeView->setSelectionMode(SingleSelection);
373 treeView->expandToDepth(1);
374 treeView->selectionChanged()
◆ pieChart()
WWidget* TreeViewDragDrop::pieChart |
( |
| ) |
|
|
inlineprivate |
Creates the chart.
Definition at line 428 of file TreeViewDragDrop.C.
429 using namespace Chart;
431 WPieChart *chart =
new WPieChart();
434 chart->setTitle(
"File sizes");
436 chart->setLabelsColumn(1);
437 chart->setDataColumn(3);
439 chart->setPerspectiveEnabled(
true, 0.2);
440 chart->setDisplayLabels(Outside | TextLabel);
442 if (!WApplication::instance()->environment().ajax()) {
443 chart->resize(500, 200);
444 chart->setMargin(WLength::Auto, Left | Right);
445 WContainerWidget *w =
new WContainerWidget();
447 w->setStyleClass(
"about");
450 chart->setStyleClass(
"about");
◆ populateFiles()
void TreeViewDragDrop::populateFiles |
( |
| ) |
|
|
inlineprivate |
Populate the files model.
Data (and headers) is read from the CSV file data/files.csv. We add icons to the first column, resolve the folder id to the actual folder name, and configure item flags, and parse date values.
Definition at line 560 of file TreeViewDragDrop.C.
561 fileModel_->invisibleRootItem()->setRowCount(0);
563 std::ifstream f((appRoot() +
"data/files.csv").c_str());
566 throw std::runtime_error(
"Could not read: data/files.csv");
570 for (
int i = 0; i <
fileModel_->rowCount(); ++i) {
572 item->setFlags(item->flags() | ItemIsDragEnabled);
573 item->setIcon(
"icons/file.gif");
575 std::string folderId = item->text().toUTF8();
577 item->setData(boost::any(folderId), UserRole);
◆ populateFolders()
void TreeViewDragDrop::populateFolders |
( |
| ) |
|
|
inlineprivate |
Populate the folders model.
Definition at line 602 of file TreeViewDragDrop.C.
603 WStandardItem *level1, *level2;
621 (WString::fromUTF8(
"Frankfürt")));
625 boost::any(std::string(
"SandBox")));
◆ popupAction()
void TreeViewDragDrop::popupAction |
( |
| ) |
|
|
inlineprivate |
Process the result of the popup menu.
Definition at line 527 of file TreeViewDragDrop.C.
533 WString text =
popup_->result()->text();
537 +
"' is not implemented.", NoIcon, Ok);
◆ showPopup()
void TreeViewDragDrop::showPopup |
( |
const WModelIndex & |
item, |
|
|
const WMouseEvent & |
event |
|
) |
| |
|
inlineprivate |
Show a popup for a folder item.
Definition at line 485 of file TreeViewDragDrop.C.
486 if (event.button() == WMouseEvent::RightButton) {
492 popup_ =
new WPopupMenu();
493 popup_->addItem(
"icons/folder_new.gif",
"Create a New Folder");
494 popup_->addItem(
"Rename this Folder")->setCheckable(
true);
495 popup_->addItem(
"Delete this Folder");
497 popup_->addItem(
"Folder Details");
499 popup_->addItem(
"Application Inventory");
500 popup_->addItem(
"Hardware Inventory");
503 WPopupMenu *subMenu =
new WPopupMenu();
504 subMenu->addItem(
"Sub Item 1");
505 subMenu->addItem(
"Sub Item 2");
506 popup_->addMenu(
"File Deployments", subMenu);
◆ fileFilterModel_
WSortFilterProxyModel* TreeViewDragDrop::fileFilterModel_ |
|
private |
◆ fileModel_
WStandardItemModel* TreeViewDragDrop::fileModel_ |
|
private |
◆ fileView_
WTableView* TreeViewDragDrop::fileView_ |
|
private |
◆ folderModel_
WStandardItemModel* TreeViewDragDrop::folderModel_ |
|
private |
◆ folderNameMap_
std::map<std::string, WString> TreeViewDragDrop::folderNameMap_ |
|
private |
◆ folderView_
WTreeView* TreeViewDragDrop::folderView_ |
|
private |
◆ popup_
WPopupMenu* TreeViewDragDrop::popup_ |
|
private |
◆ popupActionBox_
WMessageBox* TreeViewDragDrop::popupActionBox_ |
|
private |
The documentation for this class was generated from the following file:
A dialog for editing a 'file'.
void populateFolders()
Populate the folders model.
WStandardItem * createFolderItem(const WString &location, const std::string &folderId=std::string())
Create a folder item.
void editFile(const WModelIndex &item)
Edit a particular row.
WPopupMenu * popup_
Popup menu on the folder view.
void readFromCsv(std::istream &f, Wt::WAbstractItemModel *model, int numRows, bool firstLineIsHeaders)
Utility function that reads a model from a CSV file.
void popupAction()
Process the result of the popup menu.
void showPopup(const WModelIndex &item, const WMouseEvent &event)
Show a popup for a folder item.
WTableView * fileView_
The file view.
WTreeView * folderView()
Creates the folder WTreeView.
WText * createTitle(const WString &title)
Creates a title widget.
void folderChanged()
Change the filter on the file view when the selected folder changes.
void convertToNumber(WStandardItem *item)
Convert a string to a number.
WStandardItemModel * folderModel_
The folder model (used by folderView_)
void convertToDate(WStandardItem *item)
Convert a string to a date.
A specialized standard item model which report a specific drag and drop mime type.
WStandardItemModel * fileModel_
The file model (used by fileView_)
WMessageBox * popupActionBox_
Message box to confirm the poup menu action.
void populateFiles()
Populate the files model.
static WString dateEditFormat
Date edit format.
static WString dateDisplayFormat
Date display format.
WTableView * fileView()
Creates the file table view (a WTableView)
WWidget * aboutDisplay()
Creates the hints text.
std::map< std::string, WString > folderNameMap_
Maps folder id's to folder descriptions.
void createUI()
Setup the user interface.
WWidget * pieChart()
Creates the chart.
void dialogDone()
Process the result of the message box.
WSortFilterProxyModel * fileFilterModel_
The sort filter proxy model that adapts fileModel_.
WTreeView * folderView_
The folder view.
A specialized treeview that supports a custom drop event.
Generated on Mon Sep 5 2022 for the
C++ Web Toolkit (Wt) by
1.8.17