|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwicket.markup.html.image.resource.LocalizedImageResource
public final class LocalizedImageResource
THIS CLASS IS INTENDED FOR INTERNAL USE IN IMPLEMENTING LOCALE SENSITIVE COMPONENTS THAT USE IMAGE RESOURCES AND SHOULD NOT BE USED DIRECTLY BY END-USERS.
This class contains the logic for extracting static image resources referenced by the SRC attribute of component tags and keeping these static image resources in sync with the component locale.
If no image is specified by the SRC attribute of an IMG tag, then any VALUE
attribute is inspected. If there is a VALUE attribute, it must be of the form
"[factoryName]:[sharedImageName]?:[specification]". [factoryName] is the name
of a resource factory that has been added to Application (for example,
DefaultButtonImageResourceFactory is installed by default under the name
"buttonFactory"). The [sharedImageName] value is optional and gives a name
under which a given generated image is shared. For example, a cancel button
image generated by the VALUE attribute "buttonFactory:cancelButton:Cancel" is
shared under the name "cancelButton" and this specification will cause a
component to reference the same image resource no matter what page it appears
on, which is a very convenient and efficient way to create and share images.
The [specification] string which follows the second colon is passed directly
to the image factory and its format is dependent on the specific image
factory. For details on the default buttonFactory, see
DefaultButtonImageResourceFactory.
Finally, if there is no SRC attribute and no VALUE attribute, the Image component's model is converted to a String and that value is used as a path to load the image.
| Field Summary |
|---|
| Fields inherited from interface wicket.IResourceListener |
|---|
INTERFACE |
| Constructor Summary | |
|---|---|
LocalizedImageResource(Component component)
Constructor |
|
| Method Summary | |
|---|---|
void |
bind()
Binds this resource if it is shared |
void |
onResourceRequested()
Called when a resource is requested. |
void |
setResource(Resource resource)
|
void |
setResourceReference(ResourceReference resourceReference)
|
void |
setResourceReference(ResourceReference resourceReference,
ValueMap resourceParameters)
|
void |
setSrcAttribute(ComponentTag tag)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LocalizedImageResource(Component component)
component - The component that owns this localized image resource| Method Detail |
|---|
public final void bind()
public final void onResourceRequested()
IResourceListener
onResourceRequested in interface IResourceListenerIResourceListener.onResourceRequested()public final void setResource(Resource resource)
resource - The resource to set.public final void setResourceReference(ResourceReference resourceReference)
resourceReference - The resource to set.
public final void setResourceReference(ResourceReference resourceReference,
ValueMap resourceParameters)
resourceReference - The resource to set.resourceParameters - The resource parameters for the shared resourcepublic final void setSrcAttribute(ComponentTag tag)
tag - The tag to inspect for an optional src attribute that might
reference an image.
WicketRuntimeException - Thrown if an image is required by the caller, but none can be
found.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||