protected final void renderComponentTag()

in wicket-core/src/main/java/org/apache/wicket/Component.java [3932:4007]


	protected final void renderComponentTag(ComponentTag tag)
	{
		if (needToRenderTag(tag))
		{
			// apply behaviors that are attached to the component tag.
			if (tag.hasBehaviors())
			{
				tag = tag.mutable();
				Iterator<? extends Behavior> tagBehaviors = tag.getBehaviors();
				while (tagBehaviors.hasNext())
				{
					final Behavior behavior = tagBehaviors.next();
					if (behavior.isEnabled(this))
					{
						behavior.onComponentTag(this, tag);
					}
					behavior.detach(this);
				}
			}

			// Apply behavior modifiers
			List<? extends Behavior> behaviors = getBehaviors();
			if ((behaviors != null) && !behaviors.isEmpty() && !tag.isClose() &&
				(isIgnoreAttributeModifier() == false))
			{
				tag = tag.mutable();
				for (Behavior behavior : behaviors)
				{
					// Components may reject some behavior components
					if (isBehaviorAccepted(behavior))
					{
						behavior.onComponentTag(this, tag);
					}
				}
			}

			if ((tag instanceof WicketTag) && !tag.isClose() &&
				!getFlag(FLAG_IGNORE_ATTRIBUTE_MODIFIER))
			{
				ExceptionSettings.NotRenderableErrorStrategy notRenderableErrorStrategy = ExceptionSettings.NotRenderableErrorStrategy.LOG_WARNING;
				if (Application.exists())
				{
					notRenderableErrorStrategy = getApplication().getExceptionSettings().getNotRenderableErrorStrategy();
				}

				String tagName = tag.getNamespace() + ":" + tag.getName();
				String componentId = getId();
				if (getFlag(FLAG_OUTPUT_MARKUP_ID))
				{
					String message = String.format("Markup id set on a component that is usually not rendered into markup. " +
					                               "Markup id: %s, component id: %s, component tag: %s.",
					                               getMarkupId(), componentId, tagName);
					if (notRenderableErrorStrategy == ExceptionSettings.NotRenderableErrorStrategy.THROW_EXCEPTION)
					{
						throw new IllegalStateException(message);
					}
					log.warn(message);
				}
				if (getFlag(FLAG_PLACEHOLDER))
				{
					String message = String.format(
							"Placeholder tag set on a component that is usually not rendered into markup. " +
							"Component id: %s, component tag: %s.", componentId, tagName);
					if (notRenderableErrorStrategy == ExceptionSettings.NotRenderableErrorStrategy.THROW_EXCEPTION)
					{
						throw new IllegalStateException(message);
					}
					log.warn(message);
				}
			}

			// Write the tag
			tag.writeOutput(getResponse(), !needToRenderTag(null),
				getMarkup().getMarkupResourceStream().getWicketNamespace());
		}
	}