[jboss-user] [JBoss Seam] - Re: can I join a session with a conversation?

mnrz do-not-reply at jboss.com
Sat May 5 08:11:55 EDT 2007


ok

here is the page that has a button to go to setting.xhtml:


  | <?xml version="1.0" encoding="utf-8" ?>
  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns="http://www.w3.org/1999/xhtml"
  | 	xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	xmlns:h="http://java.sun.com/jsf/html"
  | 	xmlns:t="http://myfaces.apache.org/tomahawk"
  | 	xmlns:s="http://myfaces.apache.org/sandbox"
  | 	xmlns:f="http://java.sun.com/jsf/core"
  | 	xmlns:c="http://java.sun.com/jstl/core"
  | 	xmlns:fn="http://java.sun.com/jsp/jstl/functions">
  | <ui:composition template="/pages/template.xhtml">
  | 	<ui:define name="topnav">
  | 		<ui:include src="/pages/incl/navbar.xhtml" />
  | 	</ui:define>
  | 	<ui:define name="body">
  | 		<f:view>
  | 			<h:form id="resultQuery">
  | 				<s:fieldset legend="Settings:" align="left">
  | 					<h:panelGrid bgcolor="#cccccc" columns="5">
  | 						<t:selectOneMenu id="rowPerPageOption" onchange="submit(this)"
  | 							valueChangeListener="#{searchResult.rowPerPageChanged}">
  | 							<f:selectItem itemLabel="5" itemValue="5" />
  | 							<f:selectItem itemLabel="10" itemValue="10" />
  | 							<f:selectItem itemLabel="20" itemValue="20" />
  | 							<f:selectItem itemLabel="30" itemValue="30" />
  | 							<f:selectItem itemLabel="40" itemValue="40" />
  | 							<f:selectItem itemLabel="50" itemValue="50" />
  | 							<f:selectItem itemLabel="100" itemValue="100" />
  | 							<f:selectItem itemLabel="200" itemValue="200" />
  | 						</t:selectOneMenu>
  | 
  | 						<h:commandButton action="#{searchResult.setting}"
  | 							value="Columns..." />
  | 
  | 						<h:commandButton actionListener="#{exportData.export}"
  | 							value="Export to Excel" />
  | 						<h:commandButton actionListener="#{exportDataIText.exportToPDF}"
  | 							value="Export to PDF" />
  | 						<h:commandButton actionListener="#{exportDataIText.exportToRTF}"
  | 							value="Export to Word" />
  | 
  | 						<s:pprPanelGroup id="pprInlineMsg"
  | 							partialTriggers="resultQuery:rowPerPageOption"
  | 							inlineLoadingMessage="Loading..."></s:pprPanelGroup>
  | 
  | 						<t:popup styleClass="popup" id="popupMenu">
  | 
  | 							<h:outputText value="loading file"
  | 								rendered="#{exportData.loading}" />
  | 							<f:facet name="popup">
  | 								<h:panelGroup>
  | 									<h:panelGrid columns="1">
  | 										<ui:repeat value="#{exportData.listDownload}" var="down">
  | 											<h:commandLink action="#{dounloadFile.downloading}">
  | 												<f:param name="fileupload_type" value="#{down.contentType}" />
  | 												<f:param name="fileupload_name" value="#{down.filename}" />
  | 												<h:outputText value="#{down.filename}" />
  | 											</h:commandLink>
  | 										</ui:repeat>
  | 									</h:panelGrid>
  | 								</h:panelGroup>
  | 							</f:facet>
  | 						</t:popup>
  | 					</h:panelGrid>
  | 				</s:fieldset>
  | 				<hr />
  | 				<s:pprPanelGroup id="pprPanelall" align="center"
  | 					partialTriggers="resultQuery:rowPerPageOption">
  | 					<f:subview id="panelTabbedPane1" >
  | 					<t:panelTabbedPane style="text-align:center;" align="center"
  | 						serverSideTabSwitch="false">
  | 						<c:forEach items="#{searchResult.dataModels}" var="item">
  | 							<t:panelTab label="#{item.key.simpleName}">
  | 
  | 								<h:panelGroup style="text-align:center;" align="center">
  | 									<t:dataTable id="#{fn:replace(item.key.simpleName,'\\.','_')}"
  | 										value="#{item.value}" sortAscending="#{ascending}"
  | 										sortColumn="#{sortColumn}" preserveSort="false" border="1"
  | 										rowOnMouseOver="this.style.backgroundColor='#cccccc'"
  | 										rowOnMouseOut="this.style.backgroundColor=''"
  | 										preserveDataModel="false" cellspacing="0" cellpadding="0"
  | 										rows="#{searchResult.rowPerPage}" width="80%"
  | 										rowIndexVar="rowIndex" style="text-align:center"
  | 										rowClasses="rowTable1, rowTable2" columnClasses="columnTable"
  | 										rules="groups" headerClass="headerTable"
  | 										footerClass="headerTable" styleClass="borderTable"
  | 										captionClass="titleTable" var="result" first="0">
  | 										<t:columns id="columns"
  | 											value="#{searchResult.selectedColumnHeaders[item.key]}"
  | 											var="columnHeader">
  | 											<f:facet name="header">
  | 												<h:outputText value="#{columnHeader.label}" />
  | 											</f:facet>
  | 											<!-- row is also available -->
  | 											<h:outputText rendered="true"
  | 												value="#{result[columnHeader.name]}" />
  | 										</t:columns>
  | 										<f:facet name="footer">
  | 											<h:panelGroup border="0" columns="20" width="100%"
  | 												rendered='#{searchResult.sizeOfQuery>=0}'>
  | 												<t:dataScroller dir="ltr" style="text-align:left"
  | 													for="#{fn:replace(item.key.simpleName,'\\.','_')}"
  | 													pageCountVar="pageCount" pageIndexVar="pageIndex"
  | 													rowsCountVar="rowsCount" firstRowIndexVar="firstRowIndex"
  | 													displayedRowsCountVar="displayedRowsCount" fastStep="10"
  | 													paginator="true" paginatorMaxPages="3"
  | 													paginatorActiveColumnStyle="font-weight:bold;">
  | 													<f:facet name="first">
  | 														<h:graphicImage border="0" alt="first"
  | 															url="/images/btn_first_16.gif" />
  | 													</f:facet>
  | 													<f:facet name="last">
  | 														<h:graphicImage border="0" alt="last"
  | 															url="/images/btn_last_16.gif" />
  | 													</f:facet>
  | 													<f:facet name="previous">
  | 														<h:graphicImage alt="previous" border="0"
  | 															url="/images/btn_prev_16.gif" />
  | 													</f:facet>
  | 													<f:facet name="next">
  | 														<h:graphicImage border="0" alt="next"
  | 															url="/images/btn_next_16.gif" />
  | 													</f:facet>
  | 													<h:outputLabel id="recordnumber" for="name" value="total:">
  | 														<h:outputText id="sizeOfOtherProviders"
  | 															styleClass="textOutput"
  | 															value="  #{searchResult.indexResultSet[item.key].maxRow} " />
  | 													</h:outputLabel>
  | 													<h:outputText value=" | " />
  | 													<h:outputLabel id="timedurationlabel" for="name"
  | 														value="time:">
  | 														<h:outputText id="timeDuration" styleClass="textOutput"
  | 															value="   #{searchResult.searchTimeDuration} milliseconds" />
  | 													</h:outputLabel>
  | 													<f:param value="#{rowsCount}/" />
  | 													<f:param value="#{displayedRowsCount}" />
  | 													<f:param value="#{firstRowIndex}" />
  | 													<f:param value="#{lastRowIndex}" />
  | 													<f:param value="#{pageIndex}" />
  | 													<f:param value="#{pageCount}" />
  | 												</t:dataScroller>
  | 											</h:panelGroup>
  | 										</f:facet>
  | 									</t:dataTable>
  | 								</h:panelGroup>
  | 								<h:panelGrid id="gridQuery" align="center"
  | 									style="text-align:center ; Background:#ddeeff "
  | 									dir="#{bundle['demo.dir']}" columns="2" border="0" width="80%">
  | 
  | 									<h:commandButton id="backButton" action="#{searchResult.back}"
  | 										value="#{bundle['result.back']}" class="button" />
  | 								</h:panelGrid>
  | 
  | 							</t:panelTab>
  | 						</c:forEach>
  | 					</t:panelTabbedPane>
  | 					</f:subview>
  | 				</s:pprPanelGroup>
  | 			</h:form>
  | 		</f:view>
  | 	</ui:define>
  | </ui:composition>
  | </html>
  | 
  | 

