ExternalLink link = new ExternalLink("link", url); Image image = new Image("img", new SharedResourceReference(BasePage.class, "images/MyImage.png") link.add(image); add(link);
/** Constructs the panel with a link containing an image and a label. */ public ImageExternalLink( final String id, final String href, final PackageResourceReference imageRef, final IModel<String> label) { super(id); add(this.link = new ExternalLink("link", href)); link.add(this.image = new Image("image", imageRef)); link.add(this.label = new Label("label", label)); }
/** * Constructs the panel with a link containing an image and a label. */ public ImageExternalLink(final String id, final String href, final ResourceReference imageRef, final IModel<String> label) { super(id); add(this.link = new ExternalLink("link", href)); link.add(this.image = new Image("image", imageRef)); link.add(this.label = new Label("label", label)); }
public SimpleExternalLink(String id, IModel<String> linkModel, IModel<?> labelModel) { super(id, linkModel); add(link = new ExternalLink("link", linkModel)); link.add(label = new Label("label", labelModel)); } }
public SimpleExternalLink(String id, IModel linkModel, IModel labelModel) { super(id, linkModel); add(link = new ExternalLink("link", linkModel)); link.add(label = new Label("label", labelModel)); }
private ExternalLink getSmsLink(final String number) { final ExternalLink smsLink = new ExternalLink("sms", "sms:" + number); smsLink.add(new PresizedImage("smsImage", ImageDef.SMS)); return smsLink; }
/** * Instantiates a new {@link TwitterFollowPanel}. * * @param id * the id * @param model * the model */ public TwitterFollowPanel(final String id, final IModel<TwitterFollowModelBean> model) { super(id, model); final ExternalLink twitterFollowLink = new ExternalLink("url", model.getObject().getUrl()); twitterFollowLink.add(new AttributeModifier("data-show-count", model.getObject() .getShowCount().toString())); add(twitterFollowLink); final Label twitterNameLabel = new Label("twitterNameLabel", model.getObject() .getUsername()); twitterFollowLink.add(twitterNameLabel); }
/** * Instantiates a new {@link TwitterFollowPanel}. * * @param id * the id * @param model * the model */ public TwitterFollowPanel(final String id, final IModel<TwitterFollowModelBean> model) { super(id, model); final ExternalLink twitterFollowLink = new ExternalLink("url", model.getObject().getUrl()); twitterFollowLink.add( new AttributeModifier("data-show-count", model.getObject().getShowCount().toString())); add(twitterFollowLink); final Label twitterNameLabel = new Label("twitterNameLabel", model.getObject().getUsername()); twitterFollowLink.add(twitterNameLabel); }
@Override protected AbstractLink newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { ExternalLink navCont = new ExternalLink(id + "Cont", (String) null); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + increment; navCont.add(new AttributeModifier("class", new NavigationIncrementLinkCssModel(pageable, pageIndex))); // change original wicket-link, so that it always generates href navCont.add(new AjaxPagingNavigationIncrementLink(id, pageable, increment) { @Override protected void disableLink(ComponentTag tag) { } }); return navCont; }
@Override protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { ExternalLink navCont = new ExternalLink(id + "Cont", (String) null); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + pageNumber; navCont.add(new AttributeModifier("class", new PagingNavigationLinkCssModel(pageable, pageIndex, "disabled"))); // change original wicket-link, so that it always generates href navCont.add(new AjaxPagingNavigationLink(id, pageable, pageNumber) { @Override protected void disableLink(ComponentTag tag) { } }); return navCont; }
public ImageLink(String aId, ResourceReference aImageRes, IModel<String> aUrl) { super(aId, aUrl); ExternalLink link = new ExternalLink("link", aUrl); link.add(new Image("image", aImageRes)); add(link); } }
/** * Creates an external link from the given parameters. * * @param linkId * the link id * @param url * the external url * @param labelId * the label id * @param resourceBundleKey * the resource model key * @param component * the component * @return the external link */ public static ExternalLink newExternalLink(final String linkId, final String url, final String labelId, final ResourceBundleKey resourceBundleKey, final Component component) { final ExternalLink externalLink = new ExternalLink(linkId, Model.of(url)); externalLink.add(new Label(labelId, ResourceModelFactory.newResourceModel( resourceBundleKey, component))); return externalLink; }
@Override protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { ExternalLink navCont = new ExternalLink(id + "Cont", (String) null); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + pageNumber; navCont.add(new AttributeModifier("class", new BootstrapPageLinkCssModel( pageable, pageIndex, "disabled"))); // change original wicket-link, so that it always generates href navCont.add(new PagingNavigationLink<Void>(id, pageable, pageNumber)); return navCont; }
/** * Creates an external link from the given parameters. * * @param linkId * the link id * @param url * the external url * @param labelId * the label id * @param resourceBundleKey * the resource model key * @param component * the component * @return the external link */ public static ExternalLink newExternalLink(final String linkId, final String url, final String labelId, final ResourceBundleKey resourceBundleKey, final Component component) { final ExternalLink externalLink = new ExternalLink(linkId, Model.of(url)); externalLink.add(new Label(labelId, ResourceModelFactory.newResourceModel(resourceBundleKey, component))); return externalLink; }
@Override protected AbstractLink newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { ExternalLink navCont = new ExternalLink(id + "Cont", (String) null); // add css for enable/disable link long pageIndex = pageable.getCurrentPage() + increment; navCont.add(new AttributeModifier("class", new BootstrapPageLinkIncrementCssModel(pageable, pageIndex))); // change original wicket-link, so that it always generates href navCont.add(new PagingNavigationIncrementLink<Void>( id, pageable, increment)); return navCont; } }
/** * Factory method for create a new {@link ExternalLink}. * * @param linkId * the link id * @param url * the external url * @param labelId * the label id * @param resourceBundleKey * the resource model key * @param component * the component * @return the external link */ public static ExternalLink newExternalLink(final String linkId, final String url, final String labelId, final ResourceBundleKey resourceBundleKey, final Component component) { final ExternalLink externalLink = new ExternalLink(linkId, Model.of(url)); externalLink.add(new Label(labelId, ResourceModelFactory.newResourceModel( resourceBundleKey, component))); return externalLink; }
@Override public void populateItem(Item<ICellPopulator<Build>> cellItem, String componentId, IModel<Build> rowModel) { Fragment fragment = new Fragment(componentId, "versionFrag", BuildListPanel.this); fragment.add(new BuildStatusIcon("status", rowModel)); ExternalLink link = new ExternalLink("link", rowModel.getObject().getUrl()); link.add(new Label("label", rowModel.getObject().getVersion())); fragment.add(link); cellItem.add(fragment); } });
@Override protected void populateItem(ListItem<ODocument> item) { IModel<ODocument> itemModel = item.getModel(); IModel<String> urlModel = new PropertyModel<String>(itemModel, "url"); IModel<List<ODocument>> subItems = new PropertyModel<List<ODocument>>(itemModel, "subItems"); final boolean hasSubItems = subItems.getObject() != null && !subItems.getObject().isEmpty(); ExternalLink link = new ExternalLink("link", urlModel) .setContextRelative(true); link.add(new FAIcon("icon", new PropertyModel<String>(itemModel, "icon")), new Label("name", new ODocumentNameModel(item.getModel())).setRenderBodyOnly(true)); item.add(link); if (isActiveItem(urlModel)) { link.add(new AttributeAppender("class", " active")); } if (hasSubItems){ item.add(new AttributeAppender("class", " nav-dropdown")); link.add(new AttributeAppender("class", " nav-dropdown-toggle")); } item.add(new RecursiveMenuPanel("subItems", itemModel)); } });
@Override protected void populateItem(ListItem<Build> item) { item.add(new BuildStatusIcon("status", item.getModel())); Build build = item.getModelObject(); item.add(new Label("configuration", build.getConfiguration().getName())); ExternalLink link = new ExternalLink("version", build.getUrl()); link.add(new Label("label", build.getVersion())); item.add(link); }
private WebMarkupContainer createKbInfoContainer(String aId) { WebMarkupContainer wmc = new WebMarkupContainer(aId); wmc.add(new Label("description", kbInfoModel.bind("description")) .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null))); wmc.add(new Label("hostInstitutionName", kbInfoModel.bind("hostInstitutionName")) .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null))); wmc.add(new Label("authorName", kbInfoModel.bind("authorName")) .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null))); wmc.add(new ExternalLink("websiteURL", kbInfoModel.bind("websiteURL"), kbInfoModel.bind("websiteURL")) .add(LambdaBehavior.visibleWhen(() -> kbInfoModel.getObject() != null))); return wmc; }