Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8b8a4adcd09f6cd5b3dc9292fc885adbee26e408 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package org.eclipse.jst.jsf.facelet.core.internal.tagmodel;

import java.util.Map;

import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute;
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagElement;
import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor;
import org.eclipse.jst.jsf.facelet.core.internal.cm.FaceletDocumentFactory;
import org.eclipse.jst.jsf.facelet.core.internal.cm.TagInfo;

/**
 * A description of the a facelet tag
 * 
 * @author cbateman
 * 
 */
public abstract class FaceletTag extends TagElement implements IJSFTagElement
{
    /**
     * 
     */
    private static final long                    serialVersionUID = 3027895246947365781L;
    private final String                         _uri;
    private final String                         _name;
    private final TagType                        _type;
    private final String                         _tagHandlerClass;
    private final AttributeHandlerMapAdapter     _attributeHandlerMapAdapter;
    private final IAttributeAdvisor              _advisor;

    /**
     * @param uri
     * @param name
     * @param type
     * @param tagHandlerClassName
     * @param docFactory
     * @param advisor
     */
    protected FaceletTag(final String uri, final String name,
            final TagType type, final String tagHandlerClassName,
            final FaceletDocumentFactory docFactory,
            final IAttributeAdvisor advisor)
    {
        _uri = uri;
        _name = name;
        _type = type;
        _tagHandlerClass = tagHandlerClassName;
        final TagInfo tagInfo = docFactory.getOrCreateExtraTagInfo(uri);
        _attributeHandlerMapAdapter = new AttributeHandlerMapAdapter(tagInfo, advisor, name);
        _advisor = advisor;
    }

    /**
     * @return the name of the tag
     */
    @Override
    public final String getName()
    {
        return _name;
    }

    public final TagType getType()
    {
        return _type;
    }

    @Override
    public String getUri()
    {
        return _uri;
    }

    @Override
    public String getTagHandlerClassName()
    {
        return _tagHandlerClass;
    }

    @Override
    public String toString()
    {
        return "Tag Name: " + getName() + "Tag Type: " + getType(); //$NON-NLS-1$ //$NON-NLS-2$
    }

    @Override
    public Map<?, ?> getAttributeHandlers()
    {
        return _attributeHandlerMapAdapter;
    }

    public Map<String, ? extends ITagAttribute> getAttributes()
    {
        return _advisor.getAttributes();
    }

}

Back to the top