org.odftoolkit.simple.draw
Class Image

java.lang.Object
  extended by org.odftoolkit.simple.Component
      extended by org.odftoolkit.simple.draw.Image

public class Image
extends Component

This class provides method to add/remove/get images.

Since:
0.5.5

Method Summary
 String getDesciption()
          Get the description of this image
 Frame getFrame()
          Return the frame who contains this image.
 StyleTypeDefinitions.FrameHorizontalPosition getHorizontalPosition()
          Return the horizontal position
 URI getHyperlink()
          Return the URI of hypertext reference if exists, or else, return null.
 InputStream getImageInputStream()
          Get the image resource as an input stream.
static Image getInstanceof(DrawImageElement imageElement)
          Get a image instance by an instance of DrawImageElement.
 String getInternalPath()
          Get the internal path within the package of the image resource as a string.
 String getMediaTypeString()
          Get the media type of the image resource
 String getName()
          Get the name of this image.
 DrawImageElement getOdfElement()
          Return the instance of "draw:image" element
 Document getOwnerDocument()
          Get the owner document of this image
 FrameRectangle getRectangle()
          Return the rectangle used by this image
 FrameStyleHandler getStyleHandler()
          Return style handler for this frame
 String getTitle()
          Get the title of this image
 StyleTypeDefinitions.FrameVerticalPosition getVerticalPosition()
          Return the vertical position
static Iterator<Image> imageIterator(FrameContainer container)
          Return an iterator of image.
static Image newImage(FrameContainer container, URI uri)
          Create an image and append it at the end of a container element.
static Image newImage(Frame frame, URI uri)
          Create an image and add it to a frame.
 boolean remove()
          Remove the image from the document.
 void setDescription(String description)
          Set the description of this image.
 void setHorizontalPosition(StyleTypeDefinitions.FrameHorizontalPosition horizontalPos)
          Set the horizontal position
 void setHyperlink(URI linkto)
          Add a hypertext reference to this image.
 void setName(String name)
          Set the name of this image.
 void setRectangle(FrameRectangle rectangle)
          Set the rectangle used by this image
 void setTitle(String title)
          Set the title of this image
 void setVerticalPosition(StyleTypeDefinitions.FrameVerticalPosition verticalPos)
          Set the vertical position
 void updateImage(URI imageUri)
          Update the image file with another resource.
 
Methods inherited from class org.odftoolkit.simple.Component
getComponentByElement, registerComponent, unregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstanceof

public static Image getInstanceof(DrawImageElement imageElement)
Get a image instance by an instance of DrawImageElement.

Parameters:
imageElement - - the instance of DrawImageElement
Returns:
an instance of image

setHyperlink

public void setHyperlink(URI linkto)
Add a hypertext reference to this image.

Parameters:
linkto - the hyperlink
Since:
0.6.5

getHyperlink

public URI getHyperlink()
Return the URI of hypertext reference if exists, or else, return null.

Returns:
the URI of hyperlink if exists

getOwnerDocument

public Document getOwnerDocument()
Get the owner document of this image

Overrides:
getOwnerDocument in class Component
Returns:
the document who owns this image

getStyleHandler

public FrameStyleHandler getStyleHandler()
Return style handler for this frame

Returns:
the style handler

getOdfElement

public DrawImageElement getOdfElement()
Return the instance of "draw:image" element

Specified by:
getOdfElement in class Component
Returns:
the instance of "draw:image" element

getFrame

public Frame getFrame()
Return the frame who contains this image.

Returns:
- the frame who contains this image

newImage

public static Image newImage(FrameContainer container,
                             URI uri)
Create an image and append it at the end of a container element.

Parameters:
container - - the frame container element
uri - - the URI of the image
Returns:
the instance of Image

newImage

public static Image newImage(Frame frame,
                             URI uri)
Create an image and add it to a frame.

Parameters:
frame - - the frame which contains this image
uri - - the URI of the image
Returns:
the instance of Image

imageIterator

public static Iterator<Image> imageIterator(FrameContainer container)
Return an iterator of image.

Parameters:
container - the frame container.
Returns:
the image iterator.

remove

public boolean remove()
Remove the image from the document.

The resource is removed if it's only used by this object.

Returns:
true if the image object is successfully removed; false if otherwise.

updateImage

public void updateImage(URI imageUri)
Update the image file with another resource.

Parameters:
imageUri - - the URI of the new image resource

getImageInputStream

public InputStream getImageInputStream()
Get the image resource as an input stream.

Returns:
- the input stream of the image resource

getInternalPath

public String getInternalPath()
Get the internal path within the package of the image resource as a string.

Returns:
- the internal path of the image resource

getMediaTypeString

public String getMediaTypeString()
Get the media type of the image resource

Returns:
- the media type of the image resource

setName

public void setName(String name)
Set the name of this image.

Parameters:
name - - the name of the image

getName

public String getName()
Get the name of this image.

Returns:
the name of the image

setRectangle

public void setRectangle(FrameRectangle rectangle)
Set the rectangle used by this image

Parameters:
rectangle - - the rectangle used by this image

getRectangle

public FrameRectangle getRectangle()
Return the rectangle used by this image

Returns:
- the rectangle

setTitle

public void setTitle(String title)
Set the title of this image

Parameters:
title - - the title of this image

getTitle

public String getTitle()
Get the title of this image

Returns:
- the title of this image

getDesciption

public String getDesciption()
Get the description of this image

Returns:
- the description of this image

setDescription

public void setDescription(String description)
Set the description of this image.

Parameters:
description - - the description of this image

setHorizontalPosition

public void setHorizontalPosition(StyleTypeDefinitions.FrameHorizontalPosition horizontalPos)
Set the horizontal position

Parameters:
horizontalPos - - the horizontal position

setVerticalPosition

public void setVerticalPosition(StyleTypeDefinitions.FrameVerticalPosition verticalPos)
Set the vertical position

Parameters:
verticalPos - - the vertical position

getHorizontalPosition

public StyleTypeDefinitions.FrameHorizontalPosition getHorizontalPosition()
Return the horizontal position

Returns:
the horizontal position

getVerticalPosition

public StyleTypeDefinitions.FrameVerticalPosition getVerticalPosition()
Return the vertical position

Returns:
the vertical position


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.