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:
  • "https://www.w3.org/TR/SVG/single-page.html#struct-SVGElement"
UML Diagram
UML Diagram for "org.tquadrat.foundation.svg.SVG"

UML Diagram for "org.tquadrat.foundation.svg.SVG"

UML Diagram for "org.tquadrat.foundation.svg.SVG"
  • Method Details

    • addDefinition

      Adds a child to the definitions of this <svg> element.
      Type Parameters:
      E - The implementation type for the children.
      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

      default void setDimension(SVGNumber width, SVGNumber height)
      Sets the dimension for this <svg> element.
      Parameters:
      width - The width of the element.
      height - The height of the element.
    • setHeight

      void setHeight(SVGNumber value)
      Sets the height of the embedded <svg> element.
      Parameters:
      value - The type; if null the attribute will be removed.
    • setPreserveAspectRatio

      Sets the mode for the aspect ratio preservation for this <svg> element.
      Parameters:
      value - The type; if null 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

      void setViewBox(SVGNumber x, SVGNumber y, SVGNumber width, SVGNumber height)
      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

      void setWidth(SVGNumber value)
      Sets the width of the embedded <svg> element.
      Parameters:
      value - The type; if null the attribute will be removed.
    • setX

      void setX(SVGNumber value)
      Sets the x coordinate for the top left corner of the embedded <svg> element.
      Parameters:
      value - The type; if null the attribute will be removed.
    • setY

      void setY(SVGNumber value)
      Sets the y coordinate for the top left corner of the embedded <svg> element.
      Parameters:
      value - The type; if null the attribute will be removed.
    • setZoomAndPan

      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.
      Parameters:
      flag - true enables the feature by setting "magnify" to the attribute "zoomAndPan", false disables it by setting the attribute to "disable".