Drag&Drop Bug in version 3.0M4?

UI Components for JSF
Post Reply
LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

26 Nov 2011, 12:39

Hi

this was working with version 2.2.1:

Code: Select all

<p:dialog widgetVar="goal" resizable="false" modal="true"
		closable="false" minWidth="750" minHeight="400"
		visible="#{tournamentMatchBean.goalDialogVisible}">
		<h:panelGroup id="goal_content">
			<h:outputText styleClass="stdTextBold"
				value="Goal for #{tournamentMatchBean.getActionTeamName()}" />
			<br />
			<br />
			<h:panelGrid columns="2">
				<h:panelGroup id="goal_information_grid">
					<p:fieldset id="selectedGoalPlayer" legend="Player">
						<p:outputPanel id="dropGoalPlayerArea">
							<h:outputText value="Drop goal player here!"
								styleClass="successText"
								rendered="#{empty tournamentMatchBean.droppedGoalPlayer}" />
							<p:dataGrid var="player" id="goal_player_list_grid"
								value="#{tournamentMatchBean.droppedGoalPlayer}"
								rendered="#{not empty tournamentMatchBean.droppedGoalPlayer}">
								<p:column>
									<p:panel id="player_drop_panel">
										<h:outputText styleClass="smallText"
											value="#{player.number} #{player.first_name} #{player.last_name}" />
									</p:panel>
								</p:column>
							</p:dataGrid>
						</p:outputPanel>
					</p:fieldset>
					<p:droppable for="selectedGoalPlayer" tolerance="touch"
						activeStyleClass="ui-state-highlight" datasource="team_goal_players"
						dropListener="#{tournamentMatchBean.onGoalPlayerDrop}"
						onDropUpdate="dropGoalPlayerArea team_goal_players">
					</p:droppable>
					<br />
					<p:fieldset id="selectedAssist" legend="Assist">
						<p:outputPanel id="dropAssistArea">
							<h:outputText value="Drop assist player here!"
								styleClass="successText"
								rendered="#{empty tournamentMatchBean.droppedAssistPlayer}" />
							<p:dataGrid var="player"
								value="#{tournamentMatchBean.droppedAssistPlayer}"
								rendered="#{not empty tournamentMatchBean.droppedAssistPlayer}">
								<p:column>
									<p:panel id="player_drop_panel">
										<h:outputText styleClass="smallText"
											value="#{player.number} #{player.first_name} #{player.last_name}" />
									</p:panel>
								</p:column>
							</p:dataGrid>
						</p:outputPanel>
					</p:fieldset>
					<p:droppable for="selectedAssist" tolerance="touch"
						activeStyleClass="ui-state-highlight" datasource="team_goal_players"
						dropListener="#{tournamentMatchBean.onAssistPlayerDrop}"
						onDropUpdate="dropAssistArea team_goal_players">
					</p:droppable>
					<br />
					<p:fieldset id="goal_time" legend="Time"
						style="width: 150px; height: 60px;">
						<p:inputText maxlength="2" style="width: 15px"
							value="#{tournamentMatchBean.goalMin}" >
							<f:validateLongRange minimum="0" maximum="60" />
						</p:inputText>
						<h:outputText styleClass="stdTextBold" value="m " />
						<p:inputText maxlength="2" style="width: 15px"
							value="#{tournamentMatchBean.goalSec}">
							<f:validateLongRange minimum="0" maximum="60" />
						</p:inputText>
						<h:outputText styleClass="stdTextBold" value="s " />
					</p:fieldset>
				</h:panelGroup>
				<h:panelGroup id="team_goal_player_group">
					<p:fieldset legend="Team Players">
						<p:dataGrid id="team_goal_players" var="player"
							value="#{tournamentMatchBean.players}" columns="3">
							<p:column>
								<p:panel id="player_panel" style="text-align:center">
									<h:outputText styleClass="smallText"
										value="#{player.number} #{player.first_name} #{player.last_name}" />
								</p:panel>
								<p:draggable for="player_panel" revert="true"
									handle=".ui-panel-titlebar" stack=".ui-panel" />
							</p:column>
						</p:dataGrid>
					</p:fieldset>
				</h:panelGroup>
			</h:panelGrid>
			<br />
			<p:commandButton value="Add Goal" id="goal_add_action"
				title="Add Goal for #{tournamentMatchBean.team2.team_name}"
				action="#{tournamentMatchBean.addGoal}" image="ui-icon ui-icon-gear"
				ajax="false" actionListener="#{tournamentMatchBean.addGoalListener}" />
			<p:commandButton value="Close" title="Close"
				action="#{tournamentMatchBean.reset}" image="ui-icon ui-icon-gear"
				ajax="false" />
			<br />
			<p:messages showSummary="true" showDetail="false" />
		</h:panelGroup>
	</p:dialog>
With version 3.0M4 the drop is not recognized any more. I take the panel over the drop area and nothing happend. In debug mode I noticed that the onDropListener is not called any more. And due to that no update of the datasource and the dropArea happen.

Any ideas?

Lars

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

26 Nov 2011, 19:51

Solved this by using <p:ajax> instead of attributes which does not exist any more...

I can drop 1 item now, if I try to drop a second or try to commit the droped one I've get the following exception:

Code: Select all

[javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;] with root cause
java.lang.ClassCastException: javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;
	at org.primefaces.component.behavior.ajax.AjaxBehavior.restoreState(AjaxBehavior.java:317)
	at javax.faces.component.UIComponentBase.restoreBehaviors(UIComponentBase.java:2052)
	at javax.faces.component.UIComponentBase.restoreBehaviorsState(UIComponentBase.java:2019)
	at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1439)
	at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:242)
	at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:147)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1476)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIForm.visitTree(UIForm.java:331)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UINamingContainer.visitTree(UINamingContainer.java:159)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at javax.faces.component.UIComponent.visitTree(UIComponent.java:1487)
	at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:234)
	at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
	at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:119)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:438)
	at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:144)
	at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:182)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
	at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
The drop listener is not called before.

Also, whats about the "handleDrop" function which is show in the show cases? If I implemend something like this even dragging of the elements is not possible any more.

Lars

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests