[jboss-user] [JBoss Seam] - Re: A Seam example with RichFaces?

stu2 do-not-reply at jboss.com
Thu Mar 22 14:47:28 EDT 2007


"manuel.gentile at 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.  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030771#4030771

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030771



More information about the jboss-user mailing list