Inspect RendererType, Component Family and StyleKitFamily for a Component

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">

	<!--
		Bind the Component that you want to inspect to a request scope
		variable by using the 'binding' property We Will use 'myComponent' as
		scope variable name
	-->
	<xe:widgetContainer id="widgetContainer1"
		titleBarText="Hi there" binding="#{requestScope.myComponent}">
	</xe:widgetContainer>

	<!-- Output the properties of that Component -->
	<xp:table>
		<xp:tr>
			<xp:td>
				<xp:label value="Component Family" id="label1"></xp:label>
			</xp:td>
			<xp:td>
				<!--
					Output the Component's Component Family using getFamily() 'family'
					in EL Notation
				-->
				<xp:text escape="true" id="computedField1"
					value="#{requestScope.myComponent.family}"></xp:text>
			</xp:td>
		</xp:tr>
		<xp:tr>
			<xp:td>
				<xp:label value="Renderer Type" id="label2"></xp:label>
			</xp:td>
			<xp:td>
				<!--
					Output the Component's Renderer Type using getRendererType()
					'rendererType' in EL Notation
				-->
				<xp:text escape="true" id="computedField2"
					value="#{requestScope.myComponent.rendererType}"></xp:text>

			</xp:td>
		</xp:tr>
		<xp:tr>
			<xp:td>
				<xp:label value="StyleKit Family" id="label3"></xp:label>
			</xp:td>
			<xp:td>
				<!--
					Output the Component's Style Kit Family using getStyleKitFamily()
					'styleKitFamily' in EL Notation
				-->
				<xp:text escape="true" id="computedField3"
					value="#{requestScope.myComponent.styleKitFamily}"></xp:text>
			</xp:td>
		</xp:tr>

	</xp:table>

</xp:view>





If you don't have access to the Source Code of a component, or don't know where to look, you can use this snippet to inspect the component's ComponentFamily and RendererType (Which are used to select a renderer) and the StyleKitFamily (which is used to apply theme properties)

In this example I am inspecting the widget Container but you would relpace that with whatever component you want to inspect, making sure the binding property is the same

XPages
Cameron Gregor
March 8, 2016 2:59 AM
Rating
7

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...