另外我的last post关于订单列表我遇到了一个我不明白的新问题。 显示,添加和删除我的订单列表的数据非常好。
但是如何重新排序订单列表中的数据并存储它们。
如果我使用订单列表的标准功能,请抓住一个项目并将其拉到另一个位置。在我将项目释放到所需位置后,它会跳回到原来的位置,我会得到一个超出约束范围的索引。
有谁能告诉我这里有什么问题:
技术人员只是我实体中的一个普通的ArrayList。
XML:
<h:panelGroup>
<p:remoteCommand name="removeTechniker" actionListener="#{systemlandschaftRessourceHandler.removeTechnikerByRemoteCommand}"
out="technikersTable" update="@form"/>
<p:orderList id="technikersTable"
value="#{systemlandschaftRessourceHandler.entity.technikers}"
var="_techniker"
itemValue="#{_techniker}"
converter="#{entityConverter}"
controlsLocation="none">
<f:facet name="caption">Techniker</f:facet>
<p:column>
<p:commandButton id="deleteTechnikerFromListButton"
styleClass="colButton"
icon="ui-icon-trash"
type="button"
onclick="removeTechniker([{name:'id', value:'#{_techniker.id}'}]);"
update="@form"/>
</p:column>
<p:column style="width:75%;" id="outTech">
<p:outputLabel value="#{_techniker.verantwortlich.displayName}"/>
</p:column>
</p:orderList>
<p:droppable id="technikerDrop" for="technikersTable" tolerance="touch" activeStyleClass="ui-state-highlight" datasource=":systemLandschaftTabView:sysObjektDetailPanelForm:userTable">
<p:ajax listener="#{systemlandschaftRessourceHandler.onDropTechniker}" update="@form" />
</p:droppable>
</h:panelGroup>
<h:panelGroup>
堆栈跟踪:
DEBUG 2013-10-16 11:13:53,899 [EntityManagerProducer] EntityManager geschlossen.
INFO 2013-10-16 11:16:16,783 [context] java.lang.ArrayIndexOutOfBoundsException: -1: java.lang.ArrayIndexOutOfBoundsException: -1
at org.primefaces.component.dnd.Droppable.queueEvent(Droppable.java:201)
at org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.decode(AjaxBehaviorRenderer.java:42)
at javax.faces.component.behavior.ClientBehaviorBase.decode(ClientBehaviorBase.java:132)
at org.primefaces.renderkit.CoreRenderer.decodeBehaviors(CoreRenderer.java:378)
at org.primefaces.component.dnd.DroppableRenderer.decode(DroppableRenderer.java:32)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181)
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506)
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1612)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIForm.visitTree(UIForm.java:371)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at org.primefaces.component.tabview.TabView.visitTree(TabView.java:419)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at de.company.sessioninfo.HttpSessionUserFilter.doFilter(HttpSessionUserFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
at java.lang.Thread.run(Thread.java:722)
答案 0 :(得分:2)
自己解决; - )
解决方案是指定p:droppable的范围和相应的p:draggable
<p:droppable id="technikerDrop" for="technikersTable" tolerance="touch" activeStyleClass="ui-state-highlight" datasource=":systemLandschaftTabView:sysObjektDetailPanelForm:userTable" scope="userDraggable">
<p:ajax listener="#{systemlandschaftRessourceHandler.onDropTechniker}" update="@form" />
</p:droppable>