[JSF + RICHFACES] Drag and Drop

0 respostas
phfaustino

Bom dia, estou tentando implementar um drag and drop no meu projeto mas não estou conseguindo.
Já estudei o código do próprio richfaces ([url]http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=dragDrop&sample=dragDrop&skin=blueSky[/url]), que utiliza os componentes rich:dragSource e rich:dropTarget, porém quando eu arrasto meu componente (dragSource) para seu destino (dropTarget), o listener que deve ser disparado no meu ManagedBean não é acionado.

Meu managed bean é bem simples, e apenas implementei o método processDrop

public void processDrop(DropEvent dropEvent) {
	Coluna coluna = (Coluna) dropEvent.getDragValue();
	System.out.println(coluna);
}

Meu xhtml está assim:

<ui:define name="panelColunas">
		<pxt:panelGrid columnsWidth="*" width="100%">
			<rich:dataGrid value="#{mb.colunas}" var="coluna" columns="6" elements="24" style="width:100%">
				<h:panelGrid>
					<a4j:outputPanel layout="block">
						<rich:dragSource dragValue="#{coluna}" type="COL" />
						<h:outputText value="#{coluna.nome}" styleClass="outputText" style="cursor:pointer"/>		
					</a4j:outputPanel>		
				</h:panelGrid>
				<f:facet name="footer">
                    <rich:dataScroller />
                </f:facet>
			</rich:dataGrid>								
		</pxt:panelGrid>
		
	</ui:define>
	
	<ui:define name="panelFiltro">
		<pxt:panelGrid columnsWidth="*" width="100%">
			<h:outputText value="Período" styleClass="outputText" />
		</pxt:panelGrid>
	</ui:define>

	<ui:define name="table">
		<rich:panel id="pnlTable" header="Resultado da Consulta" bodyClass="pxt-rich-body-panel-detail">
			<rich:dropTarget dropListener="#{mb.processDrop}" acceptedTypes="COL" />
			<rich:dataTable id="table" var="obj" rowClasses="pxt-odd-row, pxt-even-row" value="#{mb.listagem}" styleClass="stable"
				footerClass="pxt-rf-dt-ftr-c">

				<f:facet name="footer">
					<rich:dataScroller id="scroller" renderIfSinglePage="false" align="left" render="tableStyle" />
				</f:facet>
			</rich:dataTable>
			<h:panelGroup id="tableStyle">
				<ui:include src="/META-INF/facelets/templates/tableStyle.xhtml" />
			</h:panelGroup>
		</rich:panel>
	</ui:define>

Alguém sabe o que está faltando para funcionar? Ou o que está errado?
Obrigado!

Criado 3 de setembro de 2012
Respostas 0
Participantes 1