Update of /cvsroot/displaytag/display09/site/src/org/displaytag/sample
In directory sc8-pr-cvs1:/tmp/cvs-serv553/site/src/org/displaytag/sample
Modified Files:
TotalWrapper.java Wrapper.java ListHolder.java ReportList.java
ListObject.java LongDateWrapper.java DisplaySourceServlet.java
ReportableListObject.java TestList.java
Log Message:
formatted code, some javadoc improvements and small fixes
Index: TotalWrapper.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/TotalWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TotalWrapper.java 17 Jul 2003 21:20:51 -0000 1.3
--- TotalWrapper.java 9 Aug 2003 19:54:07 -0000 1.4
***************
*** 16,24 ****
* Field cityTotal
*/
! private double mCityTotal= 0;
/**
* Field grandTotal
*/
! private double mGrandTotal= 0;
/**
--- 16,25 ----
* Field cityTotal
*/
! private double mCityTotal = 0;
!
/**
* Field grandTotal
*/
! private double mGrandTotal = 0;
/**
***************
*** 27,49 ****
* @return String
*/
! public String finishRow()
{
! int lListindex=
((List)getDecoratedObject()).indexOf(this.getCurrentRowObject());
! ReportableListObject lReportableObject= (ReportableListObject)
this.getCurrentRowObject();
! String lNextCity= "";
mCityTotal += lReportableObject.getAmount();
mGrandTotal += lReportableObject.getAmount();
! if (lListindex == ((List)getDecoratedObject()).size() - 1)
{
! lNextCity= "XXXXXX"; // Last row hack, it's only a demo
folks...
}
else
{
! lNextCity= ((ReportableListObject)
((List)getDecoratedObject()).get(lListindex + 1)).getCity();
}
! StringBuffer lBuffer= new StringBuffer(1000);
// City subtotals...
--- 28,50 ----
* @return String
*/
! public final String finishRow()
{
! int lListindex = ((List)
getDecoratedObject()).indexOf(this.getCurrentRowObject());
! ReportableListObject lReportableObject = (ReportableListObject)
this.getCurrentRowObject();
! String lNextCity = "";
mCityTotal += lReportableObject.getAmount();
mGrandTotal += lReportableObject.getAmount();
! if (lListindex == ((List) getDecoratedObject()).size() - 1)
{
! lNextCity = "XXXXXX"; // Last row hack, it's only a demo
folks...
}
else
{
! lNextCity = ((ReportableListObject) ((List)
getDecoratedObject()).get(lListindex + 1)).getCity();
}
! StringBuffer lBuffer = new StringBuffer(1000);
// City subtotals...
***************
*** 59,67 ****
lBuffer.append("\n<tr>\n<td
colspan=\"4\"> \n</td>\n</tr>");
! mCityTotal= 0;
}
// Grand totals...
! if (getViewIndex() == ((List)getDecoratedObject()).size() - 1)
{
lBuffer.append("<tr><td colspan=\"4\"><hr noshade
size=\"1\"></td></tr>");
--- 60,68 ----
lBuffer.append("\n<tr>\n<td
colspan=\"4\"> \n</td>\n</tr>");
! mCityTotal = 0;
}
// Grand totals...
! if (getViewIndex() == ((List) getDecoratedObject()).size() - 1)
{
lBuffer.append("<tr><td colspan=\"4\"><hr noshade
size=\"1\"></td></tr>");
Index: Wrapper.java
===================================================================
RCS file: /cvsroot/displaytag/display09/site/src/org/displaytag/sample/Wrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Wrapper.java 17 Jul 2003 21:20:51 -0000 1.3
--- Wrapper.java 9 Aug 2003 19:54:07 -0000 1.4
***************
*** 18,26 ****
* Field datefmt
*/
! private SimpleDateFormat mDateFormat= null;
/**
* Field moneyfmt
*/
! private DecimalFormat mMoneyFormat= null;
/**
--- 18,26 ----
* Field datefmt
*/
! private SimpleDateFormat mDateFormat = null;
/**
* Field moneyfmt
*/
! private DecimalFormat mMoneyFormat = null;
/**
***************
*** 35,40 ****
// Formats for displaying dates and money.
! this.mDateFormat= new SimpleDateFormat("MM/dd/yy");
! this.mMoneyFormat= new DecimalFormat("$ #,###,###.00");
}
--- 35,40 ----
// Formats for displaying dates and money.
! this.mDateFormat = new SimpleDateFormat("MM/dd/yy");
! this.mMoneyFormat = new DecimalFormat("$ #,###,###.00");
}
***************
*** 75,80 ****
public String getLink1()
{
! ListObject lObject= (ListObject) getDecoratedObject();
! int lIndex= getListIndex();
return "<a href=\"details.jsp?index=" + lIndex + "\">" +
lObject.getId() + "</a>";
--- 75,80 ----
public String getLink1()
{
! ListObject lObject = (ListObject) getDecoratedObject();
! int lIndex = getListIndex();
return "<a href=\"details.jsp?index=" + lIndex + "\">" +
lObject.getId() + "</a>";
***************
*** 88,93 ****
public String getLink2()
{
! ListObject lObject= (ListObject)getDecoratedObject();
! int lId= lObject.getId();
return "<a href=\"details.jsp?id="
--- 88,93 ----
public String getLink2()
{
! ListObject lObject = (ListObject) getDecoratedObject();
! int lId = lObject.getId();
return "<a href=\"details.jsp?id="
Index: ListHolder.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/ListHolder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ListHolder.java 22 Jun 2003 20:33:04 -0000 1.1
--- ListHolder.java 9 Aug 2003 19:54:07 -0000 1.2
***************
*** 22,26 ****
public ListHolder()
{
! mList= new TestList(15);
}
--- 22,26 ----
public ListHolder()
{
! mList = new TestList(15);
}
***************
*** 29,33 ****
* @return List
*/
! public List getList()
{
return mList;
--- 29,33 ----
* @return List
*/
! public final List getList()
{
return mList;
Index: ReportList.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/ReportList.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ReportList.java 22 Jun 2003 20:33:04 -0000 1.1
--- ReportList.java 9 Aug 2003 19:54:07 -0000 1.2
***************
*** 22,26 ****
super();
! for (int lCount= 0; lCount < 20; lCount++)
{
add(new ReportableListObject());
--- 22,26 ----
super();
! for (int lCount = 0; lCount < 20; lCount++)
{
add(new ReportableListObject());
***************
*** 39,43 ****
super();
! for (int lCount= 0; lCount < pSize; lCount++)
{
add(new ReportableListObject());
--- 39,43 ----
super();
! for (int lCount = 0; lCount < pSize; lCount++)
{
add(new ReportableListObject());
Index: ListObject.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/ListObject.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ListObject.java 22 Jun 2003 20:33:04 -0000 1.1
--- ListObject.java 9 Aug 2003 19:54:07 -0000 1.2
***************
*** 23,36 ****
* Field rnd
*/
! private static Random rnd= new Random();
/**
* Field words
*/
! private static List lWords= null;
/**
* Field mId
*/
! private int mId= -1;
/**
--- 23,36 ----
* Field rnd
*/
! private static Random rnd = new Random();
/**
* Field words
*/
! private static List lWords = null;
/**
* Field mId
*/
! private int mId = -1;
/**
***************
*** 95,99 ****
public void setID(int pId)
{
! mId= pId;
}
--- 95,99 ----
public void setID(int pId)
{
! mId = pId;
}
***************
*** 122,126 ****
public void setEmail(String pEmail)
{
! mEmail= pEmail;
}
--- 122,126 ----
public void setEmail(String pEmail)
{
! mEmail = pEmail;
}
***************
*** 234,254 ****
public void setupRandomData()
{
! mId= rnd.nextInt(99998) + 1;
! mMoney= (rnd.nextInt(999998) + 1) / 100;
! String lFirst= getRandomWord();
! String lLast= getRandomWord();
! mName= StringUtils.capitalise(lFirst) + " " +
StringUtils.capitalise(lLast);
! mEmail= lFirst + "-" + lLast + "@" + getRandomWord() + ".com";
! Calendar lCalendar= Calendar.getInstance();
lCalendar.add(Calendar.DATE, 365 - rnd.nextInt(730));
! mDate= lCalendar.getTime();
! mDescription= getRandomWord() + " " + getRandomWord() + "...";
! mLongDescription=
getRandomWord()
+ " "
--- 234,254 ----
public void setupRandomData()
{
! mId = rnd.nextInt(99998) + 1;
! mMoney = (rnd.nextInt(999998) + 1) / 100;
! String lFirst = getRandomWord();
! String lLast = getRandomWord();
! mName = StringUtils.capitalise(lFirst) + " " +
StringUtils.capitalise(lLast);
! mEmail = lFirst + "-" + lLast + "@" + getRandomWord() + ".com";
! Calendar lCalendar = Calendar.getInstance();
lCalendar.add(Calendar.DATE, 365 - rnd.nextInt(730));
! mDate = lCalendar.getTime();
! mDescription = getRandomWord() + " " + getRandomWord() + "...";
! mLongDescription =
getRandomWord()
+ " "
***************
*** 273,285 ****
+ getRandomWord();
! mStatus= getRandomWord().toUpperCase();
// added sublist for testing of nested tables
! mSubList= new ArrayList();
mSubList.add(new SubListItem(getRandomWord(), getRandomWord() + "@" +
getRandomWord() + ".com"));
mSubList.add(new SubListItem(getRandomWord(), getRandomWord() + "@" +
getRandomWord() + ".com"));
mSubList.add(new SubListItem(getRandomWord(), getRandomWord() + "@" +
getRandomWord() + ".com"));
! mUrl= "http://www." + lLast + ".org/";
}
--- 273,285 ----
+ getRandomWord();
! mStatus = getRandomWord().toUpperCase();
// added sublist for testing of nested tables
! mSubList = new ArrayList();
mSubList.add(new SubListItem(getRandomWord(), getRandomWord() + "@" +
getRandomWord() + ".com"));
mSubList.add(new SubListItem(getRandomWord(), getRandomWord() + "@" +
getRandomWord() + ".com"));
mSubList.add(new SubListItem(getRandomWord(), getRandomWord() + "@" +
getRandomWord() + ".com"));
! mUrl = "http://www." + lLast + ".org/";
}
***************
*** 303,307 ****
public void setupWordBase()
{
! String lLoremIpsum=
"Lorem ipsum dolor sit amet consetetur sadipscing elitr sed
diam nonumy "
+ "eirmod tempor invidunt ut labore et dolore magna
aliquyam erat sed diam "
--- 303,307 ----
public void setupWordBase()
{
! String lLoremIpsum =
"Lorem ipsum dolor sit amet consetetur sadipscing elitr sed
diam nonumy "
+ "eirmod tempor invidunt ut labore et dolore magna
aliquyam erat sed diam "
***************
*** 330,338 ****
+ "delenit augue duis dolore te feugait nulla
facilisi";
! lWords= new ArrayList();
! StringTokenizer lTokenizer= new StringTokenizer(lLoremIpsum);
while (lTokenizer.hasMoreTokens())
{
! String lWord= lTokenizer.nextToken();
lWords.add(lWord);
}
--- 330,338 ----
+ "delenit augue duis dolore te feugait nulla
facilisi";
! lWords = new ArrayList();
! StringTokenizer lTokenizer = new StringTokenizer(lLoremIpsum);
while (lTokenizer.hasMoreTokens())
{
! String lWord = lTokenizer.nextToken();
lWords.add(lWord);
}
***************
*** 370,375 ****
public SubListItem(String pName, String pEmail)
{
! mName= pName;
! mEmail= pEmail;
}
--- 370,375 ----
public SubListItem(String pName, String pEmail)
{
! mName = pName;
! mEmail = pEmail;
}
Index: LongDateWrapper.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/LongDateWrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LongDateWrapper.java 17 Jul 2003 21:20:51 -0000 1.2
--- LongDateWrapper.java 9 Aug 2003 19:54:07 -0000 1.3
***************
*** 16,20 ****
* Field sdf
*/
! private DateFormat mDateFormat= new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
/**
--- 16,20 ----
* Field sdf
*/
! private DateFormat mDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
/**
***************
*** 23,29 ****
* @return String
*/
! public String decorate(Object pColumnValue)
{
! Date lDate= (Date) pColumnValue;
return mDateFormat.format(lDate);
}
--- 23,29 ----
* @return String
*/
! public final String decorate(Object pColumnValue)
{
! Date lDate = (Date) pColumnValue;
return mDateFormat.format(lDate);
}
Index: DisplaySourceServlet.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/DisplaySourceServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DisplaySourceServlet.java 22 Jun 2003 21:01:52 -0000 1.2
--- DisplaySourceServlet.java 9 Aug 2003 19:54:07 -0000 1.3
***************
*** 22,41 ****
*/
private static final String EXAMPLE_FOLDER = "/examples/";
!
/**
* @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest,
HttpServletResponse)
*/
! protected void doGet(HttpServletRequest pRequest, HttpServletResponse
pResponse)
throws ServletException, IOException
{
! String lJspFile= pRequest.getRequestURI();
// lastIndexOf(".") can't be null, since the servlet is mapped to
".source"
! lJspFile= lJspFile.substring(0, lJspFile.lastIndexOf("."));
if (lJspFile.lastIndexOf("/") != -1)
{
! lJspFile= lJspFile.substring(lJspFile.lastIndexOf("/") + 1);
}
--- 22,41 ----
*/
private static final String EXAMPLE_FOLDER = "/examples/";
!
/**
* @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest,
HttpServletResponse)
*/
! protected final void doGet(HttpServletRequest pRequest, HttpServletResponse
pResponse)
throws ServletException, IOException
{
! String lJspFile = pRequest.getRequestURI();
// lastIndexOf(".") can't be null, since the servlet is mapped to
".source"
! lJspFile = lJspFile.substring(0, lJspFile.lastIndexOf("."));
if (lJspFile.lastIndexOf("/") != -1)
{
! lJspFile = lJspFile.substring(lJspFile.lastIndexOf("/") + 1);
}
***************
*** 46,52 ****
}
! String lFullName= EXAMPLE_FOLDER + lJspFile;
! InputStream lInputStream=
getServletContext().getResourceAsStream(lFullName);
if (lInputStream == null)
--- 46,52 ----
}
! String lFullName = EXAMPLE_FOLDER + lJspFile;
! InputStream lInputStream =
getServletContext().getResourceAsStream(lFullName);
if (lInputStream == null)
***************
*** 57,61 ****
pResponse.setContentType("text/html");
! PrintWriter lOut= pResponse.getWriter();
lOut.println(
--- 57,61 ----
pResponse.setContentType("text/html");
! PrintWriter lOut = pResponse.getWriter();
lOut.println(
***************
*** 71,75 ****
lOut.println("<body>");
lOut.println("<pre>");
! for (int lChar= lInputStream.read(); lChar != -1; lChar=
lInputStream.read())
{
if (lChar == '<')
--- 71,75 ----
lOut.println("<body>");
lOut.println("<pre>");
! for (int lChar = lInputStream.read(); lChar != -1; lChar =
lInputStream.read())
{
if (lChar == '<')
Index: ReportableListObject.java
===================================================================
RCS file:
/cvsroot/displaytag/display09/site/src/org/displaytag/sample/ReportableListObject.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ReportableListObject.java 22 Jun 2003 20:33:04 -0000 1.1
--- ReportableListObject.java 9 Aug 2003 19:54:07 -0000 1.2
***************
*** 17,25 ****
* Field rnd
*/
! private static Random mRandom= new Random();
/**
* Field words
*/
! private static List mWords= null;
/**
--- 17,25 ----
* Field rnd
*/
! private static Random mRandom = new Random();
/**
* Field words
*/
! private static List mWords = null;
/**
***************
*** 66,70 ****
public void setCity(String pCity)
{
! mCity= pCity;
}
--- 66,70 ----
public void setCity(String pCity)
{
! mCity = pCity;
}
***************
*** 84,88 ****
public void setProject(String pProject)
{
! mProject= pProject;
}
--- 84,88 ----
public void setProject(String pProject)
{
! mProject = pProject;
}
***************
*** 102,106 ****
public void setTask(String pTask)
{
! mTask= pTask;
}
--- 102,106 ----
public void setTask(String pTask)
{
! mTask = pTask;
}
***************
*** 120,124 ****
public void setAmount(double pAmount)
{
! mAmount= pAmount;
}
--- 120,124 ----
public void setAmount(double pAmount)
{
! mAmount = pAmount;
}
***************
*** 137,145 ****
public void setupRandomData()
{
! mAmount= (mRandom.nextInt(99999) + 1) / 100;
! mCity= getRandomCity();
! mProject= getRandomProject();
! mTask= getRandomTask();
}
--- 137,145 ----
public void setupRandomData()
{
! mAmount = (mRandom.nextInt(99999) + 1) / 100;
! mCity = getRandomCity();
! mProject = getRandomProject();
! mTask = getRandomTask();
}
***************
*** 150,154 ****
public String getRandomCity()
{
! String lCities[]= { "Roma", "Olympia", "Neapolis", "Carthago" };
return lCities[mRandom.nextInt(lCities.length)];
--- 150,154 ----
public String getRandomCity()
{
! String lCities[] = { "Roma", "Olympia", "Neapolis", "Carthago" };
return lCities[mRandom.nextInt(lCities.length)];
***************
*** 161,165 ****
public String getRandomProject()
{
! String lProjects[]= { "Taxes", "Arts", "Army", "Gladiators" };
return lProjects[mRandom.nextInt(lProjects.length)];
--- 161,165 ----
public String getRandomProject()
{
! String lProjects[] = { "Taxes", "Arts", "Army", "Gladiators" };
return lProjects[mRandom.nextInt(lProjects.length)];
***************
*** 192,196 ****
public void setupWordBase()
{
! String lLoremIpsum=
"Lorem ipsum dolor sit amet consetetur sadipscing elitr sed
diam nonumy "
+ "eirmod tempor invidunt ut labore et dolore magna
aliquyam erat sed diam "
--- 192,196 ----
public void setupWordBase()
{
! String lLoremIpsum =
"Lorem ipsum dolor sit amet consetetur sadipscing elitr sed
diam nonumy "
+ "eirmod tempor invidunt ut labore et dolore magna
aliquyam erat sed diam "
***************
*** 252,260 ****
+ "clita kasd gubergren no sea takimata sanctus ";
! mWords= new ArrayList();
! StringTokenizer lTokenizer= new StringTokenizer(lLoremIpsum);
while (lTokenizer.hasMoreTokens())
{
! String lWord= lTokenizer.nextToken();
mWords.add(lWord);
}
--- 252,260 ----
+ "clita kasd gubergren no sea takimata sanctus ";
! mWords = new ArrayList();
! StringTokenizer lTokenizer = new StringTokenizer(lLoremIpsum);
while (lTokenizer.hasMoreTokens())
{
! String lWord = lTokenizer.nextToken();
mWords.add(lWord);
}
***************
*** 268,273 ****
public int compareTo(Object pObject)
{
! ReportableListObject lObject1= this;
! ReportableListObject lObject2= (ReportableListObject) pObject;
if (lObject1.mCity.equals(lObject2.mCity))
--- 268,273 ----
public int compareTo(Object pObject)
{
! ReportableListObject lObject1 = this;
! ReportableListObject lObject2 = (ReportableListObject) pObject;
if (lObject1.mCity.equals(lObject2.mCity))
Index: TestList.java
===================================================================
RCS file: /cvsroot/displaytag/display09/site/src/org/displaytag/sample/TestList.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestList.java 22 Jun 2003 20:33:04 -0000 1.1
--- TestList.java 9 Aug 2003 19:54:07 -0000 1.2
***************
*** 24,28 ****
super();
! for (int lCount= 0; lCount < 60; lCount++)
{
add(new ListObject());
--- 24,28 ----
super();
! for (int lCount = 0; lCount < 60; lCount++)
{
add(new ListObject());
***************
*** 39,43 ****
super();
! for (int lCount= 0; lCount < pSize; lCount++)
{
add(new ListObject());
--- 39,43 ----
super();
! for (int lCount = 0; lCount < pSize; lCount++)
{
add(new ListObject());
***************
*** 55,67 ****
// generate a random number between 1 and 3 and duplicate that many
number of times.
! for (int lCount= 0; lCount < pSize; lCount++)
{
! ListObject lObject1= new ListObject();
! ListObject lObject2= new ListObject();
! ListObject lObject3= new ListObject();
! int lRandom= new Random().nextInt(3);
! for (int lCount2= 0; lCount2 <= lRandom; lCount2++)
{
add(lObject1);
--- 55,67 ----
// generate a random number between 1 and 3 and duplicate that many
number of times.
! for (int lCount = 0; lCount < pSize; lCount++)
{
! ListObject lObject1 = new ListObject();
! ListObject lObject2 = new ListObject();
! ListObject lObject3 = new ListObject();
! int lRandom = new Random().nextInt(3);
! for (int lCount2 = 0; lCount2 <= lRandom; lCount2++)
{
add(lObject1);
***************
*** 71,76 ****
lObject1.setID(lObject2.getId());
! lRandom= new Random().nextInt(3);
! for (int lCount2= 0; lCount2 <= lRandom; lCount2++)
{
add(lObject1);
--- 71,76 ----
lObject1.setID(lObject2.getId());
! lRandom = new Random().nextInt(3);
! for (int lCount2 = 0; lCount2 <= lRandom; lCount2++)
{
add(lObject1);
***************
*** 81,86 ****
lObject1.setEmail(lObject3.getEmail());
! lRandom= new java.util.Random().nextInt(3);
! for (int lCount2= 0; lCount2 <= lRandom; lCount2++)
{
add(lObject1);
--- 81,86 ----
lObject1.setEmail(lObject3.getEmail());
! lRandom = new java.util.Random().nextInt(3);
! for (int lCount2 = 0; lCount2 <= lRandom; lCount2++)
{
add(lObject1);
***************
*** 88,92 ****
}
}
!
/**
* Method getItem. Returns a ListObject using get(index) from the Array
--- 88,92 ----
}
}
!
/**
* Method getItem. Returns a ListObject using get(index) from the Array
***************
*** 96,100 ****
public ListObject getItem(int pIndex)
{
! return (ListObject)super.get(pIndex);
}
--- 96,100 ----
public ListObject getItem(int pIndex)
{
! return (ListObject) super.get(pIndex);
}
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel