You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2002/01/13 12:21:28 UTC
cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/data BasicView.java
hammant 02/01/13 03:21:28
Modified: apps/db/src/java/org/apache/avalon/db/basic/data
BasicView.java
Log:
named inner class killed by Larry
Revision Changes Path
1.11 +94 -91 jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/data/BasicView.java
Index: BasicView.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/data/BasicView.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BasicView.java 14 Dec 2001 21:31:52 -0000 1.10
+++ BasicView.java 13 Jan 2002 11:21:28 -0000 1.11
@@ -25,7 +25,7 @@
*
*
* @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public class BasicView extends AbstractView {
@@ -38,96 +38,7 @@
mBasicCriteria = basicCriteria;
mQueryable = queryable;
- mRowListener = new RowListener() {
- public void rowAdded(Queryable queryable, Row row) {
- try {
- if(mBasicCriteria.testDataRow((BasicRow) row)) {
- addRow(row);
- }
- } catch (DataException de) {
- getLogger().debug("(BasicView) Some exception during rowAdded",de);
- }
- }
- public void rowDeleted(Queryable queryable, Row row) {
- if(rowExists(row)) {
- deleteRow(row);
- }
- }
-
- public void rowChanged(Queryable queryable, Row row) {
- try {
- boolean exists = rowExists(row);
- if(mBasicCriteria.testDataRow((BasicRow) row)) {
- if (exists) {
- // do nothing
- } else {
- deleteRow(row);
- }
- } else {
- if (exists) {
- addRow(row);
- } else {
- // do nothing
- }
- }
- } catch (DataException de) {
- getLogger().debug("(BasicView) Some exception during rowChanged",de);
- }
- }
-
- public void rowsAdded(Queryable queryable, Collection rows) {
- BasicCriteriaMatchingRowCallback cb = new BasicCriteriaMatchingRowCallback() {
- public void rowMatches(BasicRow row, boolean matches) {
- if (matches) {
- addRow(row);
- } else {
- deleteRow(row);
- }
- }
- };
- try {
- mBasicCriteria.testDataRows(rows.iterator(), cb);
- } catch (DataException de) {
- getLogger().debug("(BasicView) Some exception during rowsAdded",de);
- }
- }
-
- public void rowsDeleted(Queryable queryable, Collection rows) {
- Iterator it = rows.iterator();
- while (it.hasNext()) {
- Row row = (Row) it.next();
- if(rowExists(row)) {
- deleteRow(row);
- }
- }
- }
-
- public void rowsChanged(Queryable queryable, Collection rows) {
- BasicCriteriaMatchingRowCallback cb = new BasicCriteriaMatchingRowCallback() {
- public void rowMatches(BasicRow row, boolean matches) {
- boolean exists = rowExists(row);
- if (matches) {
- if (exists) {
- // do nothing
- } else {
- addRow(row);
- }
- } else {
- if (exists) {
- deleteRow(row);
- } else {
- // do nothing
- }
- }
- }
- };
- try {
- mBasicCriteria.testDataRows(rows.iterator(), cb);
- } catch (DataException de) {
- getLogger().debug("(BasicView) Some exception during rowsChanged",de);
- }
- }
- };
+ mRowListener = new BasicViewRowListener();
queryable.addRowListener(mRowListener);
Iterator it = queryable.getRows().iterator();
while (it.hasNext()) {
@@ -141,5 +52,97 @@
public Queryable getSourceQueryable() {
return mQueryable;
}
+
+ private class BasicViewRowListener implements RowListener
+ {
+ public void rowAdded(Queryable queryable, Row row) {
+ try {
+ if(mBasicCriteria.testDataRow((BasicRow) row)) {
+ addRow(row);
+ }
+ } catch (DataException de) {
+ getLogger().debug("(BasicView) Some exception during rowAdded",de);
+ }
+ }
+ public void rowDeleted(Queryable queryable, Row row) {
+ if(rowExists(row)) {
+ deleteRow(row);
+ }
+ }
+
+ public void rowChanged(Queryable queryable, Row row) {
+ try {
+ boolean exists = rowExists(row);
+ if(mBasicCriteria.testDataRow((BasicRow) row)) {
+ if (exists) {
+ // do nothing
+ } else {
+ deleteRow(row);
+ }
+ } else {
+ if (exists) {
+ addRow(row);
+ } else {
+ // do nothing
+ }
+ }
+ } catch (DataException de) {
+ getLogger().debug("(BasicView) Some exception during rowChanged",de);
+ }
+ }
+
+ public void rowsAdded(Queryable queryable, Collection rows) {
+ BasicCriteriaMatchingRowCallback cb = new BasicCriteriaMatchingRowCallback() {
+ public void rowMatches(BasicRow row, boolean matches) {
+ if (matches) {
+ addRow(row);
+ } else {
+ deleteRow(row);
+ }
+ }
+ };
+ try {
+ mBasicCriteria.testDataRows(rows.iterator(), cb);
+ } catch (DataException de) {
+ getLogger().debug("(BasicView) Some exception during rowsAdded",de);
+ }
+ }
+
+ public void rowsDeleted(Queryable queryable, Collection rows) {
+ Iterator it = rows.iterator();
+ while (it.hasNext()) {
+ Row row = (Row) it.next();
+ if(rowExists(row)) {
+ deleteRow(row);
+ }
+ }
+ }
+
+ public void rowsChanged(Queryable queryable, Collection rows) {
+ BasicCriteriaMatchingRowCallback cb = new BasicCriteriaMatchingRowCallback() {
+ public void rowMatches(BasicRow row, boolean matches) {
+ boolean exists = rowExists(row);
+ if (matches) {
+ if (exists) {
+ // do nothing
+ } else {
+ addRow(row);
+ }
+ } else {
+ if (exists) {
+ deleteRow(row);
+ } else {
+ // do nothing
+ }
+ }
+ }
+ };
+ try {
+ mBasicCriteria.testDataRows(rows.iterator(), cb);
+ } catch (DataException de) {
+ getLogger().debug("(BasicView) Some exception during rowsChanged",de);
+ }
+ }
+ }
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>