001/* 002 * ============================================================================ 003 * Copyright © 2002-2025 by Thomas Thrien. 004 * All Rights Reserved. 005 * ============================================================================ 006 * Licensed to the public under the agreements of the GNU Lesser General Public 007 * License, version 3.0 (the "License"). You may obtain a copy of the License at 008 * 009 * http://www.gnu.org/licenses/lgpl.html 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 014 * License for the specific language governing permissions and limitations 015 * under the License. 016 */ 017 018package org.tquadrat.foundation.svg.internal; 019 020import static org.apiguardian.api.API.Status.INTERNAL; 021import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Class; 022import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_ExternalResourcesRequired; 023import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Id; 024import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_PreserveAspectRatio; 025import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_Style; 026import static org.tquadrat.foundation.svg.SVGUtils.SVGATTRIBUTE_ViewBox; 027import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_AltGlyphDef; 028import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Anchor; 029import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_ClipPath; 030import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_ColorProfile; 031import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Cursor; 032import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Filter; 033import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Font; 034import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_FontFace; 035import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_ForeignObject; 036import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Image; 037import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Marker; 038import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Mask; 039import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Pattern; 040import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Script; 041import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Style; 042import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Switch; 043import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Symbol; 044import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Text; 045import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_View; 046import static org.tquadrat.foundation.svg.type.SVGElementCategory.ANIMATION; 047import static org.tquadrat.foundation.svg.type.SVGElementCategory.DESCRIPTIVE; 048import static org.tquadrat.foundation.svg.type.SVGElementCategory.GRADIENT; 049import static org.tquadrat.foundation.svg.type.SVGElementCategory.SHAPE; 050import static org.tquadrat.foundation.svg.type.SVGElementCategory.STRUCTURAL; 051import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.ALLOWS_CHILDREN; 052import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_ATTRIBUTES; 053import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_CHILDREN; 054 055import java.util.ArrayList; 056import java.util.Collection; 057import java.util.HashSet; 058import java.util.List; 059 060import org.apiguardian.api.API; 061import org.tquadrat.foundation.annotation.ClassVersion; 062import org.tquadrat.foundation.svg.SVGSymbol; 063 064/** 065 * The implementation for the interface 066 * {@link SVGSymbol} 067 * for the {@code <symbol>} element. 068 * 069 * @extauthor Thomas Thrien - thomas.thrien@tquadrat.org 070 * @version $Id: SVGSymbolImpl.java 1151 2025-10-01 21:32:15Z tquadrat $ 071 * @since 0.0.5 072 * 073 * @UMLGraph.link 074 */ 075@ClassVersion( sourceVersion = "$Id: SVGSymbolImpl.java 1151 2025-10-01 21:32:15Z tquadrat $" ) 076@API( status = INTERNAL, since = "0.0.5" ) 077public final class SVGSymbolImpl extends SVGElementImpl implements SVGSymbol 078{ 079 /*--------------*\ 080 ====** Constructors **===================================================== 081 \*--------------*/ 082 /** 083 * Creates a new {@code SVGSymbolImpl} instance. 084 * 085 * @param id The id for the new symbol. 086 */ 087 public SVGSymbolImpl( final String id ) 088 { 089 super( SVGELEMENT_Symbol, ALLOWS_CHILDREN, VALIDATES_ATTRIBUTES, VALIDATES_CHILDREN ); 090 091 //---* The children and attributes for the <symbol> element *---------- 092 final Collection<String> childElements = new HashSet<>(); 093 childElements.addAll( ANIMATION.getElements() ); 094 childElements.addAll( DESCRIPTIVE.getElements() ); 095 childElements.addAll( SHAPE.getElements() ); 096 childElements.addAll( STRUCTURAL.getElements() ); 097 childElements.addAll( GRADIENT.getElements() ); 098 childElements.addAll( List.of( SVGELEMENT_Anchor, 099 SVGELEMENT_AltGlyphDef, SVGELEMENT_ClipPath, 100 SVGELEMENT_ColorProfile, SVGELEMENT_Cursor, SVGELEMENT_Filter, 101 SVGELEMENT_Font, SVGELEMENT_FontFace, SVGELEMENT_ForeignObject, 102 SVGELEMENT_Image, SVGELEMENT_Marker, SVGELEMENT_Mask, 103 SVGELEMENT_Pattern, SVGELEMENT_Script, SVGELEMENT_Style, 104 SVGELEMENT_Switch, SVGELEMENT_Text, SVGELEMENT_View ) ); 105 106 final Collection<String> attributes = new ArrayList<>(); 107 attributes.addAll( List.of( SVGATTRIBUTE_Id, 108 SVGATTRIBUTE_PreserveAspectRatio, SVGATTRIBUTE_ViewBox, 109 SVGATTRIBUTE_Class, SVGATTRIBUTE_Style, 110 SVGATTRIBUTE_ExternalResourcesRequired ) ); 111 attributes.addAll( CORE_ATTRIBUTES ); 112 attributes.addAll( GRAPHICALEVENT_ATTRIBUTES ); 113 attributes.addAll( PRESENTATION_ATTRIBUTES ); 114 115 updateRegistries( childElements, attributes ); 116 117 setId( id ); 118 } // SVGSymbolImpl() 119} 120// class SVGSymbolImpl 121 122/* 123 * End of File 124 */