/** * Returns the label for the given <code>key</code>. * * @param key the key to the requested label. * @return the label to the <code>key</code> or the <code>key</code>, if no * label is found for that <code>key</code>. */ public String getLabel(final String key) { return getLabel(key, key); }
protected void renderBodyStart() { sink.section1(); sink.sectionTitle1(); sink.text(messages.getLabel(messages.getReportTitleId())); sink.sectionTitle1_(); sink.paragraph(); sink.text(messages.getLabel(messages.getReportDescriptionId())); sink.paragraph_(); }
/** * Default constructor. * * @param reportTitleId the localized report title. * @param reportDescriptionId the localized report description. * @param messages the primary message bundle to use. * @param defaultMessages the default messages that are used if the * {@link #messages} contain no value for a given key. * @throws NullPointerException if <code>defaultMessages</code> is * <code>null</code>. */ public MessageHelper(final String reportTitleId, final String reportDescriptionId, final ResourceBundle messages, final ResourceBundle defaultMessages) throws NullPointerException { checkArguments(defaultMessages); this.reportTitleId = reportTitleId; this.reportDescriptionId = reportDescriptionId; this.messages = messages; this.defaultMessages = defaultMessages; }
/** * Returns the label for the given <code>key</code>. * * @param key the key to the requested label. * @param defaultLabel the label to return if no label is found by the * <code>key</code>. * @return the label to the <code>key</code> or the <code>defaultLabel</code>, * if no label is found for that <code>key</code>. */ public String getLabel(final String key, final String defaultLabel) { String label = getStringFromMessages(key); if (label == null) { label = getStringFromDefaultMessages(key, defaultLabel); } return label; }
protected void renderPageStart() { sink.head(); sink.title(); sink.text(messages.getLabel(messages.getReportTitleId())); sink.title_(); sink.head_(); sink.body(); }
private void initMessages(final Locale locale) { if (messages == null) { final ResourceBundle primaryMessages = getPrimaryBundle(locale); final ResourceBundle defaultMessages = getBundle(locale); final String nameId = StringUtils.isNotBlank(name) ? name : "report.name." + outputName; final String descriptionId = StringUtils.isNotBlank(description) ? description : "report.description." + outputName; messages = new MessageHelper(nameId, descriptionId, primaryMessages, defaultMessages); } }
protected void renderPageStart() { sink.head(); sink.title(); sink.text(messages.getLabel(messages.getReportTitleId())); sink.title_(); sink.head_(); sink.body(); }
private void initMessages(final Locale locale) { if (messages == null) { final ResourceBundle primaryMessages = getPrimaryBundle(locale); final ResourceBundle defaultMessages = getBundle(locale); final String nameId = StringUtils.isNotBlank(name) ? name : "report.name." + outputName; final String descriptionId = StringUtils.isNotBlank(description) ? description : "report.description." + outputName; messages = new MessageHelper(nameId, descriptionId, primaryMessages, defaultMessages); } }
void renderInPageLink(final String id) { final String label = messages.getLabel(id); renderInPageLink(label, id); }
protected void renderBodyStart() { sink.section1(); sink.sectionTitle1(); sink.text(messages.getLabel(messages.getReportTitleId())); sink.sectionTitle1_(); sink.paragraph(); sink.text(messages.getLabel(messages.getReportDescriptionId())); sink.paragraph_(); }
void renderInPageLink(final String id) { final String label = messages.getLabel(id); renderInPageLink(label, id); }
/** * {@inheritDoc} * * @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale) */ public String getName(final Locale locale) { initMessages(locale); return StringUtils.isNotBlank(name) ? name : messages .getLabel("report.name." + outputName); }
/** * Renders the footer text. */ protected void renderFooter() { final String footerText = messages.getLabel("report.footer"); if (StringUtils.isNotBlank(footerText)) { sink.rawText(footerText); } }
/** * Renders the footer text. */ protected void renderFooter() { final String footerText = messages.getLabel("report.footer"); if (StringUtils.isNotBlank(footerText)) { sink.rawText(footerText); } }
/** * {@inheritDoc} * * @see org.apache.maven.reporting.MavenReport#getDescription(java.util.Locale) */ public String getDescription(final Locale locale) { initMessages(locale); return StringUtils.isNotBlank(description) ? description : messages .getLabel("report.description." + outputName); }
/** * {@inheritDoc} * * @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale) */ public String getName(final Locale locale) { initMessages(locale); return StringUtils.isNotBlank(name) ? name : messages .getLabel("report.name." + outputName); }
/** * {@inheritDoc} * * @see org.apache.maven.reporting.MavenReport#getDescription(java.util.Locale) */ public String getDescription(final Locale locale) { initMessages(locale); return StringUtils.isNotBlank(description) ? description : messages .getLabel("report.description." + outputName); }