WWidget* WCalendar::renderCell(WWidget* widget, const WDate& date) { WText* t = dynamic_cast<WText*>(widget); if (!t) { t = new WText(); t->setInline(false); t->setTextFormat(PlainText); } #ifndef WT_TARGET_JAVA char buf[30]; #else char *buf; #endif // WT_TARGET_JAVA Utils::itoa(date.day(), buf); t->setText(WString::fromUTF8(buf)); std::string styleClass; if (isInvalid(date)) styleClass += " Wt-cal-oor"; else if (date.month() != currentMonth()) styleClass += " Wt-cal-oom"; if (isSelected(date)) styleClass += " Wt-cal-sel"; WDate currentDate = WDate::currentDate(); if (date.day() == currentDate.day() && date.month() == currentDate.month() && date.year() == currentDate.year()) { if (!isSelected(date)) styleClass += " Wt-cal-now"; t->setToolTip(WString::tr("Wt.WCalendar.today")); } else t->setToolTip(""); t->setStyleClass(styleClass.c_str()); return t; }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A void PagesList::load() { impl_->clear(); // item count WText *wtitemt = new WText("Eintraege : ", impl_); wtitemt->setStyleClass("tableFilter"); WText *wtitems = new WText(lexical_cast<string>(table_->entriesCount()), impl_); wtitems->setStyleClass("pageNumbersCurr"); // pages WText *wtxtpg = new WText(" Seiten : ", impl_); wtxtpg->setStyleClass("tableFilter"); const unsigned int pagesCount = 1 + table_->entriesCount() / table_->entriesPerPage(); if(pagesCount > 1 && table_->pageNr() > 1) { WText *previous = new WText("<", impl_); previous->setStyleClass("pageNumbers"); previous->setToolTip("vorherige"); previous->clicked().connect(SLOT(this, PagesList::select)); } for(unsigned int i=0; i<pagesCount; ++i) { WText *wtxt = new WText(lexical_cast<string>(i+1), impl_); if(i + 1 == table_->pageNr()) wtxt->setStyleClass("pageNumbersCurr"); else { wtxt->setStyleClass("pageNumbers"); wtxt->clicked().connect(SLOT(this, PagesList::select)); } } if(pagesCount > 1 && table_->pageNr() < pagesCount) { WText *next = new WText(">", impl_); next->setStyleClass("pageNumbers"); next->setToolTip("nächste"); next->clicked().connect(SLOT(this, PagesList::select)); } }
void SVSEView::addSVSEList(string &szName, string &szIndex) { if(m_pSEList) { int nRow = m_pSEList->numRows(); SVTableCell cell; sv_group_state groupState = getSVSEState(szIndex, m_pSVUser, m_szIDCUser, m_szIDCPwd); bool bHasEditRight = true; bool bHasDelRight = true; if(m_pSVUser) { bHasEditRight = m_pSVUser->haveUserRight(szIndex, "se_edit"); bHasDelRight = m_pSVUser->haveUserRight(szIndex, "se_delse"); } else { bHasEditRight = false; bHasDelRight = false; } // Ñ¡Ôñ //if(szIndex.compare("1") != 0) //{ // WCheckBox * pCheck = NULL; // if(bHasEditRight || bHasDelRight) pCheck = new WCheckBox("", (WContainerWidget *)m_pSEList->elementAt(nRow, 0)); // if(pCheck) // { // cell.setType(adCheckBox); // cell.setValue(pCheck); // m_svSEList.WriteCell(szIndex, 0, cell); // } //} // ÃèÊö WText *pDesc = new WText("", (WContainerWidget *)m_pSEList->elementAt(nRow, 0)); if(pDesc) { char szState[512] = {0}; sprintf(szState, "%s%d<BR>%s%d<BR>%s%d<BR>%s%d<BR>%s%d", SVResString::getResString("IDS_Device_Count").c_str(), groupState.nDeviceCount, SVResString::getResString("IDS_Monitor_Count").c_str(), groupState.nMonitorCount, SVResString::getResString("IDS_Monitor_Disable_Count").c_str(), groupState.nDisableCount, SVResString::getResString("IDS_Monitor_Error_Count").c_str(), groupState.nErrorCount, SVResString::getResString("IDS_Monitor_Warn_Count").c_str(), groupState.nWarnCount); pDesc->setText(szState); } // Ãû³Æ WText *pName = new WText(szName, (WContainerWidget *)m_pSEList->elementAt(nRow, 1)); if ( pName ) { sprintf(pName->contextmenu_, "style='color:#669;cursor:pointer;' onmouseover='" \ "this.style.textDecoration=\"underline\"' " \ "onmouseout='this.style.textDecoration=\"none\"'"); pName->setToolTip(szName); WObject::connect(pName, SIGNAL(clicked()), "showbar();", &m_wNameMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); m_wNameMapper.setMapping(pName, szIndex); cell.setType(adText); cell.setValue(pName); m_svSEList.WriteCell(szIndex, 2, cell); SVTableRow *pRow = m_svSEList.Row(szIndex); if(pRow) pRow->setProperty(szIndex.c_str()); } // ±à¼ WImage * pEdit = NULL; if(bHasEditRight) pEdit = new WImage("../icons/edit.gif", (WContainerWidget *)m_pSEList->elementAt(nRow, 2)); if (pEdit) { pEdit->setToolTip(SVResString::getResString("IDS_Edit")); pEdit->setStyleClass("imgbutton"); WObject::connect(pEdit, SIGNAL(clicked()), "showbar();", &m_wEditMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); m_wEditMapper.setMapping(pEdit,szIndex); } if((nRow + 1) % 2 == 0) m_pSEList->GetRow(nRow)->setStyleClass("tr1"); else m_pSEList->GetRow(nRow)->setStyleClass("tr2"); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 枚举此设备可以使用的所有监测器 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void CEccAddMonitor1st::EnumMT(const string &szParentID, const string &szDTName, const string &szNetworkSet) { m_szParentID = szParentID; m_szNetworkset = szNetworkSet; if(szDTName.empty() || m_szDTName == szDTName) return ; m_szDTName = szDTName; // 移除已有的消息绑定 removeMapping(); if(m_pContent) { m_pContent->clear(); list<int> lsMTID; CEccMainView::m_pTreeView->GetDevMTList(szDTName, lsMTID); list<int>::iterator lstItem; // 枚举每个监测器模板 for(lstItem = lsMTID.begin(); lstItem != lsMTID.end(); lstItem++) { int nMTID = (*lstItem); // 打开监测器模板 OBJECT objMonitor = GetMonitorTemplet(nMTID, CEccMainView::m_szIDCUser, CEccMainView::m_szAddr); if(objMonitor != INVALID_VALUE) {// 成功 // 主节点 MAPNODE node = GetMTMainAttribNode(objMonitor); if(node != INVALID_VALUE) { // 名称 显示 是否隐藏 描述 string szLabel(""), szHidden (""), szDesc (""); if(FindNodeValue(node, svLabel, szLabel)) szLabel = SVResString::getResString(szLabel.c_str()); if(FindNodeValue(node, svDescription, szDesc)) szDesc = SVResString::getResString(szDesc.c_str()); FindNodeValue(node, svHidden, szHidden); if(szHidden != "true") { int nRow = m_pContent->numRows(); // 监测器显示文字 WText *pName = new WText(szLabel, m_pContent->elementAt(nRow, 0)); if(pName) { // 文字样式 sprintf(pName->contextmenu_, "style='color:#1E5B99;cursor:pointer;' onmouseover='" \ "this.style.textDecoration=\"underline\"' " \ "onmouseout='this.style.textDecoration=\"none\"'"); // 绑定 click connect(pName, SIGNAL(clicked()), "showbar();", &m_MTMapper, SLOT(map()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); m_MTMapper.setMapping(pName, nMTID); pName->setToolTip(szLabel); m_lsText.push_back(pName); } new WText(szDesc, m_pContent->elementAt(nRow, 1)); m_pContent->GetRow(nRow)->setStyleClass("padding_top"); m_pContent->elementAt(nRow, 0)->setStyleClass("widthbold"); m_pContent->elementAt(nRow, 1)->setStyleClass("color_2"); } } // 关闭监测器模板 CloseMonitorTemplet(objMonitor); } } } }