/** * Factory method to create a new {@link StringResourceModel} from the given * {@link ResourceBundleKey}. * * @param resourceBundleKey * the resource bundle key * @return a new {@link StringResourceModel} as an {@link IModel} */ public static IModel<String> newResourceModel(final ResourceBundleKey resourceBundleKey) { IModel<String> resourceModel; final String resourceKey = resourceBundleKey.getKey(); resourceModel = newResourceModel(resourceKey, resourceBundleKey.getParameters(), null, resourceBundleKey.getDefaultValue()); return resourceModel; }
/** * Gets the display value. * * @param resourceBundleKey * the {@link ResourceBundleKey} object * @return the display value */ @Override public String getDisplayValue(final ResourceBundleKey resourceBundleKey) { return ResourceModelFactory .newResourceModel(getPropertiesKey(resourceBundleKey.getKey()), resourceBundleKey.getParameters(), component, resourceBundleKey.getDefaultValue()) .getObject(); }
/** * Factory method to create a new {@link StringResourceModel} from the given ResourceBundleKey. * * @param resourceBundleKey * the resource bundle key * @param component * the component * @return a new {@link StringResourceModel} as an {@link IModel} */ public static IModel<String> newResourceModel(final ResourceBundleKey resourceBundleKey, final Component component) { IModel<String> resourceModel; final String resourceKey = resourceBundleKey.getKey(); resourceModel = newResourceModel(resourceKey, resourceBundleKey.getParameters(), component, resourceBundleKey.getDefaultValue()); return resourceModel; }
/** * Factory method to create a new {@link StringResourceModel} from the given parameters. * * @param resourceBundleKey * the resource bundle key * @param component * the component * @param model * the model * @return a new {@link StringResourceModel} as an {@link IModel} */ public static IModel<String> newResourceModel(final ResourceBundleKey resourceBundleKey, final Component component, IModel<?> model) { IModel<String> resourceModel; resourceModel = newResourceModel(resourceBundleKey.getKey(), component, model, resourceBundleKey.getDefaultValue(), resourceBundleKey.getParameters()); return resourceModel; }
/** * 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()); }