/** * Construct. * * @param id the component id * @param model the default image url */ public ThumbnailBorder(String id, IModel<String> model) { super(id, model); add(title = new Label("title", Model.of("")), image = new Label("image").add(new AttributeModifier("url", getDefaultModel()))); }
@Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); checkComponentTag(tag, "div"); Attributes.addClass(tag, "img-thumbnail"); }
@Override protected void onConfigure() { super.onConfigure(); Components.hideIfModelIsEmpty(title); image.setVisible(!Strings.isEmpty(getDefaultModelObjectAsString())); } }