All Implemented Interfaces:
AllowsConditionalProcessingAttributes, AllowsDocumentElementEventAttributes, AllowsDocumentEventAttributes, AllowsGraphicalEventAttributes, AllowsPresentationAttributes, AllowsStyleAttributes, SVG, SVGElement, SVGElementWithChildren, Element, XMLElement

@ClassVersion(sourceVersion="$Id: SVGImpl.java 1074 2023-10-02 12:05:06Z tquadrat $") @API(status=INTERNAL, since="0.0.5") public final class SVGImpl extends SVGElementImpl implements SVG
The implementation for the interface SVG for the <svg> element.
Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: SVGImpl.java 1074 2023-10-02 12:05:06Z tquadrat $
Since:
0.0.5
UML Diagram
UML Diagram for "org.tquadrat.foundation.svg.internal.SVGImpl"

UML Diagram for "org.tquadrat.foundation.svg.internal.SVGImpl"

UML Diagram for "org.tquadrat.foundation.svg.internal.SVGImpl"
  • Field Details

  • Constructor Details

    • SVGImpl

      public SVGImpl()
      Creates a new SVGImpl instance.
  • Method Details

    • addDefinition

      public final <E extends SVGElement> void addDefinition(E child) throws IllegalArgumentException, IllegalStateException
      Adds a child to the definitions of this <svg> element.
      Specified by:
      addDefinition in interface SVG
      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.
      Specified by:
      addStyle in interface SVG
      Parameters:
      style - The style to add.
      Throws:
      IllegalStateException - The child has already a parent that is not this element.
      IllegalArgumentException
    • createDefinitionsElement

      Creates the element for the definitions.
      Returns:
      The <defs> element.
    • getChildren

      public final Collection<? extends Element> getChildren()
      Specified by:
      getChildren in interface Element
      Overrides:
      getChildren in class XMLElementImpl
    • hasChildren

      public final boolean hasChildren()
      Specified by:
      hasChildren in interface Element
      Overrides:
      hasChildren in class XMLElementImpl
    • setContentScriptType

      public final void setContentScriptType(MimeType value)

      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.

      Specified by:
      setContentScriptType in interface SVG
      Parameters:
      value - The default scripting language for this <svg> element.
    • setStyleSheet

      public final SVGStyle setStyleSheet(CharSequence... styles)

      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.

      Specified by:
      setStyleSheet in interface SVG
      Parameters:
      styles - The CSS style definitions.
      Returns:
      The SVG <style> element with the style sheet definitions.
    • setZoomAndPan

      public final 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.
      Specified by:
      setZoomAndPan in interface SVG
      Parameters:
      flag - true enables the feature by setting "magnify" to the attribute "zoomAndPan", false disables it by setting the attribute to "disable".
    • validChildElements

      Composes the list of the valid child elements for the <svg> element.
      Returns:
      The valid child elements.