View Javadoc
1 /* 2 * ValueListInfo.java 3 * 4 * Created on March 21, 2003, 2:57 PM 5 */ 6 7 package com.mlw.vlh; 8 9 import java.io.Serializable; 10 import java.util.HashMap; 11 import java.util.Map; 12 13 /*** This VO holds all the information needed to 14 * retrieve a <CODE>ValueList</CODE> 15 * @author Matthew Wilson 16 */ 17 public class ValueListInfo implements Serializable 18 { 19 /*** Constant for an descending order. 20 */ 21 public static Integer DESCENDING = new Integer(-1); 22 /*** Constant for an ascending order. 23 */ 24 public static Integer ASCENDING = new Integer( 1); 25 26 /*** Holds the filters. 27 */ 28 protected Map filters = null; 29 30 /*** Holds the columns the ValueList is sorted upon. 31 */ 32 protected String[] sortColumns = null; 33 34 /*** Holds the columns the ValueList is sorted upon. 35 */ 36 protected Integer[] sortDirections = null; 37 38 /*** Current page desired to display. 39 */ 40 protected int pageNumber = 1; 41 42 /*** Total number of pages available. 43 */ 44 protected int totalNumberOfEntres = 0; 45 46 /*** Total number on each page. 47 */ 48 protected int numberPerPage = Integer.MAX_VALUE; 49 50 public ValueListInfo() 51 { 52 } 53 54 /*** Creates a new ValueListInfo that contains filter 55 * information. 56 * 57 * @param filters Map of filters to apply 58 */ 59 public ValueListInfo(Map filters) 60 { 61 this.filters = filters; 62 } 63 64 /*** Creates a new ValueListInfo that contains sorting 65 * information 66 * @param primaryColumn The column to sort by 67 * @param primaryDirection The direction to sort the <CODE>ValueList</CODE> by 68 */ 69 public ValueListInfo(String primaryColumn, Integer primaryDirection, Map filters) 70 { 71 this.filters = filters; 72 this.sortColumns = new String[]{primaryColumn}; 73 this.sortDirections = new Integer[]{primaryDirection}; 74 } 75 76 /*** Getter for property filters. 77 * @return Value of property filters. 78 */ 79 public Map getFilters() 80 { 81 if(filters==null) filters = new HashMap(); 82 return filters; 83 } 84 85 /*** Returns an array of column (property) names. 86 * @return a String array of column (property) names. 87 null if no sorting information exists. */ 88 public String[] getSortColumn() 89 { 90 return sortColumns; 91 } 92 93 94 /*** Returns an array of directions. 95 * @return an Integer array of directions. 96 null if no sorting information exists. */ 97 public Integer[] getSortDirection() 98 { 99 return sortDirections; 100 } 101 102 /*** Returns the level of sorting information available. 103 * @return the level of sorting information available. 104 * zero if no sorting information is available. 105 */ 106 public int getSortLength() 107 { 108 return (sortColumns==null||sortDirections==null)?0:Math.min(sortColumns.length, sortDirections.length); 109 } 110 111 /*** Getter for the curent page to display. 112 * @return the curent page to display. */ 113 public int getPageNumber() 114 { 115 return pageNumber; 116 } 117 118 /*** Getter for the total number of pages. 119 * @return the total number of pages. */ 120 public int getTotalNumberOfPages() 121 { 122 return totalNumberOfEntres/numberPerPage; 123 } 124 125 /*** Getter for the total number VOs. 126 * @return the total number of VOs. */ 127 public int getTotalNumberOfEntries() 128 { 129 return totalNumberOfEntres; 130 } 131 132 /*** Getter for the number of VOs per page. 133 * @return the number of VOs per page. */ 134 public int getNumberPerPage() 135 { 136 return numberPerPage; 137 } 138 }

This page was automatically generated by Maven