Beispiel #1
0
bool WStandardItemModel::setData(const WModelIndex& index,
				 const boost::any& value, int role)
{
  WStandardItem *item = itemFromIndex(index);

  if (item)
    item->setData(value, role);

  return item;
}
Beispiel #2
0
///
//  Create a file entry
//
WStandardItem* FileBrowser::createEntry(const std::string& baseName, int index)
{
    WStandardItem *result = new WStandardItem(baseName);

    result->setIcon("icons/file.gif");

    // Set the data for the entry index in the user roles
    result->setData(index, UserRole);

    return result;
}
Wt::WStandardItem* VanetSpModelDump::treeNode(list< Node >& nodes)
{
    WStandardItem* result = new WStandardItem(tr("mappropertyeditor.group.spmodeldump"));
    result->setData(VanetSpatialModelDump);
    
    Node extNode("extension");
    Attribute classAttr("class", "de.uni_stuttgart.informatik.canu.spatialmodel.extensions.DumpSpatialModel");
    extNode.addAttribute(classAttr);
    Attribute outAttr("output", output_->valueText().toUTF8());
    extNode.addAttribute(outAttr);
    result->appendRow(propertyRow(string("output="), tr("mappropertyeditor.group.spmodeldump.output").toUTF8(), output_->valueText().toUTF8()));
    
    nodes.push_back(extNode);
    return result;
}
Beispiel #4
0
  /*! \brief Create a folder item.
   *
   * Configures flags for drag and drop support.
   */
  WStandardItem *createFolderItem(const WString& location,
				  const std::string& folderId = std::string())
  {
    WStandardItem *result = new WStandardItem(location);

    if (!folderId.empty()) {
      result->setData(boost::any(folderId));
      result->setFlags(result->flags() | ItemIsDropEnabled);
      folderNameMap_[folderId] = location;
    } else
      result->setFlags(result->flags().clear(ItemIsSelectable));

    result->setIcon("icons/folder.gif");

    return result;
  }
WStandardItem* VanetRoutingProtocolPropertyForm::treeNode(list< Node >& nodes)
{
    WStandardItem* result = new WStandardItem(tr("mappropertyeditor.group.glomosim"));
    result->setData(VanetGlomoSimProperties);

    Node routing("routingprotocol");
    routing.value(routingCombo_->currentText().toUTF8());
    result->appendRow(propertyRow(string("routingprotocol"), tr("mappropertyeditor.group.glomosim.routingprotocol").toUTF8(), routingCombo_->currentText().toUTF8()));
//     Node count("number_of_nodes");
//     count.value(nodesCount_->valueText().toUTF8());
//     result->appendRow(propertyRow(string("number_of_nodes"), tr("mappropertyeditor.group.glomosim.nodesnumber").toUTF8(), nodesCount_->valueText().toUTF8()));
    nodes.push_back(routing);
//     nodes.push_back(count);

    return result;
}
WStandardItem *VanetAreaPropertyForm::treeNode(std::list< Node >& nodes)
{
    WStandardItem *result = new WStandardItem(tr("mappropertyeditor.group.general"));
    result->setData(VanetArea);

    Node xNode = Node("dimx");
    xNode.value(boost::lexical_cast<std::string>(dimx_->value()));
    nodes.push_back(xNode);
    result->appendRow(propertyRow(std::string("dimx"), tr("mappropertyeditor.group.general.dimx").toUTF8(), boost::lexical_cast<std::string>(dimx_->value())));
    Node yNode = Node("dimy");
    yNode.value(boost::lexical_cast<std::string>(dimy_->value()));
    nodes.push_back(yNode);
    result->appendRow(propertyRow(std::string("dimy"), tr("mappropertyeditor.group.general.dimy").toUTF8(), boost::lexical_cast<std::string>(dimy_->value())));

    return result;
}
Beispiel #7
0
  /*! \brief 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.
   */
  void populateFiles() {
    fileModel_->invisibleRootItem()->setRowCount(0);

    std::ifstream f((appRoot() + "data/files.csv").c_str());

    if (!f)
      throw std::runtime_error("Could not read: data/files.csv");

    readFromCsv(f, fileModel_);

    for (int i = 0; i < fileModel_->rowCount(); ++i) {
      WStandardItem *item = fileModel_->item(i, 0);
      item->setFlags(item->flags() | ItemIsDragEnabled);
      item->setIcon("icons/file.gif");

      std::string folderId = item->text().toUTF8();

      item->setData(boost::any(folderId), UserRole);
      item->setText(folderNameMap_[folderId]);

      convertToDate(fileModel_->item(i, 4));
      convertToDate(fileModel_->item(i, 5));
    }
  }
Wt::WStandardItem* VanetNodeForm::treeNode(std::list< Node >& nodes)
{
    
    WStandardItem* result = new WStandardItem(tr("mappropertyeditor.group.node").arg(id_->valueText()));
    result->setData(VanetNode);
    
    Node n("node");
    Attribute idAttr("id", id_->valueText().toUTF8());
    n.addAttribute(idAttr);
    Node posNode("position");
    Attribute rndAttr("random", "true");
    posNode.addAttribute(rndAttr);
    n.addChild(posNode);
    result->appendRow(propertyRow(string("id="), tr("mappropertyeditor.group.node.id").toUTF8(), id_->valueText().toUTF8()));;
    //result->appendRow(form_->treeNode(nodes));
    // Here we place the mobility model on the same level as everything else. Just a quick fix so we can properly persist the model in the PersistenceManager.
    form_->appendPropertyRows(result, nodes);
    Node extNode = nodes.back();
    nodes.pop_back();
    n.addChild(extNode);
    nodes.push_back(n);
    return result;

}