org.apache.batik.swing.svg

Class AbstractJSVGComponent.BridgeUserAgent

protected class AbstractJSVGComponent.BridgeUserAgent extends Object implements UserAgent

To hide the user-agent methods.
Field Summary
protected Mapextensions
Constructor Summary
protected BridgeUserAgent()
Creates a new user agent.
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 scriptURL, ParsedURL docURL)
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 selection should be cleared.
voiddisplayError(String message)
Displays an error message in the User Agent interface.
voiddisplayError(Exception ex)
Displays an error resulting from the specified Exception.
voiddisplayMessage(String message)
Displays a message in the User Agent interface.
protected voidfireLinkActivatedEvent(SVGAElement elt, String href)
Fires a LinkActivatedEvent.
StringgetAlternateStyleSheet()
Returns this user agent's alternate style-sheet title.
floatgetBolderFontWeight(float f)
Returns a bolder font-weight.
SVGDocumentgetBrokenLinkDocument(Element e, String url, String message)
This implementation provides a true SVG Document that it annotates with some information about why the real document can't be loaded (unfortunately right now tool tips are broken for content referenced by images so you can't actually see the info).
PointgetClientAreaLocationOnScreen()
Returns the location on the screen of the client area in the UserAgent.
StringgetDefaultFontFamily()
Returns the default font family.
EventDispatchergetEventDispatcher()
Returns the EventDispatcher used by the UserAgent to dispatch events on GVT.
ExternalResourceSecuritygetExternalResourceSecurity(ParsedURL resourceURL, ParsedURL docURL)
Returns the security settings for the given resource url and document url
StringgetLanguages()
Returns the language settings.
floatgetLighterFontWeight(float f)
Returns a lighter font-weight.
StringgetMedia()
Returns this user agent's CSS media.
floatgetMediumFontSize()
Returns the medium font size.
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 scriptURL, ParsedURL docURL)
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 of this user agent (0, 0).
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.
booleanisXMLParserValidating()
Returns true if the XML parser must be in validation mode, false otherwise depending on the SVGUserAgent.
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 has 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

extensions

protected Map extensions

Constructor Detail

BridgeUserAgent

protected BridgeUserAgent()
Creates a new user agent.

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 scriptURL, ParsedURL docURL)
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. scriptURL url for the script, as defined in the script's xlink:href attribute. If that attribute was empty, then this parameter should be null docURL url for the document into which the script was found.

deselectAll

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

displayError

public void displayError(String message)
Displays an error message in the User Agent interface.

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.

fireLinkActivatedEvent

protected void fireLinkActivatedEvent(SVGAElement elt, String href)
Fires a LinkActivatedEvent.

getAlternateStyleSheet

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

getBolderFontWeight

public float getBolderFontWeight(float f)
Returns a bolder font-weight.

getBrokenLinkDocument

public SVGDocument getBrokenLinkDocument(Element e, String url, String message)
This implementation provides a true SVG Document that it annotates with some information about why the real document can't be loaded (unfortunately right now tool tips are broken for content referenced by images so you can't actually see the info).

Parameters: e The <image> element that can't be loaded. url The resolved url that can't be loaded. message 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 EventDispatcher used by the UserAgent to dispatch events on GVT.

getExternalResourceSecurity

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

Parameters: resourceURL url for the script, 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 script was found.

getLanguages

public String getLanguages()
Returns the language settings.

getLighterFontWeight

public float getLighterFontWeight(float f)
Returns a lighter font-weight.

getMedia

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

getMediumFontSize

public float getMediumFontSize()
Returns the medium font size.

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 scriptURL, ParsedURL docURL)
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. scriptURL url for the script, as defined in the script's xlink:href attribute. If that attribute was empty, then this parameter should be null docURL 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 of this user agent (0, 0).

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.

isXMLParserValidating

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

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 has 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.