ScopeType.COMPONENT: How to emulate it before JSF 2.0?
luxspes Jan 19, 2009 10:49 PMWe do not have it (pdf)... but if we had a ScopeType.COMPONENT that we could place a single component multiple times at various places around the page (it seems that we might have something like that in JSF 2.0.
But right now, how do you deal with this? In my case, I modified the EntityList generated by seam-gen to be re-usable inside a modal panel:
<rich:modalPanel id="modalPanelEmpleadoList" width="640" height="480"> <f:facet name="header"> <h:panelGroup> <h:outputText value="Seleccionar empleado"></h:outputText> </h:panelGroup> </f:facet> <f:facet name="controls"> <h:panelGroup> <h:outputText value="X" style="cursor:pointer" id="hidelinkEmpleado"></h:outputText> <rich:componentControl for="modalPanelEmpleadoList" attachTo="hidelinkEmpleado" operation="hide" event="onclick"/> </h:panelGroup> </f:facet> <f:subview id="empleadoSubView"> <ui:include src="/Crud/Empleado/EmpleadoList.xhtml" > <ui:param name="isModalPanel" value="#{true}"/> <ui:param name="parentHome" value="#{equipoProyectoHome}"/> <ui:param name="parentAction" value="wire"/> <ui:param name="parentRelationship" value="empleado"/> </ui:include> </f:subview> </rich:modalPanel> <h:commandButton id="empleadoButton" value="Elegir empleado"> <rich:componentControl for="modalPanelEmpleadoList" attachTo="empleadoButton" operation="show" event="onclick"> </rich:componentControl> </h:commandButton>
In this case, it is a link between the entity EquipoProyecto and the entity Empleado. I built this to overcome the problem described in CRUD is conversational, seamgen is not, it works, but now I have a new kind of problem, my new code works fine as long as there is only 1 relationship between 2 entities:
Question (asked by)ManyToOne Person
But, if I have 2 relationships:
Question (asked by)ManyToOne Person Question (answered by)ManyToOne Person
Then that means that I will have 2 ui:include referencing PersonList.xhtml in QuestionEdit.xhtml... and since there are some state in PersonList binded with ScopeType.PAGE (AFAIK it is the only sane way to deal with nested h:selectOneMenu ) that state is going to be automatically shared between the 2 instances
of PersonList.xhtml.
Any hints on how to deal with this? (I can not wait until we get ScopeType.COMPONENT with JSF 2.0!! )