void ribi::gtst::DebugDialog::Show()
{
  this->clear();

  m_fileupload = new Wt::WFileUpload;
  m_label_state_upload = new Wt::WLabel;

  assert(m_fileupload);
  assert(m_label_state_upload);

  setContentAlignment(Wt::AlignCenter);
  new Wt::WBreak(this);
  addWidget(m_label_state_upload);
  new Wt::WBreak(this);
  new Wt::WBreak(this);
  addWidget(m_fileupload);

  m_label_state_upload->setText("Please select a file to upload or press the button");

  //Upload automatically when the user entered a file
  m_fileupload->changed().connect(
    m_fileupload,
    &Wt::WFileUpload::upload);

  //Call OnUploadDone when file is uploaded
  m_fileupload->uploaded().connect(
    this,
    &ribi::gtst::DebugDialog::OnUploadDone);
}
Beispiel #2
0
yearbookDownload::yearbookDownload(yearbookDB * ptr) : db(ptr), downloadFile(nullptr) {
  addStyleClass("well");
  setContentAlignment(Wt::AlignCenter | Wt::AlignMiddle);

  addWidget(new Wt::WText("<p>Genereer een nieuwe versie van de PDF.</p> <p><b>Let op: </b>Bij ongeldige invoer kan de PDF onvolledig zijn.</p>"));
  Wt::WPushButton * button = new Wt::WPushButton("Maak PDF");
  addWidget(button);
  button->clicked().connect(this, &yearbookDownload::generatePDF);

  downloadTitle = new Wt::WText("<h1>Download beschikbaar</h1>");
  downloadTitle->addStyleClass("page-header");
  addWidget(downloadTitle);
  downloadContainer = new Wt::WContainerWidget();
  downloadContainer->addStyleClass("well");
  downloadContainer->setContentAlignment(Wt::AlignCenter | Wt::AlignMiddle);
  addWidget(downloadContainer);

  downloadTitle->hide();
  downloadContainer->hide();

  downloadFile = new Wt::WFileResource(this);
  downloadFile->setFileName("yearbook_latex/main.pdf");
  downloadFile->setMimeType("application/pdf");

  downloadAnchor = new Wt::WAnchor(Wt::WLink(downloadFile), "Download");
  downloadAnchor->setTarget(Wt::TargetNewWindow);
  downloadContainer->addWidget(downloadAnchor);
}
ribi::WtSelectFileDialog::WtSelectFileDialog()
  : m_signal_selected{},
    m_ui{}
{
  assert(!m_path.empty()
    && "Path must be set from argv[0]:"
    && "ribi::WtSelectFileDialog::SetPath(boost::filesystem::path(argv[0]).parent_path().string());");
  clear();
  setContentAlignment(Wt::AlignCenter);

  this->addWidget(m_ui.m_selection_box);
  this->addWidget(new Wt::WBreak);
  this->addWidget(m_ui.m_label_filter);
  this->addWidget(m_ui.m_edit_filter);

  m_ui.m_edit_filter->changed().connect(this,
    &ribi::WtSelectFileDialog::OnUpdateDialog);
  m_ui.m_edit_filter->enterPressed().connect(this,
    &ribi::WtSelectFileDialog::OnUpdateDialog);
  m_ui.m_edit_filter->keyWentUp().connect(this,
    &ribi::WtSelectFileDialog::OnUpdateDialog);
  m_ui.m_selection_box->activated().connect(this,
    &ribi::WtSelectFileDialog::OnSelect);
  m_ui.m_selection_box->clicked().connect(this,
    &ribi::WtSelectFileDialog::OnSelect);
  m_ui.m_selection_box->doubleClicked().connect(this,
    &ribi::WtSelectFileDialog::OnSelect);
  m_ui.m_selection_box->setSelectionMode(Wt::SingleSelection);
  m_ui.m_selection_box->resize(400,Wt::WLength::Auto);
  OnUpdateDialog();
}
Beispiel #4
0
HangmanWidget::HangmanWidget(std::wstring user, Dictionary dict,
			     WContainerWidget *parent):
   WContainerWidget(parent),
   MaxGuesses(9),
   User(user),
   Dict(dict)
{
   setContentAlignment(AlignCenter);

   Title = new WText(L"Guess the word!", this);
   Title->decorationStyle().font().setSize(WFont::XLarge);

   WordContainer = new WContainerWidget(this);
   WordContainer->setMargin(WLength(20), Top | Bottom);
   WordContainer->setContentAlignment(AlignCenter);
   WCssDecorationStyle& style = WordContainer->decorationStyle();
   style.setBorder(WBorder(WBorder::Solid));
   style.font().setFamily(WFont::Monospace, L"courier");
   style.font().setSize(WFont::XXLarge);

   StatusText = new WText(this);
   new WBreak(this);
   createHangmanImages(this);
   createAlphabet(this);
   new WBreak(this);
   NewGameButton = new WPushButton(L"New Game", this);
   NewGameButton->clicked.connect(SLOT(this, HangmanWidget::newGame));

   // prepare for first game
   newGame();
}
void CommandButton::Init( void )
{
	m_pSubMenu = NULL;
	m_pSubLabel = NULL;
	m_pParentMenu = NULL;

	// Set text color to orange
	setFgColor(Scheme::sc_primary1);

	// left align
	setContentAlignment( vgui::Label::a_west );

	// Add the Highlight signal
	if (!m_bNoHighlight)
		addInputSignal( new CHandler_CommandButtonHighlight(this) );

	// not bound to any button yet
	m_cBoundKey = 0;
}
Beispiel #6
0
HomeUI::HomeUI(WContainerWidget *parent) :
		WContainerWidget(parent), importUI(0)
{
	setContentAlignment(AlignCenter);

	session_.login().changed().connect(this, &HomeUI::onAuthEvent);

	Auth::AuthModel *authModel = new Auth::AuthModel(Session::auth(),
			session_.users(), this);
	authModel->addPasswordAuth(&Session::passwordAuth());
	authModel->addOAuth(Session::oAuth());

	Auth::AuthWidget *authWidget = new Auth::AuthWidget(session_.login());
	authWidget->setModel(authModel);
	authWidget->setRegistrationEnabled(false);

	WText *title = new WText(WString::fromUTF8("<h1>数据管理平台</h1>"));
	addWidget(title);

	addWidget(authWidget);

	mainStack_ = new WStackedWidget();
	mainStack_->setStyleClass("mainstack");
	addWidget(mainStack_);

	links_ = new WContainerWidget();
	links_->setStyleClass("links");
	links_->hide();
	addWidget(links_);

	importUIAnchor_ = new WAnchor("/dataimport", "Data Import", links_);
	importUIAnchor_->setLink(WLink(WLink::InternalPath, "/dataimport"));

	WApplication::instance()->internalPathChanged().connect(this,
			&HomeUI::handleInternalPath);

	authWidget->processEnvironment();

}
Beispiel #7
0
CategoryExample::CategoryExample(WContainerWidget *parent)
  : WContainerWidget(parent)
{
  setContentAlignment(AlignCenter);
  chart_ = new WCartesian3DChart(this);
  chart_->setType(CategoryChart);

  Wt::WCssDecorationStyle style;
  style.setBorder(Wt::WBorder(Wt::WBorder::Solid, Wt::WBorder::Medium, Wt::black));
  chart_->setDecorationStyle(style);

  chart_->resize(600, 600);
  
  // **** Dataset
  WStandardItemModel *isotopeModel_ = readCsvFile(WApplication::appRoot() + "isotope_decay.csv");
  // add some color-roles
  for (int i=1; i<isotopeModel_->rowCount(); i++) {
    for (int j=1; j<isotopeModel_->columnCount(); j++) {
      double value = Wt::asNumber(isotopeModel_->data(i, j));
      if (value < 3)
  	isotopeModel_->setData(i, j, WColor(blue), MarkerBrushColorRole);
    }
  }
  WGridData *isotopes = new WGridData(isotopeModel_);
  isotopes->setType(BarSeries3D);
  
  // **** Dataset
  planeModel_ = readCsvFile(WApplication::appRoot() + "hor_plane.csv");
  WGridData *horPlane = new WGridData(planeModel_);
  horPlane->setType(BarSeries3D);

  // **** Dataset
  randomModel_ = readCsvFile(WApplication::appRoot() + "hor_plane.csv");
  for (int i=1; i<randomModel_->rowCount(); i++) {
    for (int j=1; j<randomModel_->columnCount(); j++) {
      randomModel_->setData(i, j,Wt::asNumber(randomModel_->data(i, j)) + (rand() % 100)/100.0);
    }
  }
  WGridData *randomPlane = new WGridData(randomModel_);
  randomPlane->setType(BarSeries3D);

  // **** Dataset
  yPlaneModel_ = new PlaneData(20, 20, 0, 1, 0, 1, true, 100, 100);
  WEquidistantGridData *yPlaneFunc = new WEquidistantGridData(yPlaneModel_,
							       0, 1, 0, 1);
  yPlaneFunc->setType(BarSeries3D);

  // **** Dataset
  xPlaneModel_ = new PlaneData(20, 20, 0, 1, 0, 1, false, 100, 100);
  WEquidistantGridData *xPlaneFunc = new WEquidistantGridData(xPlaneModel_,
							       0, 1, 0, 1);
  xPlaneFunc->setType(BarSeries3D);

  // **** Dataset
  xPlaneModelColor_ = new PlaneData(20, 20, 0, 1, 0, 1, false, 5, 100);
  WEquidistantGridData *xPlaneFuncColor = new WEquidistantGridData(xPlaneModelColor_,
							       0, 1, 0, 1);
  xPlaneFuncColor->setType(BarSeries3D);
  

  
  // Data configuration widget
  DataConfig *dataconfig = new DataConfig(chart_);
  dataconfig->addDataToCollection("Isotope data (10x10) with ColorRoles", isotopes);
  dataconfig->addDataToCollection("Horizontal Plane (10x10)", horPlane);  
  dataconfig->addDataToCollection("Random Data (10x10)", randomPlane);  
  // dataconfig->addDataToCollection("tilted plane y (20x20)", yPlaneFunc);
  // dataconfig->addDataToCollection("tilted plane x (20x20)", xPlaneFunc);
  // dataconfig->addDataToCollection("tilted plane x (20x20) with ColorRoles", xPlaneFuncColor);
  
  

  WTabWidget *configuration_ = new WTabWidget(this);
  configuration_->addTab(new ChartSettings(chart_), "General Chart Settings", Wt::WTabWidget::PreLoading);
  configuration_->addTab(dataconfig, "Data selection and configuration", Wt::WTabWidget::PreLoading);
}