and this is the complete source of UserSettingsAction.java


  | @Stateful
  | @Name("userSetting")
  | @Scope(ScopeType.SESSION)
  | public class UserSettingAction implements UserSetting {
  | 
  | 	private Log logger = LogFactory.getLog(SearchResultAction.class);
  | 
  | 	private List<String> selectedItems;
  | 
  | 	private List<String> categoryList;
  | 
  | 	private HtmlSelectOneMenu selectOneCategory;
  | 
  | 	private SelectItem categorySelectItem[];
  | 	private SelectItem selectedCategory;
  | 	private HtmlSelectManyPicklist picklist;
  | 	private boolean sorted = false;
  | 
  | 	@Out
  | 	private String headerName;
  | 
  | 	private ColumnHeaderList<ColumnHeader> columns;
  | 
  | 	@Out
  | 	private Map<Class, ColumnHeaderList<ColumnHeader>> columnHeaders;
  | 
  | 	@Create
  | 	@Begin(join = true)
  | 	public void build() {
  | 		logger.debug("Populating column headers....");
  | 		selectedItems = new ArrayList<String>();
  | 		categoryList = new ArrayList<String>();
  | 		columnHeaders = new HashMap<Class, ColumnHeaderList<ColumnHeader>>();
  | 		try {
  | 			int j = 0;
  | 			categorySelectItem = new SelectItem[Infrastructure.getStructure()
  | 					.keySet().size()];
  | 			for (Class cat : Infrastructure.getStructure().keySet()) {
  | 				IndexRoot indexRoot = Infrastructure.getStructure().get(cat);
  | 				SelectItem selectItem = new SelectItem(indexRoot.getClassName().getName(), indexRoot.getName());
  | 				categorySelectItem[j] = selectItem;
  | 				headerName = indexRoot.getName();
  | 				ColumnHeaderList<ColumnHeader> columns = new ColumnHeaderList<ColumnHeader>();
  | 				int i = 1;
  | 				for (FieldData f : indexRoot.getFields()) {
  | 					if (f.isExpanded())
  | 						columns.add(new ColumnHeader(f.getOriginalName(), f
  | 								.getAlias(), i, i <= 3));
  | 					else
  | 						columns.add(new ColumnHeader(f.getName(),
  | 								f.getAlias(), i, i <= 3));
  | 					++i;
  | 				}
  | 				columnHeaders.put(indexRoot.getClassName(), columns);
  | 				j++;
  | 			}
  | 			
  | 			//set defaults...
  | 			Class clazz = getClassFromName((String)categorySelectItem[0].getValue());
  | 			selectOneCategory = new HtmlSelectOneMenu();
  | 			picklist = new HtmlSelectManyPicklist();
  | 			selectOneCategory.setValue((String)categorySelectItem[0].getValue());
  | 			//columns = columnHeaders.get(clazz);
  | 			setCurrentFields(clazz);
  | 		} catch (Exception e) {
  | 			logger.error("exception in loading column names:");
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 
  | 	public String continueNextPage() {
  | 		return "nextPage";
  | 	}
  | 	
  | 	public String apply() {
  | 		logger.debug("apply");
  | 		logger.debug("value:"+selectOneCategory.getValue());
  | 		//picklist.setSelectedValues()
  | 		Class clazz = getClassFromName((String)selectOneCategory.getValue());
  | 		logger.debug("class to apply:"+clazz);
  | 		applyChanges(clazz);
  | 		return "";
  | 	}
  | 
  | 	private void applyChanges(Class clazz) {
  | 		int i = 0;
  | 		for (ColumnHeader ch : columnHeaders.get(clazz)) {
  | 			if (selectedItems.contains(ch.getName())) {
  | 				logger.debug("contains:"+ch.getName());
  | 				ch.setIndex(i);
  | 				++i;
  | 				ch.setSelected(true);
  | 			} else {
  | 				logger.debug("NOT contains:"+ch.getName());
  | 				ch.setIndex(i);
  | 				++i;
  | 				ch.setSelected(false);
  | 			}
  | 		}
  | 	}
  | 
  | 	public void pickListValueChanged(ValueChangeEvent event) {
  | 		logger.debug("***********pickListValueChanged*************");
  | 		logger.debug("apply");
  | 		logger.debug("value:"+selectOneCategory.getValue());
  | 		//picklist.setSelectedValues()
  | 		Class clazz = getClassFromName((String)selectOneCategory.getValue());
  | 		logger.debug("class to apply:"+clazz);
  | 		applyChanges(clazz);
  | 
  | 	}
  | 
  | 	/**
  | 	 * action then category changed
  | 	 */
  | 	public void processValueChanged(ValueChangeEvent event) {
  | 		try {
  | 			selectOneCategory = (HtmlSelectOneMenu) event.getComponent();
  | 			logger.debug("new value:"+selectOneCategory.getValue());
  | 			Class newClass = getClassFromName((String)selectOneCategory.getValue());
  | 			logger.debug("new class to process:"+newClass);
  | 			setCurrentFields(newClass);
  | 			logger.debug("changes being applied");
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 
  | 	/**
  | 	 * set fields of current category
  | 	 * 
  | 	 * @param indexRoot
  | 	 */
  | 	private void setCurrentFields(Class clazz) {
  | //		logger.debug("columns.size():"+columns.size());
  | //		logger.debug("selectedItems.size():"+selectedItems.size());
  | 		columns = null;
  | 		selectedItems = null;
  | 		selectedItems = new ArrayList<String>();
  | 		selectedItems.clear();
  | 		columns = columnHeaders.get(clazz);
  | 		for (ColumnHeader ch : columns) {
  | 			if (ch.isSelected()) {
  | 				logger.debug("ch.getName():"+ch.getName());
  | 				selectedItems.add(ch.getName());
  | 			}
  | 		}
  | 		picklist.setSelectedValues(selectedItems.toArray());
  | 		logger.debug("columns.size():"+columns.size());
  | 		logger.debug("selectedItems.size():"+selectedItems.size());
  | 		
  | 	}
  | 
  | 	public List<String> getSelectedItems() {
  | 		return selectedItems;
  | 	}
  | 
  | 	public void setSelectedItems(List<String> selectedItems) {
  | 		this.selectedItems = selectedItems;
  | 	}
  | 
  | 	public UserSettingAction() {
  | 		logger.debug("UserSettingAction constracted.");
  | 	}
  | 
  | 	public ColumnHeaderList getColumns() {
  | 		if (!sorted) {
  | 			Collections.sort(columns, new Comparator<ColumnHeader>() {
  | 				public int compare(ColumnHeader ch1, ColumnHeader ch2) {
  | 					return ch1.getLabel().compareTo(ch2.getLabel());
  | 				}
  | 			});
  | 			sorted = true;
  | 		}
  | 		return columns;
  | 	}
  | 
  | 	public void setColumns(ColumnHeaderList columns) {
  | 		this.columns = columns;
  | 	}
  | 
  | 	public String getHeaderName() {
  | 		return headerName;
  | 	}
  | 
  | 	public void setHeaderName(String headerName) {
  | 		this.headerName = headerName;
  | 	}
  | 
  | 	public List<String> getCategoryList() {
  | 		return categoryList;
  | 	}
  | 
  | 	public void setCategoryList(List<String> categoryList) {
  | 		this.categoryList = categoryList;
  | 	}
  | 
  | 	public HtmlSelectOneMenu getSelectOneCategory() {
  | 		return selectOneCategory;
  | 	}
  | 
  | 	public void setSelectOneCategory(HtmlSelectOneMenu selectOneCategory) {
  | 		this.selectOneCategory = selectOneCategory;
  | 	}
  | 
  | 	public SelectItem[] getCategorySelectItem() {
  | 		return categorySelectItem;
  | 	}
  | 
  | 	public void setCategorySelectItem(SelectItem[] categorySelectItem) {
  | 		this.categorySelectItem = categorySelectItem;
  | 	}
  | 
  | 	@Destroy
  | 	@Remove
  | 	public void destroy() {
  | 		logger.debug("destroying UserSettingAction...");
  | 	}
  | 
  | 	public Map<Class, ColumnHeaderList<ColumnHeader>> getColumnHeaders() {
  | 		return columnHeaders;
  | 	}
  | 
  | 	public void setColumnHeaders(
  | 			Map<Class, ColumnHeaderList<ColumnHeader>> columnHeaders) {
  | 		this.columnHeaders = columnHeaders;
  | 	}
  | 	
  | 	private Class getClassFromName(String name) {
  | 		try {
  | 			return Class.forName(name);
  | 		} catch (ClassNotFoundException e) {
  | 			e.printStackTrace();
  | 		}
  | 		return null;
  | 	}
  | 
  | 	public SelectItem getSelectedCategory() {
  | 		return selectedCategory;
  | 	}
  | 
  | 	public void setSelectedCategory(SelectItem selectedCategory) {
  | 		this.selectedCategory = selectedCategory;
  | 	}
  | 
  | 	public HtmlSelectManyPicklist getPicklist() {
  | 		return picklist;
  | 	}
  | 
  | 	public void setPicklist(HtmlSelectManyPicklist picklist) {
  | 		this.picklist = picklist;
  | 	}
  | 
  | }
  | 
  | 

and this is other component in conversation scope 


  | @Stateful     
  | @Name("searchResult")
  | @Scope(CONVERSATION) 
  | public class SearchResultAction implements SearchResult , Serializable{
  | 
  | 	private final static int MOVE_FORWARD = 1;
  | 	private final static int MOVE_BACKWARD = -1;
  | 	
  | 	@Out(required=false)
  | 	private Map<Class,javax.faces.model.DataModel> dataModels;
  | 	private boolean settingsHasChanged;
  | 	private Map<Class, ColumnHeaderList<ColumnHeader>> selectedColumnHeaders;
  | 
  | //	@In("#{userSetting.columnHeaders}")
  | //	private ColumnHeaderList<ColumnHeader> columnHeaders;
  | 
  | 	@In("#{userSetting.columnHeaders}")
  | 	private Map<Class, ColumnHeaderList<ColumnHeader>> columnHeaders;
  | 	
  | 	@In(required=true)
  | 	@Out
  | 	Map<Class,IndexResultSet> indexResultSet;
  | 	
  | 	@In
  | 	long searchTimeDuration;
  | 	
  | 	private String headerName;
  | 	
  | 	private Log logger = LogFactory.getLog(SearchResultAction.class);
  | 	
  | 	private int sizeOfQuery;
  | 	
  |     private String sortColumn="textResultname"; 
  |     private boolean ascending = false; 
  | 	private int lastSizeOfList;
  | 	private Integer rowPerPage = 10;
  | 
  | 	public SearchResultAction(){
  |     	logger.debug("starting SearchResultAction");
  | 	}
  | 	
  | 	@Factory("selectedColumnHeaders")
  | 	public void extractColumns() {
  | 		logger.debug("extractColumns...");
  | 		//ColumnHeaderList<ColumnHeader> columnHeaderList=new ColumnHeaderList<ColumnHeader>();
  | 		try {
  | 			selectedColumnHeaders = new HashMap<Class,ColumnHeaderList<ColumnHeader>>();
  | 			for(Class c:columnHeaders.keySet()) {
  | 				ColumnHeaderList<ColumnHeader> columnHeaderList = new ColumnHeaderList<ColumnHeader>();
  | 				for(ColumnHeader ch: columnHeaders.get(c)) {
  | 					if(ch.isSelected()) {
  | 						columnHeaderList.add(ch);
  | 					}
  | 				}
  | 				Collections.sort(columnHeaderList,new Comparator<ColumnHeader>() {
  | 					public int compare(ColumnHeader ch1,ColumnHeader ch2) {
  | 						return ch1.getIndex() < ch2.getIndex()?-1:1;
  | 					}
  | 				});
  | 				selectedColumnHeaders.put(c,columnHeaderList);
  | 			}
  | 			
  | 		} catch (Exception e) {
  | 			logger.error("exception in loading column names:");
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 	@Create
  | 	public void setuplist(){
  | 		//if(indexResultSet == null || indexResultSet.getMaxRow() <= 0)
  | 		
  | 		settingsHasChanged = false;
  | 		logger.debug("beginning conversation in SearchResulAction");
  | 		setSizeOfQuery(100);
  | 		extractColumns();
  | 	}
  | 	
  | 	private void changesApplied() {
  | 		logger.debug("has changed.");
  | 		settingsHasChanged = true;
  | 	}
  | 	/**
  | 	 * this method call after select one item off rowPerPageOption(combobox) 
  | 	 */
  | 	public void rowPerPageChanged(ValueChangeEvent e) {
  | 		logger.debug("Row Per page is:"+rowPerPage);
  | 		rowPerPage = Integer.valueOf((String)e.getNewValue());
  | 		logger.debug("Now row per page is:"+rowPerPage);
  | 		//dataModel = new LocalDataModel(rowPerPage,indexResultSet,selectedColumnHeaders);
  | 	}
  | 	
  | 	@SuppressWarnings(value = { "unchecked" })
  | 	public DataPage getDataPage(Class clazz,int startRow, int pageSize,IndexResultSet indexResultSet,ColumnHeaderList<ColumnHeader>  _columnHeaderList) {
  | 		logger.debug("getting data page....");
  | 		logger.debug("start row:"+startRow);
  | 		logger.debug("page size:"+pageSize);
  | 		indexResultSet.absolute(startRow);
  |  		int start = startRow;
  | 		int last = startRow+pageSize;
  | 		List<Map<String,String>> rowList = new ArrayList<Map<String,String>>();
  | 		for(;start<last;++start) {
  | 			if (indexResultSet.next()) {
  | 				Map<String,String> colMap = new HashMap<String,String>();
  | 				for(ColumnHeader ch:_columnHeaderList) {
  | 	            	try {
  |             			colMap.put(ch.getName(),indexResultSet.getString(ch.getName()));
  | 					} catch (Exception e) {
  | 						e.printStackTrace();
  | 					}
  | 	            }
  | 	            rowList.add(colMap);
  | 			}
  |         }
  | 		logger.debug("indexResultSet:"+indexResultSet);
  | 		logger.debug("Max Row:"+indexResultSet.getMaxRow());
  | 		DataPage dataPage = new DataPage(indexResultSet.getMaxRow(),startRow,rowList);
  | 	    return dataPage;
  | 	}
  | 	
  | 	public String setting() {
  | 		changesApplied();
  | 		return "setting";
  | 	}
  | 	/**
  | 	 * inner class implements the fetchPage() method for this special reason
  | 	 * @author Mohammad Norouzi
  | 	 * @version 1.0
  | 	 * @since Mar 5, 2007
  | 	 *
  | 	 */
  | 	private class LocalDataModel extends PagedListDataModel implements Serializable{
  | 		IndexResultSet resultSet;
  | 		ColumnHeaderList<ColumnHeader> columnHeaderList;
  | 		private Class clazz;
  | 		
  | 		public LocalDataModel(Class clazz,int pageSize,IndexResultSet resultSet,ColumnHeaderList<ColumnHeader> _columnHeaderList) {
  | 			super(pageSize);
  | 			this.resultSet = resultSet;
  | 			this.columnHeaderList = _columnHeaderList;
  | 			try {
  | 				this.clazz = (clazz);
  | 			} catch (Exception e) {
  | 				e.printStackTrace();
  | 			}
  | 		}
  | 		
  | 		@Override
  | 		public DataPage fetchPage(int startRow, int pageSize) {
  | 			try{
  | 				return getDataPage(clazz,startRow,pageSize,resultSet,columnHeaderList);
  | 			}catch(Exception ee){
  | 				return null;
  | 			}
  | 		}
  | 		
  | 	}
  | 
  | 	//least used methods
  | 	public long getSearchTimeDuration() {
  | 		return searchTimeDuration;
  | 	}
  | 
  | 	@End
  | 	public String back(){
  | 		logger.debug("back() action method has been called.");
  | 		logger.debug("the current conversation is going to end...");
  | 		try{
  | 			if(indexResultSet != null  /*|| !indexResultSet.isClosed()*/)
  | 				indexResultSet.clear();
  | 		}catch(Exception e){
  | 			e.getStackTrace();
  | 		}
  | 		setSizeOfQuery(0);
  | 		selectedColumnHeaders = null;
  | 		dataModels.clear();
  | 		dataModels = null;
  | 		searchTimeDuration = 0;
  | 		return "back" ;
  | 	}
  | 	
  | 	@Begin(join=true)
  |     public Map<Class,javax.faces.model.DataModel> getDataModels() {
  |     	logger.debug("calling data model getter.");
  |         if (dataModels == null) {
  |         	dataModels = new HashMap<Class, DataModel>();
  |         	for(Class c:selectedColumnHeaders.keySet()) {
  |         		try {
  |         			if(indexResultSet.get((c)) != null && 
  |         					indexResultSet.get((c)).getMaxRow() > 0) {
  |         				dataModels.put(c,new LocalDataModel(c,rowPerPage,indexResultSet.get((c)),selectedColumnHeaders.get(c)));
  |         			}
  | 				} catch (Exception e) {
  | 					e.printStackTrace();
  | 				}
  |         	}
  |         }else if(settingsHasChanged) {
  |         	dataModels.clear();
  |         	dataModels = null;
  |         	extractColumns();
  |         	for(Class c:selectedColumnHeaders.keySet()) {
  |         		try {
  |         			if(indexResultSet.get((c)) != null && 
  |         					indexResultSet.get((c)).getMaxRow() > 0)
  |         				dataModels.put(c,new LocalDataModel(c,rowPerPage,indexResultSet.get((c)),selectedColumnHeaders.get(c)));
  | 				} catch (Exception e) {
  | 					e.printStackTrace();
  | 				}
  |         	}
  |         	settingsHasChanged = false;
  |         }
  |         return dataModels;
  |     }
  | 
  | 	
  | 	public Integer getRowPerPage() {
  | 		return rowPerPage;
  | 	}
  | 
  | 	public void setRowPerPage(Integer rowPerPage) {
  | 		this.rowPerPage = rowPerPage;
  | 	}
  | 
  | 	public String getHeaderName() {
  | 		return headerName;
  | 	}
  | 
  | 	public void setHeaderName(String headerName) {
  | 		this.headerName = headerName;
  | 	}
  | 
  | //	public void setColumnHeaders(ColumnHeaderList<ColumnHeader> columnHeaders) {
  | //		this.columnHeaders = columnHeaders;
  | //	}
  | 
  | 	public void setDataModels(Map<Class,javax.faces.model.DataModel> dataModels) {
  | 		this.dataModels = dataModels;
  | 	}
  | 	public Log getLogger() {
  | 		return logger;
  | 	}
  | 
  | 	public void setLogger(Log logger) {
  | 		this.logger = logger;
  | 	}
  | 	public boolean getAscending() {
  | 		return ascending;
  | 	}
  | 
  | 	public void setAscending(boolean ascending) {
  | 		this.ascending = ascending;
  | 	}
  | 	
  | 	protected boolean isDefaultAscending(String sortColumn){
  | 		return true;
  | 	}
  | 
  | 	public int getSizeOfQuery() {
  | 		return sizeOfQuery;
  | 	}
  | 
  | 	public void setSizeOfQuery(int sizeOfQuery) {
  | 		this.sizeOfQuery = sizeOfQuery;
  | 	}
  | 	public String getSortColumn() {
  | 		return sortColumn;
  | 	}
  | 
  | 	public void setSortColumn(String sortColumn) {
  | 		this.sortColumn = sortColumn;
  | 	}
  | 	public Map<Class,IndexResultSet> getIndexResultSet() {
  | 		return indexResultSet;
  | 	}
  | 
  | 	public void setIndexResultSet(Map<Class,IndexResultSet> indexResultSet) {
  | 		this.indexResultSet = indexResultSet;
  | 	}
  | 	
  | 	
  | 	@Deprecated
  | 	public Object getColumnValue() {
  | 		/**
  | 		 * TODO this method should be revised since it has many bugs and overloads the system.
  | 		 * TODO revising postponed to later time 
  | 		 */
  |         Object columnValue = null;
  |         return columnValue;
  | 	}
  | 
  | //	public ColumnHeaderList<ColumnHeader> getColumnHeaders() {
  | //		return columnHeaders;
  | //	}
  | 
  | 	public Map<Class,ColumnHeaderList<ColumnHeader>> getSelectedColumnHeaders() {
  | 		return selectedColumnHeaders;
  | 	}
  | 
  | 	public void setSelectedColumnHeaders(Map<Class,ColumnHeaderList<ColumnHeader>> selectedColumnHeaders) {
  | 		this.selectedColumnHeaders = selectedColumnHeaders;
  | 	}
  | 	
  |     @Destroy
  | 	@Remove
  | 	public void destroy() {
  | 		logger.debug("destroying SearchResultAction...");
  | 		setSizeOfQuery(0);
  | 		try{
  | 			indexResultSet.clear();
  | 		}catch(Exception e){
  | 			e.getStackTrace();
  | 		}
  | 	}
  | 
  | 	public Map<Class, ColumnHeaderList<ColumnHeader>> getColumnHeaders() {
  | 		return columnHeaders;
  | 	}
  | 
  | 	public void setColumnHeaders(
  | 			Map<Class, ColumnHeaderList<ColumnHeader>> columnHeaders) {
  | 		this.columnHeaders = columnHeaders;
  | 	}
  |     private Class getClassFromString(String className) throws ClassNotFoundException {
  |     	return Class.forName(className);
  |     }
  | 
  | }
  | 
  | 

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

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



More information about the jboss-user mailing list