|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.editor.imageRenderer.ImageRenderer
public final class ImageRenderer
A renderer that is able to render an image. Processes ObjectSource only.
Method Summary | |
---|---|
IInputPreprocessor |
createPreprocessor()
Constructs new instance of preprocessor. |
org.eclipse.draw2d.geometry.Dimension |
getCanvasSize()
Retrieves size of area where the rendering occurs. |
IEMFigure |
getFigure(Object o)
Retrieves figure that displays given data object. |
protected EMImageFigure |
getImageFigure()
|
RendererInfo |
getInfo()
Returns instance of RendererInfo able to create this renderer. |
org.eclipse.draw2d.geometry.Point |
getPlacement(String id)
Returns point, relative to renderer's canvas, where canvas of child renderer will be positioned. |
IEMFigure |
getRootFigure()
Retrieves the root figure, where all figures will be placed. |
void |
init(Source transformedDoc,
RendererContext context)
Initializes the renderer. |
Object |
offerObject()
When the renderer accepts the ObjectSource but wants to provide an object as a result (for example it wants the document producer to draw something in a certain instance of Graphics), then return non-null value. |
void |
reinit(sk.baka.ikslibs.modify.IChangeCollector changes)
Reinitialize the renderer when a partial change of the rendered document occurs. |
void |
render(org.eclipse.draw2d.Graphics g)
Paint rendered view to Graphics . |
protected void |
setImageFigure(EMImageFigure imageFigure)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void init(Source transformedDoc, RendererContext context) throws EditorException
IRenderer
Initializes the renderer. Called as the first method (only the
IRenderer.offerObject()
and IRenderer.getInfo()
methods may be called
before this method). Renderer should prepare IFigure
instances
for future rendering.
If an element from another namespace occurs (generef
processing instruction in case of DOMSource
- you can retrieve id
using SplittedDocHolder.getRef(org.w3c.dom.Node)
function, or a
custom object type in case of ObjectSource
), the
following steps are to be taken:
Composite
widget.IRenderer.getPlacement(String)
method.
init
in interface IRenderer
transformedDoc
- fragment of document, DOMSource
or
ObjectSource
instance. This nametree is to be rendered by
the renderer. Renderer is encouraged to throw any exception including
ClassCastException
if it encounters illegal objects, to
detect invalid objects quickly and cleanly.context
- the context instance, allows you to ask for child
renderers output, etc.
EditorException
- if initialization fails.public org.eclipse.draw2d.geometry.Point getPlacement(String id)
IRenderer
getPlacement
in interface IRenderer
id
- the child nametree's ID.
null
if the child renderer's canvas
is not visible (not placed anywhere).public void reinit(sk.baka.ikslibs.modify.IChangeCollector changes) throws EditorException
IRenderer
Reinitialize the renderer when a partial change of the rendered document
occurs. Renderer should discard IFigures no longer needed, and prepare
new IFigures. This changed
object is given to an editor
when this method finishes, to allow the editor to query for new figures.
reinit
in interface IRenderer
changes
- defines changed elements. Has appropriate type for
transformedDoc
parameter, i.e. DOMChangeCollector
for DOMSource
etc. Contains source with
all changes already applied.
EditorException
- if error occurs.public org.eclipse.draw2d.geometry.Dimension getCanvasSize() throws EditorException
IRenderer
getCanvasSize
in interface IRenderer
null
.
EditorException
- if error occurs.public IEMFigure getFigure(Object o)
IRenderer
getFigure
in interface IRenderer
o
- the data object, may be any object instance when transformed
document is in form of ObjectSource
, or a
Node
instance otherwise.
public IEMFigure getRootFigure()
IRenderer
getRootFigure
in interface IRenderer
public void render(org.eclipse.draw2d.Graphics g) throws EditorException
IRenderer
Paint rendered view to Graphics
. Use the context object
to let the children renderers to paint.
render
in interface IRenderer
g
- paint onto this graphics instance.
EditorException
- if error occurs.public Object offerObject()
IRenderer
When the renderer accepts the ObjectSource but wants to provide an object
as a result (for example it wants the document producer to draw something
in a certain instance of Graphics), then return non-null value. If this
functionality is not needed then just return null
- if the
document producer requires some object then it can create any object as
long as it is instance of class that this exporter expects.
The consumer (the one that receives the object, i.e. this) is responsible
for freeing the object if necessary (at the end of the export method),
even if this function returned null
.
If you want producer (the one that creates the object) to create custom
instances then provide a factory object. This trick is used with
http://www.uniba.sk/euromath/holder/java.awt.Graphics
holder - a factory is returned that is able to produce
java.awt.Graphics
instances.
This method can be called anytime, and is usually called before
IRenderer.init(Source, RendererContext)
.
offerObject
in interface IRenderer
null
.protected EMImageFigure getImageFigure()
protected void setImageFigure(EMImageFigure imageFigure)
imageFigure
- The imageFigure to set.public RendererInfo getInfo()
IRenderer
RendererInfo
able to create this renderer.
getInfo
in interface IRenderer
public IInputPreprocessor createPreprocessor()
IRenderer
createPreprocessor
in interface IRenderer
null
then no
preprocessor is needed and will be ignored.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |