2 Replies Latest reply on Mar 22, 2007 2:47 PM by Stuart Robertson

    A Seam example with RichFaces?

    Manuel Gentile Newbie

      Hello,
      I think it is useful to have an example of using Seam with richfaces. In particular with drag and drop features.
      I have some problem with this and the RichFaces people didn't give me a solution. The richfaces example works... but i use
      Seam+Facelet+Richfaces from CVS and I'm not able to use the drag and drop features.....

      Thanks

        • 1. Re: A Seam example with RichFaces?
          Norman Richards Master

          seam-gen will generate a richfaces-enabled app, but it doesn't make use of drag and drop. I don't know which examples will be updated for Richfaces in 1.2.1, but you can expect to see more and more Richfaces in them over time.

          • 2. Re: A Seam example with RichFaces?
            Stuart Robertson Novice

             

            "manuel.gentile@itd.cnr.it" wrote:
            Hello,
            I think it is useful to have an example of using Seam with richfaces. In particular with drag and drop features.
            I have some problem with this and the RichFaces people didn't give me a solution. The richfaces example works... but i use
            Seam+Facelet+Richfaces from CVS and I'm not able to use the drag and drop features.....

            Thanks


            I'm using DnD for a "map your columns to our columns" type scenario with the latest Seam + Facelets + Richfaces. Up until yesterday when the Richfaces snapshot seemed to break with JSF 1.2 (http://jboss.com/index.html?module=bb&op=viewtopic&t=104731) it worked extremely well. Here's a summary:

             <rich:dragIndicator id="indicator" />
             <s:link action="#{feedMapping.hideEmptyFeedColumns}" value="Hide Empty Columns" rendered="#{empty feedMapping.hiddenEmptyFeedMappingColumns}"/>
             <s:link action="#{feedMapping.showEmptyFeedColumns}" value="Show Empty Columns (#{feedMapping.hiddenEmptyFeedMappingColumnCount} hidden)" rendered="#{! empty feedMapping.hiddenEmptyFeedMappingColumns}"/>
             <h:form id="mapping">
             <div style="float: left; width: 60%;">
             <rich:panel id="feedColumns">
             <f:facet name="header">Your Columns</f:facet>
             <rich:dataTable value="#{unmappedColumns}" var="fm"
             styleClass="datatable" rowClasses="rowOdd,rowEven" style="width: 100%;">
             <h:column>
             <f:facet name="header">Your Column</f:facet>
             #{fm.rawColumn.columnNumber}
             </h:column>
             <h:column>
             <f:facet name="header">Example Data(Drag me!)</f:facet>
             <a:outputPanel style="border:1px solid grey;padding:2px;"
             layout="block">
             <rich:dragSupport dragIndicator=":indicator" dragType="column"
             dragValue="#{fm.rawColumn.columnNumber}">
             <rich:dndParam name="label" value="#{fm.rawColumn.header}" />
             </rich:dragSupport>
             <span style="float: right"><strong>#{fm.rawColumn.header}</strong></span> <em>#{fm.rawColumn.oneExample}</em>
             </a:outputPanel>
             </h:column>
             </rich:dataTable>
             </rich:panel>
             </div>
             <div>
             <rich:panel id="cdmFields">
             <f:facet name="header">
             <h:outputText value="CDM Fields" />
             </f:facet>
            
             <rich:dataGrid value="#{remainingCdmFields}"
             var="fm" columns="2">
             <h:column>
             <a:outputPanel style="border:1px solid #{fm.required ? 'red' : 'grey'};padding:2px;" layout="block">
             <rich:dropSupport acceptedTypes="column" dropValue="#{fm.cdmField}"
             dropListener="#{feedMapping.mapColumn}" reRender="cdmFields,messages,mappedColumns,feedColumns">
             </rich:dropSupport>
             #{fm.cdmField.name}
             </a:outputPanel>
             </h:column>
             </rich:dataGrid>
             </rich:panel>
             </div>
            


            In the SFSB the DnD event is received like this:

             public void mapColumn(DropEvent dropEvent) {
             Dropzone dropzone = (Dropzone) dropEvent.getComponent();
             this.mapColumn(Integer.parseInt(dropEvent.getDragValue().toString()), dropzone.getDropValue().toString());
             }
            
            


            Hope that helps. You'll find quite a few Richfaces examples in the seam example apps - especially the wiki. Though they don't cover DnD.