Mercurial > hg > LGServices
comparison src/main/java/de/mpiwg/web/jsp/BooksPage.java @ 18:881e7591f3e4
new: adding paginator in books page
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 02 Jun 2015 15:09:54 +0200 |
parents | 372dab740f15 |
children | 996f8f1b69db |
comparison
equal
deleted
inserted
replaced
17:372dab740f15 | 18:881e7591f3e4 |
---|---|
40 private List<DBBook> filteredBookList; | 40 private List<DBBook> filteredBookList; |
41 private List<DBBook> displayBookList; | 41 private List<DBBook> displayBookList; |
42 | 42 |
43 private Map<String, DBSectionVersion> sectionVersionMap = null; | 43 private Map<String, DBSectionVersion> sectionVersionMap = null; |
44 private int bookNumber; | 44 private int bookNumber; |
45 | |
46 private DataPaginator paginator = new DataPaginator(); | |
47 | |
45 | 48 |
46 private String tocBookId = new String(); | 49 private String tocBookId = new String(); |
47 | 50 |
48 private String bookNameFilter = new String(); | 51 private String bookNameFilter = new String(); |
49 private String dynastyFilter = new String(); | 52 private String dynastyFilter = new String(); |
91 } | 94 } |
92 } | 95 } |
93 } | 96 } |
94 | 97 |
95 if(completeBookList.size() > 0){ | 98 if(completeBookList.size() > 0){ |
96 //this.searchMessage = completeSectionList.size() + " section(s) found for the term(s): " + this.searchTerm; | |
97 //this.filteringMessage = this.filteredSectionList.size() + " section(s) listed after the filtering"; | 99 //this.filteringMessage = this.filteredSectionList.size() + " section(s) listed after the filtering"; |
98 //this.paginator.setCurrentPage(0); | 100 this.paginator.setCurrentPage(0); |
99 //this.paginator.resetNumberOfPages(filteredSectionList.size()); | 101 this.paginator.resetNumberOfPages(filteredBookList.size()); |
100 this.updateCurrentBooks(); | 102 this.updateCurrentBooks(); |
101 }else{ | 103 }else{ |
102 //this.searchMessage = "No sections found for the term(s): " + this.searchTerm; | 104 //this.searchMessage = "No sections found for the term(s): " + this.searchTerm; |
103 this.filteredBookList = null; | 105 this.filteredBookList = null; |
104 } | 106 } |
105 | 107 |
106 } | 108 } |
107 | 109 |
108 | 110 |
109 private void updateCurrentBooks() { | 111 private void updateCurrentBooks() { |
110 this.displayBookList = this.filteredBookList; | 112 //this.displayBookList = this.filteredBookList; |
111 /*this.paginator.initCount(); | 113 // TODO: update displayBookList using paginator |
114 | |
115 this.paginator.initCount(); | |
112 int startRecord = this.paginator.getCurrentPage() | 116 int startRecord = this.paginator.getCurrentPage() |
113 * this.paginator.getItemsPerPage(); | 117 * this.paginator.getItemsPerPage(); |
114 | 118 |
115 if(this.paginator.getNumberOfPages() == 0){ | 119 if(this.paginator.getNumberOfPages() == 0){ |
116 this.displaySectionList = new ArrayList<DBSection>(); | 120 this.displayBookList = new ArrayList<DBBook>(); |
117 }else if((this.paginator.getCurrentPage() + 1) == this.paginator.getNumberOfPages()){ | 121 }else if((this.paginator.getCurrentPage() + 1) == this.paginator.getNumberOfPages()){ |
118 int mod = this.filteredSectionList.size() % paginator.getItemsPerPage(); | 122 int mod = this.filteredBookList.size() % paginator.getItemsPerPage(); |
119 if(mod == 0){ | 123 if(mod == 0){ |
120 this.displaySectionList = filteredSectionList.subList(startRecord, startRecord + this.paginator.getItemsPerPage()); | 124 this.displayBookList = filteredBookList.subList(startRecord, startRecord + this.paginator.getItemsPerPage()); |
121 }else{ | 125 }else{ |
122 this.displaySectionList = filteredSectionList.subList(startRecord, startRecord + mod); | 126 this.displayBookList = filteredBookList.subList(startRecord, startRecord + mod); |
123 } | 127 } |
124 | 128 |
125 }else{ | 129 }else{ |
126 this.displaySectionList = filteredSectionList.subList(startRecord, startRecord + this.paginator.getItemsPerPage()); | 130 this.displayBookList = filteredBookList.subList(startRecord, startRecord + this.paginator.getItemsPerPage()); |
127 } | 131 } |
128 | 132 |
129 for(DBSection section : this.displaySectionList){ | |
130 section.setBranches(this.branchesMap.get(section.getId())); | |
131 } | |
132 */ | |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 public List<DBBook> getDisplayBookList() { | 136 public List<DBBook> getDisplayBookList() { |
137 return displayBookList; | 137 return displayBookList; |
446 public void setEditionFilter(String editionFilter) { | 446 public void setEditionFilter(String editionFilter) { |
447 this.editionFilter = editionFilter; | 447 this.editionFilter = editionFilter; |
448 } | 448 } |
449 | 449 |
450 | 450 |
451 | 451 public void firstPage() { |
452 | 452 this.paginator.first(); |
453 | 453 this.updateCurrentBooks(); |
454 } | |
455 | |
456 public void lastPage() { | |
457 this.paginator.last(); | |
458 this.updateCurrentBooks(); | |
459 } | |
460 | |
461 public void fastForward() { | |
462 this.paginator.fastForward(); | |
463 this.updateCurrentBooks(); | |
464 } | |
465 | |
466 public void fastRewind() { | |
467 this.paginator.fastRewind(); | |
468 this.updateCurrentBooks(); | |
469 } | |
470 | |
471 public void previousPage() { | |
472 this.paginator.previous(); | |
473 this.updateCurrentBooks(); | |
474 } | |
475 | |
476 public void nextPage() { | |
477 this.paginator.next(); | |
478 this.updateCurrentBooks(); | |
479 } | |
480 | |
481 | |
482 public DataPaginator getPaginator() { | |
483 return paginator; | |
484 } | |
485 | |
486 public void setPaginator(DataPaginator paginator) { | |
487 this.paginator = paginator; | |
488 } | |
454 } | 489 } |