I'm also using DnD from Richfaces, and just like you started with a simple example to
explore it. It's working fine for me (also latest Seam from CVS) so I'll post
what I have in case it helps you out.
Here's the xhtml:
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition
xmlns="http://www.w3.org/1999/xhtml"
|
xmlns:s="http://jboss.com/products/seam/taglib"
|
xmlns:ui="http://java.sun.com/jsf/facelets"
|
xmlns:f="http://java.sun.com/jsf/core"
|
xmlns:h="http://java.sun.com/jsf/html"
|
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
|
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| template="/themes/#{globalPrefs.themeName}/template.xhtml">
|
| <ui:define name="content">
| <h1>Drag and Drop exploration</h1>
|
| <a:outputPanel id="messages">
| <h:messages styleClass="message" />
| </a:outputPanel>
| <rich:dragIndicator id="indicator" />
| <h:form id="dand">
|
| <h:panelGrid columnClasses="panelc" columns="4"
width="100%">
|
| <rich:panel>
| <f:facet name="header">
| <h:outputText value="Source List!" />
| </f:facet>
| <h:dataTable id="src" columns="1"
value="#{dand.genders}" var="fm">
| <h:column>
| <a:outputPanel style="border:1px solid gray;padding:2px;"
| layout="block">
| <rich:dragSupport dragIndicator=":indicator"
| dragType="gender" dragValue="#{fm}">
| <rich:dndParam name="label" value="#{fm}" />
| </rich:dragSupport>
| #{fm}
| </a:outputPanel>
| </h:column>
| </h:dataTable>
| </rich:panel>
|
| <rich:panel>
| <f:facet name="header">
| <h:outputText value="CDM Fields" />
| </f:facet>
|
| <h:dataTable id="cdmtable" columns="1"
| value="#{dand.fields}" var="fm">
| <h:column>
| <a:outputPanel style="border:1px solid gray;padding:2px;"
| layout="block">
| <rich:dropSupport acceptedTypes="gender"
dropValue="#{fm}"
| dropListener="#{dand.dragged}" reRender="messages">
| </rich:dropSupport>
| #{fm}
| </a:outputPanel>
| </h:column>
| </h:dataTable>
| </rich:panel>
|
| </h:panelGrid>
| </h:form>
|
| </ui:define>
| </ui:composition>
|
Here's the SLSB:
| package com.fb.core.action;
|
| import java.util.ArrayList;
| import java.util.EnumSet;
| import java.util.List;
|
| import javax.ejb.Stateless;
|
| import org.ajax4jsf.dnd.Dropzone;
| import org.ajax4jsf.dnd.event.DropEvent;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.datamodel.DataModel;
| import org.jboss.seam.framework.EntityController;
|
| import com.fb.core.model.cdm.CdmField;
| import com.fb.core.model.cdm.Gender;
|
| @Stateless
| @Name("dand")
| public class DandDAction extends EntityController implements DanD {
|
| private static final long serialVersionUID = -5492165330283497323L;
|
| @DataModel
| private final List<CdmField> fields;
| @DataModel
| private final List<Gender> genders;
|
| public DandDAction() {
| fields = new ArrayList<CdmField>();
| fields.addAll(EnumSet.allOf(CdmField.class));
| genders = new ArrayList<Gender>();
| genders.addAll(EnumSet.allOf(Gender.class));
| }
|
| public void dragged(DropEvent dropEvent) {
| Dropzone dropzone = (Dropzone) dropEvent.getComponent();
| addFacesMessage("Dragged #0 with dragType #1 onto dropValue #2",
| dropEvent.getDragValue(), dropEvent.getDragType(), dropzone.getDropValue());
| }
|
| public List<CdmField> getFields() {
| return fields;
| }
|
| public List<Gender> getGenders() {
| return genders;
| }
|
| }
|
There wasn't really much else to it. The two lists in the SLSB just contain enums.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032931#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...