Coverage Report - org.openpermis.editor.policy.gui.binding.ObservableListAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
ObservableListAdapter
100%
9/9
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport
 3  
  *                     (http://www.vbs.admin.ch)
 4  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 5  
  * All rights reserved.
 6  
  *
 7  
  * Licensed under the Open Permis License which accompanies this distribution,
 8  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 9  
  */
 10  
 package org.openpermis.editor.policy.gui.binding;
 11  
 
 12  
 import java.util.List;
 13  
 
 14  
 import org.jdesktop.observablecollections.ObservableList;
 15  
 import org.jdesktop.observablecollections.ObservableListListener;
 16  
 
 17  
 
 18  
 /**
 19  
  * A listener on observable lists with default implementations.
 20  
  * @param <E> the element type of the observed list.
 21  
  * @since 0.3.0
 22  
  */
 23  20
 public abstract class ObservableListAdapter<E>
 24  
         implements ObservableListListener
 25  
 {
 26  
 
 27  
         //---- Methods
 28  
         
 29  
         /**
 30  
          * Universal update method for all listener methods.
 31  
          * @param list the list that was changed.
 32  
          * @since 0.3.0
 33  
          */
 34  
         protected abstract void listChanged (ObservableList<E> list);
 35  
 
 36  
         //---- ObservableListListener
 37  
         
 38  
         /**
 39  
          * @since 0.3.0
 40  
          */
 41  
         @SuppressWarnings("unchecked")
 42  
         public void listElementPropertyChanged (ObservableList list, int index) {
 43  1
                 listChanged(list);
 44  1
         }
 45  
 
 46  
         /**
 47  
          * @since 0.3.0
 48  
          */
 49  
         @SuppressWarnings("unchecked")
 50  
         public void listElementReplaced (ObservableList list, int index, Object oldElement) {
 51  1
                 listChanged(list);
 52  1
         }
 53  
 
 54  
         /**
 55  
          * @since 0.3.0
 56  
          */
 57  
         @SuppressWarnings("unchecked")
 58  
         public void listElementsAdded (ObservableList list, int index, int length) {
 59  9
                 listChanged(list);
 60  9
         }
 61  
 
 62  
         /**
 63  
          * @since 0.3.0
 64  
          */
 65  
         @SuppressWarnings("unchecked")
 66  
         public void listElementsRemoved (ObservableList list, int index, List oldElements) {
 67  13
                 listChanged(list);
 68  13
         }
 69  
 
 70  
 }