/** * 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(); }
/** * 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 values with the full properties keys as a List of {@link ResourceBundleKey}. * * @return the display values */ public List<ResourceBundleKey> getDisplayValues() { final List<ResourceBundleKey> rbk = new ArrayList<>(); for (final ResourceBundleKey key : getValues()) { final ResourceBundleKey clone = (ResourceBundleKey)key.clone(); clone.setKey(getPropertiesKey(key.getKey())); rbk.add(clone); } return rbk; } }
@Override public String getString(final BundleApplication bundleApplication, final BundleKey bundleKey) { final BundleApplications owner = resourcebundlesService.find(bundleApplication.getName()); final Resourcebundles resourcebundles = resourcebundlesService.getResourcebundle(owner, bundleKey.getBaseName(), bundleKey.getLocale(), bundleKey.getResourceBundleKey().getKey()); if (resourcebundles != null) { Resourcebundle domainObject = getMapper().toDomainObject(resourcebundles); return domainObject.getValue().getName(); } return ""; }
/** * 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(); }
/** * 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; }
/** * 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(); }
/** * 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 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 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(); }
/** * {@inheritDoc} */ @Override public Object getDisplayValue(final String object) { final IModel<String> resourceModel = ResourceModelFactory.newResourceModel(ResourceBundleKey .builder().key(propertiesKeyPrefix + "." + object).defaultValue("").build(), component); final String value = resourceModel.getObject(); return value; }
/** * 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()); }
/** * 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()); }
/** * {@inheritDoc} */ @Override public Object getDisplayValue(final String object) { final IModel<String> resourceModel = ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key(object).defaultValue("").build(), component); final String value = resourceModel.getObject(); return value; }
/** * {@inheritDoc} */ @Override public Object getDisplayValue(final String object) { final String splitString = "=>"; final String[] splittedValue = object.split(splitString); final StringBuilder sb = new StringBuilder(); if (splittedValue.length == 1) { final IModel<String> resourceModel = ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key(splittedValue[0]).defaultValue("").build(), component); sb.append(resourceModel.getObject()); } else { IModel<String> resourceModel = ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key(splittedValue[0]).defaultValue("").build(), component); sb.append(resourceModel.getObject()); sb.append(splitString); resourceModel = ResourceModelFactory.newResourceModel( ResourceBundleKey.builder().key(splittedValue[1]).defaultValue("").build(), component); sb.append(resourceModel.getObject()); } return sb.toString(); }
/** * 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 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 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 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); }
/** * 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); }