view src/main/webapp/home/searchPage.xhtml @ 5:5316e79f9a27

Implementation of search pagination and lazy loading to display the result set of a search.
author "jurzua <jurzua@mpiwg-berlin.mpg.de>"
date Mon, 16 Mar 2015 11:25:36 +0100
parents 7682c04c63a8
children
line wrap: on
line source

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ace="http://www.icefaces.org/icefaces/components"
	xmlns:ice="http://www.icesoft.com/icefaces/component"
	xmlns:icecore="http://www.icefaces.org/icefaces/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:cl="http://java.sun.com/jsf/composite/jsf/cl"
	template="../templates/publicTemplate.xhtml">
	
	<ui:define name="content">
	
			<ice:form styleClass="content">
			
				<ice:outputLabel value="Search" styleClass="subTitle"/>
					
					<h:panelGrid columns="2" style="width: 300px; margin-left: auto;margin-right: auto;">
						
							<ace:autoCompleteEntry
								id="searchTextInput"
								value="#{sessionBean.searchPage.term}"
								textChangeListener="#{sessionBean.searchPage.changeSectionName}" style="width: 300px;"
								valueChangeListener="#{sessionBean.searchPage.changeSectionSearch}">
								 <f:selectItems value="#{sessionBean.searchPage.sectionSuggestion}"/>
							</ace:autoCompleteEntry>
							
						<h:commandButton 
							value="Search"
							title="Search Submit" 
							actionListener="#{sessionBean.searchPage.listenerSearch}"
							image="#{appBean.searchImage}"/>
					</h:panelGrid>
					
					<h:outputLabel value="#{sessionBean.searchPage.message}"/>
					
					<h:panelGrid columns="1" rendered="#{!empty sessionBean.searchPage.completeSectionList}" 
						style="width: 90%; margin-left: auto;margin-right: auto;text-align: center;" styleClass="centerTable">
						
					    <h:panelGroup >
							<h:commandButton image="#{appBean.paginatorFirst}"
					            style="border:none;" title="First Page" 
					            action="#{sessionBean.searchPage.advancedFirst}"/> 
					            
					        <h:commandButton image="#{appBean.paginatorFr}"
					            style="border:none;" title="Fast Backwards" 
					            action="#{sessionBean.searchPage.advancedFastRewind}"/> 
					            
					        <h:commandButton image="#{appBean.paginatorPrevious}"
					            style="border:none;" title="Previous Page" 
					            action="#{sessionBean.searchPage.advancedPrevious}"/>     
					            
					        <h:outputLabel value="#{sessionBean.searchPage.advancedPaginator.recordStatus}"/> 
					            
					        <h:commandButton image="#{appBean.paginatorNext}"
					            style="border:none;" title="Next Page" 
					            action="#{sessionBean.searchPage.advancedNext}"/>
					            
					        <h:commandButton image="#{appBean.paginatorFf}"
					            style="border:none;" title="Fast Forward" 
					            action="#{sessionBean.searchPage.advancedFastForward}"/>      
					            
					            <h:commandButton image="#{appBean.paginatorLast}"
					            style="border:none;" title="Last Page" 
					            action="#{sessionBean.searchPage.advancedLast}"/>      
					    </h:panelGroup>
						
						<ace:dataTable 
							var="section" 
							value="#{sessionBean.searchPage.currentSectionList}">
							
							<ace:column headerText="Book Id">
							 	<h:outputText value="#{section.book.id}"/>
							 </ace:column>
							 <ace:column headerText="Book Name">
							 	<h:outputText value="#{section.book.name}"/>
							 </ace:column>
							 <ace:column headerText="Section Id">
							 	<h:outputText value="#{section.id}"/>
							 </ace:column>
							 <ace:column headerText="Section Name">
							 	<h:outputText value="#{section.name}"/>
							 </ace:column>
							 <ace:column headerText="Volume">
							 	<h:outputText value="#{section.book.volume}"/>
							 </ace:column>
							 <ace:column headerText="Period">
							 	<h:outputText value="#{section.book.period}"/>
							 </ace:column>
							 <ace:column headerText="Author">
							 	<h:outputText value="#{section.book.author}"/>
							 </ace:column>
							 <ace:column headerText="Edition">
							 	<h:outputText value="#{section.book.edition}"/>
							 </ace:column>
							 <ace:column headerText="Create Branch">
							 	<h:commandButton 
							 		value="Show Section in Extraction Interface"
							 		title="Show Section in Extraction Interface" 
							 		onclick="sectionInExtractionInterface(#{section.id}, '#{section.name}', #{section.book.id}, '#{section.book.name}', #{sessionBean.user.id}, '#{appBean.extractionInterfaceUrl}');"
							 		image="#{appBean.showImage}"/>
							 </ace:column>								 
							 <ace:column headerText="Existing Branches">
							 	<ace:dataTable value="#{section.branches}" var="branch" rendered="#{!empty 	section.branches}">
							 		<ace:column>
							 			<h:outputLabel value="[#{branch.id}] #{branch.label}"/>
							 		</ace:column>
							 		<ace:column>
							 			<h:commandButton value="Edit Branch in Extraction Interface" 
											onclick="branchInExtractionInterface(#{branch.id}, #{branch.currentLastFileId}, #{branch.sectionId}, '#{branch.sectionName}', #{branch.book.id}, '#{branch.book.name}', #{sessionBean.user.id}, '#{appBean.extractionInterfaceUrl}');"
											image="#{appBean.editBranchImage}" title="Edit Branch in Extraction Interface"
											styleClass="iconLink"/>
										<h:outputLink 
											title="Manage Branch"
											value="#{appBean.rootServer}/home/branchEditor.xhtml?branchId=#{branch.id}"
											styleClass="iconLink">
											<h:graphicImage value="#{appBean.branchDetailsImage}"/>
										</h:outputLink>
							 		</ace:column>
							 	</ace:dataTable>
							 </ace:column>							
							
						</ace:dataTable>						
						
					    <h:panelGroup >
							<h:commandButton image="#{appBean.paginatorFirst}"
					            style="border:none;" title="First Page" 
					            action="#{sessionBean.searchPage.advancedFirst}"/> 
					            
					        <h:commandButton image="#{appBean.paginatorFr}"
					            style="border:none;" title="Fast Backwards" 
					            action="#{sessionBean.searchPage.advancedFastRewind}"/> 
					            
					        <h:commandButton image="#{appBean.paginatorPrevious}"
					            style="border:none;" title="Previous Page" 
					            action="#{sessionBean.searchPage.advancedPrevious}"/>     
					            
					        <h:outputLabel value="#{sessionBean.searchPage.advancedPaginator.recordStatus}"/> 
					            
					        <h:commandButton image="#{appBean.paginatorNext}"
					            style="border:none;" title="Next Page" 
					            action="#{sessionBean.searchPage.advancedNext}"/>
					            
					        <h:commandButton image="#{appBean.paginatorFf}"
					            style="border:none;" title="Fast Forward" 
					            action="#{sessionBean.searchPage.advancedFastForward}"/>      
					            
					            <h:commandButton image="#{appBean.paginatorLast}"
					            style="border:none;" title="Last Page" 
					            action="#{sessionBean.searchPage.advancedLast}"/>      
					    </h:panelGroup>					
					
					
					
					</h:panelGrid>
					
				
			</ice:form>
			
	</ui:define>
	
		
	
</ui:composition>