Search in sources :

Example 31 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project peppol-practical by phax.

the class LayoutAreaContentProviderPublic method getContent.

@Nonnull
public static IHCNode getContent(@Nonnull final LayoutExecutionContext aLEC) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final HCNodeList ret = new HCNodeList();
    // Header
    ret.addChild(_getNavbar(aLEC));
    final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(true));
    // Breadcrumbs
    {
        final BootstrapBreadcrumb aBreadcrumbs = BootstrapBreadcrumbProvider.createBreadcrumb(aLEC);
        aBreadcrumbs.addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_SM_BLOCK);
        aOuterContainer.addChild(aBreadcrumbs);
    }
    // Content
    {
        final HCDiv aRow = aOuterContainer.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.D_MD_FLEX));
        final HCDiv aCol1 = aRow.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.D_MD_FLEX));
        final HCDiv aCol2 = aRow.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.ML_3).addClass(CBootstrapCSS.FLEX_FILL));
        // left
        // We need a wrapper span for easy AJAX content replacement
        aCol1.addClass(CBootstrapCSS.D_PRINT_NONE).addChild(new HCSpan().setID(CLayout.LAYOUT_AREAID_MENU).addChild(getMenuContent(aLEC)));
        aCol1.addChild(new HCDiv().setID(CLayout.LAYOUT_AREAID_SPECIAL));
        // content
        aCol2.addChild(getPageContent(aLEC));
    }
    // Footer
    {
        final BootstrapContainer aFooter = new BootstrapContainer().setFluid(true).setID(CLayout.LAYOUT_AREAID_FOOTER);
        aFooter.addChild(new HCP().addChild(AppHelper.getApplicationTitle() + " - created by Philip Helger").addChild(" - GitHub: ").addChild(new HCA(new SimpleURL("https://github.com/phax")).addChild("phax")).addChild(" - Twitter: ").addChild(new HCA(new SimpleURL("https://twitter.com/philiphelger")).addChild("@philiphelger")));
        if (FOOTER_ROW_COUNT > 0) {
            final BootstrapMenuItemRendererHorz aRenderer = new BootstrapMenuItemRendererHorz(aDisplayLocale);
            final HCDiv aTable = new HCDiv();
            aTable.addClass(CSS_CLASS_FOOTER_LINKS);
            for (int i = 0; i < FOOTER_ROW_COUNT; ++i) {
                final BootstrapRow aRow = aTable.addAndReturnChild(new BootstrapRow());
                aRow.createColumn(4).addChild(_getRenderedFooterMenuObj(aLEC, aRenderer, FOOTER_COL1.getAtIndex(i)));
                aRow.createColumn(4).addChild(_getRenderedFooterMenuObj(aLEC, aRenderer, FOOTER_COL2.getAtIndex(i)));
                aRow.createColumn(4).addChild(_getRenderedFooterMenuObj(aLEC, aRenderer, FOOTER_COL3.getAtIndex(i)));
            }
            aFooter.addChild(aTable);
        }
        aFooter.addChild(new HCP().addChild(new HCSmall().addChild("Disclaimer: This page is a personal project of Philip Helger." + " The content is neither provided nor approved by OpenPeppol AISBL." + " The official Peppol website is ").addChild(new HCA(new SimpleURL("https://www.peppol.eu")).addChild("www.peppol.eu").setTargetBlank())));
        ret.addChild(aFooter);
    }
    return ret;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) BootstrapRow(com.helger.photon.bootstrap4.grid.BootstrapRow) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapMenuItemRendererHorz(com.helger.photon.bootstrap4.uictrls.ext.BootstrapMenuItemRendererHorz) BootstrapContainer(com.helger.photon.bootstrap4.layout.BootstrapContainer) HCP(com.helger.html.hc.html.grouping.HCP) HCSmall(com.helger.html.hc.html.textlevel.HCSmall) HCA(com.helger.html.hc.html.textlevel.HCA) BootstrapBreadcrumb(com.helger.photon.bootstrap4.breadcrumb.BootstrapBreadcrumb) SimpleURL(com.helger.commons.url.SimpleURL) ISimpleURL(com.helger.commons.url.ISimpleURL) Nonnull(javax.annotation.Nonnull)

Example 32 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project peppol-practical by phax.

the class AppCommonUI method createViewLoginForm.

@Nonnull
public static BootstrapForm createViewLoginForm(@Nonnull final LayoutExecutionContext aLEC, @Nullable final String sPreselectedUserName, final boolean bShowRegistration) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    // Use new IDs for both fields, in case the login stuff is displayed more
    // than once!
    final String sIDUserName = GlobalIDFactory.getNewStringID();
    final String sIDPassword = GlobalIDFactory.getNewStringID();
    final String sIDErrorField = GlobalIDFactory.getNewStringID();
    final BootstrapForm aForm = new BootstrapForm(aLEC).setAction(aLEC.getSelfHref()).setFormType(EBootstrapFormType.DEFAULT);
    aForm.setLeft(3);
    // Placeholder for error message
    aForm.addChild(new HCDiv().setID(sIDErrorField).addStyle(CCSSProperties.MARGIN.newValue("4px 0")));
    // User name field
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory(EPhotonCoreText.EMAIL_ADDRESS.getDisplayText(aDisplayLocale)).setCtrl(new HCEdit(new RequestField(CLogin.REQUEST_ATTR_USERID, sPreselectedUserName)).setPlaceholder(EPhotonCoreText.EMAIL_ADDRESS.getDisplayText(aDisplayLocale)).setID(sIDUserName)));
    // Password field
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory(EPhotonCoreText.LOGIN_FIELD_PASSWORD.getDisplayText(aDisplayLocale)).setCtrl(new HCEditPassword(CLogin.REQUEST_ATTR_PASSWORD).setPlaceholder(EPhotonCoreText.LOGIN_FIELD_PASSWORD.getDisplayText(aDisplayLocale)).setID(sIDPassword)));
    // Login button
    final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aLEC));
    {
        final JSPackage aOnClick = new JSPackage();
        final JSAnonymousFunction aJSSuccess = new JSAnonymousFunction();
        final JSVar aJSData = aJSSuccess.param("data");
        aJSSuccess.body()._if(aJSData.ref(AjaxExecutorPublicLogin.JSON_LOGGEDIN), JSHtml.windowLocationReload(), JQuery.idRef(sIDErrorField).empty().append(aJSData.ref(AjaxExecutorPublicLogin.JSON_HTML)));
        aOnClick.add(new JQueryAjaxBuilder().url(CAjax.LOGIN.getInvocationURI(aRequestScope)).method(EHttpMethod.POST).data(new JSAssocArray().add(CLogin.REQUEST_ATTR_USERID, JQuery.idRef(sIDUserName).val()).add(CLogin.REQUEST_ATTR_PASSWORD, JQuery.idRef(sIDPassword).val())).success(aJSSuccess).build());
        aOnClick._return(false);
        aToolbar.addSubmitButton(EPhotonCoreText.LOGIN_BUTTON_SUBMIT.getDisplayText(aDisplayLocale), aOnClick, EDefaultIcon.YES.getIcon());
    }
    if (bShowRegistration) {
        aToolbar.addChild(new BootstrapButton(EBootstrapButtonType.SUCCESS).addChild(EPhotonCoreText.BUTTON_SIGN_UP.getDisplayText(aDisplayLocale)).setOnClick(aLEC.getLinkToMenuItem(CMenuPublic.MENU_SIGN_UP)));
    }
    return aForm;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) JSAnonymousFunction(com.helger.html.jscode.JSAnonymousFunction) JSVar(com.helger.html.jscode.JSVar) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCEditPassword(com.helger.html.hc.html.forms.HCEditPassword) PDTToString(com.helger.commons.datetime.PDTToString) BootstrapForm(com.helger.photon.bootstrap4.form.BootstrapForm) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) JQueryAjaxBuilder(com.helger.html.jquery.JQueryAjaxBuilder) JSPackage(com.helger.html.jscode.JSPackage) JSAssocArray(com.helger.html.jscode.JSAssocArray) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) RequestField(com.helger.photon.core.form.RequestField) Nonnull(javax.annotation.Nonnull)

Aggregations

HCDiv (com.helger.html.hc.html.grouping.HCDiv)32 Nonnull (javax.annotation.Nonnull)21 HCNodeList (com.helger.html.hc.impl.HCNodeList)18 Locale (java.util.Locale)16 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)11 HCEdit (com.helger.html.hc.html.forms.HCEdit)9 BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)9 PDTToString (com.helger.commons.datetime.PDTToString)8 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)8 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)8 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)7 BootstrapTable (com.helger.photon.bootstrap4.table.BootstrapTable)7 RequestField (com.helger.photon.core.form.RequestField)7 HCSpan (com.helger.html.hc.html.textlevel.HCSpan)6 HCTextNode (com.helger.html.hc.impl.HCTextNode)6 JQueryAjaxBuilder (com.helger.html.jquery.JQueryAjaxBuilder)6 JSAnonymousFunction (com.helger.html.jscode.JSAnonymousFunction)6 JSAssocArray (com.helger.html.jscode.JSAssocArray)6 JSVar (com.helger.html.jscode.JSVar)6 BootstrapForm (com.helger.photon.bootstrap4.form.BootstrapForm)6