Skip to content

Diagram: Inherit UIData #9551

@rider87

Description

@rider87

Describe the bug

It seems the p:diagram does not generate a iterator (uniqueId).
Therefore all element / components inside a <f:facet name="element"> // MyComponent has the same id.

<h:form id="automationFlowChartForm">
	<p:diagram id="automationDiagram"
				value="#{myController.model}"
				var="diagramElement">
		<p:ajax event="positionChange"
					listener="#{automationFlowChartView.doSavePosition()}" />
		<f:facet name="element">
			<f:attribute name="element" value="#{diagramElement}" />
			<p:panel id="triggerPanel" >
				<f:facet name="header">
					<h:outputText styleClass="#{diagramElement.icon} Fs11" />
					<h:outputText value="#{diagramElement.name}"
				styleClass="FontBold Fs11" style="margin-left: 10px;" />
				</f:facet>
				<h:outputText id="triggerText" value="TEST" />
			</p:panel>
		</f:facet>
	</p:diagram>
</h:form>

This means also a normal actionListener for a element is also not working and I will always get only the first element from p:diagram.
<p:commandButton actionListener="#{myController.openDialogClicked(element)}" icon="fa fa-edit" />

<f:facet name="element"> has a unique ID, but all components inside has the same ID.
I would assume a iterator, like in the p:datatable etc.

So for the component inside the <f:facet name="element"> you have than something like:
automationFlowChartForm:0:triggerPanel, for the next panel automationFlowChartForm:1:triggerPanel, but currently for all panels you will have:
automationFlowChartForm:triggerPanel.
This means also for buttons etc.: if you hover on a button, it will change the color for each button with this ID, because all components are not unique...

I can see this also in the HTML console:
image

Green is the var="diagramElement", but you can see the ID from the panel is always the same.

Can this be fixed?

Reproducer

No response

Expected behavior

No response

PrimeFaces edition

None

PrimeFaces version

12.0.0

Theme

No response

JSF implementation

Mojarra

JSF version

2.4

Java version

11

Browser(s)

Chrome

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions