org.apache.batik.swing.svg

Class AbstractJSVGComponent.BridgeUserAgentWrapper

protected static class AbstractJSVGComponent.BridgeUserAgentWrapper extends Object implements UserAgent

The user-agent wrapper, which call the methods in the event thread.
Field Summary
protected UserAgentuserAgent
The wrapped user agent.
Constructor Summary
BridgeUserAgentWrapper(UserAgent ua)
Creates a new BridgeUserAgentWrapper.
Method Summary
voidcheckLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL)
This method throws a SecurityException if the resource found at url and referenced from docURL should not be loaded.
voidcheckLoadScript(String scriptType, ParsedURL scriptPURL, ParsedURL docPURL)
This method throws a SecurityException if the script of given type, found at url and referenced from docURL should not be loaded.
voiddeselectAll()
Informs the user agent that the text should be deselected.
voiddisplayError(Exception ex)
Displays an error resulting from the specified Exception.
voiddisplayMessage(String message)
Displays a message in the User Agent interface.
StringgetAlternateStyleSheet()
Returns this user agent's alternate style-sheet title.
floatgetBolderFontWeight(float f)
SVGDocumentgetBrokenLinkDocument(Element e, String url, String msg)
This Implementation simply forwards the request to the AWT thread.
PointgetClientAreaLocationOnScreen()
Returns the location on the screen of the client area in the UserAgent.
StringgetDefaultFontFamily()
Returns the default font family.
EventDispatchergetEventDispatcher()
Returns the event dispatcher to use.
ExternalResourceSecuritygetExternalResourceSecurity(ParsedURL resourcePURL, ParsedURL docPURL)
Returns the security settings for the given resource url and document url
StringgetLanguages()
Returns the language settings.
floatgetLighterFontWeight(float f)
StringgetMedia()
Returns this user agent's CSS media.
floatgetMediumFontSize()
floatgetPixelToMM()
Returns the size of a px CSS unit in millimeters.
floatgetPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.
ScriptSecuritygetScriptSecurity(String scriptType, ParsedURL scriptPURL, ParsedURL docPURL)
Returns the security settings for the given script type, script url and document url
AffineTransformgetTransform()
Returns the AffineTransform currently applied to the drawing by the UserAgent.
StringgetUserStyleSheetURI()
Returns the user stylesheet uri.
Dimension2DgetViewportSize()
Returns the default size of the viewport.
StringgetXMLParserClassName()
Returns the class name of the XML parser.
voidhandleElement(Element elt, Object data)
Notifies the UserAgent that the input element has been found in the document.
booleanhasFeature(String s)
Tells whether the given feature is supported by this user agent.
protected voidinvokeAndWait(Runnable r)
Invokes the given runnable from the event thread, and wait for the run method to terminate.
booleanisXMLParserValidating()
Returns true if the XML parser must be in validation mode, false otherwise.
voidopenLink(SVGAElement elt)
Opens a link.
voidregisterExtension(BridgeExtension ext)
Lets the bridge tell the user agent that the following extension is supported by the bridge.
voidsetSVGCursor(Cursor cursor)
Informs the user agent to change the cursor.
voidsetTextSelection(Mark start, Mark end)
Informs the user agent that the text selection should be changed.
voidsetTransform(AffineTransform at)
Sets the AffineTransform to be applied to the drawing by the UserAgent.
voidshowAlert(String message)
Shows an alert dialog box.
booleanshowConfirm(String message)
Shows a confirm dialog box.
StringshowPrompt(String message)
Shows a prompt dialog box.
StringshowPrompt(String message, String defaultValue)
Shows a prompt dialog box.
booleansupportExtension(String s)
Tells whether the given extension is supported by this user agent.

Field Detail

userAgent

protected UserAgent userAgent
The wrapped user agent.

Constructor Detail

BridgeUserAgentWrapper

public BridgeUserAgentWrapper(UserAgent ua)
Creates a new BridgeUserAgentWrapper.

Method Detail

checkLoadExternalResource

public void checkLoadExternalResource(ParsedURL resourceURL, ParsedURL docURL)
This method throws a SecurityException if the resource found at url and referenced from docURL should not be loaded. This is a convenience method to call checkLoadExternalResource on the ExternalResourceSecurity strategy returned by getExternalResourceSecurity.

Parameters: resourceURL url for the resource, as defined in the resource's xlink:href attribute. If that attribute was empty, then this parameter should be null docURL url for the document into which the resource was found.

checkLoadScript

public void checkLoadScript(String scriptType, ParsedURL scriptPURL, ParsedURL docPURL)
This method throws a SecurityException if the script of given type, found at url and referenced from docURL should not be loaded. This is a convenience method to call checkLoadScript on the ScriptSecurity strategy returned by getScriptSecurity.

