1 2 3 package com.sri.emo.wizard.creation.model; 4 5 import java.io.*; 6 import java.util.*; 7 8 import com.jcorporate.expresso.core.db.*; 9 10 /*** 11 * <p>Title: </p> 12 * 13 * <p>Description: </p> 14 * 15 * <p>Copyright: Copyright (c) 2003</p> 16 * 17 * <p>Company: </p> 18 * 19 * @author not attributable 20 * @version 1.0 21 */ 22 public class SearchResultBean implements Serializable { 23 24 Serializable pageId; 25 List nodes; 26 boolean searched; 27 28 public SearchResultBean() { 29 nodes = new Vector(10); 30 } 31 32 public List getNodes() { 33 return nodes; 34 } 35 36 public int getNumNodes(){ 37 return nodes.size(); 38 } 39 40 public void clearSelectedSearchResults(){ 41 Iterator iter = nodes.iterator(); 42 while (iter.hasNext()) { 43 SearchNode item = (SearchNode) iter.next(); 44 item.setSelected(false); 45 } 46 } 47 48 public List getSelectedNodes(){ 49 List list = new Vector(20); 50 Iterator iter = nodes.iterator(); 51 while (iter.hasNext()) { 52 SearchNode item = (SearchNode) iter.next(); 53 if(item.isSelected()){ 54 list.add(item); 55 } 56 } 57 return list; 58 } 59 60 public Serializable getPageId() { 61 return pageId; 62 } 63 64 public boolean isSearched() { 65 return searched; 66 } 67 68 public void setNodes(List nodes) { 69 this.nodes = nodes; 70 } 71 72 public void setPageId(Serializable pageId) { 73 this.pageId = pageId; 74 } 75 76 public void setSearched(boolean searched) { 77 this.searched = searched; 78 } 79 80 public String toString(){ 81 return pageId.toString(); 82 } 83 84 /*** 85 * setSelectedNode 86 * 87 * @param nodeId int 88 */ 89 public void setSelectedNode(int id) throws DBException { 90 Iterator iter = nodes.iterator(); 91 String nodeId = Integer.toString(id); 92 while (iter.hasNext()) { 93 SearchNode item = (SearchNode) iter.next(); 94 if(item.getNode().getNodeId().equals(nodeId)){ 95 item.setSelected(true); 96 break; 97 } 98 } 99 } 100 101 public boolean isSelected(){ 102 Iterator iter = nodes.iterator(); 103 while (iter.hasNext()) { 104 SearchNode item = (SearchNode) iter.next(); 105 if(item.isSelected()){ 106 return true; 107 } 108 } 109 return false; 110 } 111 }