# HG changeset patch # User Zoe Hong # Date 1454064872 -3600 # Node ID cf747a960516e8e6dc8bdca128765ed8966b319d # Parent 8f6c47775fe8dfcd310aee1ca86e8b0591e6576a new: auto scroll to the last position when de/selecting rows, and add number of selected rows info, in full text search page diff -r 8f6c47775fe8 -r cf747a960516 src/main/java/de/mpiwg/gazetteer/utils/FileManager.java --- a/src/main/java/de/mpiwg/gazetteer/utils/FileManager.java Tue Jan 26 13:41:47 2016 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/utils/FileManager.java Fri Jan 29 11:54:32 2016 +0100 @@ -135,7 +135,7 @@ text += header; text += "" + "
Table name: " + file.getFileName() + "
" - + "
" + list.size() + " result(s) in the table." + + "
" + list.size() + " row(s) in the table." + "
searching by keywords: " + '"' + "" + file.getSearchTerms() + "" + '"' + "
" + "
view on LGMap
" + "
" diff -r 8f6c47775fe8 -r cf747a960516 src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java --- a/src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java Tue Jan 26 13:41:47 2016 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java Fri Jan 29 11:54:32 2016 +0100 @@ -55,6 +55,7 @@ private DataPaginator paginator = new DataPaginator(); private String searchMessage; private String filteringMessage; + private String selectedContentMessage; private String bookIdFilter = new String(); private String bookNameFilter = new String(); @@ -67,10 +68,16 @@ private String fileName = new String(); private String focusedContentId = new String(); + private Integer selectedNumOfContent = 0; + + private String mouseX; + private String mouseY; + @Override public void init(){ super.init(); + } public void loadParameters(HttpServletRequest request, HttpServletResponse response){ @@ -96,8 +103,11 @@ this.fileName = getParameter("fileName"); this.focusedContentId = getParameter("focusedContentId"); + this.mouseX = getParameter("mouseX"); + this.mouseY = getParameter("mouseY"); + this.paginator.setItemsPerPage(20); } @@ -134,6 +144,7 @@ // save none zero result Collections.sort(this.completeList); this.filter(); + this.calSelectedContentInCompleteList(); this.setFileName(this.getSearchTerm()); this.save(); @@ -169,6 +180,9 @@ if (this.completeList != null ){ Collections.sort(this.completeList); filter(); + + this.calSelectedContentInCompleteList(); + } } catch (Exception e) { @@ -178,6 +192,17 @@ } + private void calSelectedContentInCompleteList() { + // calculate selectedContent + this.selectedNumOfContent = 0; + for (DBContents content: this.completeList) { + if (!content.isRemoved()) { + this.selectedNumOfContent += 1; + } + } + this.setSelectedContentMessage(this.selectedNumOfContent.toString() + " section(s) selected"); + } + public void forceLoadFileList(){ logger.debug("forceLoadFileList"); logger.debug(this.getSearchTerm()); @@ -192,14 +217,22 @@ } + public void deleteFile() { + // TODO delete the files from file system (html in ftsearch-data/... and csv in LGMap/datasets/) and the record in database table FullTextSearchFile + Long fileId = getLongParameter("fileId"); + logger.debug("loading fileId=" + fileId); + + if(fileId != null){ + + } + } public void loadFile() { Long fileId = getLongParameter("fileId"); logger.debug("loading fileId=" + fileId); if(fileId != null){ - // TODO load from html? or csv? file into searching result table - + // load from html file into searching result table LGFullTextSearchFile file = DataProvider.getInstance().getFullTextSearchFile(fileId); if(file != null){ String html; @@ -269,6 +302,9 @@ if (this.completeList != null ){ Collections.sort(this.completeList); filter(); + // TODO + this.calSelectedContentInCompleteList(); + } } catch (Exception e) { @@ -353,8 +389,7 @@ (StringUtils.isEmpty(bookNameFilter) || StringUtils.startsWith(content.getSection().getBook().getName(), bookNameFilter)) && (StringUtils.isEmpty(sectionNameFilter) || StringUtils.startsWith(content.getSection().getName(), sectionNameFilter)) && (StringUtils.isEmpty(contentFilter) || StringUtils.contains(content.getContent(), contentFilter)) - - + ){ this.filteredList.add(content); } @@ -404,6 +439,47 @@ } + + public void removeFocusedContent(boolean status) { + + // set isRemove for the content with id=this.focusedContentId + // status is true: remove; + // status is false: recover (unremove) + + for (DBContents content: this.completeList) { + if (StringUtils.equals(content.getId().toString(), this.focusedContentId)) { + content.setRemoved(status); + logger.debug("set remove content id=" + content.getId().toString()); + break; + } + } + + int currentPage = this.getPaginator().getCurrentPage(); + + Collections.sort(this.completeList); + filter(); + + // update the selectedNumOfContent to selectedMessage + if (status) { + this.selectedNumOfContent -= 1; + } else { + this.selectedNumOfContent += 1; + } + + selectedContentMessage = this.selectedNumOfContent.toString() + " section(s) selected"; + this.setSelectedContentMessage(selectedContentMessage); + + this.getPaginator().setCurrentPage(currentPage); + this.updateCurrentSections(); + + + + } + + + + + private List splitBatchSearchTerm() { List rs = new ArrayList(); @@ -586,6 +662,15 @@ this.filteringMessage = filteringMessage; } + + public String getSelectedContentMessage() { + return selectedContentMessage; + } + + public void setSelectedContentMessage(String selectedContentMessage) { + this.selectedContentMessage = selectedContentMessage; + } + public String getFileName() { return fileName; } @@ -673,6 +758,32 @@ this.sectionNameFilter = sectionNameFilter; } + + + public String getMouseX() { + return mouseX; + } + + public void setMouseX(String mouseX) { + this.mouseX = mouseX; + } + + public String getMouseY() { + return mouseY; + } + + public void setMouseY(String mouseY) { + this.mouseY = mouseY; + } + + public Integer getSelectedNumOfContent() { + return selectedNumOfContent; + } + + public void setSelectedNumOfContent(Integer selectedNumOfContent) { + this.selectedNumOfContent = selectedNumOfContent; + } + /////// Sorting @@ -803,31 +914,6 @@ - public void removeFocusedContent(boolean status) { - - // set isRemove for the content with id=this.focusedContentId - // status is true: remove; - // status is false: recover (unremove) - - for (DBContents content: this.completeList) { - if (StringUtils.equals(content.getId().toString(), this.focusedContentId)) { - content.setRemoved(status); - logger.debug("set remove content id=" + content.getId().toString()); - break; - } - } - - int currentPage = this.getPaginator().getCurrentPage(); - - Collections.sort(this.completeList); - filter(); - - this.getPaginator().setCurrentPage(currentPage); - this.updateCurrentSections(); - } - - - diff -r 8f6c47775fe8 -r cf747a960516 src/main/java/de/mpiwg/web/jsp/JSPProxy.java --- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Tue Jan 26 13:41:47 2016 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Fri Jan 29 11:54:32 2016 +0100 @@ -245,6 +245,10 @@ } else if(StringUtils.equals(action, "loadFile")) { getSessionBean().getFullTextSearchPage().loadFile(); + // delete existing searching result + } else if(StringUtils.equals(action, "deleteFile")) { + getSessionBean().getFullTextSearchPage().deleteFile(); + //PAGINATOR } else if(StringUtils.equals(action, "firstPage")){ getSessionBean().getFullTextSearchPage().firstPage(); diff -r 8f6c47775fe8 -r cf747a960516 src/main/webapp/pages/fullTextSearch.jsp --- a/src/main/webapp/pages/fullTextSearch.jsp Tue Jan 26 13:41:47 2016 +0100 +++ b/src/main/webapp/pages/fullTextSearch.jsp Fri Jan 29 11:54:32 2016 +0100 @@ -15,6 +15,8 @@