Пример #1
0
void WDatePicker::create(WInteractWidget *displayWidget,
			 WLineEdit *forEdit)
{
  setImplementation(layout_ = new WContainerWidget());

  displayWidget_ = displayWidget;
  forEdit_ = forEdit;
  forEdit_->setVerticalAlignment(AlignMiddle);
  forEdit_->changed().connect(this, &WDatePicker::setFromLineEdit);

  format_ = "dd/MM/yyyy";

  layout_->setInline(true);
  layout_->addWidget(displayWidget);
  layout_->setAttributeValue("style", "white-space: nowrap");

  const char *TEMPLATE = "${calendar}";

  WTemplate *t = new WTemplate(WString::fromUTF8(TEMPLATE));
  popup_ = new WPopupWidget(t, this);
  popup_->setAnchorWidget(displayWidget_, Horizontal);
  popup_->setTransient(true);

  calendar_ = new WCalendar();
  calendar_->setSingleClickSelect(true);
  calendar_->activated().connect(popup_, &WWidget::hide);
  calendar_->activated().connect(this, &WDatePicker::onPopupHidden);
  calendar_->selectionChanged().connect(this, &WDatePicker::setFromCalendar);

  t->escapePressed().connect(popup_, &WTemplate::hide);
  t->escapePressed().connect(forEdit_, &WWidget::setFocus);

  t->bindWidget("calendar", calendar_);

  WApplication::instance()->theme()->apply(this, popup_, DatePickerPopupRole);

  displayWidget->clicked().connect(popup_, &WWidget::show);
  displayWidget->clicked().connect(this, &WDatePicker::setFromLineEdit);

  if (!forEdit_->validator())
    forEdit_->setValidator(new WDateValidator(format_, this));
}
Пример #2
0
Файл: WMenu.C Проект: LifeGo/wt
void WMenu::init()
{
  internalPathEnabled_ = false;
  emitPathChange_ = false;
  parentItem_ = 0;
  needSelectionEventUpdate_ = false;
  current_ = -1;

  if (contentsStack_) {
#ifndef WT_CNOR
    contentsStackConnection_
      = contentsStack_->destroyed().connect(this, &WMenu::contentsDestroyed);
#endif // WT_CNOR

    contentsStack_->childrenChanged().connect(this,
					      &WMenu::updateSelectionEvent);
  }

  setImplementation(ul_ = new WContainerWidget());
  ul_->setList(true);
}
Пример #3
0
void WSuggestionPopup::init()
{
  setImplementation(impl_);
  impl_->setLoadLaterWhenInvisible(false);
  impl_->setStyleClass("Wt-suggest Wt-outset");

  impl_->bindString("shadow-x1-x2", WTemplate::DropShadow_x1_x2);
  impl_->bindWidget("contents", content_ = new WContainerWidget());
  content_->setStyleClass("content");

  /*
   * We use display: none because logically, the popup is visible and
   * propagates signals
   */
  setAttributeValue("style", "z-index: 10000; display: none");
  setPositionScheme(Absolute);

  setModel(new WStringListModel(this));

  filter_.connect(this, &WSuggestionPopup::doFilter);
  jactivated_.connect(this, &WSuggestionPopup::doActivate);
}
Пример #4
0
void WInPlaceEdit::create()
{
  setImplementation(impl_ = new WContainerWidget());
  setInline(true);

  text_ = new WText(WString::Empty, PlainText, impl_);
  text_->decorationStyle().setCursor(ArrowCursor);

  editing_ = new WContainerWidget(impl_);
  editing_->setInline(true);
  editing_->hide();

  edit_ = new WLineEdit(editing_);
  edit_->setTextSize(20);
  save_ = 0;
  cancel_ = 0;

  /*
   * This is stateless implementation heaven
   */
  text_->clicked().connect(text_, &WWidget::hide);
  text_->clicked().connect(editing_, &WWidget::show);
  text_->clicked().connect(edit_, &WFormWidget::setFocus);

  edit_->enterPressed().connect(edit_, &WFormWidget::disable);
  edit_->enterPressed().connect(this, &WInPlaceEdit::save);
  edit_->enterPressed().preventPropagation();

  edit_->escapePressed().connect(editing_, &WWidget::hide);
  edit_->escapePressed().connect(text_, &WWidget::show);
  edit_->escapePressed().connect(this, &WInPlaceEdit::cancel);
  edit_->escapePressed().preventPropagation();

  buttons_ = new WContainerWidget(editing_);
  buttons_->setInline(true);
  buttons_->addStyleClass("input-group-btn"); // FIXME !!!!

  setButtonsEnabled();
}
Пример #5
0
WPopupMenu::WPopupMenu()
  : WCompositeWidget(),
    parentItem_(0),
    result_(0),
    location_(0),
    aboutToHide_(this),
    triggered_(this),
    cancel_(this, "cancel"),
    recursiveEventLoop_(false),
    autoHideDelay_(-1)
{
  const char *TEMPLATE =
    "${shadow-x1-x2}"
    "${contents}";

  setImplementation(impl_ = new WTemplate(WString::fromUTF8(TEMPLATE)));
  impl_->setLoadLaterWhenInvisible(false);

  setPositionScheme(Absolute);
  setStyleClass("Wt-popupmenu Wt-outset");

  impl_->bindString("shadow-x1-x2", WTemplate::DropShadow_x1_x2);
  WContainerWidget *content = new WContainerWidget();
  content->setStyleClass("content");
  impl_->bindWidget("contents", content);

  const char *CSS_RULES_NAME = "Wt::WPopupMenu";

  WApplication *app = WApplication::instance();

  if (!app->styleSheet().isDefined(CSS_RULES_NAME))
    app->styleSheet().addRule
      (".Wt-notselected .Wt-popupmenu", "visibility: hidden;", CSS_RULES_NAME);

  app->domRoot()->addWidget(this);

  hide();
}
Пример #6
0
WTreeTable::WTreeTable()
{
  setImplementation(std::unique_ptr<WContainerWidget>(impl_ = new WContainerWidget()));

  setStyleClass("Wt-treetable");
  setPositionScheme(PositionScheme::Relative);

  headers_ = impl_->addWidget(cpp14::make_unique<WContainerWidget>());
  headers_->setStyleClass("Wt-header header");

  /*
   * spacer for when a scroll bar is visible
   */
  WContainerWidget *spacer
    = headers_->addWidget(cpp14::make_unique<WContainerWidget>());
  spacer->setStyleClass("Wt-sbspacer");

  headerContainer_
    = headers_->addWidget(cpp14::make_unique<WContainerWidget>());
  headerContainer_->setFloatSide(Side::Right);

  headers_->addWidget(cpp14::make_unique<WText>());
  columnWidths_.push_back(WLength::Auto);

  WContainerWidget *content
    = impl_->addWidget(cpp14::make_unique<WContainerWidget>());
  content->setStyleClass("Wt-content");
  if (!wApp->environment().agentIsIE())
    content->setOverflow(Overflow::Auto);
  else
    content->setAttributeValue
      ("style", "overflow-y: auto; overflow-x: hidden; zoom: 1");

  tree_ = content->addWidget(cpp14::make_unique<WTree>());
  tree_->setMargin(3, Side::Top);
  tree_->resize(WLength(100, LengthUnit::Percentage), WLength::Auto);
}
Пример #7
0
WTreeTable::WTreeTable(WContainerWidget *parent)
  : WCompositeWidget(parent)
{
  setImplementation(impl_ = new WContainerWidget());

  setStyleClass("Wt-treetable");
  setPositionScheme(Relative);

  headers_ = new WContainerWidget(impl_);
  headers_->setStyleClass("Wt-header header");

  /*
   * spacer for when a scroll bar is visible
   */
  WContainerWidget *spacer = new WContainerWidget(headers_);
  spacer->setStyleClass("Wt-sbspacer");

  headerContainer_ = new WContainerWidget(headers_);
  headerContainer_->setFloatSide(Right);

  headers_->addWidget(new WText());
  columnWidths_.push_back(WLength::Auto);

  WContainerWidget *content = new WContainerWidget(impl_);
  content->setStyleClass("Wt-content");
  if (!wApp->environment().agentIsIE())
    content->setOverflow(WContainerWidget::OverflowAuto);
  else
    content->setAttributeValue
      ("style", "overflow-y: auto; overflow-x: hidden; zoom: 1");

  content->addWidget(tree_ = new WTree());

  tree_->setMargin(3, Top);
  tree_->resize(WLength(100, WLength::Percentage), WLength::Auto);
}
Пример #8
0
WValidationStatus::WValidationStatus(WFormWidget *field,
				     WWidget *validStateWidget,
				     WWidget *invalidStateWidget,
				     WWidget *invalidEmptyStateWidget,
				     WContainerWidget *parent)
  : WCompositeWidget(parent),
    validated(this),
    field_(field),
    validStateWidget_(validStateWidget),
    invalidStateWidget_(invalidStateWidget),
    invalidEmptyStateWidget_(invalidEmptyStateWidget)
{
  setImplementation(impl_ = new WContainerWidget());
  impl_->setInline(true);

  state_ = field_->validate();

  if (validStateWidget_) {
    impl_->addWidget(validStateWidget_);
    validStateWidget_->setHidden(state_ != WValidator::Valid);
  }

  if (invalidStateWidget_) {
    impl_->addWidget(invalidStateWidget_);
    invalidStateWidget_->setHidden(state_ != WValidator::Invalid);
  }

  if (invalidEmptyStateWidget_) {
    impl_->addWidget(invalidEmptyStateWidget_);
    invalidEmptyStateWidget_->setHidden(state_ != WValidator::InvalidEmpty);
  }

  field->changed.connect(SLOT(this, WValidationStatus::inputChanged));
  field->keyWentUp.connect(SLOT(this, WValidationStatus::inputChanged));
  //field->keyPressed.connect(SLOT(this, WValidationStatus::inputChanged));
}
Пример #9
0
WTreeNode::WTreeNode(DemoTreeList *pTreeList, const std::string labelText, const std::string nodeId, int nType, int nState,
                     WText::Formatting labelFormatting,
                     WStateIcon *labelIcon,
                     WWidget *userContent,
                     WContainerWidget *parent,
                     string szIDCUser,
                     string szIDCPwd)
                     : parentNode_(0),
                     m_pParentTreeView(pTreeList),
                     strId(nodeId),
                     labelIcon_(labelIcon),
                     userContent_(userContent),
                     nTreeType(nType),
                     m_szIDCUser(szIDCUser),
                     m_szIDCPwd(szIDCPwd)
{
    bFistundoCollapse = true;
    //m_pParentTreeView = NULL;

    bSelected = false;
    bCurrently = false;	
    m_bNoChild = false;
    setImplementation(layout_ = new WTable(parent));

    expandedContent_ = new WContainerWidget();
    if (userContent)
        expandedContent_->addWidget(userContent);

    expandedDeviceContent_ = new WContainerWidget();
    if (userContent)
        expandedDeviceContent_->addWidget(userContent);

    labelText_ = new WText(labelText);
    if(labelText_)
    {
        labelText_->setToolTip(labelText);
        labelText_->setFormatting(labelFormatting);
    }


    expandIcon_ = NULL;
    if(nType != Tree_DEVICE && nType != Tree_NOCHILD)
    {
        expandIcon_ = new WStateIcon(imageFold_[OPEN], imageFold_[CLOSE ]);
        if(expandIcon_)
        {
            connect(expandIcon_->icon1(), SIGNAL(clicked()), this, SLOT(expand()), STATIC);
            connect(expandIcon_->icon2(), SIGNAL(clicked()),this, SLOT(collapse()), STATIC);
        }
    }
    else if(nType == Tree_DEVICE)
    {
        expandIcon_ = new WStateIcon("../icons/small_normal.gif", "../icons/small_normal.gif");
        if(expandIcon_)
        {
            switch(nState)
            {
            case dyn_normal:
                break;
            case dyn_warnning:
                expandIcon_->icon1()->setImageRef("../icons/small_warnning.gif");
                break;
            case dyn_error:
                expandIcon_->icon1()->setImageRef("../icons/small_error.gif");
                break;
            case dyn_disable:
                expandIcon_->icon1()->setImageRef("../icons/small_disablemonitor.gif");
                break;
            }
        }
    }

    if(expandIcon_)
        layout_->elementAt(0, 0)->addWidget(expandIcon_);

    if (labelIcon_) 
    {   
        layout_->elementAt(0, 1)->addWidget(labelIcon_);
    }

    if(labelText_)
    {
        layout_->elementAt(0, 1)->addWidget(labelText_);
    }
    layout_->elementAt(1, 1)->addWidget(expandedContent_);
    layout_->elementAt(2, 1)->addWidget(expandedDeviceContent_);

    //焦点
    m_szFocus = "SetCurfocus(\"" + strId + "\")";


    //根据权限显示相应的菜单项........未做

    //右键菜单
    if(nType == Tree_SE)
    {
        if(expandIcon_)
            expandIcon_->showIcon2();
    }
    else if(nType == Tree_GROUP)
    {        
        if(expandIcon_)
            expandIcon_->showIcon2();
    }

    if(labelText_ && nType != Tree_NOCHILD)
    {
        string szMenu(makeMenuText());
        sprintf(labelText_->contextmenu_, "class='treelink' onclick='%s' oncontextmenu='showPopMenu(\"%s\",\"%d\",\"%s\");' onmouseover='mouseover(this)' onmouseout='mouseout(this)'",
            m_szFocus.c_str(), strId.c_str(), nType, szMenu.c_str());
    }
    if(expandedContent_) expandedContent_->show();
    if(expandedDeviceContent_) expandedDeviceContent_->show();
}
Пример #10
0
void WCalendar::create()
{
  selectionMode_ = SingleSelection;
  singleClickSelect_ = false;
  horizontalHeaderFormat_ = ShortDayNames;
  firstDayOfWeek_ = 1;
  cellClickMapper_ = 0;
  cellDblClickMapper_ = 0;

  WDate currentDay = WDate::currentDate();

  currentYear_ = currentDay.year();
  currentMonth_ = currentDay.month();

  WStringStream text;

  text <<
    "<table class=\"days ${table-class}\" cellspacing=\"0\" cellpadding=\"0\">"
    """<tr>"
    ""  "<th class=\"caption\">${nav-prev}</th>"
    ""  "<th class=\"caption\"colspan=\"5\">${month} ${year}</th>"
    ""  "<th class=\"caption\">${nav-next}</th>"
    """</tr>"
    """<tr>";

  for (int j = 0; j < 7; ++j)
    text <<
      "<th title=\"${t" << j << "}\" scope=\"col\">${d" << j << "}</th>";

  text << "</tr>";

  for (int i = 0; i < 6; ++i) {
    text << "<tr>";
    for (int j = 0; j < 7; ++j)
      text << "<td>${c" << (i * 7 + j) << "}</td>";
    text << "</tr>";
  }

  text << "</table>";

  setImplementation(impl_ = new WTemplate());
  impl_->setTemplateText(WString::fromUTF8(text.str()), XHTMLUnsafeText);
  impl_->setStyleClass("Wt-cal");

  setSelectable(false);

  WText *prevMonth = new WText(tr("Wt.WCalendar.PrevMonth"));
  prevMonth->setStyleClass("Wt-cal-navbutton");
  prevMonth->clicked().connect(this, &WCalendar::browseToPreviousMonth);

  WText *nextMonth = new WText(tr("Wt.WCalendar.NextMonth"));
  nextMonth->setStyleClass("Wt-cal-navbutton");
  nextMonth->clicked().connect(this, &WCalendar::browseToNextMonth);

  monthEdit_ = new WComboBox();
  monthEdit_->setInline(true);
  for (unsigned i = 0; i < 12; ++i)
    monthEdit_->addItem(WDate::longMonthName(i+1));
  monthEdit_->activated().connect(this, &WCalendar::monthChanged);
  monthEdit_->setDisabled(!WApplication::instance()->environment().ajax());

  yearEdit_ = new WInPlaceEdit("");
  yearEdit_->setButtonsEnabled(false);
  yearEdit_->lineEdit()->setTextSize(4);
  yearEdit_->setStyleClass("Wt-cal-year");
  yearEdit_->valueChanged().connect(this, &WCalendar::yearChanged);

  impl_->bindWidget("nav-prev", prevMonth);
  impl_->bindWidget("nav-next", nextMonth);
  impl_->bindWidget("month", monthEdit_);
  impl_->bindWidget("year", yearEdit_);

  setHorizontalHeaderFormat(horizontalHeaderFormat_);
  setFirstDayOfWeek(firstDayOfWeek_);
}
Пример #11
0
template <typename M> void
ImagesClass<M>::images()
{
    cl_int err;
    int i= 6;
    int iMax = 30;
    nano_time_t maxTime = 1000;
    nano_time_t minTime = 100;
    bool next = true;

    do {
        nano_time_t time;

        metod.initDefault(256*i, 1);
        bool b = generateData();
        ASSERT_EQ(b, true) << "generateData()";
        setImplementation(I_BUFERS);
        metod.initOutEvent();
        time = runRepeat(2, &err);
        ASSERT_EQ(err, CL_SUCCESS) << "clFinish()";
        //std::cerr << "size = " << 256*i << "/" << i << " time = " << conv2millisec(time) << std::endl;
        if (conv2millisec(time) < minTime) {
            i += (((int)minTime - (int)conv2millisec(time)) /20) + 1;
			metod.destroy();
            continue;
        }
        if (conv2millisec(time) > maxTime) {
            i = iMax;
			metod.destroy();
            continue;
        }
		next = false;

		nano_time_t time1 = runRepeat(5, &err);
        ASSERT_EQ(err, CL_SUCCESS) << "clFinish()";

        setImplementation(I_IMAGES);

        nano_time_t time2 = runRepeat(5, &err);
        ASSERT_EQ(err, CL_SUCCESS) << "clFinish()";

        setImplementation(I_DEFAULT);

        //nano_time_t time3 = runRepeat(5, & err);
        //ASSERT_EQ(err, CL_SUCCESS) << "clFinish()";

        double d = (double)(time1) / time2;
        std::cerr << "size = " << 256*i
                  << "  timeBufer = " << conv2millisec(time1)
                  << "  timeImage = " << conv2millisec(time2)
                  << "  t1/t2 = " << d << std::endl;

        if (d < 1.2) {
            next = true;
            i++;
        }
        metod.destroy();

    } while (i < iMax && next);

    ASSERT_TRUE(!next) ;

}
Пример #12
0
WPanel::WPanel(WContainerWidget *parent)
  : WCompositeWidget(parent),
    collapseIcon_(0),
    title_(0),
    centralWidget_(0),
    collapsed_(this),
    expanded_(this),
    collapsedSS_(this),
    expandedSS_(this)
{
  const char *TEMPLATE =
    "${titlebar}"
    "${contents}";

  setImplementation(impl_ = new WTemplate(WString::fromUTF8(TEMPLATE)));

  implementStateless(&WPanel::doExpand, &WPanel::undoExpand);
  implementStateless(&WPanel::doCollapse, &WPanel::undoCollapse);

  WApplication *app = WApplication::instance();

  WContainerWidget *centralArea = new WContainerWidget();
  app->theme()->apply(this, centralArea, PanelBodyRole);

  impl_->bindWidget("titlebar", 0);
  impl_->bindWidget("contents", centralArea);

  setJavaScriptMember
    (WT_RESIZE_JS,
     "function(self, w, h, l) {"
     """var defined = h >= 0;"
     """if (defined) {"
     ""  "var mh = " WT_CLASS ".px(self, 'maxHeight');"
     ""  "if (mh > 0) h = Math.min(h, mh);"
     """}"
     """if (" WT_CLASS ".boxSizing(self)) {"
     ""  "h -= " WT_CLASS ".px(self, 'borderTopWidth') + "
     ""       WT_CLASS ".px(self, 'borderBottomWidth');"
     """}"
     """var c = self.lastChild;"
     """var t = c.previousSibling;"
     """if (t)"
     ""  "h -= t.offsetHeight;"
     """h -= 8;" // padding
     """if (defined && h > 0) {"
     ""  "c.lh = l;"
     ""  "c.style.height = h + 'px';"
     // this seems golden, but, JQuery docs say it doesn't work when
     // the panel is indirectly hidden: will this back-fire ?
     ""  "$(c).children().each(function() { "
     ""      "var self = $(this), "
     ""          "padding = self.outerHeight() - self.height();"
     ""      "self.height(h - padding);"
     ""      "this.lh = l;"
     ""  "});"
     """} else {"
     ""  "c.lh = false;"
     ""  "c.style.height = '';"
     ""  "$(c).children().each(function() { "
     ""      "this.style.height = '';"
     ""      "this.lh = false;"
     ""  "});"
     """}"
     "};");

  setJavaScriptMember(WT_GETPS_JS, StdWidgetItemImpl::secondGetPSJS());
}
Пример #13
0
void WTreeNode::create()
{
  setImplementation(layout_ = new WTemplate(tr("Wt.WTreeNode.template")));
  setStyleClass("Wt-tree");
  layout_->setSelectable(false);

  layout_->bindEmpty("cols-row");
  layout_->bindEmpty("trunk-class");

  implementStateless(&WTreeNode::doExpand, &WTreeNode::undoDoExpand);
  implementStateless(&WTreeNode::doCollapse, &WTreeNode::undoDoCollapse);

  WApplication *app = WApplication::instance();

  /*
   * Children
   */
  WContainerWidget *children = new WContainerWidget();
  children->setList(true);
  children->hide();
  layout_->bindWidget("children", children);

  /*
   * Expand icon
   */
  if (WApplication::instance()->layoutDirection() == RightToLeft)
    expandIcon_
      = new WIconPair(app->theme()->resourcesUrl() + imagePlusRtl_,
		      app->theme()->resourcesUrl() + imageMinRtl_);
  else
    expandIcon_
      = new WIconPair(app->theme()->resourcesUrl() + imagePlus_,
		      app->theme()->resourcesUrl() + imageMin_);
  expandIcon_->setStyleClass("Wt-ctrl Wt-expand");
  noExpandIcon_ = new WText();
  noExpandIcon_->setStyleClass("Wt-ctrl Wt-noexpand");
  layout_->bindWidget("expand", noExpandIcon_);
  addStyleClass("Wt-trunk");

  /*
   * Label
   */
  layout_->bindWidget("label-area", new WContainerWidget());

  if (labelText_)
    labelText_->setStyleClass("Wt-label");

  childCountLabel_ = 0;

  if (labelIcon_) {
    labelArea()->addWidget(labelIcon_);
    labelIcon_->setVerticalAlignment(AlignMiddle);
  }

  if (labelText_)
    labelArea()->addWidget(labelText_);

  childrenLoaded_ = false;

  setLoadPolicy(LazyLoading);
}
Пример #14
0
RSWappSearchFilesPage::RSWappSearchFilesPage(Wt::WContainerWidget *parent,RsFiles *mfiles)
	: WCompositeWidget(parent),mFiles(mfiles)
{
	setImplementation(_impl = new Wt::WContainerWidget()) ;

	//_treeView = new Wt::WTreeView(_impl);
	_tableView = new Wt::WTableView(_impl);

	Wt::WVBoxLayout *layout = new Wt::WVBoxLayout() ;
	_impl->setLayout(layout) ;


	search_box = new Wt::WLineEdit(_impl) ;
	search_box->setText("mp3") ;
	search_box->enterPressed().connect(this,&RSWappSearchFilesPage::searchClicked) ;

	//search_box->setHeight(50) ;

	localcb = new Wt::WCheckBox(Wt::WString("Search Local"),_impl) ;
	remotecb = new Wt::WCheckBox(Wt::WString("Search Remote"),_impl) ;
	distantcb = new Wt::WCheckBox(Wt::WString("Search Distant"),_impl) ;

	localcb->setChecked(false);
	remotecb->setChecked(true);
	distantcb->setChecked(true);

	Wt::WPushButton *btn = new Wt::WPushButton("Search!") ;
	btn->clicked().connect(this,&RSWappSearchFilesPage::searchClicked) ;

	Wt::WContainerWidget *hSearchBox = new Wt::WContainerWidget();
	Wt::WHBoxLayout *hSearchLayout = new Wt::WHBoxLayout ;
	hSearchBox->setLayout(hSearchLayout);

	hSearchLayout->addWidget(search_box) ;
	hSearchLayout->addWidget(localcb);
	hSearchLayout->addWidget(distantcb);
	hSearchLayout->addWidget(remotecb);
	hSearchLayout->addWidget(btn) ;

	layout->addWidget(hSearchBox) ;
	search_box->setWidth(1000);

	_tableView->setAlternatingRowColors(true);

	_tableView->setSelectionMode(Wt::ExtendedSelection);
	_tableView->setDragEnabled(true);


	_tableView->setColumnWidth(0, 250);
	_tableView->setColumnWidth(1, 150);
	_tableView->setColumnWidth(2, 250);
	_tableView->setColumnWidth(3, 150);
	_tableView->setColumnWidth(4, 150);
	_tableView->setColumnWidth(5, 100);

	_shared_files_model = new LocalSearchFilesModel(mfiles) ;

	_tableView->setModel(_shared_files_model) ;

	_tableView->doubleClicked().connect(this,&RSWappSearchFilesPage::tableClicked) ;
	layout->addWidget(_tableView,1) ;

	_tableView->setHeight(300) ;


	Wt::WPushButton *dlbtn = new Wt::WPushButton("Download selected") ;
	dlbtn->clicked().connect(this,&RSWappSearchFilesPage::searchClicked) ;
	layout->addWidget(dlbtn) ;

	_timer = new Wt::WTimer(this) ;
	_timer->setInterval(5000) ;
	_timer->timeout().connect(this,&RSWappSearchFilesPage::refresh) ;
	_timer->start() ;
}
Пример #15
0
WTreeNode::WTreeNode(const std::string labelText, const std::string nodeId, bool bCheck, bool bDevice,int nType, 
                     WText::Formatting labelFormatting,
                     WStateIcon *labelIcon,
                     WWidget *userContent, WContainerWidget *parent)
                     : parentNode_(0),
                     labelIcon_(labelIcon),
                     userContent_(userContent),
                     wasSelected_(false)
{

    bMExpand =false;
    bFirst = true;
    bFirstadjust=true;
    bFistundoCollapse =true;
    m_CheckBoxTreeView =NULL;
    treeCheckBox_ =NULL;
    nTreeType= nType;
    setImplementation(layout_ = new WTable(parent));
    layout_->setCellSpaceing(0);
	layout_->setCellSpaceing(0);
	layout_->setStyleClass("widthauto");
    
    strId = nodeId;
    expandIcon_ = new WStateIcon(imageFold_[OPEN], imageFold_[CLOSE ]);
    expandedContent_ = new WContainerWidget();
    if (userContent)
        expandedContent_->addWidget(userContent);

    labelText_ = new WText(labelText);
		labelText_->setStyleClass("hand");
    labelText_->setFormatting(labelFormatting);


    connect(labelText_ , SIGNAL(clicked()), this ,SLOT(OnRightClick()));

    noExpandIcon_ = new WImage("../Images/9bland.gif");

		WText *blank = new WText("&nbsp;");
		//layout_->elementAt(0, 1)->setStyleClass("tree_text");
		layout_->elementAt(0, 0)->setStyleClass("padding_right_2");
    layout_->elementAt(0, 0)->addWidget(expandIcon_);
    layout_->elementAt(0, 0)->addWidget(noExpandIcon_);
    layout_->elementAt(0, 0)->addWidget(blank);
    
    if( (false==bDevice)&&( Tree_DEVICE==nTreeType))//ajax --monitor
    {
        noExpandIcon_->hide();
    }else 
    {
        expandIcon_->hide();
	}

    treeCheckBox_ = new WCheckBox(labelText);
    treeCheckBox_->setStyleClass("smallcheckbox");

    if(nTreeType==Tree_MONITOR)
    {
        connect(treeCheckBox_,SIGNAL(clicked()),this,SLOT(OnTreeNodeCheck()));
        layout_->elementAt(0, 1)->setStyleClass("tree_text");
    }
    if (labelIcon_) 
    {
        if(bCheck)
        {
            layout_->elementAt(0, 0)->addWidget(treeCheckBox_);
        }
        layout_->elementAt(0, 1)->addWidget(labelIcon_);
        labelIcon_->setVerticalAlignment(AlignMiddle);
    }
    layout_->elementAt(0, 1)->addWidget(labelText_);
    layout_->elementAt(1, 1)->addWidget(expandedContent_);
    layout_->elementAt(0, 0)->setVerticalAlignment(AlignMiddle);
    layout_->elementAt(0, 0)->setContentAlignment(AlignMiddle);
    layout_->elementAt(0, 1)->setContentAlignment(AlignMiddle);
    layout_->elementAt(0, 1)->setVerticalAlignment(AlignMiddle);

	//add end
    connect(expandIcon_->icon1(), SIGNAL(clicked()), this, SLOT(expand()), STATIC);
    connect(expandIcon_->icon2(), SIGNAL(clicked()), this, SLOT(collapse()), STATIC);
}
Пример #16
0
void WTimePicker::init(const WTime &time)
{
    Wt::WStringStream text;
    text << "<table>"
            """<tr>"
            ""  "<th>${incrementHour}</th>"
            ""  "<th></th>"
            ""  "<th>${incrementMinute}</th>"
            ""  "<th></th>"
            ""  "<th>${incrementSecond}</th>"
            """</tr>"
            """<tr>"
            ""  "<td valign=\"middle\" align=\"center\">${hourText}</td>"
            ""  "<td valign=\"middle\" align=\"center\">:</td>"
            ""  "<td valign=\"middle\" align=\"center\">${minuteText}</td>"
            ""  "<td valign=\"middle\" align=\"center\">:</td>"
            ""  "<td valign=\"middle\" align=\"center\">${secondText}</td>"
            """</tr>"
            """<tr>"
            ""  "<th>${decrementHour}</th>"
            ""  "<th></th>"
            ""  "<th>${decrementMinute}</th>"
            ""  "<th></th>"
            ""  "<th>${decrementSecond}</th>"
            """</tr>"
            "</table>";

    WTemplate *impl = new WTemplate();
    setImplementation(impl);
    impl->setTemplateText(WString::fromUTF8(text.str(), XHTMLUnsafeText));

    WIcon::loadIconFont();
    WPushButton *incHourButton = new WPushButton();
    incHourButton->addStyleClass("fa fa-arrow-up");

    WPushButton *decHourButton = new WPushButton();
    decHourButton->addStyleClass("fa fa-arrow-down");

    WPushButton *incMinuteButton = new WPushButton();
    incMinuteButton->addStyleClass("fa fa-arrow-up");

    WPushButton *decMinuteButton = new WPushButton();
    decMinuteButton->addStyleClass("fa fa-arrow-down");
    
	WPushButton *incSecondButton = new WPushButton();
    incSecondButton->addStyleClass("fa fa-arrow-up");

    WPushButton *decSecondButton = new WPushButton();
    decSecondButton->addStyleClass("fa fa-arrow-down");

    hourText_ = new WText("0");
    hourText_->setInline(false);
    hourText_->setTextAlignment(AlignCenter);

    minuteText_ = new WText("00");
    minuteText_->setInline(false);
    minuteText_->setTextAlignment(AlignCenter);
    
	secondText_ = new WText("00");
    secondText_->setInline(false);
    secondText_->setTextAlignment(AlignCenter);

    impl->bindWidget("incrementHour", incHourButton);
    impl->bindWidget("decrementHour", decHourButton);

    impl->bindWidget("hourText", hourText_);
    impl->bindWidget("minuteText", minuteText_);
    impl->bindWidget("secondText", secondText_);

    impl->bindWidget("incrementMinute", incMinuteButton);
    impl->bindWidget("decrementMinute", decMinuteButton);
    
	impl->bindWidget("incrementSecond", incSecondButton);
    impl->bindWidget("decrementSecond", decSecondButton);

    incHourButton->clicked().connect(this, &WTimePicker::incrementHours);
    decHourButton->clicked().connect(this, &WTimePicker::decrementHours);

    incMinuteButton->clicked().connect(this, &WTimePicker::incrementMinutes);
    decMinuteButton->clicked().connect(this, &WTimePicker::decrementMinutes);
    
	incSecondButton->clicked().connect(this, &WTimePicker::incrementSeconds);
    decSecondButton->clicked().connect(this, &WTimePicker::decrementSeconds);

}