Coverage report

  %line %branch
net.sf.infrared.web.treecontrolmodel.IRTreeStateModel
0% 
0% 

 1  
 /*
 2  
  *
 3  
  * Copyright 2005 Tavant Technologies and Contributors
 4  
  * 
 5  
  * Licensed under the Apache License, Version 2.0 (the "License")
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  *
 17  
  *
 18  
  *
 19  
  * Original Author:  kamal.govindraj (Tavant Technologies)
 20  
  * Contributor(s):   prashant.nair;
 21  
  *
 22  
  */
 23  
 package net.sf.infrared.web.treecontrolmodel;
 24  
 
 25  
 import net.sf.jsptree.tree.TreeStateModel;
 26  
 
 27  
 import java.util.HashSet;
 28  
 
 29  
 /**
 30  
  * The class which stores the current state of the tree. <br/>
 31  
  * It keeps track that which nodes in the tree are exploded/collapsed.
 32  
  */
 33  
 public class IRTreeStateModel implements TreeStateModel
 34  
 {
 35  
     private HashSet selected;
 36  
     private HashSet opened;
 37  
     private boolean expand;
 38  
 
 39  
     public IRTreeStateModel()
 40  0
     {
 41  0
         selected = new HashSet();
 42  0
         opened = new HashSet();
 43  0
     }
 44  
 
 45  
     public void addOpened(int hashCode)
 46  
     {
 47  0
         opened.add(new Integer(hashCode));
 48  0
     }
 49  
 
 50  
     public void addSelected(int hashCode)
 51  
     {
 52  0
         selected.add(new Integer(hashCode));
 53  0
     }
 54  
 
 55  
     public boolean isSelected(int code)
 56  
     {
 57  0
         return selected.contains(new Integer(code));
 58  
     }
 59  
 
 60  
     public boolean isOpened(int code)
 61  
     {
 62  0
         return expand || opened.contains(new Integer(code));
 63  
     }
 64  
 
 65  
     public void removeSelected(int code)
 66  
     {
 67  0
         selected.remove(new Integer(code));
 68  0
     }
 69  
 
 70  
     public void removeOpened(int code)
 71  
     {
 72  0
         opened.remove(new Integer(code));
 73  0
     }
 74  
 
 75  
     public void removeAllSelected()
 76  
     {
 77  0
         selected.clear();
 78  0
     }
 79  
 
 80  
     public void removeAllOpened()
 81  
     {
 82  0
         opened.clear();
 83  0
     }
 84  
 
 85  
     public void expand(String expandAll)
 86  
     {
 87  0
         if("full".equals(expandAll))
 88  0
             expand = true;
 89  
         else
 90  0
             expand = false;
 91  0
     }
 92  
 
 93  
     public Object clone() throws CloneNotSupportedException
 94  
     {
 95  0
         IRTreeStateModel stateModel = (IRTreeStateModel) super.clone();
 96  0
         stateModel.selected = (HashSet) this.selected.clone();
 97  0
         stateModel.opened = (HashSet) this.opened.clone();
 98  0
         return stateModel;
 99  
     }
 100  
 
 101  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.