Model<String> strMdl = Model.of("My old message"); Label msg = new Label("label", strMdl); msg.setOutputMarkupId(true); add(msg);
/** * {@inheritDoc} */ @Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getDefaultModelObjectAsString()); }
/** * Converts model object into the display value * * @return display value */ private String getStringValue() { T value = getModelObject(); String converted = value != null ? getString(resourceKey(value)) : nullValue(); return getDefaultModelObjectAsString(converted); }
/** * Override this method to provide your own implementation of a Label. * * @param id the component id * @param model the component model * @param titleModel the title model * @return the label to use */ protected Label newTitleLabel(String id, IModel<T> model, IModel<String> titleModel){ return new Label(id, titleModel); }
/** * creates a new label component * * @param markupId the component id of the label * @return new label component */ protected <L extends Serializable> Component newLabel(final String markupId, IModel<L> model) { return new Label(markupId, model) .setRenderBodyOnly(true); }
/** * sets the subtitle model. * * @param subtitle The subtitle as model * @return this component's instance */ public final PageHeader setSubtitle(final IModel<String> subtitle) { this.subtitle.setDefaultModel(subtitle); return this; } }
@Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getStringValue()); }
/** * Gets model object * * @return model object */ @SuppressWarnings("unchecked") public final T getModelObject() { return (T)getDefaultModelObject(); }
/** * creates a new help label that contains a help message for the form field. This field * will be set to invisible if there is no content. * * @param id the component id * @param model the content model for this component * @return new help label */ protected Component newHelpLabel(final String id, final IModel<String> model) { return new Label(id, model); }
/** * creates a new icon component with given {@link IconType}. * * @param markupId The component' id * @param labelModel The label text as model * @return new label component */ protected Component createButtonLabel(final String markupId, final IModel<?> labelModel) { final Label label = new Label(markupId, labelModel); label.setRenderBodyOnly(true); return label; }
/** * sets the label of the button. * * @param label the new button label * @return reference to the current instance */ public TypedAjaxLink<T> setLabel(IModel<?> label) { this.label.setDefaultModel(label); return this; }
/** * Converts model object into the display value * * @return display value */ private String getStringValue() { T value = getModelObject(); String converted = value != null ? getString(resourceKey(value)) : nullValue(); return getDefaultModelObjectAsString(converted); }
/** * {@inheritDoc} */ @Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getDefaultModelObjectAsString()); }
@Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getStringValue()); }
private ListView getListView(final String id, final List<DocumentMetadataEntry> metaDataList) { return new ListView<DocumentMetadataEntry>(id, metaDataList) { @Override protected void populateItem(ListItem item) { final DocumentMetadataEntry entry = (DocumentMetadataEntry) item.getModelObject(); item.add(new Label("key", entry.getKey())); item.add(new Label("value", entry.getValue())); } }; }
/** * sets the label of the button. * * @param label the new button label * @return reference to the current instance */ public TypedBookmarkablePageLink<T> setLabel(IModel<?> label) { this.label.setDefaultModel(label); return this; }
/** * Converts model object into the display value * * @return display value */ private String getStringValue() { T value = getModelObject(); String converted = value != null ? getString(resourceKey(value)) : nullValue(); return getDefaultModelObjectAsString(converted); }
/** * Creates the content component (label in this case) for the node * * @param componentId * @param tree * @param model * @return content component */ protected Component newContentComponent(String componentId, BaseTree tree, IModel model) { return new Label(componentId, model); }
/** * Sets the header message. * * @param header The header message. * @return This instance for chaining. */ public Alert withHeader(IModel<String> header) { this.blockHeader.setDefaultModel(header); this.inlineHeader.setDefaultModel(header); return this; }
/** * sets the label of the button. * * @param label the new button label * @return reference to the current instance */ @Override public TypedAjaxButton setLabel(IModel<String> label) { this.label.setDefaultModel(label); return this; }