Search in sources :

Example 1 with MenuItemDeterminatorCallback

use of com.helger.photon.core.menu.MenuItemDeterminatorCallback in project phoss-smp by phax.

the class SMPRendererPublic method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
    // Main menu
    final IMenuTree aMenuTree = aLEC.getMenuTree();
    final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {

        @Override
        protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
            // Don't show items that belong to the footer
            if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER))
                return false;
            // Use default code
            return super.isMenuItemValidToBeDisplayed(aMenuObj);
        }
    };
    return BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
}
Also used : Nonnull(javax.annotation.Nonnull) IMenuTree(com.helger.photon.core.menu.IMenuTree) IMenuObject(com.helger.photon.core.menu.IMenuObject) MenuItemDeterminatorCallback(com.helger.photon.core.menu.MenuItemDeterminatorCallback) Nonnull(javax.annotation.Nonnull)

Example 2 with MenuItemDeterminatorCallback

use of com.helger.photon.core.menu.MenuItemDeterminatorCallback in project phoss-directory by phax.

the class PublicHTMLProvider method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
    // Main menu
    final IMenuTree aMenuTree = aLEC.getMenuTree();
    final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {

        @Override
        protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
            // Don't show items that belong to the footer
            if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER))
                return false;
            // Use default code
            return super.isMenuItemValidToBeDisplayed(aMenuObj);
        }
    };
    final IHCElement<?> aMenu = BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
    return aMenu;
}
Also used : Nonnull(javax.annotation.Nonnull) IMenuTree(com.helger.photon.core.menu.IMenuTree) IMenuObject(com.helger.photon.core.menu.IMenuObject) MenuItemDeterminatorCallback(com.helger.photon.core.menu.MenuItemDeterminatorCallback) Nonnull(javax.annotation.Nonnull)

Example 3 with MenuItemDeterminatorCallback

use of com.helger.photon.core.menu.MenuItemDeterminatorCallback in project peppol-practical by phax.

the class LayoutAreaContentProviderPublic method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
    // Main menu
    final IMenuTree aMenuTree = aLEC.getMenuTree();
    final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {

        @Override
        protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
            // Don't show items that belong to the footer
            if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL1) || aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL2) || aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL3))
                return false;
            // Use default code
            return super.isMenuItemValidToBeDisplayed(aMenuObj);
        }
    };
    final IHCElement<?> aMenu = BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
    // Add PayPal
    HCForm aPayPal = null;
    if (!GlobalDebug.isDebugMode()) {
        aPayPal = new HCForm(new SimpleURL("https://www.paypal.com/cgi-bin/webscr")).setTarget(HC_Target.TOP).addClass(CSS_CLASS_PAYPAL).addClass(CBootstrapCSS.MT_2);
        aPayPal.addChild(new HCHiddenField("cmd", "_s-xclick"));
        aPayPal.addChild(new HCHiddenField("encrypted", "-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9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2lDCRPJt36iBotZuFEgzOsnhv1PVAAdNKMxSuvEFjP1gOkA3ZgaVzPLPteHGCVZ5eU2syP8259AdEC1AFCCUHt2eRg1po6qv2LJoNm-----END PKCS7-----\r\n"));
        aPayPal.addChild(new HCInput().setType(EHCInputType.IMAGE).setSrc(new SimpleURL("https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif")).setName("submit").setAlt("PayPal - The safer, easier way to pay online!"));
        aPayPal.addChild(new HCImg().setAlt("").setSrc(new SimpleURL("https://www.paypalobjects.com/de_DE/i/scr/pixel.gif")).setExtent(1, 1));
    }
    return new HCNodeList().addChild(aMenu).addChild(aPayPal);
}
Also used : HCForm(com.helger.html.hc.html.forms.HCForm) HCInput(com.helger.html.hc.html.forms.HCInput) HCNodeList(com.helger.html.hc.impl.HCNodeList) Nonnull(javax.annotation.Nonnull) HCHiddenField(com.helger.html.hc.html.forms.HCHiddenField) IMenuTree(com.helger.photon.core.menu.IMenuTree) IMenuObject(com.helger.photon.core.menu.IMenuObject) HCImg(com.helger.html.hc.html.embedded.HCImg) MenuItemDeterminatorCallback(com.helger.photon.core.menu.MenuItemDeterminatorCallback) SimpleURL(com.helger.commons.url.SimpleURL) ISimpleURL(com.helger.commons.url.ISimpleURL) Nonnull(javax.annotation.Nonnull)

Aggregations

IMenuObject (com.helger.photon.core.menu.IMenuObject)3 IMenuTree (com.helger.photon.core.menu.IMenuTree)3 MenuItemDeterminatorCallback (com.helger.photon.core.menu.MenuItemDeterminatorCallback)3 Nonnull (javax.annotation.Nonnull)3 ISimpleURL (com.helger.commons.url.ISimpleURL)1 SimpleURL (com.helger.commons.url.SimpleURL)1 HCImg (com.helger.html.hc.html.embedded.HCImg)1 HCForm (com.helger.html.hc.html.forms.HCForm)1 HCHiddenField (com.helger.html.hc.html.forms.HCHiddenField)1 HCInput (com.helger.html.hc.html.forms.HCInput)1 HCNodeList (com.helger.html.hc.impl.HCNodeList)1