/** * Factory method for create a new {@link ResourceBundleKey} for the header of the {@link Label} * . This method is invoked in the constructor from the derived classes and can be overridden so * users can provide their own version of a new {@link ResourceBundleKey} for the header of the * {@link Label}. Note: this method is only invoked if model is null of this panel. * * @return the new {@link IModel}. */ protected ResourceBundleKey newHeaderResourceKey() { return ResourceBundleKey.builder().key("header.label").build(); }
/** * Resolves the locale from the given properties file. * * @param propertiesFile * the properties file * @return the locale */ public static Locale resolveLocale(final File propertiesFile) { return LocaleResolver.resolveLocale(propertiesFile, true); }
/** * Gets the locale name for instance 'de_DE' for the Locale.GERMANY. * * @param locale * the locale * @return the locale name */ public static String getLocaleName(final Locale locale) { return getLocaleFileSuffix(locale, true, true, false); }
/** * Creates a new {@link IModel} from the given key. * * @param key * the key * @return the new {@link IModel} from the given key. */ protected IModel<String> newIModel(final String key) { return ResourceModelFactory.newResourceModel(ResourceBundleKey.builder().key(key) .defaultValue("").build(), this); }
/** * Resolves the {@link String} object from the given {@link BundleKey}. * * @param bundleKey * the bundle key * @return the {@link String} value from the given {@link BundleKey}. * @throws MissingResourceException * is thrown if the given key is missing */ public static String getString(final BundleKey bundleKey) throws MissingResourceException { return getString(bundleKey.getBaseName(), bundleKey.getLocale(), bundleKey.getResourceBundleKey().getKey(), bundleKey.getResourceBundleKey().getDefaultValue(), bundleKey.getResourceBundleKey().getParameters()); }
/** * Gets the display country name from the given country code in the given {@link Locale}. * * @param countryCode * the country code * @param inLocale * The locale for which to retrieve the display country * @return the country name */ public static String getCountryName(String countryCode, Locale inLocale) { return getCountryName(countryCode, inLocale, countryCode); }
/** * Factory method that can be overwritten for new meta tag content for the title. * * @return the new <code>{@link IModel}</code> for the meta tag content for title. */ protected IModel<String> newTitle() { return ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("page.title").defaultValue("Home page").build(), this); }
/** * Factory method for create a new {@link ResourceBundleKey} for the header of the {@link Label} * . This method is invoked in the constructor from the derived classes and can be overridden so * users can provide their own version of a new {@link ResourceBundleKey} for the header of the * {@link Label}. Note: this method is only invoked if model is null of this panel. * * @return the new {@link IModel}. */ protected ResourceBundleKey newHeaderResourceKey() { return ResourceBundleKey.builder().key("header.label").build(); }
/** * Resolves the {@link Locale} object from the given locale code. If not found the system * default locale will be taken. * * @param localeCode * the locale code * @return the {@link Locale} object. */ public static Locale resolveLocale(final String localeCode) { return resolveLocale(localeCode, true); }
/** * Gets the locale file name suffix that has the format 'language_COUNTRY_variant' for instance * 'de_DE' for the Locale.GERMANY. * * @param locale * the locale * @return the locale name */ public static String getLocaleFilenameSuffix(final Locale locale) { return getLocaleFileSuffix(locale, true, true, false); }
/** * Factory method that can be overwritten for new meta tag content for description. * * @return the new <code>IModel</code> */ protected IModel<String> newDescription() { return ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("page.meta.description").defaultValue("").build(), this); }
/** * Factory method for create a new {@link ResourceBundleKey} for the content of the * {@link MultiLineLabel}. This method is invoked in the constructor from the derived classes * and can be overridden so users can provide their own version of a new * {@link ResourceBundleKey} for the content of the {@link MultiLineLabel}. Note: this method is * only invoked if model is null of this panel. * * @return the new {@link IModel}. */ protected ResourceBundleKey newContentResourceKey() { return ResourceBundleKey.builder().key("content.label").build(); }
/** * Gets the locale file name suffix for instance '_de_DE' for the Locale.GERMANY. * * @param locale * the locale * @param withCountry * the with country * @return the locale file suffix */ public static String getLocaleFileSuffix(final Locale locale, final boolean withCountry) { return getLocaleFileSuffix(locale, withCountry, false); }
/** * Factory method that can be overwritten for new meta tag content for keywords. * * @return the new <code>IModel</code> */ protected IModel<String> newKeywords() { return ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("page.meta.keywords").defaultValue("").build(), this); }
/** * Factory method for create a new {@link ResourceBundleKey} for the content of the * {@link MultiLineLabel}. This method is invoked in the constructor from the derived classes * and can be overridden so users can provide their own version of a new * {@link ResourceBundleKey} for the content of the {@link MultiLineLabel}. Note: this method is * only invoked if model is null of this panel. * * @return the new {@link IModel}. */ protected ResourceBundleKey newContentResourceKey() { return ResourceBundleKey.builder().key("content.label").build(); }
/** * Creates a new {@link IModel} from the given key. * * @param key * the key * @return the new {@link IModel} from the given key. */ protected IModel<String> newIModel(final String key) { return ResourceModelFactory .newResourceModel(ResourceBundleKey.builder().key(key).defaultValue("").build(), this); }
/** * Factory method to create a new {@link StringResourceModel} from the given ResourceBundleKey. * * @param resourceBundleKey * the resource bundle key as String * @return a new {@link StringResourceModel} as an {@link IModel} */ public static IModel<String> newResourceModel(final String resourceBundleKey) { return newResourceModel(ResourceBundleKey.builder().key(resourceBundleKey).build()); }
/** * Factory method that can be overwritten for new meta tag content for keywords. * * @return the new <code>{@link IModel}</code> for the meta tag content for keywords. */ protected IModel<String> newKeywords() { return ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("page.meta.keywords").defaultValue("").build(), this); }
/** * Factory method that can be overwritten for new meta tag content for the title. * * @return the new <code>IModel</code> */ protected IModel<String> newTitle() { return ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key("page.title").defaultValue("Home page").build(), this); }
/** * Factory method to create a new StringResourceModel from the given key. * * @param key * the key * @return the new {@link IModel} */ protected IModel<String> newIModel(final String key) { return ResourceModelFactory.newResourceModel(ResourceBundleKey.builder().key(key) .defaultValue("").build(), this); }