Package org.apache.wicket.model
Class ResourceModel
java.lang.Object
org.apache.wicket.model.ResourceModel
- All Implemented Interfaces:
Serializable
,IComponentAssignedModel<String>
,IDetachable
,IModel<String>
,IClusterable
A model that represents a localized resource string. This is a lightweight version of the
StringResourceModel
. It lacks parameter substitutions, but is generally easier to use.
If you don't use this model as primary component model (you don't specify it in component
constructor and don't assign it to component using Component.setDefaultModel(IModel)
),
you will need to connect the model with a component using wrapOnAssignment(Component)
.
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
-
Constructor Summary
ConstructorDescriptionResourceModel
(String resourceKey) ConstructorResourceModel
(String resourceKey, String defaultValue) ConstructorResourceModel
(String resourceKey, IModel<String> defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionGets the model object.final void
Sets the model object.wrapOnAssignment
(Component component) This method is called when the component gets its model assigned.
-
Constructor Details
-
ResourceModel
Constructor- Parameters:
resourceKey
- key of the resource this model represents
-
ResourceModel
Constructor- Parameters:
resourceKey
- key of the resource this model representsdefaultValue
- value that will be returned if resource does not exist
-
ResourceModel
-
-
Method Details
-
getObject
Description copied from interface:IModel
Gets the model object. -
setObject
Description copied from interface:IModel
Sets the model object. -
wrapOnAssignment
Description copied from interface:IComponentAssignedModel
This method is called when the component gets its model assigned. WARNING: Because the model can be assigned in the constructor of component this method can also be called with a 'this' of a component that is not fully constructed yet.- Specified by:
wrapOnAssignment
in interfaceIComponentAssignedModel<String>
- Returns:
- The WrapModel that wraps this model
-