Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1a440fbf0c858e19b5f6593628cbc0f7a7450a4f (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.j2ee.taglib.internal.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jem.java.JavaClass;
import org.eclipse.jst.j2ee.common.internal.impl.DescriptionGroupImpl;
import org.eclipse.jst.j2ee.taglib.internal.BodyContentType;
import org.eclipse.jst.j2ee.taglib.internal.JSPTag;
import org.eclipse.jst.j2ee.taglib.internal.JSPTagAttribute;
import org.eclipse.jst.j2ee.taglib.internal.JSPVariable;
import org.eclipse.jst.j2ee.taglib.internal.TaglibPackage;


/**
 * The tag element defines an action in this tag library. The tag element has one attribute, id.
 * The tag element may have several subelements defining:
 * name -- The unique action name
 * tag-class -- The tag handler class implementing javax.servlet.jsp.tagext.Tag
 * tei-class -- An optional subclass of javax.servlet.jsp.tagext.TagExtraInfo
 * body-content -- The body content type
 * display-name -- A short name that is intended to be displayed by tools
 * small-icon -- Optional small-icon that can be used by tools
 * large-icon -- Optional large-icon that can be used by tools
 * description -- Optional tag-specific information
 * variable -- Optional scripting variable information
 * attribute -- All attributes of this action
 * example -- Optional informal description of an example of a use of this action.

 */
public class JSPTagImpl extends DescriptionGroupImpl implements JSPTag{

	/**
	 * The default value of the '{@link #getBodyContent() <em>Body Content</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBodyContent()
	 * @generated
	 * @ordered
	 */
	protected static final BodyContentType BODY_CONTENT_EDEFAULT = BodyContentType.TAGDEPENDENT_LITERAL;

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	protected BodyContentType bodyContent = BODY_CONTENT_EDEFAULT;
	/**
	 * This is true if the Body Content attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean bodyContentESet = false;

	/**
	 * The default value of the '{@link #getExample() <em>Example</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getExample()
	 * @generated
	 * @ordered
	 */
	protected static final String EXAMPLE_EDEFAULT = null;

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	protected String example = EXAMPLE_EDEFAULT;
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #isDynamicAttributes() <em>Dynamic Attributes</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isDynamicAttributes()
	 * @generated
	 * @ordered
	 */
	protected static final boolean DYNAMIC_ATTRIBUTES_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isDynamicAttributes() <em>Dynamic Attributes</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isDynamicAttributes()
	 * @generated
	 * @ordered
	 */
	protected boolean dynamicAttributes = DYNAMIC_ATTRIBUTES_EDEFAULT;

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	protected EList attributes = null;
	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	protected EList variables = null;
	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	protected JavaClass tagClass = null;
	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	protected JavaClass teiClass = null;
	public JSPTagImpl() {
		super();
	}
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return TaglibPackage.eINSTANCE.getJSPTag();
	}

	/**
	 * @generated This field/method will be replaced during code generation 
	 * Provides a hint as to the content of the body of this tag. Primarily intended
	 * for use by page composition tools.There are currently three values specified:
	 * 
	 * tagdependent - The body of the tag is interpreted by the tag implementation
	 * itself, and is most likely in a		different "langage", e.g embedded SQL
	 * statements.
	 * 
	 * JSP - The body of the tag contains nested JSP syntax
	 * 
	 * empty - The body must be emptyThe default (if not defined) is JSP#PCDATA ::= 
	 * tagdependent | JSP | empty
	 */
	public BodyContentType getBodyContent() {
		return bodyContent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBodyContent(BodyContentType newBodyContent) {
		BodyContentType oldBodyContent = bodyContent;
		bodyContent = newBodyContent == null ? BODY_CONTENT_EDEFAULT : newBodyContent;
		boolean oldBodyContentESet = bodyContentESet;
		bodyContentESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TaglibPackage.JSP_TAG__BODY_CONTENT, oldBodyContent, bodyContent, !oldBodyContentESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetBodyContent() {
		BodyContentType oldBodyContent = bodyContent;
		boolean oldBodyContentESet = bodyContentESet;
		bodyContent = BODY_CONTENT_EDEFAULT;
		bodyContentESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, TaglibPackage.JSP_TAG__BODY_CONTENT, oldBodyContent, BODY_CONTENT_EDEFAULT, oldBodyContentESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetBodyContent() {
		return bodyContentESet;
	}

	/**
	 * @generated This field/method will be replaced during code generation 
	 * The example element provides an informal description of an example of the use
	 * of a tag.
	 */
	public String getExample() {
		return example;
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public void setExample(String newExample) {
		String oldExample = example;
		example = newExample;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TaglibPackage.JSP_TAG__EXAMPLE, oldExample, example));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TaglibPackage.JSP_TAG__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isDynamicAttributes() {
		return dynamicAttributes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDynamicAttributes(boolean newDynamicAttributes) {
		boolean oldDynamicAttributes = dynamicAttributes;
		dynamicAttributes = newDynamicAttributes;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TaglibPackage.JSP_TAG__DYNAMIC_ATTRIBUTES, oldDynamicAttributes, dynamicAttributes));
	}

	/**
	 * @generated This field/method will be replaced during code generation 
	 */
	public EList getAttributes() {
		if (attributes == null) {
			attributes = new EObjectContainmentEList(JSPTagAttribute.class, this, TaglibPackage.JSP_TAG__ATTRIBUTES);
		}
		return attributes;
	}

	/**
	 * @generated This field/method will be replaced during code generation 
	 * The variable element provides information on the scripting variables defined by 
	 * this tag.
	 * It is a (translation time) error for an action that has one or more variable
	 * subelements to have a TagExtraInfo class that returns a non-null object.
	 * The subelements of variable are of the form:
	 * name-given -- The variable name as a constant
	 * name-from-attribute -- The name of an attribute whose (translation time) value
	 * will give the name of the variable. One of name-given or namefrom-attribute is
	 * required.
	 * variable-class -- Name of the class of the variable. java.lang.String is
	 * default.
	 * declare -- Whether the variable is declared or not. True is the default.
	 * scope -- The scope of the scripting variable defined. NESTED is default.

	 */
	public EList getVariables() {
		if (variables == null) {
			variables = new EObjectContainmentEList(JSPVariable.class, this, TaglibPackage.JSP_TAG__VARIABLES);
		}
		return variables;
	}

	/**
	 * @generated This field/method will be replaced during code generation 
	 * The tag-class element indicates the subclass of javax.serlvet.jsp.tagext.Tag
	 * that implements the request time semantics for this tag. This element is
	 * required.
	 * @regexp fully qualified Java class name

	 */
	public JavaClass getTagClass() {
		if (tagClass != null && tagClass.eIsProxy()) {
			JavaClass oldTagClass = tagClass;
			tagClass = (JavaClass)eResolveProxy((InternalEObject)tagClass);
			if (tagClass != oldTagClass) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TaglibPackage.JSP_TAG__TAG_CLASS, oldTagClass, tagClass));
			}
		}
		return tagClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public JavaClass basicGetTagClass() {
		return tagClass;
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public void setTagClass(JavaClass newTagClass) {
		JavaClass oldTagClass = tagClass;
		tagClass = newTagClass;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TaglibPackage.JSP_TAG__TAG_CLASS, oldTagClass, tagClass));
	}

	/**
	 * @generated This field/method will be replaced during code generation 
	 * The tei-class element indicates the subclass of
	 * javax.servlet.jsp.tagext.TagExtraInfo for this tag. The class is instantiated
	 * at translation time. This element is optional.
	 * @regexp fully qualified Java class name
	 */
	public JavaClass getTeiClass() {
		if (teiClass != null && teiClass.eIsProxy()) {
			JavaClass oldTeiClass = teiClass;
			teiClass = (JavaClass)eResolveProxy((InternalEObject)teiClass);
			if (teiClass != oldTeiClass) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TaglibPackage.JSP_TAG__TEI_CLASS, oldTeiClass, teiClass));
			}
		}
		return teiClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public JavaClass basicGetTeiClass() {
		return teiClass;
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public void setTeiClass(JavaClass newTeiClass) {
		JavaClass oldTeiClass = teiClass;
		teiClass = newTeiClass;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TaglibPackage.JSP_TAG__TEI_CLASS, oldTeiClass, teiClass));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
		if (featureID >= 0) {
			switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
				case TaglibPackage.JSP_TAG__ICONS:
					return ((InternalEList)getIcons()).basicRemove(otherEnd, msgs);
				case TaglibPackage.JSP_TAG__DISPLAY_NAMES:
					return ((InternalEList)getDisplayNames()).basicRemove(otherEnd, msgs);
				case TaglibPackage.JSP_TAG__DESCRIPTIONS:
					return ((InternalEList)getDescriptions()).basicRemove(otherEnd, msgs);
				case TaglibPackage.JSP_TAG__ATTRIBUTES:
					return ((InternalEList)getAttributes()).basicRemove(otherEnd, msgs);
				case TaglibPackage.JSP_TAG__VARIABLES:
					return ((InternalEList)getVariables()).basicRemove(otherEnd, msgs);
				default:
					return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
			}
		}
		return eBasicSetContainer(null, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(EStructuralFeature eFeature, boolean resolve) {
		switch (eDerivedStructuralFeatureID(eFeature)) {
			case TaglibPackage.JSP_TAG__ICONS:
				return getIcons();
			case TaglibPackage.JSP_TAG__DISPLAY_NAMES:
				return getDisplayNames();
			case TaglibPackage.JSP_TAG__DESCRIPTIONS:
				return getDescriptions();
			case TaglibPackage.JSP_TAG__BODY_CONTENT:
				return getBodyContent();
			case TaglibPackage.JSP_TAG__EXAMPLE:
				return getExample();
			case TaglibPackage.JSP_TAG__NAME:
				return getName();
			case TaglibPackage.JSP_TAG__DYNAMIC_ATTRIBUTES:
				return isDynamicAttributes() ? Boolean.TRUE : Boolean.FALSE;
			case TaglibPackage.JSP_TAG__ATTRIBUTES:
				return getAttributes();
			case TaglibPackage.JSP_TAG__VARIABLES:
				return getVariables();
			case TaglibPackage.JSP_TAG__TAG_CLASS:
				if (resolve) return getTagClass();
				return basicGetTagClass();
			case TaglibPackage.JSP_TAG__TEI_CLASS:
				if (resolve) return getTeiClass();
				return basicGetTeiClass();
		}
		return eDynamicGet(eFeature, resolve);
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public boolean eIsSet(EStructuralFeature eFeature) {
		switch (eDerivedStructuralFeatureID(eFeature)) {
			case TaglibPackage.JSP_TAG__ICONS:
				return icons != null && !icons.isEmpty();
			case TaglibPackage.JSP_TAG__DISPLAY_NAMES:
				return displayNames != null && !displayNames.isEmpty();
			case TaglibPackage.JSP_TAG__DESCRIPTIONS:
				return descriptions != null && !descriptions.isEmpty();
			case TaglibPackage.JSP_TAG__BODY_CONTENT:
				return isSetBodyContent();
			case TaglibPackage.JSP_TAG__EXAMPLE:
				return EXAMPLE_EDEFAULT == null ? example != null : !EXAMPLE_EDEFAULT.equals(example);
			case TaglibPackage.JSP_TAG__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case TaglibPackage.JSP_TAG__DYNAMIC_ATTRIBUTES:
				return dynamicAttributes != DYNAMIC_ATTRIBUTES_EDEFAULT;
			case TaglibPackage.JSP_TAG__ATTRIBUTES:
				return attributes != null && !attributes.isEmpty();
			case TaglibPackage.JSP_TAG__VARIABLES:
				return variables != null && !variables.isEmpty();
			case TaglibPackage.JSP_TAG__TAG_CLASS:
				return tagClass != null;
			case TaglibPackage.JSP_TAG__TEI_CLASS:
				return teiClass != null;
		}
		return eDynamicIsSet(eFeature);
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public void eSet(EStructuralFeature eFeature, Object newValue) {
		switch (eDerivedStructuralFeatureID(eFeature)) {
			case TaglibPackage.JSP_TAG__ICONS:
				getIcons().clear();
				getIcons().addAll((Collection)newValue);
				return;
			case TaglibPackage.JSP_TAG__DISPLAY_NAMES:
				getDisplayNames().clear();
				getDisplayNames().addAll((Collection)newValue);
				return;
			case TaglibPackage.JSP_TAG__DESCRIPTIONS:
				getDescriptions().clear();
				getDescriptions().addAll((Collection)newValue);
				return;
			case TaglibPackage.JSP_TAG__BODY_CONTENT:
				setBodyContent((BodyContentType)newValue);
				return;
			case TaglibPackage.JSP_TAG__EXAMPLE:
				setExample((String)newValue);
				return;
			case TaglibPackage.JSP_TAG__NAME:
				setName((String)newValue);
				return;
			case TaglibPackage.JSP_TAG__DYNAMIC_ATTRIBUTES:
				setDynamicAttributes(((Boolean)newValue).booleanValue());
				return;
			case TaglibPackage.JSP_TAG__ATTRIBUTES:
				getAttributes().clear();
				getAttributes().addAll((Collection)newValue);
				return;
			case TaglibPackage.JSP_TAG__VARIABLES:
				getVariables().clear();
				getVariables().addAll((Collection)newValue);
				return;
			case TaglibPackage.JSP_TAG__TAG_CLASS:
				setTagClass((JavaClass)newValue);
				return;
			case TaglibPackage.JSP_TAG__TEI_CLASS:
				setTeiClass((JavaClass)newValue);
				return;
		}
		eDynamicSet(eFeature, newValue);
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public void eUnset(EStructuralFeature eFeature) {
		switch (eDerivedStructuralFeatureID(eFeature)) {
			case TaglibPackage.JSP_TAG__ICONS:
				getIcons().clear();
				return;
			case TaglibPackage.JSP_TAG__DISPLAY_NAMES:
				getDisplayNames().clear();
				return;
			case TaglibPackage.JSP_TAG__DESCRIPTIONS:
				getDescriptions().clear();
				return;
			case TaglibPackage.JSP_TAG__BODY_CONTENT:
				unsetBodyContent();
				return;
			case TaglibPackage.JSP_TAG__EXAMPLE:
				setExample(EXAMPLE_EDEFAULT);
				return;
			case TaglibPackage.JSP_TAG__NAME:
				setName(NAME_EDEFAULT);
				return;
			case TaglibPackage.JSP_TAG__DYNAMIC_ATTRIBUTES:
				setDynamicAttributes(DYNAMIC_ATTRIBUTES_EDEFAULT);
				return;
			case TaglibPackage.JSP_TAG__ATTRIBUTES:
				getAttributes().clear();
				return;
			case TaglibPackage.JSP_TAG__VARIABLES:
				getVariables().clear();
				return;
			case TaglibPackage.JSP_TAG__TAG_CLASS:
				setTagClass((JavaClass)null);
				return;
			case TaglibPackage.JSP_TAG__TEI_CLASS:
				setTeiClass((JavaClass)null);
				return;
		}
		eDynamicUnset(eFeature);
	}

	/**
	 * @generated This field/method will be replaced during code generation.
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (bodyContent: ");
		if (bodyContentESet) result.append(bodyContent); else result.append("<unset>");
		result.append(", example: ");
		result.append(example);
		result.append(", name: ");
		result.append(name);
		result.append(", dynamicAttributes: ");
		result.append(dynamicAttributes);
		result.append(')');
		return result.toString();
	}

}














Back to the top