Beispiel #1
0
 /** @see org.apache.wicket.Component#setDefaultModel(org.apache.wicket.model.IModel) */
 @Override
 public Component setDefaultModel(IModel<?> model) {
   // Null out the image resource, so we reload it (otherwise we'll be
   // stuck with the old model.
   localizedImageResource.setResourceReference(null);
   localizedImageResource.setResource(null);
   return super.setDefaultModel(model);
 }
Beispiel #2
0
  /**
   * Processes the component tag.
   *
   * @param tag Tag to modify
   * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
   */
  @Override
  protected final void onComponentTag(final ComponentTag tag) {
    checkComponentTag(tag, "input");
    checkComponentTagAttribute(tag, "type", "image");

    final IResource resource = getImageResource();
    if (resource != null) {
      localizedImageResource.setResource(resource);
    }
    final ResourceReference resourceReference = getImageResourceReference();
    if (resourceReference != null) {
      localizedImageResource.setResourceReference(resourceReference);
    }
    localizedImageResource.setSrcAttribute(tag);
    super.onComponentTag(tag);
  }
Beispiel #3
0
  /** @see org.apache.wicket.Component#onComponentTag(ComponentTag) */
  @Override
  protected void onComponentTag(final ComponentTag tag) {
    checkComponentTag(tag, "img");
    super.onComponentTag(tag);
    final IResource resource = getImageResource();
    if (resource != null) {
      localizedImageResource.setResource(resource);
    }
    final ResourceReference resourceReference = getImageResourceReference();
    if (resourceReference != null) {
      localizedImageResource.setResourceReference(resourceReference);
    }
    localizedImageResource.setSrcAttribute(tag);

    if (shouldAddAntiCacheParameter()) {
      addAntiCacheParameter(tag);
    }
  }
Beispiel #4
0
 /** @see org.apache.wicket.Component#getStatelessHint() */
 @Override
 protected boolean getStatelessHint() {
   return (getImageResource() == null
           || getImageResource() == localizedImageResource.getResource())
       && localizedImageResource.isStateless();
 }
Beispiel #5
0
 /** @return ResourceReference returned from subclass */
 protected ResourceReference getImageResourceReference() {
   return localizedImageResource.getResourceReference();
 }
Beispiel #6
0
 /**
  * @param resourceReference The shared ImageResource to set.
  * @param parameters Set the resource parameters for the resource.
  */
 public void setImageResourceReference(
     final ResourceReference resourceReference, final PageParameters parameters) {
   localizedImageResource.setResourceReference(resourceReference, parameters);
 }
Beispiel #7
0
 /** @param resourceReference The shared ImageResource to set. */
 public void setImageResourceReference(final ResourceReference resourceReference) {
   localizedImageResource.setResourceReference(resourceReference);
 }
Beispiel #8
0
 /** @param imageResource The new ImageResource to set. */
 public void setImageResource(final IResource imageResource) {
   localizedImageResource.setResource(imageResource);
 }
Beispiel #9
0
 /** @see org.apache.wicket.IResourceListener#onResourceRequested() */
 @Override
 public void onResourceRequested() {
   localizedImageResource.onResourceRequested(null);
 }