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_Id;
022import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_AltGlyphDef;
023import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Anchor;
024import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_ClipPath;
025import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_ColorProfile;
026import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Cursor;
027import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Filter;
028import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Font;
029import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_FontFace;
030import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_ForeignObject;
031import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Group;
032import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Image;
033import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Marker;
034import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Mask;
035import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Pattern;
036import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Script;
037import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Style;
038import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Switch;
039import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_Text;
040import static org.tquadrat.foundation.svg.SVGUtils.SVGELEMENT_View;
041import static org.tquadrat.foundation.svg.type.SVGElementCategory.ANIMATION;
042import static org.tquadrat.foundation.svg.type.SVGElementCategory.DESCRIPTIVE;
043import static org.tquadrat.foundation.svg.type.SVGElementCategory.GRADIENT;
044import static org.tquadrat.foundation.svg.type.SVGElementCategory.SHAPE;
045import static org.tquadrat.foundation.svg.type.SVGElementCategory.STRUCTURAL;
046import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.ALLOWS_CHILDREN;
047import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_ATTRIBUTES;
048import static org.tquadrat.foundation.xml.builder.XMLElement.Flags.VALIDATES_CHILDREN;
049
050import java.util.ArrayList;
051import java.util.Collection;
052import java.util.HashSet;
053import java.util.List;
054
055import org.apiguardian.api.API;
056import org.tquadrat.foundation.annotation.ClassVersion;
057import org.tquadrat.foundation.svg.SVGGroup;
058
059/**
060 *  The implementation of the interface
061 *  {@link SVGGroup}
062 *  for the SVG {@code <g>} element.
063 *
064 *  @extauthor Thomas Thrien - thomas.thrien@tquadrat.org
065 *  @version $Id: SVGGroupImpl.java 1151 2025-10-01 21:32:15Z tquadrat $
066 *  @since 0.0.5
067 *
068 *  @UMLGraph.link
069 */
070@ClassVersion( sourceVersion = "$Id: SVGGroupImpl.java 1151 2025-10-01 21:32:15Z tquadrat $" )
071@API( status = INTERNAL, since = "0.0.5" )
072public final class SVGGroupImpl extends SVGElementImpl implements SVGGroup
073{
074        /*--------------*\
075    ====** Constructors **=====================================================
076        \*--------------*/
077    /**
078     *  Creates a new {@code SVGGroupImpl} instance.
079     */
080    public SVGGroupImpl()
081    {
082        super( SVGELEMENT_Group, ALLOWS_CHILDREN, VALIDATES_ATTRIBUTES, VALIDATES_CHILDREN );
083
084        //---* The children and attributes for the <g> element *---------------
085        final Collection<String> childElements = new HashSet<>();
086        childElements.addAll( ANIMATION.getElements() );
087        childElements.addAll( DESCRIPTIVE.getElements() );
088        childElements.addAll( SHAPE.getElements() );
089        childElements.addAll( STRUCTURAL.getElements() );
090        childElements.addAll( GRADIENT.getElements() );
091        childElements.addAll( List.of( SVGELEMENT_Anchor,
092            SVGELEMENT_AltGlyphDef, SVGELEMENT_ClipPath,
093            SVGELEMENT_ColorProfile, SVGELEMENT_Cursor, SVGELEMENT_Filter,
094            SVGELEMENT_Font, SVGELEMENT_FontFace, SVGELEMENT_ForeignObject,
095            SVGELEMENT_Image, SVGELEMENT_Marker, SVGELEMENT_Mask,
096            SVGELEMENT_Pattern, SVGELEMENT_Script, SVGELEMENT_Style,
097            SVGELEMENT_Switch, SVGELEMENT_Text, SVGELEMENT_View ) );
098
099        final Collection<String> attributes = new ArrayList<>();
100        attributes.add( SVGATTRIBUTE_Id );
101        attributes.addAll( CORE_ATTRIBUTES );
102        attributes.addAll( STYLE_ATTRIBUTES );
103        attributes.addAll( CONDITIONALPROCESSING_ATTRIBUTES );
104        attributes.addAll( GLOBALEVENT_ATTRIBUTES );
105        attributes.addAll( GRAPHICALEVENT_ATTRIBUTES );
106        attributes.addAll( PRESENTATION_ATTRIBUTES );
107
108        updateRegistries( childElements, attributes );
109    }   //  SVGGroupImpl()
110}
111//  class SVGGroupImpl
112
113/*
114 *  End of File
115 */