static void addMenuComponent(final PageParameter pp) { final MenuBean menu = (MenuBean) pp.addComponentBean("AbstractHeaderPage_menu", MenuBean.class) .setMenuEvent(EMenuEvent.mouseenter) .setSelector(".re .acts .link_menuicon"); final AbstractElement<?>[] eles = new AbstractElement[] { ModuleContextFactory.get(IMyPortalWebContext.class).toMyPortalElement(pp), ModuleContextFactory.get(IFavoriteWebContext.class).toMyFavoriteElement(pp) }; for (final AbstractElement<?> ele : eles) { if (ele instanceof LinkElement) { final LinkElement link = (LinkElement) ele; if ("-".equals(link.getText())) { menu.addItem(MenuItem.sep()); } else { menu.addItem(MenuItem.of(link.getText()).setUrl(link.getHref())); } } } menu.addItem(MenuItem.sep()); menu.addItem( MenuItem.of($m("DemoTemplateT1.0")).setUrl(AbstractMVCPage.url(UserAttriPageT2.class))); }
static String toActionsHTML(final PageParameter pp, final AbstractHeaderPage page) { final StringBuilder sb = new StringBuilder(); if (pp.getLoginId() == null) { sb.append(page.str_Login(pp)); } else { sb.append("<div class='acts'>"); sb.append( ModuleContextFactory.get(IMessageWebContext.class) .toMyMessageElement(pp) .setId("AbstractHeaderPage_sup")); sb.append(SpanElement.SEP()) .append(page.str_User(pp)) .append(SpanElement.SEP()) .append(page.str_Logout(pp)); sb.append("</div>"); sb.append("<div class='user'>").append(page.str_Photo(pp)).append("</div>"); sb.append(BlockElement.CLEAR); sb.append(HtmlConst.TAG_SCRIPT_START); sb.append(AbstractHeaderPage.js_shake("#AbstractHeaderPage_sup .highlight")); sb.append(HtmlConst.TAG_SCRIPT_END); } return sb.toString(); }