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))); }
@Override protected Map<String, Object> getRowData(final ComponentParameter cp, final Object dataObject) { final NewsAttachment attachment = (NewsAttachment) dataObject; final KVMap kv = new KVMap(); try { final AttachmentFile af = newsContext.getAttachmentService().createAttachmentFile(attachment); kv.put( "topic", new LinkElement(attachment.getTopic()) .setOnclick(JS.loc(DownloadUtils.getDownloadHref(af), true)) .setTitle(attachment.getDescription())); } catch (final IOException e) { kv.put("topic", attachment.getTopic()); } kv.put("attachsize", FileUtils.toFileSize(attachment.getAttachsize())); final Class<? extends Enum<?>> eClass = ((NewsFormAttachPage) get(cp)).getAttachmentTypeClass(); if (eClass != null) { kv.put("attachtype", eClass.getEnumConstants()[attachment.getAttachtype()]); } if (((INewsWebContext) newsContext).getLogRef() != null) { kv.put( "downloads", LinkElement.style2(attachment.getDownloads()) .setOnclick( "$Actions['NewsTabAttachPage_logWin']('beanId=" + attachment.getId() + "');")); } else { kv.put("downloads", attachment.getDownloads()); } kv.put("userId", cp.getUser(attachment.getUserId())); kv.put("createDate", attachment.getCreateDate()); kv.add(TablePagerColumn.OPE, toOpeHTML(cp, attachment)); return kv; }