HydrovoltsConnectChartView::HydrovoltsConnectChartView(
    HydrovoltsConnectModel* pModel,
    WContainerWidget* parent):
    WContainerWidget(parent),
    m_y1(HydrovoltsConnectModel::COL_POWER),
    m_y2(HydrovoltsConnectModel::COL_POWER, LineSeries, Y2Axis)
{
    m_pModel = pModel;
    resize(WLength::Auto, 600);
    //resize(WLength::Auto, WLength::Auto);

    setStyleClass("layoutdiv");
    CreateChart();
    HydrovoltsConnectChartToolbar* pToolbar = new HydrovoltsConnectChartToolbar( m_pModel, this);
    pToolbar->y1Changed().connect(this, &HydrovoltsConnectChartView::OnY1Changed);
    pToolbar->y2Changed().connect(this, &HydrovoltsConnectChartView::OnY2Changed);

    WVBoxLayout *pLayout = new WVBoxLayout();

    if (pLayout != NULL && m_pChart != NULL && pToolbar != NULL)
    {

        setWidth(WLength::Auto);

        // Toolbar
        pLayout->addWidget(pToolbar);
        pLayout->setStretchFactor(pToolbar, 0);

        // Chart
        pLayout->addWidget(m_pChart);
        pLayout->setStretchFactor(m_pChart,100);
        //pLayout->setRowStretch();
        //pLayout->setColumnStretch();

        setLayoutSizeAware(true);
        setLayout(pLayout);
    }
}
示例#2
0
IdeaSubmit::IdeaSubmit(CgiRoot *cgi, Wt::WDialog *parentDialog, bool editMode, size_t editRowId) : BaseWidget(cgi),
    m_dlgParent(parentDialog),
    m_editMode(editMode),
    m_editRowId(editRowId),
    m_editCompletedHandler(this)
{
    this->clear();
    this->addWidget(Layout());

    this->setOverflow(WContainerWidget::OverflowAuto);

    Div *dvButtonWrappers = new Div();
    Div *dvButtons = new Div(dvButtonWrappers, "dvDialogButtons");
    WPushButton *submitButton;
    if (!m_editMode)
        submitButton = new WPushButton(m_lang->GetString("HOME_SUBMIT_IDEA_DLG_OK_BUTTON"), dvButtons);
    else
        submitButton = new WPushButton(m_lang->GetString("HOME_SUBMIT_IDEA_DLG_OK_EDIT_BUTTON"), dvButtons);
    WPushButton *returnButton = new WPushButton(m_lang->GetString("HOME_SUBMIT_IDEA_DLG_RETURN_BUTTON"), dvButtons);

    submitButton->setStyleClass("dialogButton");
    returnButton->setStyleClass("dialogButton");

    WVBoxLayout *layout = new WVBoxLayout();

    layout->addWidget(this);
    layout->setStretchFactor(this, 1);

    layout->addWidget(dvButtonWrappers );
    layout->setStretchFactor(dvButtonWrappers , 0);


    m_dlgParent->contents()->setLayout(layout);

    if (m_editMode) {
        string title;
        int typegamesentertainment;
        int typehygienehealth;
        int typenewsinfo;
        int typelearning;
        int typenonepresenceservices;
        int typeonlineshopping;
        int typeothers;
        string typeotherstext;
        string description;
        int audienceteens;
        int audienceparents;
        int audienceboys;
        int audiencegirls;
        int audiencewomen;
        int audiencemen;
        int audiencechilds;
        int audienceallfamilymembers;
        string usage;
        string similar;
        string difference;

        result r = m_db->Sql() << "SELECT title, "
                                  "typegamesentertainment, typehygienehealth, typenewsinfo, typelearning, "
                                  "typenonepresenceservices, typeonlineshopping, typeothers, typeotherstext, "
                                  "description, "
                                  "audienceteens, audienceparents, audienceboys, audiencegirls, audiencewomen, "
                                  "audiencemen, audiencechilds, audienceallfamilymembers, "
                                  "usage, similar, difference "
                                  "FROM [" + m_dbTables->Table("IDEAS")
                                  + "] WHERE rowid=?;" << m_editRowId << row;
        if (!r.empty()) {
            r >> title >> typegamesentertainment >> typehygienehealth
              >> typenewsinfo >> typelearning >> typenonepresenceservices >> typeonlineshopping
              >> typeothers >> typeotherstext >> description >> audienceteens >> audienceparents >> audienceboys
              >> audiencegirls >> audiencewomen >> audiencemen >> audiencechilds >> audienceallfamilymembers
              >> usage >> similar >> difference;

            title = Crypto::Decrypt(title);
            typeotherstext = Crypto::Decrypt(typeotherstext);
            description = Crypto::Decrypt(description);
            usage = Crypto::Decrypt(usage);
            similar = Crypto::Decrypt(similar);
            difference = Crypto::Decrypt(difference);

            m_typeGamesEntertainmentCheckBox->setChecked(typegamesentertainment);
            m_typeHygieneHealthCheckBox->setChecked(typehygienehealth);
            m_typeNewsInfoCheckBox->setChecked(typenewsinfo);
            m_typeLearningCheckBox->setChecked(typelearning);
            m_typeNonePresenceServicesCheckBox->setChecked(typenonepresenceservices);
            m_typeOnlineShoppingCheckBox->setChecked(typeonlineshopping);
            m_typeOthersCheckBox->setChecked(typeothers);
            if (typeothers)
                m_typeOthersTextLineEdit->setText(WString::fromUTF8(typeotherstext));
            m_titleLineEdit->setText(WString::fromUTF8(title));
            m_descriptionTextArea->setText(WString::fromUTF8(description));
            m_audienceTeensCheckBox->setChecked(audienceteens);
            m_audienceParentsCheckBox->setChecked(audienceparents);
            m_audienceBoysCheckBox->setChecked(audienceboys);
            m_audienceGirlsCheckBox->setChecked(audiencegirls);
            m_audienceWomenCheckBox->setChecked(audiencewomen);
            m_audienceMenCheckBox->setChecked(audiencemen);
            m_audienceChildsCheckBox->setChecked(audiencechilds);
            m_audienceAllFamilyMembersCheckBox->setChecked(audienceallfamilymembers);
            m_usageTextArea->setText(WString::fromUTF8(usage));
            m_similarTextArea->setText(WString::fromUTF8(similar));
            m_differenceTextArea->setText(WString::fromUTF8(difference));
        }
    }