|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WResource
eu.webtoolkit.jwt.WSvgImage
public class WSvgImage
A paint device for rendering using Scalable Vector Graphics (SVG).
The WSvgImage is primarily used by WPaintedWidget to render to the
browser in Support Vector Graphics (SVG) format.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WResource |
|---|
WResource.DispositionType |
| Nested classes/interfaces inherited from interface eu.webtoolkit.jwt.WPaintDevice |
|---|
WPaintDevice.ChangeFlag, WPaintDevice.FeatureFlag |
| Constructor Summary | |
|---|---|
WSvgImage(WLength width,
WLength height)
Create an SVG paint device. |
|
WSvgImage(WLength width,
WLength height,
WObject parent)
Create an SVG paint device. |
|
WSvgImage(WLength width,
WLength height,
WObject parent,
boolean paintUpdate)
Create an SVG paint device. |
|
| Method Summary | |
|---|---|
void |
done()
Finishes painting on the device. |
void |
drawArc(WRectF rect,
double startAngle,
double spanAngle)
Draws an arc. |
void |
drawImage(WRectF rect,
java.lang.String imageUri,
int imgWidth,
int imgHeight,
WRectF srect)
Draws an image. |
void |
drawLine(double x1,
double y1,
double x2,
double y2)
Draws a line. |
void |
drawPath(WPainterPath path)
Draws a path. |
void |
drawText(WRectF rect,
java.util.EnumSet<AlignmentFlag> flags,
TextFlag textFlag,
java.lang.CharSequence text)
Draws text. |
java.util.EnumSet<WPaintDevice.FeatureFlag> |
getFeatures()
Returns device features. |
WFontMetrics |
getFontMetrics()
Returns font metrics. |
WLength |
getHeight()
Returns the device height. |
WPainter |
getPainter()
Returns the painter that is currently painting on the device. |
java.lang.String |
getRendered()
Internal method. |
WLength |
getWidth()
Returns the device width. |
void |
handleRequest(WebRequest request,
WebResponse response)
Handles a request. |
void |
init()
Initializes the device for painting. |
boolean |
isPaintActive()
Returns whether painting is active. |
WTextItem |
measureText(java.lang.CharSequence text)
Measures rendered text size. |
WTextItem |
measureText(java.lang.CharSequence text,
double maxWidth)
Measures rendered text size. |
WTextItem |
measureText(java.lang.CharSequence text,
double maxWidth,
boolean wordWrap)
Measures rendered text size. |
void |
setChanged(java.util.EnumSet<WPaintDevice.ChangeFlag> flags)
Indicates changes in painter state. |
void |
setChanged(WPaintDevice.ChangeFlag flag,
WPaintDevice.ChangeFlag... flags)
Indicates changes in painter state. |
void |
setPainter(WPainter painter)
Sets the painter. |
| Methods inherited from class eu.webtoolkit.jwt.WResource |
|---|
dataChanged, dataReceived, generateUrl, getDispositionType, getInternalPath, getSuggestedFileName, getUrl, setChanged, setDispositionType, setInternalPath, setUploadProgress, suggestFileName, suggestFileName, write, write |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WSvgImage(WLength width,
WLength height,
WObject parent,
boolean paintUpdate)
If paintUpdate is true, then only an SVG
fragment will be rendered that can be used to update the DOM of an
existing SVG image, instead of a full SVG image.
public WSvgImage(WLength width,
WLength height)
Calls
this(width, height, (WObject)null, false)
public WSvgImage(WLength width,
WLength height,
WObject parent)
Calls
this(width, height, parent, false)
| Method Detail |
|---|
public java.util.EnumSet<WPaintDevice.FeatureFlag> getFeatures()
WPaintDevice
getFeatures in interface WPaintDevicepublic void setChanged(java.util.EnumSet<WPaintDevice.ChangeFlag> flags)
WPaintDevice
The flags argument is the logical OR of one or more change
flags.
setChanged in interface WPaintDeviceWPaintDevice.ChangeFlag
public final void setChanged(WPaintDevice.ChangeFlag flag,
WPaintDevice.ChangeFlag... flags)
WPaintDevice
Calls setChanged(EnumSet.of(flag,
flags))
setChanged in interface WPaintDevice
public void drawArc(WRectF rect,
double startAngle,
double spanAngle)
WPaintDevice
The arc is defined as in
WPainter#drawArc()
The arc must be stroked, filled, and transformed using the current painter settings.
drawArc in interface WPaintDevice
public void drawImage(WRectF rect,
java.lang.String imageUri,
int imgWidth,
int imgHeight,
WRectF srect)
WPaintDevice
Draws sourceRect from the image with URL imageUri and
original dimensions imgWidth and imgHeight to the
location, into the rectangle defined by rect.
The image is transformed using the current painter settings.
drawImage in interface WPaintDevice
public void drawLine(double x1,
double y1,
double x2,
double y2)
WPaintDeviceThe line must be stroked and transformed using the current painter settings.
drawLine in interface WPaintDevicepublic void drawPath(WPainterPath path)
WPaintDeviceThe path must be stroked, filled, and transformed using the current painter settings.
drawPath in interface WPaintDevice
public void drawText(WRectF rect,
java.util.EnumSet<AlignmentFlag> flags,
TextFlag textFlag,
java.lang.CharSequence text)
WPaintDeviceThe text must be rendered, stroked and transformed using the current painter settings.
drawText in interface WPaintDevice
public WTextItem measureText(java.lang.CharSequence text,
double maxWidth,
boolean wordWrap)
WPaintDeviceReturns the bounding rect of the given text when rendered using the current font.
If maxWidth != -1, then the text is truncated to fit in the
width.
If wordWrap = true then text is truncated only
at word boundaries. Note that in this case the whitespace at the
truncated position is included in the text but not accounted for by the
returned width (since usually you will not render the whitespace at the
end of a line).
Throws a std::logic_error if the underlying device does not provide font metrics.
measureText in interface WPaintDevicepublic final WTextItem measureText(java.lang.CharSequence text)
WPaintDevice
Returns
measureText(text, - 1, false)
measureText in interface WPaintDevice
public final WTextItem measureText(java.lang.CharSequence text,
double maxWidth)
WPaintDevice
Returns
measureText(text, maxWidth, false)
measureText in interface WPaintDevicepublic WFontMetrics getFontMetrics()
WPaintDeviceThis returns font metrics for the current font.
Throws a std::logic_error if the underlying device does not provide font metrics.
getFontMetrics in interface WPaintDevicepublic void init()
WPaintDevice
This method is called when a WPainter starts painting.
init in interface WPaintDeviceWPainter.begin(WPaintDevice device),
WPaintDevice.getPainter()public void done()
WPaintDevice
This method is called when a WPainter stopped painting.
done in interface WPaintDeviceWPainter.end()public boolean isPaintActive()
WPaintDevice
isPaintActive in interface WPaintDeviceWPaintDevice.init(),
WPaintDevice.getPainter()public java.lang.String getRendered()
WVectorImage
getRendered in interface WVectorImagepublic WLength getWidth()
WPaintDeviceThe device width, in pixels, establishes the width of the device coordinate system.
getWidth in interface WPaintDevicepublic WLength getHeight()
WPaintDeviceThe device height, in pixels, establishes the height of the device coordinate system.
getHeight in interface WPaintDevice
public void handleRequest(WebRequest request,
WebResponse response)
throws java.io.IOException
WResourceReimplement this method so that a proper response is generated for the given request. From the request object you can access request parameters and whether the request is a continuation request. In the response object, you should set the mime type and stream the output data.
handleRequest in class WResourcerequest - The request informationresponse - The response object
java.io.IOExceptionpublic WPainter getPainter()
WPaintDevice
getPainter in interface WPaintDeviceWPaintDevice.init()public void setPainter(WPainter painter)
WPaintDevice
setPainter in interface WPaintDevice
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||