Search in sources :

Example 11 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan in project peppol-practical by phax.

the class LayoutAreaContentProviderPublic method _getNavbar.

@Nonnull
private static BootstrapNavbar _getNavbar(final LayoutExecutionContext aLEC) {
    final ISimpleURL aLinkToStartPage = aLEC.getLinkToMenuItem(aLEC.getMenuTree().getDefaultMenuItemID());
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    final IUser aUser = LoggedInUserManager.getInstance().getCurrentUser();
    final BootstrapNavbar aNavbar = new BootstrapNavbar();
    aNavbar.addBrand(new HCSpan().addClass(AppCommonUI.CSS_CLASS_LOGO1).addChild(AppHelper.getApplicationTitle()), aLinkToStartPage);
    aNavbar.addChild(new BootstrapButton(EBootstrapButtonType.DEFAULT).addChild("Participant information").setIcon(EFamFamIcon.USER_GREEN).setOnClick(aLEC.getLinkToMenuItem(CMenuPublic.MENU_TOOLS_PARTICIPANT_INFO)).addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2));
    aNavbar.addChild(new BootstrapButton(EBootstrapButtonType.DEFAULT).addChild("Document validation").setIcon(EFamFamIcon.SCRIPT_GO).setOnClick(aLEC.getLinkToMenuItem(CMenuPublic.MENU_VALIDATION_UPLOAD)).addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2));
    aNavbar.addChild(new BootstrapButton(EBootstrapButtonType.DEFAULT).addChild("ID information").setIcon(EFamFamIcon.CUP).setOnClick(aLEC.getLinkToMenuItem(CMenuPublic.MENU_TOOLS_ID_INFO)).addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2));
    final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
    if (aUser != null) {
        aToggleable.addAndReturnText().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2).addChild("Welcome ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
        if (SecurityHelper.hasUserRole(aUser.getID(), CPPApp.ROLE_CONFIG_ID)) {
            aToggleable.addChild(new BootstrapButton().setOnClick(LinkHelper.getURLWithContext(AbstractSecureApplicationServlet.SERVLET_DEFAULT_PATH)).addChild("Administration").addClass(CBootstrapCSS.MX_2));
        }
        aToggleable.addChild(new BootstrapButton().setOnClick(LinkHelper.getURLWithContext(aRequestScope, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)).addClass(CBootstrapCSS.MX_2));
    } else {
        // show login in Navbar
        final BootstrapNavbarNav aNav = aToggleable.addAndReturnNav();
        final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
        {
            final HCDiv aDiv = new HCDiv().addClass(CBootstrapCSS.P_2).addStyle(CCSSProperties.MIN_WIDTH.newValue("400px"));
            aDiv.addChild(AppCommonUI.createViewLoginForm(aLEC, null, false));
            aDropDown.addChild(aDiv);
        }
        aNav.addItem().addNavDropDown("Login", aDropDown);
        aToggleable.addChild(new BootstrapButton(EBootstrapButtonType.SUCCESS).addChild(EPhotonCoreText.BUTTON_SIGN_UP.getDisplayText(aDisplayLocale)).setOnClick(aLEC.getLinkToMenuItem(CMenuPublic.MENU_SIGN_UP)).addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2));
    }
    return aNavbar;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) HCStrong(com.helger.html.hc.html.textlevel.HCStrong) BootstrapNavbarNav(com.helger.photon.bootstrap4.navbar.BootstrapNavbarNav) BootstrapNavbar(com.helger.photon.bootstrap4.navbar.BootstrapNavbar) BootstrapDropdownMenu(com.helger.photon.bootstrap4.dropdown.BootstrapDropdownMenu) ISimpleURL(com.helger.commons.url.ISimpleURL) IUser(com.helger.photon.security.user.IUser) BootstrapNavbarToggleable(com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) Nonnull(javax.annotation.Nonnull)

Example 12 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan 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)

Aggregations

HCSpan (com.helger.html.hc.html.textlevel.HCSpan)12 Nonnull (javax.annotation.Nonnull)12 ISimpleURL (com.helger.commons.url.ISimpleURL)8 HCDiv (com.helger.html.hc.html.grouping.HCDiv)6 HCNodeList (com.helger.html.hc.impl.HCNodeList)6 BootstrapNavbar (com.helger.photon.bootstrap4.navbar.BootstrapNavbar)6 Locale (java.util.Locale)6 HCStrong (com.helger.html.hc.html.textlevel.HCStrong)5 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)5 BootstrapContainer (com.helger.photon.bootstrap4.layout.BootstrapContainer)5 IUser (com.helger.photon.security.user.IUser)5 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)5 BootstrapBreadcrumb (com.helger.photon.bootstrap4.breadcrumb.BootstrapBreadcrumb)4 BootstrapNavbarToggleable (com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable)4 SimpleURL (com.helger.commons.url.SimpleURL)2 HCP (com.helger.html.hc.html.grouping.HCP)2 HCA (com.helger.html.hc.html.textlevel.HCA)2 HCSmall (com.helger.html.hc.html.textlevel.HCSmall)2 NonBlockingStack (com.helger.commons.collection.NonBlockingStack)1 CommonsHashSet (com.helger.commons.collection.impl.CommonsHashSet)1