Parameters: scriptType type of script, as found in the type attribute of the <script> element. scriptPURL url for the script, as defined in the script's xlink:href attribute. If that attribute was empty, then this parameter should be null docPURL url for the document into which the script was found.

deselectAll

public void deselectAll()
Informs the user agent that the text should be deselected.

displayError

public void displayError(Exception ex)
Displays an error resulting from the specified Exception.

displayMessage

public void displayMessage(String message)
Displays a message in the User Agent interface.

getAlternateStyleSheet

public String getAlternateStyleSheet()
Returns this user agent's alternate style-sheet title.

getBolderFontWeight

public float getBolderFontWeight(float f)

getBrokenLinkDocument

public SVGDocument getBrokenLinkDocument(Element e, String url, String msg)
This Implementation simply forwards the request to the AWT thread.

Parameters: e The element that can't be loaded. url The resolved url that can't be loaded. msg As best as can be determined the reason it can't be loaded (not available, corrupt, unknown format,...).

getClientAreaLocationOnScreen

public Point getClientAreaLocationOnScreen()
Returns the location on the screen of the client area in the UserAgent.

getDefaultFontFamily

public String getDefaultFontFamily()
Returns the default font family.

getEventDispatcher

public EventDispatcher getEventDispatcher()
Returns the event dispatcher to use.

getExternalResourceSecurity

public ExternalResourceSecurity getExternalResourceSecurity(ParsedURL resourcePURL, ParsedURL docPURL)
Returns the security settings for the given resource url and document url

Parameters: resourcePURL url for the resource, as defined in the resource's xlink:href attribute. If that attribute was empty, then this parameter should be null docPURL url for the document into which the resource was found.

getLanguages

public String getLanguages()
Returns the language settings.

getLighterFontWeight

public float getLighterFontWeight(float f)

getMedia

public String getMedia()
Returns this user agent's CSS media.

getMediumFontSize

public float getMediumFontSize()

getPixelToMM

public float getPixelToMM()
Returns the size of a px CSS unit in millimeters. This will be removed after next release.

See Also: getPixelUnitToMillimeter

getPixelUnitToMillimeter

public float getPixelUnitToMillimeter()
Returns the size of a px CSS unit in millimeters.

getScriptSecurity

public ScriptSecurity getScriptSecurity(String scriptType, ParsedURL scriptPURL, ParsedURL docPURL)
Returns the security settings for the given script type, script url and document url

Parameters: scriptType type of script, as found in the type attribute of the <script> element. scriptPURL url for the script, as defined in the script's xlink:href attribute. If that attribute was empty, then this parameter should be null docPURL url for the document into which the script was found.

getTransform

public AffineTransform getTransform()
Returns the AffineTransform currently applied to the drawing by the UserAgent.

getUserStyleSheetURI

public String getUserStyleSheetURI()
Returns the user stylesheet uri.

Returns: null if no user style sheet was specified.

getViewportSize

public Dimension2D getViewportSize()
Returns the default size of the viewport.

getXMLParserClassName

public String getXMLParserClassName()
Returns the class name of the XML parser.

handleElement

public void handleElement(Element elt, Object data)
Notifies the UserAgent that the input element has been found in the document. This is sometimes called, for example, to handle <a> or <title> elements in a UserAgent-dependant way.

hasFeature

public boolean hasFeature(String s)
Tells whether the given feature is supported by this user agent.

invokeAndWait

protected void invokeAndWait(Runnable r)
Invokes the given runnable from the event thread, and wait for the run method to terminate.

isXMLParserValidating

public boolean isXMLParserValidating()
Returns true if the XML parser must be in validation mode, false otherwise.

openLink

public void openLink(SVGAElement elt)
Opens a link.

Parameters: elt The activated link element.

registerExtension

public void registerExtension(BridgeExtension ext)
Lets the bridge tell the user agent that the following extension is supported by the bridge.

setSVGCursor

public void setSVGCursor(Cursor cursor)
Informs the user agent to change the cursor.

Parameters: cursor the new cursor

setTextSelection

public void setTextSelection(Mark start, Mark end)
Informs the user agent that the text selection should be changed.

Parameters: start The Mark for the start of the selection. end The Mark for the end of the selection.

setTransform

public void setTransform(AffineTransform at)
Sets the AffineTransform to be applied to the drawing by the UserAgent.

showAlert

public void showAlert(String message)
Shows an alert dialog box.

showConfirm

public boolean showConfirm(String message)
Shows a confirm dialog box.

showPrompt

public String showPrompt(String message)
Shows a prompt dialog box.

showPrompt

public String showPrompt(String message, String defaultValue)
Shows a prompt dialog box.

supportExtension

public boolean supportExtension(String s)
Tells whether the given extension is supported by this user agent.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.