Author: nbelaevski
Date: 2007-06-26 12:25:12 -0400 (Tue, 26 Jun 2007)
New Revision: 1328
Removed:
trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/CachingTreeDataLocator.java
Log:
CachingTreeDataLocator.java removed
Deleted:
trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/CachingTreeDataLocator.java
===================================================================
---
trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/CachingTreeDataLocator.java 2007-06-26
16:14:55 UTC (rev 1327)
+++
trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/CachingTreeDataLocator.java 2007-06-26
16:25:12 UTC (rev 1328)
@@ -1,83 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.richfaces.component.TreeRowKey;
-import org.richfaces.component.preserve.TreeDataLocator;
-
-/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com
- * created 30.12.2006
- *
- */
-public class CachingTreeDataLocator implements TreeDataLocator {
-
- private static class CacheEntry {
- private int pid;
- private TreeRowKey key;
- private Object data;
- }
-
- private List cache = new ArrayList();
- private int number = 0;
-
- /* (non-Javadoc)
- * @see com.exadel.jsf.model.preserve.TreeDataLocator#createData(java.lang.Object,
com.exadel.jsf.model.TreeRowKey, com.exadel.jsf.model.TreeNode)
- */
- public Object createData(Object locator, TreeRowKey rowKey) {
- for (Iterator iterator = cache.iterator(); iterator.hasNext();) {
- CacheEntry entry = (CacheEntry) iterator.next();
- if (entry.pid == ((Integer) locator).intValue()) {
- return entry.data;
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see com.exadel.jsf.model.preserve.TreeDataLocator#createLocator(java.lang.Object,
com.exadel.jsf.model.TreeRowKey, com.exadel.jsf.model.TreeNode)
- */
- public Object createLocator(Object data, TreeRowKey rowKey) {
- for (Iterator iterator = cache.iterator(); iterator.hasNext();) {
- CacheEntry entry = (CacheEntry) iterator.next();
-
- if (entry.key.equals(rowKey)) {
- return Integer.valueOf(entry.pid);
- }
- }
-
- CacheEntry cacheEntry = new CacheEntry();
- cacheEntry.data = data;
- cacheEntry.key = rowKey;
- cacheEntry.pid = number++;
-
- cache.add(cacheEntry);
-
- return Integer.valueOf(cacheEntry.pid);
- }
-
-}
Show replies by date