Пример #1
0
Файл: Tabs.C Проект: DTidd/wt
DataConfig::DataConfig(WCartesian3DChart* chart)
  : chart_(chart)
{
  WTemplate *template_ = new WTemplate(Wt::WString::tr("totaldataconfig-template"), this);

  dataselection_ = new DataSelection(chart);
  template_->bindWidget("dataselection", dataselection_);

  WStackedWidget *sw = new WStackedWidget(this);
  sw->addWidget(new WText("Select data to configure it"));
  numgriddatasettings_ = new NumGridDataSettings();
  catgriddatasettings_ = new CatGridDataSettings();
  scatterdatasettings_ = new ScatterDataSettings();
  sw->addWidget(numgriddatasettings_);
  sw->addWidget(catgriddatasettings_);
  sw->addWidget(scatterdatasettings_);
  template_->bindWidget("dataconfig", sw);

  dataselection_->selectionChanged().connect(std::bind([=] (WAbstractDataSeries3D* data) {
	if (dynamic_cast<WAbstractGridData*>(data)) {
	  WAbstractGridData *gridData = dynamic_cast<WAbstractGridData*>(data);
	  if (gridData->type() == BarSeries3D) {
	    catgriddatasettings_->bindDataSet(gridData);
	    sw->setCurrentIndex(2);
	  } else {
	    numgriddatasettings_->bindDataSet(gridData);
	    sw->setCurrentIndex(1);
	  }
	} else if (dynamic_cast<WScatterData*>(data)) {
	  scatterdatasettings_->bindDataSet(dynamic_cast<WScatterData*>(data));
	  sw->setCurrentIndex(3);
	}
      }, std::placeholders::_1));
}
Пример #2
0
Crianca::Crianca(Wt::WContainerWidget *parent):
    WContainerWidget(parent)
{
    WTemplate *view = new WTemplate(WString::tr("App.nova-crianca"));
    WText *title = new WText("Cadastrar nova crianca:");
    view->bindWidget("action", title);

    name = new WLineEdit("Nome: ");
    view->bindWidget("name", name);

    WText *text = new WText("Sexo: ");
    view->bindWidget("sex", text);

    selectSexo = new WButtonGroup();
    WRadioButton *optionSexo = new WRadioButton("masculino");
    selectSexo->addButton(optionSexo, 1);

    optionSexo = new WRadioButton("feminino");
    selectSexo->addButton(optionSexo, 2);

    view->bindWidget("group", selectSexo);

    Wt::WPushButton *cadastrar = new Wt::WPushButton("Cadastrar");
    cadastrar->clicked().connect(this, &Crianca::salvarDadosCrianca);
    view->bindWidget("button", cadastrar);

    WContainerWidget *container = new WContainerWidget();
    WStackedWidget *stacked = new WStackedWidget(container);
    stacked->addWidget(view);
}
Пример #3
0
 bool checkAdministrator()
 {
   if (session_.user() && (session_.user()->role == User::Admin)) return true;
   panel_->show();
   if (!mustBeAdministratorWarning_)
     panel_->addWidget(mustBeAdministratorWarning_ = new WTemplate(tr("blog-mustbeadministrator")));
   panel_->setCurrentWidget(mustBeAdministratorWarning_);
   return false;
 }
Пример #4
0
 bool checkLoggedIn()
 {
   if (session_.user()) return true;
   panel_->show();
   if (!mustLoginWarning_)
     panel_->addWidget(mustLoginWarning_ = new WTemplate(tr("blog-mustlogin")));
   panel_->setCurrentWidget(mustLoginWarning_);
   return false;
 }
Пример #5
0
 void authorPanel() {
    panel_->show();
    if (!authorPanel_)
    {
      authorPanel_ = new WTemplate(tr("blog-author-panel"));
      panel_->addWidget(authorPanel_);
      bindPanelTemplates();
    }
    panel_->setCurrentWidget(authorPanel_);
  }
Пример #6
0
  void editUsers() {
    panel_->show();

    if (!users_) {
      users_ = new EditUsers(session_, basePath_);
      panel_->addWidget(users_);
      bindPanelTemplates();
    }

    panel_->setCurrentWidget(users_);
  }
Пример #7
0
  void editUser(const std::string& ids) {
    if (!checkLoggedIn()) return;
    if (!checkAdministrator()) return;
    dbo::dbo_traits<User>::IdType id;
    try {
      id = boost::lexical_cast<dbo::dbo_traits<User>::IdType>(ids);
    } catch (boost::bad_lexical_cast&) {
      id = dbo::dbo_traits<User>::invalidId();
    }
    panel_->show();
    try {
      dbo::Transaction t(session_);
      dbo::ptr<User> target(session_.load<User>(id));
      if (!userEditor_)
	panel_->addWidget(userEditor_ = new EditUser(session_));
      userEditor_->switchUser(target);
      panel_->setCurrentWidget(userEditor_);
    }
    catch (Dbo::ObjectNotFoundException) {
      if (!invalidUser_)
	panel_->addWidget(invalidUser_ = new WTemplate(tr("blog-invaliduser")));
      panel_->setCurrentWidget(invalidUser_);
    }
  }