ASF Bugzilla – Attachment 12853 Details for
Bug 31353
Datagrid: Hyperlinks not re-ordered when values re-ordered
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
New Patch
DataGrid.patch (text/plain), 124.18 KB, created by
Nestor Boscan
on 2004-09-24 05:47:00 UTC
(
hide
)
Description:
New Patch
Filename:
MIME Type:
Creator:
Nestor Boscan
Created:
2004-09-24 05:47:00 UTC
Size:
124.18 KB
patch
obsolete
>? DataGrid.patch >? examples/web/WEB-INF >? examples/web/example7.jsp >? src/org.zip >? src/org/apache/taglibs/datagrid/Cell.java >Index: examples/web/example1.jsp >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/examples/web/example1.jsp,v >retrieving revision 1.2 >diff -u -r1.2 example1.jsp >--- examples/web/example1.jsp 28 Jul 2004 00:54:25 -0000 1.2 >+++ examples/web/example1.jsp 24 Sep 2004 05:37:22 -0000 >@@ -1,370 +1,740 @@ >-<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example</title> >- >-</head> >- >-<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >- >-<%@ page contentType="text/html"%> >- >-<%@ page import="java.util.ArrayList" %> >- >- >- >-<%! public static class Employee >- >- { >- >- protected String firstName; >- >- protected String lastName; >- >- protected double salary; >- >- protected double bonus; >- >- >- >- public String getFirstName () >- >- { >- >- return (firstName); >- >- } >- >- >- >- public String getLastName () >- >- { >- >- return (lastName); >- >- } >- >- >- >- public double getSalary () >- >- { >- >- return (salary); >- >- } >- >- >- >- public double getBonus () >- >- { >- >- return (bonus); >- >- } >- >- >- >- public void setFirstName (String newFirstName) >- >- { >- >- firstName = newFirstName; >- >- } >- >- >- >- public void setLastName (String newLastName) >- >- { >- >- lastName = newLastName; >- >- } >- >- >- >- public void setSalary (double newSalary) >- >- { >- >- salary = newSalary; >- >- } >- >- >- >- public void setBonus (double newBonus) >- >- { >- >- bonus = newBonus; >- >- } >- >- } >- >-%> >- >-<% ArrayList employees; >- >- Employee employee; >- >- >- >- employees = new ArrayList (); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Peter"); >- >- employee.setLastName ("Jackson"); >- >- employee.setSalary (120000); >- >- employee.setBonus (20000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Woo"); >- >- employee.setSalary (100000); >- >- employee.setBonus (17000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("George"); >- >- employee.setLastName ("Lucas"); >- >- employee.setSalary (150000); >- >- employee.setBonus (23000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Michael"); >- >- employee.setLastName ("Kain"); >- >- employee.setSalary (100000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Doe"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Jim"); >- >- employee.setLastName ("Carrey"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Sean"); >- >- employee.setLastName ("Penn"); >- >- employee.setSalary (150000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Charlize"); >- >- employee.setLastName ("Theron"); >- >- employee.setSalary (200000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Tom"); >- >- employee.setLastName ("Hanks"); >- >- employee.setSalary (190000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Edward"); >- >- employee.setLastName ("Norton"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Gary"); >- >- employee.setLastName ("Oldman"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- request.setAttribute ("employees", employees); >- >-%> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example 1</title> >- >- <style> >- >- .rows { background-color: #EDD98A; border: 1px solid #000000 } >- >- .hiliterows { background-color: #CDBD4F } >- >- .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >- >- .header { background-color: #998B3B } >- >- .footer { background-color: #998B3B } >- >- .datagrid { border: 1px solid #000000 } >- >- </style> >- >- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >- >-</head> >- >-<body> >- >-<h3>Example 1</h3> >- >-<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0"> >- >- <columns> >- >- <column width="100" order="true"> >- >- <header value="Name" hAlign="center"/> >- >- <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >- >- <aggregate function="count" var="total"/> >- >- <footer value="Total ${total}" hAlign="left"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Salary" hAlign="center"/> >- >- <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Bonus" hAlign="center"/> >- >- <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- </columns> >- >- <header styleClass="header" show="true"/> >- >- <footer styleClass="footer" show="true"/> >- >- <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >- >- <alternateRows styleClass="alternaterows"/> >- >-</ui:dataGrid> >- >-<p><a href="index.jsp">Back to index</a></p> >- >-</body> >- >-</html> >- >+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example</title> >+ >+ >+ >+</head> >+ >+ >+ >+<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >+ >+ >+ >+<%@ page contentType="text/html"%> >+ >+ >+ >+<%@ page import="java.util.ArrayList" %> >+ >+ >+ >+ >+ >+ >+ >+<%! public static class Employee >+ >+ >+ >+ { >+ >+ >+ >+ protected String firstName; >+ >+ >+ >+ protected String lastName; >+ >+ >+ >+ protected double salary; >+ >+ >+ >+ protected double bonus; >+ >+ >+ >+ >+ >+ >+ >+ public String getFirstName () >+ >+ >+ >+ { >+ >+ >+ >+ return (firstName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public String getLastName () >+ >+ >+ >+ { >+ >+ >+ >+ return (lastName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getSalary () >+ >+ >+ >+ { >+ >+ >+ >+ return (salary); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getBonus () >+ >+ >+ >+ { >+ >+ >+ >+ return (bonus); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setFirstName (String newFirstName) >+ >+ >+ >+ { >+ >+ >+ >+ firstName = newFirstName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setLastName (String newLastName) >+ >+ >+ >+ { >+ >+ >+ >+ lastName = newLastName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setSalary (double newSalary) >+ >+ >+ >+ { >+ >+ >+ >+ salary = newSalary; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setBonus (double newBonus) >+ >+ >+ >+ { >+ >+ >+ >+ bonus = newBonus; >+ >+ >+ >+ } >+ >+ >+ >+ } >+ >+ >+ >+%> >+ >+ >+ >+<% ArrayList employees; >+ >+ >+ >+ Employee employee; >+ >+ >+ >+ >+ >+ >+ >+ employees = new ArrayList (); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Peter"); >+ >+ >+ >+ employee.setLastName ("Jackson"); >+ >+ >+ >+ employee.setSalary (120000); >+ >+ >+ >+ employee.setBonus (20000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Woo"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (17000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("George"); >+ >+ >+ >+ employee.setLastName ("Lucas"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (23000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Michael"); >+ >+ >+ >+ employee.setLastName ("Kain"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Doe"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Jim"); >+ >+ >+ >+ employee.setLastName ("Carrey"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Sean"); >+ >+ >+ >+ employee.setLastName ("Penn"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Charlize"); >+ >+ >+ >+ employee.setLastName ("Theron"); >+ >+ >+ >+ employee.setSalary (200000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Tom"); >+ >+ >+ >+ employee.setLastName ("Hanks"); >+ >+ >+ >+ employee.setSalary (190000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Edward"); >+ >+ >+ >+ employee.setLastName ("Norton"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Gary"); >+ >+ >+ >+ employee.setLastName ("Oldman"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ request.setAttribute ("employees", employees); >+ >+ >+ >+%> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example 1</title> >+ >+ >+ >+ <style> >+ >+ >+ >+ .rows { background-color: #EDD98A; border: 1px solid #000000 } >+ >+ >+ >+ .hiliterows { background-color: #CDBD4F } >+ >+ >+ >+ .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >+ >+ >+ >+ .header { background-color: #998B3B } >+ >+ >+ >+ .footer { background-color: #998B3B } >+ >+ >+ >+ .datagrid { border: 1px solid #000000 } >+ >+ >+ >+ </style> >+ >+ >+ >+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >+ >+ >+ >+</head> >+ >+ >+ >+<body> >+ >+ >+ >+<h3>Example 1</h3> >+ >+ >+ >+<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" styleClass="datagrid"> >+ >+ >+ >+ <columns> >+ >+ >+ >+ <column width="100" order="true"> >+ >+ >+ >+ <header value="Name" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >+ >+ >+ >+ <aggregate function="count" var="total"/> >+ >+ >+ >+ <footer value="Total ${total}" hAlign="left"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Salary" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Bonus" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ </columns> >+ >+ >+ >+ <header styleClass="header" show="true"/> >+ >+ >+ >+ <footer styleClass="footer" show="true"/> >+ >+ >+ >+ <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >+ >+ >+ >+ <alternateRows styleClass="alternaterows"/> >+ >+ >+ >+</ui:dataGrid> >+ >+ >+ >+<p><a href="index.jsp">Back to index</a></p> >+ >+ >+ >+</body> >+ >+ >+ >+</html> >+ >+ >+ >Index: examples/web/example2.jsp >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/examples/web/example2.jsp,v >retrieving revision 1.2 >diff -u -r1.2 example2.jsp >--- examples/web/example2.jsp 28 Jul 2004 00:54:25 -0000 1.2 >+++ examples/web/example2.jsp 24 Sep 2004 05:37:22 -0000 >@@ -1,368 +1,736 @@ >-<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example 2</title> >- >-</head> >- >-<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >- >-<%@ page contentType="text/html"%> >- >-<%@ page import="java.util.ArrayList" %> >- >-<%! public static class Employee >- >- { >- >- protected String firstName; >- >- protected String lastName; >- >- protected double salary; >- >- protected double bonus; >- >- >- >- public String getFirstName () >- >- { >- >- return (firstName); >- >- } >- >- >- >- public String getLastName () >- >- { >- >- return (lastName); >- >- } >- >- >- >- public double getSalary () >- >- { >- >- return (salary); >- >- } >- >- >- >- public double getBonus () >- >- { >- >- return (bonus); >- >- } >- >- >- >- public void setFirstName (String newFirstName) >- >- { >- >- firstName = newFirstName; >- >- } >- >- >- >- public void setLastName (String newLastName) >- >- { >- >- lastName = newLastName; >- >- } >- >- >- >- public void setSalary (double newSalary) >- >- { >- >- salary = newSalary; >- >- } >- >- >- >- public void setBonus (double newBonus) >- >- { >- >- bonus = newBonus; >- >- } >- >- } >- >-%> >- >-<% ArrayList employees; >- >- Employee employee; >- >- >- >- employees = new ArrayList (); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Peter"); >- >- employee.setLastName ("Jackson"); >- >- employee.setSalary (120000); >- >- employee.setBonus (20000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Woo"); >- >- employee.setSalary (100000); >- >- employee.setBonus (17000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("George"); >- >- employee.setLastName ("Lucas"); >- >- employee.setSalary (150000); >- >- employee.setBonus (23000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Michael"); >- >- employee.setLastName ("Kain"); >- >- employee.setSalary (100000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Doe"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Jim"); >- >- employee.setLastName ("Carrey"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Sean"); >- >- employee.setLastName ("Penn"); >- >- employee.setSalary (150000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Charlize"); >- >- employee.setLastName ("Theron"); >- >- employee.setSalary (200000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Tom"); >- >- employee.setLastName ("Hanks"); >- >- employee.setSalary (190000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Edward"); >- >- employee.setLastName ("Norton"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Gary"); >- >- employee.setLastName ("Oldman"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- request.setAttribute ("employees", employees); >- >-%> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example</title> >- >- <style> >- >- .rows { background-color: #EDD98A; border: 1px solid #000000 } >- >- .hiliterows { background-color: #CDBD4F } >- >- .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >- >- .header { background-color: #998B3B } >- >- .footer { background-color: #998B3B } >- >- .datagrid { border: 1px solid #000000 } >- >- </style> >- >- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >- >-</head> >- >-<body> >- >-<h3>Example 2</h3> >- >-<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" scroll="true" width="500" height="100"> >- >- <columns> >- >- <column width="100" order="true"> >- >- <header value="Name" hAlign="center"/> >- >- <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >- >- <aggregate function="count" var="total"/> >- >- <footer value="Total ${total}" hAlign="left"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Salary" hAlign="center"/> >- >- <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Bonus" hAlign="center"/> >- >- <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- </columns> >- >- <header styleClass="header" show="true"/> >- >- <footer styleClass="footer" show="true"/> >- >- <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >- >- <alternateRows styleClass="alternaterows"/> >- >-</ui:dataGrid> >- >-<p><a href="index.jsp">Back to index</a></p> >- >-</body> >- >-</html> >- >+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example 2</title> >+ >+ >+ >+</head> >+ >+ >+ >+<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >+ >+ >+ >+<%@ page contentType="text/html"%> >+ >+ >+ >+<%@ page import="java.util.ArrayList" %> >+ >+ >+ >+<%! public static class Employee >+ >+ >+ >+ { >+ >+ >+ >+ protected String firstName; >+ >+ >+ >+ protected String lastName; >+ >+ >+ >+ protected double salary; >+ >+ >+ >+ protected double bonus; >+ >+ >+ >+ >+ >+ >+ >+ public String getFirstName () >+ >+ >+ >+ { >+ >+ >+ >+ return (firstName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public String getLastName () >+ >+ >+ >+ { >+ >+ >+ >+ return (lastName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getSalary () >+ >+ >+ >+ { >+ >+ >+ >+ return (salary); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getBonus () >+ >+ >+ >+ { >+ >+ >+ >+ return (bonus); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setFirstName (String newFirstName) >+ >+ >+ >+ { >+ >+ >+ >+ firstName = newFirstName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setLastName (String newLastName) >+ >+ >+ >+ { >+ >+ >+ >+ lastName = newLastName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setSalary (double newSalary) >+ >+ >+ >+ { >+ >+ >+ >+ salary = newSalary; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setBonus (double newBonus) >+ >+ >+ >+ { >+ >+ >+ >+ bonus = newBonus; >+ >+ >+ >+ } >+ >+ >+ >+ } >+ >+ >+ >+%> >+ >+ >+ >+<% ArrayList employees; >+ >+ >+ >+ Employee employee; >+ >+ >+ >+ >+ >+ >+ >+ employees = new ArrayList (); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Peter"); >+ >+ >+ >+ employee.setLastName ("Jackson"); >+ >+ >+ >+ employee.setSalary (120000); >+ >+ >+ >+ employee.setBonus (20000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Woo"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (17000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("George"); >+ >+ >+ >+ employee.setLastName ("Lucas"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (23000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Michael"); >+ >+ >+ >+ employee.setLastName ("Kain"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Doe"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Jim"); >+ >+ >+ >+ employee.setLastName ("Carrey"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Sean"); >+ >+ >+ >+ employee.setLastName ("Penn"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Charlize"); >+ >+ >+ >+ employee.setLastName ("Theron"); >+ >+ >+ >+ employee.setSalary (200000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Tom"); >+ >+ >+ >+ employee.setLastName ("Hanks"); >+ >+ >+ >+ employee.setSalary (190000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Edward"); >+ >+ >+ >+ employee.setLastName ("Norton"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Gary"); >+ >+ >+ >+ employee.setLastName ("Oldman"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ request.setAttribute ("employees", employees); >+ >+ >+ >+%> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example</title> >+ >+ >+ >+ <style> >+ >+ >+ >+ .rows { background-color: #EDD98A; border: 1px solid #000000 } >+ >+ >+ >+ .hiliterows { background-color: #CDBD4F } >+ >+ >+ >+ .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >+ >+ >+ >+ .header { background-color: #998B3B } >+ >+ >+ >+ .footer { background-color: #998B3B } >+ >+ >+ >+ .datagrid { border: 1px solid #000000 } >+ >+ >+ >+ </style> >+ >+ >+ >+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >+ >+ >+ >+</head> >+ >+ >+ >+<body> >+ >+ >+ >+<h3>Example 2</h3> >+ >+ >+ >+<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" scroll="true" width="500" height="100" style="border: 1px solid black" styleClass="datagrid"> >+ >+ >+ >+ <columns> >+ >+ >+ >+ <column width="100" order="true"> >+ >+ >+ >+ <header value="Name" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >+ >+ >+ >+ <aggregate function="count" var="total"/> >+ >+ >+ >+ <footer value="Total ${total}" hAlign="left"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Salary" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Bonus" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ </columns> >+ >+ >+ >+ <header styleClass="header" show="true"/> >+ >+ >+ >+ <footer styleClass="footer" show="true"/> >+ >+ >+ >+ <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >+ >+ >+ >+ <alternateRows styleClass="alternaterows"/> >+ >+ >+ >+</ui:dataGrid> >+ >+ >+ >+<p><a href="index.jsp">Back to index</a></p> >+ >+ >+ >+</body> >+ >+ >+ >+</html> >+ >+ >+ >Index: examples/web/example3.jsp >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/examples/web/example3.jsp,v >retrieving revision 1.2 >diff -u -r1.2 example3.jsp >--- examples/web/example3.jsp 28 Jul 2004 00:54:25 -0000 1.2 >+++ examples/web/example3.jsp 24 Sep 2004 05:37:23 -0000 >@@ -1,384 +1,768 @@ >-<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example 3</title> >- >-</head> >- >-<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >- >-<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> >- >-<%@ page contentType="text/html"%> >- >-<%@ page import="java.util.ArrayList" %> >- >-<%! public static class Employee >- >- { >- >- protected String firstName; >- >- protected String lastName; >- >- protected double salary; >- >- protected double bonus; >- >- >- >- public String getFirstName () >- >- { >- >- return (firstName); >- >- } >- >- >- >- public String getLastName () >- >- { >- >- return (lastName); >- >- } >- >- >- >- public double getSalary () >- >- { >- >- return (salary); >- >- } >- >- >- >- public double getBonus () >- >- { >- >- return (bonus); >- >- } >- >- >- >- public void setFirstName (String newFirstName) >- >- { >- >- firstName = newFirstName; >- >- } >- >- >- >- public void setLastName (String newLastName) >- >- { >- >- lastName = newLastName; >- >- } >- >- >- >- public void setSalary (double newSalary) >- >- { >- >- salary = newSalary; >- >- } >- >- >- >- public void setBonus (double newBonus) >- >- { >- >- bonus = newBonus; >- >- } >- >- } >- >-%> >- >-<% ArrayList employees; >- >- Employee employee; >- >- >- >- employees = new ArrayList (); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Peter"); >- >- employee.setLastName ("Jackson"); >- >- employee.setSalary (120000); >- >- employee.setBonus (20000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Woo"); >- >- employee.setSalary (100000); >- >- employee.setBonus (17000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("George"); >- >- employee.setLastName ("Lucas"); >- >- employee.setSalary (150000); >- >- employee.setBonus (23000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Michael"); >- >- employee.setLastName ("Kain"); >- >- employee.setSalary (100000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Doe"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Jim"); >- >- employee.setLastName ("Carrey"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Sean"); >- >- employee.setLastName ("Penn"); >- >- employee.setSalary (150000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Charlize"); >- >- employee.setLastName ("Theron"); >- >- employee.setSalary (200000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Tom"); >- >- employee.setLastName ("Hanks"); >- >- employee.setSalary (190000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Edward"); >- >- employee.setLastName ("Norton"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Gary"); >- >- employee.setLastName ("Oldman"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- request.setAttribute ("employees", employees); >- >-%> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example</title> >- >- <style> >- >- .rows { background-color: #EDD98A; border: 1px solid #000000 } >- >- .hiliterows { background-color: #CDBD4F } >- >- .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >- >- .header { background-color: #998B3B } >- >- .footer { background-color: #998B3B } >- >- .datagrid { border: 1px solid #000000 } >- >- </style> >- >- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >- >-</head> >- >-<body> >- >-<h3>Example 3</h3> >- >-<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0"> >- >- <columns> >- >- <column width="100" order="true"> >- >- <header value="Name" hAlign="center"/> >- >- <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >- >- <aggregate function="count" var="total"/> >- >- <footer value="Total ${total}" hAlign="left"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Salary" hAlign="center"/> >- >- <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Bonus" hAlign="center"/> >- >- <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- </columns> >- >- <header styleClass="header" show="true"/> >- >- <footer styleClass="footer" show="true"/> >- >- <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >- >- <alternateRows styleClass="alternaterows"/> >- >- <paging size="4" nextUrlVar="next" previousUrlVar="previous"/> >- >-</ui:dataGrid> >- >-<c:if test="${previous != null}"> >- >-<a href="<c:out value="${previous}"/>">Previous</a> >- >-</c:if> >- >-<c:if test="${next != null}"> >- >-<a href="<c:out value="${next}"/>">Next</a> >- >-</c:if> >- >-<p><a href="index.jsp">Back to index</a></p> >- >-</body> >- >-</html> >- >+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example 3</title> >+ >+ >+ >+</head> >+ >+ >+ >+<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >+ >+ >+ >+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> >+ >+ >+ >+<%@ page contentType="text/html"%> >+ >+ >+ >+<%@ page import="java.util.ArrayList" %> >+ >+ >+ >+<%! public static class Employee >+ >+ >+ >+ { >+ >+ >+ >+ protected String firstName; >+ >+ >+ >+ protected String lastName; >+ >+ >+ >+ protected double salary; >+ >+ >+ >+ protected double bonus; >+ >+ >+ >+ >+ >+ >+ >+ public String getFirstName () >+ >+ >+ >+ { >+ >+ >+ >+ return (firstName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public String getLastName () >+ >+ >+ >+ { >+ >+ >+ >+ return (lastName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getSalary () >+ >+ >+ >+ { >+ >+ >+ >+ return (salary); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getBonus () >+ >+ >+ >+ { >+ >+ >+ >+ return (bonus); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setFirstName (String newFirstName) >+ >+ >+ >+ { >+ >+ >+ >+ firstName = newFirstName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setLastName (String newLastName) >+ >+ >+ >+ { >+ >+ >+ >+ lastName = newLastName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setSalary (double newSalary) >+ >+ >+ >+ { >+ >+ >+ >+ salary = newSalary; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setBonus (double newBonus) >+ >+ >+ >+ { >+ >+ >+ >+ bonus = newBonus; >+ >+ >+ >+ } >+ >+ >+ >+ } >+ >+ >+ >+%> >+ >+ >+ >+<% ArrayList employees; >+ >+ >+ >+ Employee employee; >+ >+ >+ >+ >+ >+ >+ >+ employees = new ArrayList (); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Peter"); >+ >+ >+ >+ employee.setLastName ("Jackson"); >+ >+ >+ >+ employee.setSalary (120000); >+ >+ >+ >+ employee.setBonus (20000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Woo"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (17000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("George"); >+ >+ >+ >+ employee.setLastName ("Lucas"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (23000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Michael"); >+ >+ >+ >+ employee.setLastName ("Kain"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Doe"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Jim"); >+ >+ >+ >+ employee.setLastName ("Carrey"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Sean"); >+ >+ >+ >+ employee.setLastName ("Penn"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Charlize"); >+ >+ >+ >+ employee.setLastName ("Theron"); >+ >+ >+ >+ employee.setSalary (200000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Tom"); >+ >+ >+ >+ employee.setLastName ("Hanks"); >+ >+ >+ >+ employee.setSalary (190000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Edward"); >+ >+ >+ >+ employee.setLastName ("Norton"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Gary"); >+ >+ >+ >+ employee.setLastName ("Oldman"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ request.setAttribute ("employees", employees); >+ >+ >+ >+%> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example</title> >+ >+ >+ >+ <style> >+ >+ >+ >+ .rows { background-color: #EDD98A; border: 1px solid #000000 } >+ >+ >+ >+ .hiliterows { background-color: #CDBD4F } >+ >+ >+ >+ .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >+ >+ >+ >+ .header { background-color: #998B3B } >+ >+ >+ >+ .footer { background-color: #998B3B } >+ >+ >+ >+ .datagrid { border: 1px solid #000000 } >+ >+ >+ >+ </style> >+ >+ >+ >+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >+ >+ >+ >+</head> >+ >+ >+ >+<body> >+ >+ >+ >+<h3>Example 3</h3> >+ >+ >+ >+<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" styleClass="datagrid"> >+ >+ >+ >+ <columns> >+ >+ >+ >+ <column width="100" order="true"> >+ >+ >+ >+ <header value="Name" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >+ >+ >+ >+ <aggregate function="count" var="total"/> >+ >+ >+ >+ <footer value="Total ${total}" hAlign="left"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Salary" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Bonus" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ </columns> >+ >+ >+ >+ <header styleClass="header" show="true"/> >+ >+ >+ >+ <footer styleClass="footer" show="true"/> >+ >+ >+ >+ <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >+ >+ >+ >+ <alternateRows styleClass="alternaterows"/> >+ >+ >+ >+ <paging size="4" nextUrlVar="next" previousUrlVar="previous"/> >+ >+ >+ >+</ui:dataGrid> >+ >+ >+ >+<c:if test="${previous != null}"> >+ >+ >+ >+<a href="<c:out value="${previous}"/>">Previous</a> >+ >+ >+ >+</c:if> >+ >+ >+ >+<c:if test="${next != null}"> >+ >+ >+ >+<a href="<c:out value="${next}"/>">Next</a> >+ >+ >+ >+</c:if> >+ >+ >+ >+<p><a href="index.jsp">Back to index</a></p> >+ >+ >+ >+</body> >+ >+ >+ >+</html> >+ >+ >+ >Index: examples/web/example4.jsp >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/examples/web/example4.jsp,v >retrieving revision 1.2 >diff -u -r1.2 example4.jsp >--- examples/web/example4.jsp 28 Jul 2004 00:54:25 -0000 1.2 >+++ examples/web/example4.jsp 24 Sep 2004 05:37:23 -0000 >@@ -1,378 +1,756 @@ >-<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example</title> >- >-</head> >- >-<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >- >-<%@ page contentType="text/html"%> >- >-<%@ page import="java.util.ArrayList" %> >- >- >- >-<%! public static class Employee >- >- { >- >- protected String firstName; >- >- protected String lastName; >- >- protected double salary; >- >- protected double bonus; >- >- >- >- public String getFirstName () >- >- { >- >- return (firstName); >- >- } >- >- >- >- public String getLastName () >- >- { >- >- return (lastName); >- >- } >- >- >- >- public double getSalary () >- >- { >- >- return (salary); >- >- } >- >- >- >- public double getBonus () >- >- { >- >- return (bonus); >- >- } >- >- >- >- public void setFirstName (String newFirstName) >- >- { >- >- firstName = newFirstName; >- >- } >- >- >- >- public void setLastName (String newLastName) >- >- { >- >- lastName = newLastName; >- >- } >- >- >- >- public void setSalary (double newSalary) >- >- { >- >- salary = newSalary; >- >- } >- >- >- >- public void setBonus (double newBonus) >- >- { >- >- bonus = newBonus; >- >- } >- >- } >- >-%> >- >-<% ArrayList employees; >- >- Employee employee; >- >- >- >- employees = new ArrayList (); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Peter"); >- >- employee.setLastName ("Jackson"); >- >- employee.setSalary (120000); >- >- employee.setBonus (20000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Woo"); >- >- employee.setSalary (100000); >- >- employee.setBonus (17000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("George"); >- >- employee.setLastName ("Lucas"); >- >- employee.setSalary (150000); >- >- employee.setBonus (23000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Michael"); >- >- employee.setLastName ("Kain"); >- >- employee.setSalary (100000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Doe"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Jim"); >- >- employee.setLastName ("Carrey"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Sean"); >- >- employee.setLastName ("Penn"); >- >- employee.setSalary (150000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Charlize"); >- >- employee.setLastName ("Theron"); >- >- employee.setSalary (200000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Tom"); >- >- employee.setLastName ("Hanks"); >- >- employee.setSalary (190000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Edward"); >- >- employee.setLastName ("Norton"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Gary"); >- >- employee.setLastName ("Oldman"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- request.setAttribute ("employees", employees); >- >-%> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example 4</title> >- >- <style> >- >- .rows { background-color: #EDD98A; border: 1px solid #000000 } >- >- .hiliterows { background-color: #CDBD4F } >- >- .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >- >- .header { background-color: #998B3B } >- >- .footer { background-color: #998B3B } >- >- .datagrid { border: 1px solid #000000 } >- >- </style> >- >- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >- >-</head> >- >-<body> >- >-<h3>Example 4</h3> >- >-<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" scroll="true" width="600" height="100"> >- >- <columns> >- >- <column width="100"> >- >- <header value="Select" hAlign="center"/> >- >- <item value="<input type="radio" name="employee" value="${employee.firstName} ${employee.lastName}"/>" hAlign="center"/> >- >- </column> >- >- <column width="100" order="true"> >- >- <header value="Name" hAlign="center"/> >- >- <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >- >- <aggregate function="count" var="total"/> >- >- <footer value="Total ${total}" hAlign="left"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Salary" hAlign="center"/> >- >- <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Bonus" hAlign="center"/> >- >- <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- </columns> >- >- <header styleClass="header" show="true"/> >- >- <footer styleClass="footer" show="true"/> >- >- <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >- >- <alternateRows styleClass="alternaterows"/> >- >-</ui:dataGrid> >- >-<p><a href="index.jsp">Back to index</a></p> >- >-</body> >- >-</html> >- >+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example</title> >+ >+ >+ >+</head> >+ >+ >+ >+<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >+ >+ >+ >+<%@ page contentType="text/html"%> >+ >+ >+ >+<%@ page import="java.util.ArrayList" %> >+ >+ >+ >+ >+ >+ >+ >+<%! public static class Employee >+ >+ >+ >+ { >+ >+ >+ >+ protected String firstName; >+ >+ >+ >+ protected String lastName; >+ >+ >+ >+ protected double salary; >+ >+ >+ >+ protected double bonus; >+ >+ >+ >+ >+ >+ >+ >+ public String getFirstName () >+ >+ >+ >+ { >+ >+ >+ >+ return (firstName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public String getLastName () >+ >+ >+ >+ { >+ >+ >+ >+ return (lastName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getSalary () >+ >+ >+ >+ { >+ >+ >+ >+ return (salary); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getBonus () >+ >+ >+ >+ { >+ >+ >+ >+ return (bonus); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setFirstName (String newFirstName) >+ >+ >+ >+ { >+ >+ >+ >+ firstName = newFirstName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setLastName (String newLastName) >+ >+ >+ >+ { >+ >+ >+ >+ lastName = newLastName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setSalary (double newSalary) >+ >+ >+ >+ { >+ >+ >+ >+ salary = newSalary; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setBonus (double newBonus) >+ >+ >+ >+ { >+ >+ >+ >+ bonus = newBonus; >+ >+ >+ >+ } >+ >+ >+ >+ } >+ >+ >+ >+%> >+ >+ >+ >+<% ArrayList employees; >+ >+ >+ >+ Employee employee; >+ >+ >+ >+ >+ >+ >+ >+ employees = new ArrayList (); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Peter"); >+ >+ >+ >+ employee.setLastName ("Jackson"); >+ >+ >+ >+ employee.setSalary (120000); >+ >+ >+ >+ employee.setBonus (20000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Woo"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (17000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("George"); >+ >+ >+ >+ employee.setLastName ("Lucas"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (23000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Michael"); >+ >+ >+ >+ employee.setLastName ("Kain"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Doe"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Jim"); >+ >+ >+ >+ employee.setLastName ("Carrey"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Sean"); >+ >+ >+ >+ employee.setLastName ("Penn"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Charlize"); >+ >+ >+ >+ employee.setLastName ("Theron"); >+ >+ >+ >+ employee.setSalary (200000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Tom"); >+ >+ >+ >+ employee.setLastName ("Hanks"); >+ >+ >+ >+ employee.setSalary (190000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Edward"); >+ >+ >+ >+ employee.setLastName ("Norton"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Gary"); >+ >+ >+ >+ employee.setLastName ("Oldman"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ request.setAttribute ("employees", employees); >+ >+ >+ >+%> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example 4</title> >+ >+ >+ >+ <style> >+ >+ >+ >+ .rows { background-color: #EDD98A; border: 1px solid #000000 } >+ >+ >+ >+ .hiliterows { background-color: #CDBD4F } >+ >+ >+ >+ .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >+ >+ >+ >+ .header { background-color: #998B3B } >+ >+ >+ >+ .footer { background-color: #998B3B } >+ >+ >+ >+ .datagrid { border: 1px solid #000000 } >+ >+ >+ >+ </style> >+ >+ >+ >+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >+ >+ >+ >+</head> >+ >+ >+ >+<body> >+ >+ >+ >+<h3>Example 4</h3> >+ >+ >+ >+<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" scroll="true" width="600" height="100" styleClass="datagrid"> >+ >+ >+ >+ <columns> >+ >+ >+ >+ <column width="100"> >+ >+ >+ >+ <header value="Select" hAlign="center"/> >+ >+ >+ >+ <item value="<input type="radio" name="employee" value="${employee.firstName} ${employee.lastName}"/>" hAlign="center"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="100" order="true"> >+ >+ >+ >+ <header value="Name" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >+ >+ >+ >+ <aggregate function="count" var="total"/> >+ >+ >+ >+ <footer value="Total ${total}" hAlign="left"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Salary" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Bonus" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ </columns> >+ >+ >+ >+ <header styleClass="header" show="true"/> >+ >+ >+ >+ <footer styleClass="footer" show="true"/> >+ >+ >+ >+ <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >+ >+ >+ >+ <alternateRows styleClass="alternaterows"/> >+ >+ >+ >+</ui:dataGrid> >+ >+ >+ >+<p><a href="index.jsp">Back to index</a></p> >+ >+ >+ >+</body> >+ >+ >+ >+</html> >+ >+ >+ >Index: examples/web/example5.jsp >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/examples/web/example5.jsp,v >retrieving revision 1.2 >diff -u -r1.2 example5.jsp >--- examples/web/example5.jsp 28 Jul 2004 00:54:25 -0000 1.2 >+++ examples/web/example5.jsp 24 Sep 2004 05:37:24 -0000 >@@ -1,378 +1,756 @@ >-<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example</title> >- >-</head> >- >-<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >- >-<%@ page contentType="text/html"%> >- >-<%@ page import="java.util.ArrayList" %> >- >- >- >-<%! public static class Employee >- >- { >- >- protected String firstName; >- >- protected String lastName; >- >- protected double salary; >- >- protected double bonus; >- >- >- >- public String getFirstName () >- >- { >- >- return (firstName); >- >- } >- >- >- >- public String getLastName () >- >- { >- >- return (lastName); >- >- } >- >- >- >- public double getSalary () >- >- { >- >- return (salary); >- >- } >- >- >- >- public double getBonus () >- >- { >- >- return (bonus); >- >- } >- >- >- >- public void setFirstName (String newFirstName) >- >- { >- >- firstName = newFirstName; >- >- } >- >- >- >- public void setLastName (String newLastName) >- >- { >- >- lastName = newLastName; >- >- } >- >- >- >- public void setSalary (double newSalary) >- >- { >- >- salary = newSalary; >- >- } >- >- >- >- public void setBonus (double newBonus) >- >- { >- >- bonus = newBonus; >- >- } >- >- } >- >-%> >- >-<% ArrayList employees; >- >- Employee employee; >- >- >- >- employees = new ArrayList (); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Peter"); >- >- employee.setLastName ("Jackson"); >- >- employee.setSalary (120000); >- >- employee.setBonus (20000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Woo"); >- >- employee.setSalary (100000); >- >- employee.setBonus (17000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("George"); >- >- employee.setLastName ("Lucas"); >- >- employee.setSalary (150000); >- >- employee.setBonus (23000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Michael"); >- >- employee.setLastName ("Kain"); >- >- employee.setSalary (100000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Doe"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Jim"); >- >- employee.setLastName ("Carrey"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Sean"); >- >- employee.setLastName ("Penn"); >- >- employee.setSalary (150000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Charlize"); >- >- employee.setLastName ("Theron"); >- >- employee.setSalary (200000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Tom"); >- >- employee.setLastName ("Hanks"); >- >- employee.setSalary (190000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Edward"); >- >- employee.setLastName ("Norton"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Gary"); >- >- employee.setLastName ("Oldman"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- request.setAttribute ("employees", employees); >- >-%> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example 5</title> >- >- <style> >- >- .rows { background-color: #EDD98A; border: 1px solid #000000 } >- >- .hiliterows { background-color: #CDBD4F } >- >- .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >- >- .header { background-color: #998B3B } >- >- .footer { background-color: #998B3B } >- >- .datagrid { border: 1px solid #000000 } >- >- </style> >- >- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >- >-</head> >- >-<body> >- >-<h3>Example 5</h3> >- >-<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" scroll="true" width="600" height="100"> >- >- <columns> >- >- <column width="100"> >- >- <header value="Select" hAlign="center"/> >- >- <item value="<input type="checkbox" name="employee" value="${employee.firstName} ${employee.lastName}"/>" hAlign="center"/> >- >- </column> >- >- <column width="100" order="true"> >- >- <header value="Name" hAlign="center"/> >- >- <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >- >- <aggregate function="count" var="total"/> >- >- <footer value="Total ${total}" hAlign="left"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Salary" hAlign="center"/> >- >- <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Bonus" hAlign="center"/> >- >- <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- </columns> >- >- <header styleClass="header" show="true"/> >- >- <footer styleClass="footer" show="true"/> >- >- <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >- >- <alternateRows styleClass="alternaterows"/> >- >-</ui:dataGrid> >- >-<p><a href="index.jsp">Back to index</a></p> >- >-</body> >- >-</html> >- >+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example</title> >+ >+ >+ >+</head> >+ >+ >+ >+<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >+ >+ >+ >+<%@ page contentType="text/html"%> >+ >+ >+ >+<%@ page import="java.util.ArrayList" %> >+ >+ >+ >+ >+ >+ >+ >+<%! public static class Employee >+ >+ >+ >+ { >+ >+ >+ >+ protected String firstName; >+ >+ >+ >+ protected String lastName; >+ >+ >+ >+ protected double salary; >+ >+ >+ >+ protected double bonus; >+ >+ >+ >+ >+ >+ >+ >+ public String getFirstName () >+ >+ >+ >+ { >+ >+ >+ >+ return (firstName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public String getLastName () >+ >+ >+ >+ { >+ >+ >+ >+ return (lastName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getSalary () >+ >+ >+ >+ { >+ >+ >+ >+ return (salary); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getBonus () >+ >+ >+ >+ { >+ >+ >+ >+ return (bonus); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setFirstName (String newFirstName) >+ >+ >+ >+ { >+ >+ >+ >+ firstName = newFirstName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setLastName (String newLastName) >+ >+ >+ >+ { >+ >+ >+ >+ lastName = newLastName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setSalary (double newSalary) >+ >+ >+ >+ { >+ >+ >+ >+ salary = newSalary; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setBonus (double newBonus) >+ >+ >+ >+ { >+ >+ >+ >+ bonus = newBonus; >+ >+ >+ >+ } >+ >+ >+ >+ } >+ >+ >+ >+%> >+ >+ >+ >+<% ArrayList employees; >+ >+ >+ >+ Employee employee; >+ >+ >+ >+ >+ >+ >+ >+ employees = new ArrayList (); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Peter"); >+ >+ >+ >+ employee.setLastName ("Jackson"); >+ >+ >+ >+ employee.setSalary (120000); >+ >+ >+ >+ employee.setBonus (20000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Woo"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (17000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("George"); >+ >+ >+ >+ employee.setLastName ("Lucas"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (23000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Michael"); >+ >+ >+ >+ employee.setLastName ("Kain"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Doe"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Jim"); >+ >+ >+ >+ employee.setLastName ("Carrey"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Sean"); >+ >+ >+ >+ employee.setLastName ("Penn"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Charlize"); >+ >+ >+ >+ employee.setLastName ("Theron"); >+ >+ >+ >+ employee.setSalary (200000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Tom"); >+ >+ >+ >+ employee.setLastName ("Hanks"); >+ >+ >+ >+ employee.setSalary (190000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Edward"); >+ >+ >+ >+ employee.setLastName ("Norton"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Gary"); >+ >+ >+ >+ employee.setLastName ("Oldman"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ request.setAttribute ("employees", employees); >+ >+ >+ >+%> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example 5</title> >+ >+ >+ >+ <style> >+ >+ >+ >+ .rows { background-color: #EDD98A; border: 1px solid #000000 } >+ >+ >+ >+ .hiliterows { background-color: #CDBD4F } >+ >+ >+ >+ .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >+ >+ >+ >+ .header { background-color: #998B3B } >+ >+ >+ >+ .footer { background-color: #998B3B } >+ >+ >+ >+ .datagrid { border: 1px solid #000000 } >+ >+ >+ >+ </style> >+ >+ >+ >+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >+ >+ >+ >+</head> >+ >+ >+ >+<body> >+ >+ >+ >+<h3>Example 5</h3> >+ >+ >+ >+<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" scroll="true" width="600" height="100" styleClass="datagrid"> >+ >+ >+ >+ <columns> >+ >+ >+ >+ <column width="100"> >+ >+ >+ >+ <header value="Select" hAlign="center"/> >+ >+ >+ >+ <item value="<input type="checkbox" name="employee" value="${employee.firstName} ${employee.lastName}"/>" hAlign="center"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="100" order="true"> >+ >+ >+ >+ <header value="Name" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.firstName} ${employee.lastName}" hAlign="left"/> >+ >+ >+ >+ <aggregate function="count" var="total"/> >+ >+ >+ >+ <footer value="Total ${total}" hAlign="left"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Salary" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Bonus" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ </columns> >+ >+ >+ >+ <header styleClass="header" show="true"/> >+ >+ >+ >+ <footer styleClass="footer" show="true"/> >+ >+ >+ >+ <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >+ >+ >+ >+ <alternateRows styleClass="alternaterows"/> >+ >+ >+ >+</ui:dataGrid> >+ >+ >+ >+<p><a href="index.jsp">Back to index</a></p> >+ >+ >+ >+</body> >+ >+ >+ >+</html> >+ >+ >+ >Index: examples/web/example6.jsp >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/examples/web/example6.jsp,v >retrieving revision 1.2 >diff -u -r1.2 example6.jsp >--- examples/web/example6.jsp 28 Jul 2004 00:54:25 -0000 1.2 >+++ examples/web/example6.jsp 24 Sep 2004 05:37:24 -0000 >@@ -1,386 +1,772 @@ >-<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example</title> >- >-</head> >- >-<%@ page contentType="text/html"%> >- >-<%@ page import="java.util.ArrayList" %> >- >-<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >- >-<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> >- >-<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> >- >-<%! public static class Employee >- >- { >- >- protected String firstName; >- >- protected String lastName; >- >- protected double salary; >- >- protected double bonus; >- >- >- >- public String getFirstName () >- >- { >- >- return (firstName); >- >- } >- >- >- >- public String getLastName () >- >- { >- >- return (lastName); >- >- } >- >- >- >- public double getSalary () >- >- { >- >- return (salary); >- >- } >- >- >- >- public double getBonus () >- >- { >- >- return (bonus); >- >- } >- >- >- >- public void setFirstName (String newFirstName) >- >- { >- >- firstName = newFirstName; >- >- } >- >- >- >- public void setLastName (String newLastName) >- >- { >- >- lastName = newLastName; >- >- } >- >- >- >- public void setSalary (double newSalary) >- >- { >- >- salary = newSalary; >- >- } >- >- >- >- public void setBonus (double newBonus) >- >- { >- >- bonus = newBonus; >- >- } >- >- } >- >-%> >- >-<% ArrayList employees; >- >- Employee employee; >- >- >- >- employees = new ArrayList (); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Peter"); >- >- employee.setLastName ("Jackson"); >- >- employee.setSalary (120000); >- >- employee.setBonus (20000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Woo"); >- >- employee.setSalary (100000); >- >- employee.setBonus (17000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("George"); >- >- employee.setLastName ("Lucas"); >- >- employee.setSalary (150000); >- >- employee.setBonus (23000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Michael"); >- >- employee.setLastName ("Kain"); >- >- employee.setSalary (100000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("John"); >- >- employee.setLastName ("Doe"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Jim"); >- >- employee.setLastName ("Carrey"); >- >- employee.setSalary (110000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Sean"); >- >- employee.setLastName ("Penn"); >- >- employee.setSalary (150000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Charlize"); >- >- employee.setLastName ("Theron"); >- >- employee.setSalary (200000); >- >- employee.setBonus (11000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Tom"); >- >- employee.setLastName ("Hanks"); >- >- employee.setSalary (190000); >- >- employee.setBonus (10000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Edward"); >- >- employee.setLastName ("Norton"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- employee = new Employee (); >- >- employee.setFirstName ("Gary"); >- >- employee.setLastName ("Oldman"); >- >- employee.setSalary (180000); >- >- employee.setBonus (13000); >- >- employees.add (employee); >- >- >- >- request.setAttribute ("employees", employees); >- >-%> >- >-<html> >- >-<head> >- >- <title>Jakarta Data Grid Taglib Example 6</title> >- >- <style> >- >- .rows { background-color: #EDD98A; border: 1px solid #000000 } >- >- .hiliterows { background-color: #CDBD4F } >- >- .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >- >- .header { background-color: #998B3B } >- >- .footer { background-color: #998B3B } >- >- .datagrid { border: 1px solid #000000 } >- >- </style> >- >- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >- >-</head> >- >-<body> >- >-<h3>Example 6</h3> >- >-<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0"> >- >- <columns> >- >- <column width="100" order="true"> >- >- <header value="Name" hAlign="center"/> >- >- <item value="${employee.firstName} ${employee.lastName}" hAlign="left" hyperLink="http://www.imdb.com/find?tt=on;nm=on;mx=20;q=${employee.firstName}%20${employee.lastName}" hyperLinkTarget="_blank"/> >- >- <aggregate function="count" var="total"/> >- >- <footer value="Total ${total}" hAlign="left"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Salary" hAlign="center"/> >- >- <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- <column width="200" order="true"> >- >- <header value="Bonus" hAlign="center"/> >- >- <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >- >- <aggregate function="avg" pattern="#,##0.00" var="total"/> >- >- <footer value="Average ${total}" hAlign="right"/> >- >- </column> >- >- </columns> >- >- <header styleClass="header" show="true"/> >- >- <footer styleClass="footer" show="true"/> >- >- <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >- >- <alternateRows styleClass="alternaterows"/> >- >- <paging size="4" nextUrlVar="next" previousUrlVar="previous"/> >- >-</ui:dataGrid> >- >-<c:if test="${previous != null}"> >- >-<a href="<c:out value="${previous}"/>">Previous</a> >- >-</c:if> >- >-<c:if test="${next != null}"> >- >-<a href="<c:out value="${next}"/>">Next</a> >- >-</c:if> >- >-<p><a href="index.jsp">Back to index</a></p> >- >-</body> >- >-</html> >- >+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example</title> >+ >+ >+ >+</head> >+ >+ >+ >+<%@ page contentType="text/html"%> >+ >+ >+ >+<%@ page import="java.util.ArrayList" %> >+ >+ >+ >+<%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %> >+ >+ >+ >+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> >+ >+ >+ >+<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> >+ >+ >+ >+<%! public static class Employee >+ >+ >+ >+ { >+ >+ >+ >+ protected String firstName; >+ >+ >+ >+ protected String lastName; >+ >+ >+ >+ protected double salary; >+ >+ >+ >+ protected double bonus; >+ >+ >+ >+ >+ >+ >+ >+ public String getFirstName () >+ >+ >+ >+ { >+ >+ >+ >+ return (firstName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public String getLastName () >+ >+ >+ >+ { >+ >+ >+ >+ return (lastName); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getSalary () >+ >+ >+ >+ { >+ >+ >+ >+ return (salary); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public double getBonus () >+ >+ >+ >+ { >+ >+ >+ >+ return (bonus); >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setFirstName (String newFirstName) >+ >+ >+ >+ { >+ >+ >+ >+ firstName = newFirstName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setLastName (String newLastName) >+ >+ >+ >+ { >+ >+ >+ >+ lastName = newLastName; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setSalary (double newSalary) >+ >+ >+ >+ { >+ >+ >+ >+ salary = newSalary; >+ >+ >+ >+ } >+ >+ >+ >+ >+ >+ >+ >+ public void setBonus (double newBonus) >+ >+ >+ >+ { >+ >+ >+ >+ bonus = newBonus; >+ >+ >+ >+ } >+ >+ >+ >+ } >+ >+ >+ >+%> >+ >+ >+ >+<% ArrayList employees; >+ >+ >+ >+ Employee employee; >+ >+ >+ >+ >+ >+ >+ >+ employees = new ArrayList (); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Peter"); >+ >+ >+ >+ employee.setLastName ("Jackson"); >+ >+ >+ >+ employee.setSalary (120000); >+ >+ >+ >+ employee.setBonus (20000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Woo"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (17000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("George"); >+ >+ >+ >+ employee.setLastName ("Lucas"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (23000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Michael"); >+ >+ >+ >+ employee.setLastName ("Kain"); >+ >+ >+ >+ employee.setSalary (100000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("John"); >+ >+ >+ >+ employee.setLastName ("Doe"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Jim"); >+ >+ >+ >+ employee.setLastName ("Carrey"); >+ >+ >+ >+ employee.setSalary (110000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Sean"); >+ >+ >+ >+ employee.setLastName ("Penn"); >+ >+ >+ >+ employee.setSalary (150000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Charlize"); >+ >+ >+ >+ employee.setLastName ("Theron"); >+ >+ >+ >+ employee.setSalary (200000); >+ >+ >+ >+ employee.setBonus (11000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Tom"); >+ >+ >+ >+ employee.setLastName ("Hanks"); >+ >+ >+ >+ employee.setSalary (190000); >+ >+ >+ >+ employee.setBonus (10000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Edward"); >+ >+ >+ >+ employee.setLastName ("Norton"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ employee = new Employee (); >+ >+ >+ >+ employee.setFirstName ("Gary"); >+ >+ >+ >+ employee.setLastName ("Oldman"); >+ >+ >+ >+ employee.setSalary (180000); >+ >+ >+ >+ employee.setBonus (13000); >+ >+ >+ >+ employees.add (employee); >+ >+ >+ >+ >+ >+ >+ >+ request.setAttribute ("employees", employees); >+ >+ >+ >+%> >+ >+ >+ >+<html> >+ >+ >+ >+<head> >+ >+ >+ >+ <title>Jakarta Data Grid Taglib Example 6</title> >+ >+ >+ >+ <style> >+ >+ >+ >+ .rows { background-color: #EDD98A; border: 1px solid #000000 } >+ >+ >+ >+ .hiliterows { background-color: #CDBD4F } >+ >+ >+ >+ .alternaterows { background-color: #D3C971; border: 1px solid #000000 } >+ >+ >+ >+ .header { background-color: #998B3B } >+ >+ >+ >+ .footer { background-color: #998B3B } >+ >+ >+ >+ .datagrid { border: 1px solid #000000 } >+ >+ >+ >+ </style> >+ >+ >+ >+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >+ >+ >+ >+</head> >+ >+ >+ >+<body> >+ >+ >+ >+<h3>Example 6</h3> >+ >+ >+ >+<ui:dataGrid items="${employees}" var="employee" name="datagrid1" cellPadding="0" cellSpacing="0" styleClass="datagrid"> >+ >+ >+ >+ <columns> >+ >+ >+ >+ <column width="100" order="true"> >+ >+ >+ >+ <header value="Name" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.firstName} ${employee.lastName}" hAlign="left" hyperLink="http://www.imdb.com/find?tt=on;nm=on;mx=20;q=${employee.firstName}%20${employee.lastName}" hyperLinkTarget="_blank"/> >+ >+ >+ >+ <aggregate function="count" var="total"/> >+ >+ >+ >+ <footer value="Total ${total}" hAlign="left"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Salary" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.salary}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ <column width="200" order="true"> >+ >+ >+ >+ <header value="Bonus" hAlign="center"/> >+ >+ >+ >+ <item value="${employee.bonus}" hAlign="right" pattern="#,##0.00"/> >+ >+ >+ >+ <aggregate function="avg" pattern="#,##0.00" var="total"/> >+ >+ >+ >+ <footer value="Average ${total}" hAlign="right"/> >+ >+ >+ >+ </column> >+ >+ >+ >+ </columns> >+ >+ >+ >+ <header styleClass="header" show="true"/> >+ >+ >+ >+ <footer styleClass="footer" show="true"/> >+ >+ >+ >+ <rows styleClass="rows" hiliteStyleClass="hiliterows"/> >+ >+ >+ >+ <alternateRows styleClass="alternaterows"/> >+ >+ >+ >+ <paging size="4" nextUrlVar="next" previousUrlVar="previous"/> >+ >+ >+ >+</ui:dataGrid> >+ >+ >+ >+<c:if test="${previous != null}"> >+ >+ >+ >+<a href="<c:out value="${previous}"/>">Previous</a> >+ >+ >+ >+</c:if> >+ >+ >+ >+<c:if test="${next != null}"> >+ >+ >+ >+<a href="<c:out value="${next}"/>">Next</a> >+ >+ >+ >+</c:if> >+ >+ >+ >+<p><a href="index.jsp">Back to index</a></p> >+ >+ >+ >+</body> >+ >+ >+ >+</html> >+ >+ >+ >Index: src/org/apache/taglibs/datagrid/Column.java >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/src/org/apache/taglibs/datagrid/Column.java,v >retrieving revision 1.2 >diff -u -r1.2 Column.java >--- src/org/apache/taglibs/datagrid/Column.java 28 Jul 2004 00:54:25 -0000 1.2 >+++ src/org/apache/taglibs/datagrid/Column.java 24 Sep 2004 05:37:25 -0000 >@@ -1,244 +1,268 @@ >-/* >- * Copyright 2004 The Apache Software Foundation. >- * >- * Licensed under the Apache License, Version 2.0 (the "License"); >- * you may not use this file except in compliance with the License. >- * You may obtain a copy of the License at >- * >- * http://www.apache.org/licenses/LICENSE-2.0 >- * >- * Unless required by applicable law or agreed to in writing, software >- * distributed under the License is distributed on an "AS IS" BASIS, >- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >- * See the License for the specific language governing permissions and >- * limitations under the License. >- */ >-package org.apache.taglibs.datagrid; >- >-import java.util.ArrayList; >-import java.util.List; >- >-/** >- * Class that stores a column definition of a data grid. >- * >- * @see DataGridTag >- */ >- >-public class Column >-{ >- protected ArrayList aggregates = new ArrayList (); >- protected String itemStyleClass; >- protected String headerStyleClass; >- protected String width; >- protected String itemValue; >- protected String headerValue; >- protected String footerStyleClass; >- protected String footerValue; >- protected String itemHyperLinkValue; >- protected String headerHorizontalAlign; >- protected String headerVerticalAlign; >- protected String footerHorizontalAlign; >- protected String footerVerticalAlign; >- protected String itemHorizontalAlign; >- protected String itemVerticalAlign; >- protected String [] itemHyperLinkValues; >- protected String itemPattern; >- protected String totalPattern; >- protected String itemHyperLinkTarget; >- protected boolean order; >- >- public Column() >- { >- } >- >- public String getItemStyleClass() >- { >- return itemStyleClass; >- } >- >- public void setItemStyleClass(String newItemStyleClass) >- { >- itemStyleClass = newItemStyleClass; >- } >- >- public String getHeaderStyleClass() >- { >- return headerStyleClass; >- } >- >- public void setHeaderStyleClass(String newHeaderStyleClass) >- { >- headerStyleClass = newHeaderStyleClass; >- } >- >- public String getWidth() >- { >- return width; >- } >- >- public void setWidth(String newWidth) >- { >- width = newWidth; >- } >- >- public String getItemValue() >- { >- return itemValue; >- } >- >- public void setItemValue(String newItemValue) >- { >- itemValue = newItemValue; >- } >- >- >- public String getHeaderValue() >- { >- return headerValue; >- } >- >- public void setHeaderValue(String newHeaderValue) >- { >- headerValue = newHeaderValue; >- } >- >- public String getFooterStyleClass() >- { >- return footerStyleClass; >- } >- >- public void setFooterStyleClass(String newFooterStyleClass) >- { >- footerStyleClass = newFooterStyleClass; >- } >- >- public String getFooterValue() >- { >- return footerValue; >- } >- >- public void setFooterValue(String newFooterValue) >- { >- footerValue = newFooterValue; >- } >- >- public String getItemHyperLinkValue() >- { >- return itemHyperLinkValue; >- } >- >- public void setItemHyperLinkValue(String newItemHyperLinkValue) >- { >- itemHyperLinkValue = newItemHyperLinkValue; >- } >- >- public String getHeaderHorizontalAlign() >- { >- return headerHorizontalAlign; >- } >- >- public void setHeaderHorizontalAlign(String newHeaderHorizontalAlign) >- { >- headerHorizontalAlign = newHeaderHorizontalAlign; >- } >- >- public String getHeaderVerticalAlign() >- { >- return headerVerticalAlign; >- } >- >- public void setHeaderVerticalAlign(String newHeaderVerticalAlign) >- { >- headerVerticalAlign = newHeaderVerticalAlign; >- } >- >- public String getFooterHorizontalAlign() >- { >- return footerHorizontalAlign; >- } >- >- public void setFooterHorizontalAlign(String newFooterHorizontalAlign) >- { >- footerHorizontalAlign = newFooterHorizontalAlign; >- } >- >- public String getFooterVerticalAlign() >- { >- return footerVerticalAlign; >- } >- >- public void setFooterVerticalAlign(String newFooterVerticalAlign) >- { >- footerVerticalAlign = newFooterVerticalAlign; >- } >- >- public String getItemHorizontalAlign() >- { >- return itemHorizontalAlign; >- } >- >- public void setItemHorizontalAlign(String newItemHorizontalAlign) >- { >- itemHorizontalAlign = newItemHorizontalAlign; >- } >- >- public String getItemVerticalAlign() >- { >- return itemVerticalAlign; >- } >- >- public void setItemVerticalAlign(String newItemVerticalAlign) >- { >- itemVerticalAlign = newItemVerticalAlign; >- } >- >- public String [] getItemHyperLinkValues() >- { >- return itemHyperLinkValues; >- } >- >- public void setItemHyperLinkValues (String [] newItemHyperLinkValues) >- { >- itemHyperLinkValues = newItemHyperLinkValues; >- } >- >- public String getItemPattern() >- { >- return itemPattern; >- } >- >- public void setItemPattern(String newItemPattern) >- { >- itemPattern = newItemPattern; >- } >- >- public String getItemHyperLinkTarget() >- { >- return itemHyperLinkTarget; >- } >- >- public void setItemHyperLinkTarget(String newItemHyperLinkTarget) >- { >- itemHyperLinkTarget = newItemHyperLinkTarget; >- } >- >- public boolean isOrder() >- { >- return order; >- } >- >- public void setOrder(boolean newOrder) >- { >- order = newOrder; >- } >- >- public ArrayList getAggregates () >- { >- return aggregates; >- } >- >- public void setAggregates (ArrayList newAggregates) >- { >- aggregates = newAggregates; >- } >-} >+/* >+ * Copyright 2004 The Apache Software Foundation. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+package org.apache.taglibs.datagrid; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+/** >+ * Class that stores a column definition of a data grid. >+ * >+ * @see DataGridTag >+ */ >+ >+public class Column >+{ >+ private ArrayList aggregates = new ArrayList (); >+ private String itemStyleClass; >+ private String headerStyleClass; >+ private String width; >+ private String itemValue; >+ private String headerValue; >+ private String footerStyleClass; >+ private String footerValue; >+ private String itemHyperLinkValue; >+ private String headerHorizontalAlign; >+ private String headerVerticalAlign; >+ private String footerHorizontalAlign; >+ private String footerVerticalAlign; >+ private String itemHorizontalAlign; >+ private String itemVerticalAlign; >+ private String itemPattern; >+ private String totalPattern; >+ private String itemHyperLinkTarget; >+ private boolean order; >+ private String footerStyle; >+ private String headerStyle; >+ private String itemStyle; >+ >+ public Column() >+ { >+ } >+ >+ public String getItemStyleClass() >+ { >+ return itemStyleClass; >+ } >+ >+ public void setItemStyleClass(String newItemStyleClass) >+ { >+ itemStyleClass = newItemStyleClass; >+ } >+ >+ public String getHeaderStyleClass() >+ { >+ return headerStyleClass; >+ } >+ >+ public void setHeaderStyleClass(String newHeaderStyleClass) >+ { >+ headerStyleClass = newHeaderStyleClass; >+ } >+ >+ public String getWidth() >+ { >+ return width; >+ } >+ >+ public void setWidth(String newWidth) >+ { >+ width = newWidth; >+ } >+ >+ public String getItemValue() >+ { >+ return itemValue; >+ } >+ >+ public void setItemValue(String newItemValue) >+ { >+ itemValue = newItemValue; >+ } >+ >+ >+ public String getHeaderValue() >+ { >+ return headerValue; >+ } >+ >+ public void setHeaderValue(String newHeaderValue) >+ { >+ headerValue = newHeaderValue; >+ } >+ >+ public String getFooterStyleClass() >+ { >+ return footerStyleClass; >+ } >+ >+ public void setFooterStyleClass(String newFooterStyleClass) >+ { >+ footerStyleClass = newFooterStyleClass; >+ } >+ >+ public String getFooterValue() >+ { >+ return footerValue; >+ } >+ >+ public void setFooterValue(String newFooterValue) >+ { >+ footerValue = newFooterValue; >+ } >+ >+ public String getItemHyperLinkValue() >+ { >+ return itemHyperLinkValue; >+ } >+ >+ public void setItemHyperLinkValue(String newItemHyperLinkValue) >+ { >+ itemHyperLinkValue = newItemHyperLinkValue; >+ } >+ >+ public String getHeaderHorizontalAlign() >+ { >+ return headerHorizontalAlign; >+ } >+ >+ public void setHeaderHorizontalAlign(String newHeaderHorizontalAlign) >+ { >+ headerHorizontalAlign = newHeaderHorizontalAlign; >+ } >+ >+ public String getHeaderVerticalAlign() >+ { >+ return headerVerticalAlign; >+ } >+ >+ public void setHeaderVerticalAlign(String newHeaderVerticalAlign) >+ { >+ headerVerticalAlign = newHeaderVerticalAlign; >+ } >+ >+ public String getFooterHorizontalAlign() >+ { >+ return footerHorizontalAlign; >+ } >+ >+ public void setFooterHorizontalAlign(String newFooterHorizontalAlign) >+ { >+ footerHorizontalAlign = newFooterHorizontalAlign; >+ } >+ >+ public String getFooterVerticalAlign() >+ { >+ return footerVerticalAlign; >+ } >+ >+ public void setFooterVerticalAlign(String newFooterVerticalAlign) >+ { >+ footerVerticalAlign = newFooterVerticalAlign; >+ } >+ >+ public String getItemHorizontalAlign() >+ { >+ return itemHorizontalAlign; >+ } >+ >+ public void setItemHorizontalAlign(String newItemHorizontalAlign) >+ { >+ itemHorizontalAlign = newItemHorizontalAlign; >+ } >+ >+ public String getItemVerticalAlign() >+ { >+ return itemVerticalAlign; >+ } >+ >+ public void setItemVerticalAlign(String newItemVerticalAlign) >+ { >+ itemVerticalAlign = newItemVerticalAlign; >+ } >+ >+ >+ >+ public String getItemPattern() >+ { >+ return itemPattern; >+ } >+ >+ public void setItemPattern(String newItemPattern) >+ { >+ itemPattern = newItemPattern; >+ } >+ >+ public String getItemHyperLinkTarget() >+ { >+ return itemHyperLinkTarget; >+ } >+ >+ public void setItemHyperLinkTarget(String newItemHyperLinkTarget) >+ { >+ itemHyperLinkTarget = newItemHyperLinkTarget; >+ } >+ >+ public boolean isOrder() >+ { >+ return order; >+ } >+ >+ public void setOrder(boolean newOrder) >+ { >+ order = newOrder; >+ } >+ >+ public ArrayList getAggregates () >+ { >+ return aggregates; >+ } >+ >+ public void setAggregates (ArrayList newAggregates) >+ { >+ aggregates = newAggregates; >+ } >+ >+ public String getFooterStyle() >+ { >+ return footerStyle; >+ } >+ >+ public void setFooterStyle(String newFooterStyle) >+ { >+ footerStyle = newFooterStyle; >+ } >+ >+ public String getHeaderStyle() >+ { >+ return headerStyle; >+ } >+ >+ public void setHeaderStyle(String newHeaderStyle) >+ { >+ headerStyle = newHeaderStyle; >+ } >+ >+ public String getItemStyle() >+ { >+ return itemStyle; >+ } >+ >+ public void setItemStyle(String newItemStyle) >+ { >+ itemStyle = newItemStyle; >+ } >+} >Index: src/org/apache/taglibs/datagrid/DataGridTag.java >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/src/org/apache/taglibs/datagrid/DataGridTag.java,v >retrieving revision 1.3 >diff -u -r1.3 DataGridTag.java >--- src/org/apache/taglibs/datagrid/DataGridTag.java 9 Sep 2004 01:33:15 -0000 1.3 >+++ src/org/apache/taglibs/datagrid/DataGridTag.java 24 Sep 2004 05:37:27 -0000 >@@ -115,13 +115,17 @@ > private boolean scroll; > private Collection items; > private int sizeItems; >- private Object [][] values; >+ private Cell [][] cells; > private String itemVar; > private ArrayList columns; >+ private String headerStyle; > private String headerStyleClass; >+ private String footerStyle; > private String footerStyleClass; >+ private String rowsStyle; > private String rowsStyleClass; > private String rowsHiliteStyleClass; >+ private String alternateRowsStyle; > private String alternateRowsStyleClass; > private String alternateRowsHiliteStyleClass; > private String height; >@@ -130,6 +134,7 @@ > private boolean footerShow; > private String cellPadding; > private String cellSpacing; >+ private String style; > private String styleClass; > private String name; > private String parameterNameOrderIndex; >@@ -234,21 +239,25 @@ > > if (element.getNodeName ().equals ("header")) > { >+ if (element.hasAttribute ("style")) headerStyle = element.getAttribute ("style"); > if (element.hasAttribute ("styleClass")) headerStyleClass = element.getAttribute ("styleClass"); > if (element.hasAttribute ("show")) headerShow = element.getAttribute ("show").equals ("true"); > } > else if (element.getNodeName ().equals ("footer")) > { >+ if (element.hasAttribute ("style")) footerStyle = element.getAttribute ("style"); > if (element.hasAttribute ("styleClass")) footerStyleClass = element.getAttribute ("styleClass"); > if (element.hasAttribute ("show")) footerShow = element.getAttribute ("show").equals ("true"); > } > else if (element.getNodeName ().equals ("rows")) > { >+ if (element.hasAttribute ("style")) rowsStyle = element.getAttribute ("style"); > if (element.hasAttribute ("styleClass")) rowsStyleClass = element.getAttribute ("styleClass"); > if (element.hasAttribute ("hiliteStyleClass")) rowsHiliteStyleClass = element.getAttribute ("hiliteStyleClass"); > } > else if (element.getNodeName ().equals ("alternateRows")) > { >+ if (element.hasAttribute ("style")) alternateRowsStyle = element.getAttribute ("style"); > if (element.hasAttribute ("styleClass")) alternateRowsStyleClass = element.getAttribute ("styleClass"); > if (element.hasAttribute ("hiliteStyleClass")) alternateRowsHiliteStyleClass = element.getAttribute ("hiliteStyleClass"); > } >@@ -283,6 +292,7 @@ > > if (element.getNodeName ().equals ("header")) > { >+ if (element.hasAttribute ("style")) column.setHeaderStyleClass (element.getAttribute ("style")); > if (element.hasAttribute ("styleClass")) column.setHeaderStyleClass (element.getAttribute ("styleClass")); > if (element.hasAttribute ("value")) column.setHeaderValue (element.getAttribute ("value")); > if (element.hasAttribute ("hAlign")) column.setHeaderHorizontalAlign (element.getAttribute ("hAlign")); >@@ -290,20 +300,18 @@ > } > else if (element.getNodeName ().equals ("item")) > { >- if (element.hasAttribute ("styleClass")) column.setItemStyleClass (element.getAttribute ("styleClass")); >- if (element.hasAttribute ("value")) column.setItemValue (element.getAttribute ("value")); >- if (element.hasAttribute ("pattern")) column.setItemPattern (element.getAttribute ("pattern")); >- if (element.hasAttribute ("hAlign")) column.setItemHorizontalAlign (element.getAttribute ("hAlign")); >- if (element.hasAttribute ("vAlign")) column.setItemVerticalAlign (element.getAttribute ("vAlign")); >- if (element.hasAttribute ("hyperLink")) >- { >- column.setItemHyperLinkValue (element.getAttribute ("hyperLink")); >- column.setItemHyperLinkValues (new String [sizeItems]); >- } >+ if (element.hasAttribute ("style")) column.setItemStyleClass (element.getAttribute ("style")); >+ if (element.hasAttribute ("styleClass")) column.setItemStyleClass (element.getAttribute ("styleClass")); >+ if (element.hasAttribute ("value")) column.setItemValue (element.getAttribute ("value")); >+ if (element.hasAttribute ("pattern")) column.setItemPattern (element.getAttribute ("pattern")); >+ if (element.hasAttribute ("hAlign")) column.setItemHorizontalAlign (element.getAttribute ("hAlign")); >+ if (element.hasAttribute ("vAlign")) column.setItemVerticalAlign (element.getAttribute ("vAlign")); >+ if (element.hasAttribute ("hyperLink")) column.setItemHyperLinkValue (element.getAttribute ("hyperLink")); > if (element.hasAttribute ("hyperLinkTarget")) column.setItemHyperLinkTarget (element.getAttribute ("hyperLinkTarget")); > } > else if (element.getNodeName ().equals ("footer")) > { >+ if (element.hasAttribute ("style")) column.setFooterStyleClass (element.getAttribute ("style")); > if (element.hasAttribute ("styleClass")) column.setFooterStyleClass (element.getAttribute ("styleClass")); > if (element.hasAttribute ("value")) column.setFooterValue (element.getAttribute ("value")); > if (element.hasAttribute ("hAlign")) column.setFooterHorizontalAlign (element.getAttribute ("hAlign")); >@@ -333,37 +341,40 @@ > private void calculateValues () throws Exception > { > Iterator iterator; >- Object [] itemValues; >- Object value; >+ Cell [] rowCells; > Column column; >+ Cell cell; > Format format = null; >- int indexColumns, indexValues, indexAggregates, lengthAggregates, sizeColumns; >+ int indexColumn, indexRow, indexAggregate, sizeAggregates, sizeColumns; > > if (items != null) > { > sizeColumns = columns.size (); >- values = new Object [sizeItems][sizeColumns]; >- indexValues = 0; >+ cells = new Cell [sizeItems][sizeColumns]; >+ indexRow = 0; >+ > iterator = items.iterator (); > while (iterator.hasNext ()) > { > pageContext.setAttribute (itemVar, iterator.next ()); > >- itemValues = values [indexValues]; >- for (indexColumns = 0; indexColumns < sizeColumns; indexColumns++) >+ rowCells = cells [indexRow]; >+ for (indexColumn = 0; indexColumn < sizeColumns; indexColumn++) > { >- column = (Column)columns.get(indexColumns); >- value = ExpressionLanguageHelper.evalObject ("value", column.getItemValue (), this, pageContext); >- itemValues [indexColumns] = value; >- >- lengthAggregates = column.getAggregates ().size (); >- for (indexAggregates = 0; indexAggregates < lengthAggregates; indexAggregates++) >- ((Aggregate) column.getAggregates ().get (indexAggregates)).getFunction ().addValue (value); >+ column = (Column) columns.get (indexColumn); >+ cell = new Cell (); >+ cell.setValue (ExpressionLanguageHelper.evalObject ("value", column.getItemValue (), this, pageContext)); >+ if (column.getItemHyperLinkValue () != null) >+ cell.setHyperLink (ExpressionLanguageHelper.evalString ("hyperLink", column.getItemHyperLinkValue (), this, pageContext)); > >- if (column.getItemHyperLinkValue () != null) column.getItemHyperLinkValues () [indexValues] = org.apache.taglibs.datagrid.helper.ExpressionLanguageHelper.evalString ("hyperLink", column.getItemHyperLinkValue (), this, pageContext); >+ rowCells [indexColumn] = cell; >+ >+ sizeAggregates = column.getAggregates ().size (); >+ for (indexAggregate = 0; indexAggregate < sizeAggregates; indexAggregate++) >+ ((Aggregate) column.getAggregates ().get (indexAggregate)).getFunction ().addValue (cell.getValue ()); > } > >- indexValues++; >+ indexRow++; > } > > pageContext.removeAttribute (itemVar); >@@ -377,10 +388,10 @@ > { > ValueComparator comparator; > >- if ((values != null) && (orderIndex != 0)) >+ if ((cells != null) && (orderIndex != 0)) > { > comparator = new ValueComparator (orderIndex); >- Arrays.sort (values, comparator); >+ Arrays.sort (cells, comparator); > } > } > >@@ -447,6 +458,12 @@ > tableStart.append (styleClass); > tableStart.append ("\""); > } >+ if (style != null) >+ { >+ tableStart.append (" style=\""); >+ tableStart.append (style); >+ tableStart.append ("\""); >+ } > if (cellPadding != null) > { > tableStart.append (" cellpadding=\""); >@@ -477,66 +494,72 @@ > { > Iterator iterator; > Column column; >- Object [] itemValues; >- Object value; >- String link; >- int indexColumns, indexValues, sizeColumns, sizeValues; >+ Cell [] rowCells; >+ Cell cell; >+ String value, hyperLink; >+ int indexColumn, indexRow, sizeColumns, sizeRows; > boolean alternate = false; > >- if (values != null) >+ if (cells != null) > { > if ((pageSize > 0) && (!customPaging)) > { >- indexValues = pageIndex; >- sizeValues = pageIndex + pageSize; >- if (sizeValues > values.length) sizeValues = values.length; >+ indexRow = pageIndex; >+ sizeRows = pageIndex + pageSize; >+ if (sizeRows > cells.length) sizeRows = cells.length; > } > else > { >- indexValues = 0; >- sizeValues = values.length; >+ indexRow = 0; >+ sizeRows = cells.length; > } > > sizeColumns = columns.size (); >- for (; indexValues < sizeValues; indexValues++) >+ for (; indexRow < sizeRows; indexRow++) > { >- itemValues = values [indexValues]; >+ rowCells = cells [indexRow]; > > out.print ("<tr"); >- if ((alternate = !alternate) || (alternateRowsStyleClass == null)) >+ if ((alternate = !alternate) || ((alternateRowsStyleClass == null) && (alternateRowsStyle == null))) > { >+ if (rowsStyle != null) out.print (" style=\"" + rowsStyle + "\""); > if (rowsStyleClass != null) out.print (" class=\"" + rowsStyleClass + "\""); > if (rowsHiliteStyleClass != null) out.print (" onMouseOver=\"this.className='" + rowsHiliteStyleClass + "'\" onMouseOut=\"this.className='" + rowsStyleClass + "'\""); > } > else > { >- out.print (" class=\"" + alternateRowsStyleClass + "\""); >+ if (alternateRowsStyleClass != null) out.print (" class=\"" + alternateRowsStyleClass + "\""); >+ if (alternateRowsStyle != null) out.print (" style=\"" + alternateRowsStyle + "\""); >+ > if (alternateRowsHiliteStyleClass != null) out.print (" onMouseOver=\"this.className='" + alternateRowsHiliteStyleClass + "'\" onMouseOut=\"this.className='" + alternateRowsStyleClass + "'\""); > else if (rowsHiliteStyleClass != null) out.print (" onMouseOver=\"this.className='" + rowsHiliteStyleClass + "'\" onMouseOut=\"this.className='" + alternateRowsStyleClass + "'\""); > } > out.println (">"); > >- for (indexColumns = 0; indexColumns < sizeColumns; indexColumns++) >+ for (indexColumn = 0; indexColumn < sizeColumns; indexColumn++) > { >- column = (Column)columns.get(indexColumns); >+ column = (Column) columns.get (indexColumn); > > out.print ("<td"); > if (column.getWidth () != null) out.print (" width=\"" + column.getWidth () + "\""); > if (column.getItemHorizontalAlign () != null) out.print (" align=\"" + column.getItemHorizontalAlign () + "\""); > if (column.getItemVerticalAlign () != null) out.print (" valign=\"" + column.getItemVerticalAlign () + "\""); > if (column.getItemStyleClass () != null) out.print (" class=\"" + column.getItemStyleClass () + "\""); >+ if (column.getItemStyle () != null) out.print (" style=\"" + column.getItemStyle () + "\""); > out.println (">"); > >- value = itemValues [indexColumns]; >- if ((value != null) && (column.getItemPattern () != null)) >- value = formatValue (value, column.getItemPattern ()); >- >- if (value != null) >+ cell = rowCells [indexColumn]; >+ if (cell.getValue () != null) > { >- if (column.getItemHyperLinkValues () != null) >+ if (column.getItemPattern () != null) >+ value = formatValue (cell.getValue (), column.getItemPattern ()); >+ else >+ value = cell.getValue ().toString (); >+ >+ if (cell.getHyperLink () != null) > { > out.print ("<a href=\""); >- out.print (((HttpServletResponse) pageContext.getResponse ()).encodeURL (column.getItemHyperLinkValues () [indexValues])); >+ out.print (((HttpServletResponse) pageContext.getResponse ()).encodeURL (cell.getHyperLink ())); > out.print ("\""); > if (column.getItemHyperLinkTarget () != null) > { >@@ -571,6 +594,7 @@ > > out.print ("<tr"); > if (headerStyleClass != null) out.print (" class=\"" + headerStyleClass + "\""); >+ if (headerStyle != null) out.print (" style=\"" + headerStyle + "\""); > out.println (">"); > > length = columns.size (); >@@ -583,6 +607,7 @@ > if (column.getHeaderHorizontalAlign () != null) out.print (" align=\"" + column.getHeaderHorizontalAlign () + "\""); > if (column.getHeaderVerticalAlign () != null) out.print (" valign=\"" + column.getHeaderVerticalAlign () + "\""); > if (column.getHeaderStyleClass () != null) out.print (" class=\"" + column.getHeaderStyleClass () + "\""); >+ if (column.getHeaderStyle () != null) out.print (" style=\"" + column.getHeaderStyle () + "\""); > out.println (">"); > > value = ExpressionLanguageHelper.evalObject ("value", column.getHeaderValue (), this, pageContext); >@@ -624,6 +649,7 @@ > > out.print ("<tr"); > if (footerStyleClass != null) out.print (" class=\"" + footerStyleClass + "\""); >+ if (footerStyle != null) out.print (" style=\"" + footerStyle + "\""); > out.println (">"); > > columnIterator = columns.iterator (); >@@ -647,6 +673,7 @@ > if (column.getFooterHorizontalAlign () != null) out.print (" align=\"" + column.getFooterHorizontalAlign () + "\""); > if (column.getFooterVerticalAlign () != null) out.print (" valign=\"" + column.getFooterVerticalAlign () + "\""); > if (column.getFooterStyleClass () != null) out.print (" class=\"" + column.getFooterStyleClass () + "\""); >+ if (column.getFooterStyle () != null) out.print (" style=\"" + column.getFooterStyle () + "\""); > out.println (">"); > > value = ExpressionLanguageHelper.evalObject ("value", column.getFooterValue (), this, pageContext); >@@ -771,6 +798,16 @@ > cellSpacing = value; > } > >+ /** >+ * Set the attribute <b>style</b> that defines the CSS style to be used in the datagrid. >+ * >+ * @param String style defines the CSS style to be used in the datagrid. >+ */ >+ public void setStyle (String value) >+ { >+ style = value; >+ } >+ > /** > * Set the attribute <b>styleClass</b> that defines the CSS class to be used in the datagrid. > * >Index: src/org/apache/taglibs/datagrid/ValueComparator.java >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/src/org/apache/taglibs/datagrid/ValueComparator.java,v >retrieving revision 1.2 >diff -u -r1.2 ValueComparator.java >--- src/org/apache/taglibs/datagrid/ValueComparator.java 28 Jul 2004 00:54:25 -0000 1.2 >+++ src/org/apache/taglibs/datagrid/ValueComparator.java 24 Sep 2004 05:37:27 -0000 >@@ -1,62 +1,63 @@ >-/* >- * Copyright 2004 The Apache Software Foundation. >- * >- * Licensed under the Apache License, Version 2.0 (the "License"); >- * you may not use this file except in compliance with the License. >- * You may obtain a copy of the License at >- * >- * http://www.apache.org/licenses/LICENSE-2.0 >- * >- * Unless required by applicable law or agreed to in writing, software >- * distributed under the License is distributed on an "AS IS" BASIS, >- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >- * See the License for the specific language governing permissions and >- * limitations under the License. >- */ >-package org.apache.taglibs.datagrid; >- >-import java.util.Comparator; >- >-/** >- * Comparator Class to order the values of a data grid. >- * >- * @see DataGridTag >- */ >- >-public class ValueComparator implements Comparator >-{ >- private int index; >- private boolean inverse; >- >- public ValueComparator (int index) >- { >- if (index >= 0) >- this.index = index - 1; >- else >- { >- this.inverse = true; >- this.index = -index - 1; >- } >- } >- >- public int compare (Object values1, Object values2) >- { >- Object obj1, obj2; >- int result; >- >- obj1 = ((Object []) values1) [index]; >- obj2 = ((Object []) values2) [index]; >- >- if (obj1 == null) >- result = -1; >- else if (obj2 == null) >- result = 1; >- else if ((obj1 instanceof Comparable) && (obj2 instanceof Comparable)) >- result = ((Comparable) obj1).compareTo (obj2); >- else >- result = obj1.toString ().compareTo (obj2.toString ()); >- >- if (inverse) result = -result; >- return (result); >- } >-} >+/* >+ * Copyright 2004 The Apache Software Foundation. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+package org.apache.taglibs.datagrid; >+ >+import java.util.Comparator; >+ >+/** >+ * Comparator Class to order the values of a data grid. >+ * >+ * @see DataGridTag >+ */ >+ >+public class ValueComparator implements Comparator >+{ >+ private int index; >+ private boolean inverse; >+ >+ public ValueComparator (int index) >+ { >+ if (index >= 0) >+ this.index = index - 1; >+ else >+ { >+ this.inverse = true; >+ this.index = -index - 1; >+ } >+ } >+ >+ public int compare (Object values1, Object values2) >+ { >+ Cell cell1, cell2; >+ int result; >+ >+ cell1 = ((Cell []) values1) [index]; >+ cell2 = ((Cell []) values2) [index]; >+ >+ if (cell1 == null) >+ result = -1; >+ else if (cell2 == null) >+ result = 1; >+ else if ((cell1.getValue () instanceof Comparable) && (cell2.getValue () instanceof Comparable)) >+ result = ((Comparable) cell1.getValue ()).compareTo (cell2.getValue ()); >+ else >+ result = cell1.getValue ().toString ().compareTo (cell2.getValue ().toString ()); >+ >+ if (inverse) result = -result; >+ >+ return (result); >+ } >+} >\ No newline at end of file >Index: xml/datagrid.xml >=================================================================== >RCS file: /home/cvspublic/jakarta-taglibs-sandbox/datagrid/xml/datagrid.xml,v >retrieving revision 1.3 >diff -u -r1.3 datagrid.xml >--- xml/datagrid.xml 9 Sep 2004 01:33:15 -0000 1.3 >+++ xml/datagrid.xml 24 Sep 2004 05:37:28 -0000 >@@ -130,6 +130,12 @@ > <description>Attribute to set a vertical scroll bar. If the value is true a vertical scroll bar will be rendered with the datagrid.</description> > </attribute> > <attribute> >+ <name>style</name> >+ <required>false</required> >+ <rtexprvalue>true</rtexprvalue> >+ <description>Attribute to set the CSS style for the datagrid.</description> >+ </attribute> >+ <attribute> > <name>styleClass</name> > <required>false</required> > <rtexprvalue>true</rtexprvalue> >@@ -249,15 +255,33 @@ > <!-- The following is used to generate the tag library revision history > changes.html file. There can be 0 .. N revisions. Each revision > can have 0 .. N sections, each section can have 0 .. N items. --> >+<revision release="Development" date="09/22/2004"> >+ <description> >+ Bug fix. >+ </description> >+ <section name="Bugs Fixed"> >+ <item> >+ Fixed problem with hyperlinks not beign ordered in a column. >+ </item> >+ </section> >+</revision> >+ > <revision release="Development" date="09/02/2004"> > <description> >- The Data Grid tag library is in development, changes are fast and furious. >+ Bug fix. > </description> > <section name="Bugs Fixed"> > <item> > Fixed a bug when using Arrays in the item attribute instead of Collections. > </item> > </section> >+</revision> >+ >+<revision release="Development" date="06/06/2004"> >+ <description> >+ The Data Grid tag library is in development, >+ changes are fast and furious. >+ </description> > </revision> > > </document>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 31353
:
12850
| 12853 |
12854