org.olat.core.gui.components.image
Class ImageComponent

java.lang.Object
  extended by org.olat.core.gui.components.Component
      extended by org.olat.core.gui.components.image.ImageComponent

public class ImageComponent
extends Component

Description:

Author:
Felix Jost

Constructor Summary
ImageComponent(java.lang.String name)
           
 
Method Summary
 java.lang.Long getHeight()
           
 ComponentRenderer getHTMLRendererSingleton()
           
 java.lang.Long getWidth()
           
 void setHeight(java.lang.Long height)
          Sets the height.
 void setMaxWithAndHeightToFitWithin(int maxWidth, int maxHeight)
          Call this method to display the image within a given box of width and height.
 void setMediaResource(MediaResource mediaResource)
          sets the image to be delivered
 void setWidth(java.lang.Long width)
          Sets the width.
 
Methods inherited from class org.olat.core.gui.components.Component
addListener, debuginfoGetListeners, dispatchRequest, getAndClearLatestFiredEvent, getComponentName, getDispatchID, getExtendedDebugInfo, getLatestDispatchedController, getListenerInfo, getParent, getSpanAsDomReplaceable, getTimestamp, getTranslator, isDirty, isDirtyForUser, isDomReplaceable, isEnabled, isVisible, setDirty, setDomReplaceable, setEnabled, setSpanAsDomReplaceable, setVisible, toString, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageComponent

public ImageComponent(java.lang.String name)
Parameters:
name -
Method Detail

getHeight

public java.lang.Long getHeight()
Returns:
Long

getWidth

public java.lang.Long getWidth()
Returns:
Long

setHeight

public void setHeight(java.lang.Long height)
Sets the height.

Parameters:
height - The height to set

setWidth

public void setWidth(java.lang.Long width)
Sets the width.

Parameters:
width - The width to set

setMediaResource

public void setMediaResource(MediaResource mediaResource)
sets the image to be delivered

Parameters:
mediaResource -

getHTMLRendererSingleton

public ComponentRenderer getHTMLRendererSingleton()
Specified by:
getHTMLRendererSingleton in class Component

setMaxWithAndHeightToFitWithin

public void setMaxWithAndHeightToFitWithin(int maxWidth,
                                           int maxHeight)
Call this method to display the image within a given box of width and height. The method does NOT manipulate the image itself, it does only adjust the images width and height tag.
The image will made displayed smaller, it will not enlarge the image since this always looks bad. The scaling is done in a way to get an image that is smaller than the maxWidth or smaller than the maxHeight, depending on whith of the sizes produce a smaller scaling factor.
To scale an image on the filesystem to another width and height, use the ImageHelper.scaleImage() method.

Parameters:
maxWidth -
maxHeight -