# HG changeset patch # User "jurzua " # Date 1426505553 -3600 # Node ID dece72e97c650d575aadf5e4bfffd9211a86f91b # Parent 7c8012ec9f9065856c99ee643a87d58f4e725090 Adding paginator class diff -r 7c8012ec9f90 -r dece72e97c65 src/main/java/de/mpiwg/web/jsf/DataPaginator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/web/jsf/DataPaginator.java Mon Mar 16 12:32:33 2015 +0100 @@ -0,0 +1,127 @@ +package de.mpiwg.web.jsf; +import java.text.MessageFormat; + +public class DataPaginator { + + private int itemsPerPage = 100; + private int rewindFastForwardBy = 10; + + private int currentPage; + private int numberOfPages; + + private String recordStatus; + + public void first(){ + this.currentPage = 0; + } + + public void last(){ + this.currentPage = this.numberOfPages -1; + } + + public void fastRewind () { + this.rewind(this.rewindFastForwardBy); + } + + private void rewind (int aRewindFastForwardBy) { + int newPageNumber = currentPage - aRewindFastForwardBy; + if (newPageNumber < 0) { + currentPage = 0; + } else { + currentPage = newPageNumber; + } + } + + public void goToPage(int newPageNumber){ + if (newPageNumber > this.numberOfPages -1) { + currentPage = this.numberOfPages -1; + } else if(newPageNumber < 0 ){ + currentPage = 0; + }else{ + currentPage = newPageNumber; + } + + } + + private void forward (int aRewindFastForwardBy) { + int newPageNumber = currentPage + aRewindFastForwardBy; + if (newPageNumber > this.numberOfPages - 1) { + currentPage = this.numberOfPages -1; + } else { + currentPage = newPageNumber; + } + } + + public void previous () { + this.rewind(1); + } + + public void next () { + this.forward(1); + } + + public void fastForward () { + this.forward(this.rewindFastForwardBy); + } + + public void initCount() { + if (currentPage > numberOfPages) { + currentPage=numberOfPages; + } + } + + public int getNumberOfPages() { + return numberOfPages; + } + + public void setNumberOfPages(int numberOfPages) { + this.numberOfPages = numberOfPages; + } + + public void resetNumberOfPages(int itemsTotal){ + int numberOfPages = (itemsTotal + % this.getItemsPerPage() == 0) ? + itemsTotal + / this.getItemsPerPage() : + (itemsTotal + / this.getItemsPerPage()) + 1; + this.setNumberOfPages(numberOfPages); + } + + public int getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + + public String getRecordStatus () { + this.recordStatus = MessageFormat.format("{0} of {1}", + new Object []{ + Integer.valueOf(currentPage + 1), + Integer.valueOf(numberOfPages) + }); + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public int getItemsPerPage() { + return itemsPerPage; + } + + public void setItemsPerPage(int itemsPerPage) { + this.itemsPerPage = itemsPerPage; + } + + public int getRewindFastForwardBy() { + return rewindFastForwardBy; + } + + public void setRewindFastForwardBy(int rewindFastForwardBy) { + this.rewindFastForwardBy = rewindFastForwardBy; + } +} \ No newline at end of file diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/css/style.css~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/webapp/resources/css/style.css~ Mon Mar 16 12:32:33 2015 +0100 @@ -0,0 +1,134 @@ +body { + margin: 0; + padding: 0; + font-family: Verdana, Arial, sans-serif; + background-color: #FCF2DF ; + font-size: 12px; +} + +.tableComponent{ + margin-top: 10px; + padding-top: 10px; + width: 300px; + border-top: 5px solid #ABABCC; + width: 100%; +} + +.tableComponent table{ + width: 100%; +} + +#header { + background-color: #fcf2df; + box-shadow: 0 0 5px 3px #d0d0d0; + height: 100px; + margin: 0 auto; + width: 80%; +} + +#page { + background-color: #fcf2df; + box-shadow: 0 0 5px 3px #d0d0d0; + margin: 0 auto; + padding-bottom: 50px; + width: 80%; +} + +.inputSearch{ + margin: 0; + outline: medium none; + padding: 4px; + box-shadow: inset 0 2px 2px #d3d3d3; + color: #555555; + border-radius: 4px/*{cornerRadius}*/; + font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; + font-size: 1.1em/*{fsDefault}*/; + letter-spacing: normal; + font: normal normal normal 13.3333330154419px/normal Arial; + text-rendering: auto; + word-spacing: normal; + text-transform: none; + text-indent: 0px; + text-shadow: none; + display: inline-block; + +} + +.content{ + color: #3b4186; + margin-left: auto; + margin-right: auto; + text-align: center; + width: 100%; + padding-left: 10px; + padding-right: 10px; +} + +.content table, td{ + text-align: left; +} + +.iceOutLbl { + color: #485297; + font-family: Verdana,Arial,sans-serif; + padding: 2px 0; +} + +.subTitle{ + display: inline-block; + font-size: x-large; + padding: 10px 0; +} + +.iconLink{ + padding: 0 10px; +} + +/* Logo */ + +#logo { + width: 920px; + height: 40px; + margin: 0; + padding: 20px 45px 0px 40px; + /*color: #000000;*/ +} + +#logo h1, #logo p { + margin: 0px; + padding: 0px; + //text-transform: uppercase; +} + +#logo h1 { + font-family: Verdana, Verdana, Arial, sans-serif; + font-size: x-large; +} + +#logo p { + font-size: 12px; + font-weight: bold; + color: #FFFFFF; +} + +#logo a { + border: none; + background: none; + text-decoration: none; + color: #FFFFFF; +} + +#login { + background-color: #fcf2df; + color: black; + font-size: 11px; + height: 25px; + margin: 0 auto; + padding-bottom: 2px; + width: 80%; +} + +#loginContent { + float: right; + width: 600px; +} \ No newline at end of file diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/images/arrow-ff.gif Binary file src/main/webapp/resources/images/arrow-ff.gif has changed diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/images/arrow-first.gif Binary file src/main/webapp/resources/images/arrow-first.gif has changed diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/images/arrow-fr.gif Binary file src/main/webapp/resources/images/arrow-fr.gif has changed diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/images/arrow-last.gif Binary file src/main/webapp/resources/images/arrow-last.gif has changed diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/images/arrow-next.gif Binary file src/main/webapp/resources/images/arrow-next.gif has changed diff -r 7c8012ec9f90 -r dece72e97c65 src/main/webapp/resources/images/arrow-previous.gif Binary file src/main/webapp/resources/images/arrow-previous.gif has changed