- All Superinterfaces:
AllowsConditionalProcessingAttributes
,AllowsDocumentElementEventAttributes
,AllowsDocumentEventAttributes
,AllowsGraphicalEventAttributes
,AllowsPresentationAttributes
,AllowsStyleAttributes
,Element
,SVGElement
,SVGElementWithChildren
- All Known Implementing Classes:
SVGImpl
The definition of the SVG element
<svg>
.
The <svg>
element is the root element for any SVG
document, either stand-alone (in a file with the *.svg
extension)
or embedded in an HTML file (or elsewhere - including another SVG
document). Therefore the definition for the namespaces is different for
each usage. This is reflected by the type
SVG.Usage
.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: SVG.java 1139 2024-06-16 19:50:41Z tquadrat $
- Since:
- 0.0.5
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.svg.SVG"
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
The different usages for an<svg>
element. -
Field Summary
Fields inherited from interface org.tquadrat.foundation.svg.AllowsConditionalProcessingAttributes
CONDITIONALPROCESSING_ATTRIBUTES
Fields inherited from interface org.tquadrat.foundation.svg.AllowsDocumentElementEventAttributes
DOCUMENTELEMENTEVENT_ATTRIBUTES
Fields inherited from interface org.tquadrat.foundation.svg.AllowsDocumentEventAttributes
DOCUMENTEVENT_ATTRIBUTES
Fields inherited from interface org.tquadrat.foundation.svg.AllowsGraphicalEventAttributes
GRAPHICALEVENT_ATTRIBUTES
Fields inherited from interface org.tquadrat.foundation.svg.AllowsPresentationAttributes
PRESENTATION_ATTRIBUTES
Fields inherited from interface org.tquadrat.foundation.svg.AllowsStyleAttributes
STYLE_ATTRIBUTES
Fields inherited from interface org.tquadrat.foundation.svg.SVGElement
CORE_ATTRIBUTES
-
Method Summary
Modifier and TypeMethodDescription<E extends SVGElement>
voidaddDefinition
(E child) Adds a child to the definitions of this<svg>
element.void
Adds an SVG<style>
element to the definitions of this<svg>
element.void
setContentScriptType
(MimeType value) Sets the default scripting language used to process the type strings in event attributes.default void
setDimension
(SVGNumber width, SVGNumber height) Sets the dimension for this<svg>
element.void
Sets the height of the embedded<svg>
element.void
Sets the mode for the aspect ratio preservation for this<svg>
element.setStyleSheet
(CharSequence... styles) Sets the given CSS style definitions as a style sheet in an SVGstyle
element to the<defs>
element of this<svg>
element.void
setViewBox
(SVGNumber x, SVGNumber y, SVGNumber width, SVGNumber height) Defines the visible area in this SVG drawing area.void
Sets the width of the embedded<svg>
element.void
Sets the x coordinate for the top left corner of the embedded<svg>
element.void
Sets the y coordinate for the top left corner of the embedded<svg>
element.void
setZoomAndPan
(boolean flag) Sets the 'Zoom-and-Pan' flag; if enabled on a stand-alone instance of the<svg>
element, it allows panning and zooming the image.Methods inherited from interface org.tquadrat.foundation.svg.AllowsConditionalProcessingAttributes
setExternalResourcesRequired, setRequiredExtensions, setRequiredFeatures, setSystemLanguage
Methods inherited from interface org.tquadrat.foundation.svg.AllowsDocumentElementEventAttributes
setCopyHandler, setCutHandler, setPasteHandler
Methods inherited from interface org.tquadrat.foundation.svg.AllowsDocumentEventAttributes
setAbortHandler, setErrorHandler, setResizeHandler, setScrollHandler, setUnloadHandler
Methods inherited from interface org.tquadrat.foundation.svg.AllowsGraphicalEventAttributes
setActivationHandler, setFocusInHandler, setFocusOutHandler
Methods inherited from interface org.tquadrat.foundation.svg.AllowsPresentationAttributes
setAlignmentBaseline, setBaselineShift, setClip, setClipPath, setClipRule, setColor, setColorInterpolation, setColorInterpolationFilters, setColorProfile, setColorRendering, setCursor, setDirection, setDisplay, setDominantBaseline, setEnableBackground, setFill, setFillOpacity, setFillRule, setFilter, setFloodColor, setFloodOpacity, setFontFamily, setFontSize, setFontSizeAdjust, setFontStretch, setFontStyle, setFontVariant, setFontWeight, setGlyphOrientationHorizontal, setGlyphOrientationVertical, setImageRendering, setKerning, setLetterSpacing, setLightingColor, setMarkerEnd, setMarkerMid, setMarkerStart, setMask, setOpacity, setOverflow, setPointerEvents, setShapeRendering, setStopColor, setStopOpacity, setStroke, setStrokeDashArray, setStrokeDashOffset, setStrokeLineCap, setStrokeLineJoin, setStrokeMiterLimit, setStrokeOpacity, setStrokeWidth, setTextAnchor, setTextDecoration, setTextRendering, setTransform, setUnicodeBidi, setVectorEffect, setVisibility, setWordSpacing, setWritingMode
Methods inherited from interface org.tquadrat.foundation.svg.AllowsStyleAttributes
setClass, setStyle
Methods inherited from interface org.tquadrat.foundation.xml.builder.spi.Element
getAttribute, getAttributes, getChildren, getElementName, getNamespaces, getParent, hasChildren, isBlock, setParent, toString
Methods inherited from interface org.tquadrat.foundation.svg.SVGElement
addComment, getSVGElementCategory, setId, setLang, setPreserveSpace, setTabIndex, setTitle, setXMLBase, setXMLId, setXMLLang
Methods inherited from interface org.tquadrat.foundation.svg.SVGElementWithChildren
addChild, setDescription
-
Method Details
-
addDefinition
<E extends SVGElement> void addDefinition(E child) throws IllegalArgumentException, IllegalStateException Adds a child to the definitions of this<svg>
element.- Type Parameters:
E
- The implementation type for thechildren
.- Parameters:
child
- The child to add.- Throws:
IllegalArgumentException
- The given child is not valid to be added to a<defs>
element, or it does not have an id.IllegalStateException
- The child has already a parent that is not this element.
-
addStyle
Adds an SVG<style>
element to the definitions of this<svg>
element. If there exists already a<style>
element, the new one will be merged into the existing one.- Parameters:
style
- The style to add.- Throws:
IllegalStateException
- The child has already a parent that is not this element.
-
setContentScriptType
Sets the default scripting language used to process the type strings in event attributes. This language must be used for all instances of script that do not specify their own scripting language.
The type specifies a media type as a MIME document identifier; the default type is
application/ecmascript
.- Parameters:
value
- The default scripting language for this<svg>
element.
-
setDimension
Sets the dimension for this<svg>
element.- Parameters:
width
- The width of the element.height
- The height of the element.
-
setHeight
Sets the height of the embedded<svg>
element.- Parameters:
value
- The type; ifnull
the attribute will be removed.
-
setPreserveAspectRatio
Sets the mode for the aspect ratio preservation for this<svg>
element.- Parameters:
value
- The type; ifnull
the attribute will be removed.
-
setStyleSheet
Sets the given CSS style definitions as a style sheet in an SVG
style
element to the<defs>
element of this<svg>
element.This is not an attribute; instead an SVG
<style>
element will be created.Consecutive calls to this method will not create additional
<style>
elements, instead the new styles will be added to the existing ones.- Parameters:
styles
- The CSS style definitions.- Returns:
- The SVG
<style>
element with the style sheet definitions.
-
setViewBox
Defines the visible area in this SVG drawing area.- Parameters:
x
- The x coordinate of top left corner of the area.y
- The y coordinate of top left corner of the area.width
- The width of the area.height
- The height of the area.
-
setWidth
Sets the width of the embedded<svg>
element.- Parameters:
value
- The type; ifnull
the attribute will be removed.
-
setX
Sets the x coordinate for the top left corner of the embedded<svg>
element.- Parameters:
value
- The type; ifnull
the attribute will be removed.
-
setY
Sets the y coordinate for the top left corner of the embedded<svg>
element.- Parameters:
value
- The type; ifnull
the attribute will be removed.
-
setZoomAndPan
Sets the 'Zoom-and-Pan' flag; if enabled on a stand-alone instance of the<svg>
element, it allows panning and zooming the image.- Parameters:
flag
-true
enables the feature by setting "magnify
" to the attribute "zoomAndPan",false
disables it by setting the attribute to "disable
".
-