Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.multiplicity.UpdatableMultiplicityComposite
 
Classes in this File Line Coverage Branch Coverage Complexity
UpdatableMultiplicityComposite
0%
0/22
0%
0/4
1.333
UpdatableMultiplicityComposite$1
0%
0/3
N/A
1.333
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.common.ui.client.configurable.mvc.multiplicity;
 17  
 
 18  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 19  
 import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
 20  
 
 21  
 import com.google.gwt.event.dom.client.ClickEvent;
 22  
 import com.google.gwt.event.dom.client.ClickHandler;
 23  
 import com.google.gwt.user.client.ui.Widget;
 24  
 
 25  
 /**
 26  
  * This extends multiplicity composite to allow adding and removing of items. 
 27  
  * 
 28  
  * @author Kuali Student Team
 29  
  *
 30  
  */
 31  
 
 32  
 /**
 33  
  * @deprecated
 34  
  */
 35  
 public abstract class UpdatableMultiplicityComposite extends MultiplicityComposite {
 36  
     protected String addItemLabel;
 37  
     protected String itemLabel;
 38  0
     protected boolean readOnly = false;
 39  
     
 40  
     public UpdatableMultiplicityComposite(StyleType style){
 41  0
             super(style);
 42  0
     }
 43  
     
 44  
     public UpdatableMultiplicityComposite(StyleType style, boolean readOnly){
 45  0
             super(style);
 46  0
             this.readOnly=readOnly;
 47  0
     }
 48  
     
 49  
     /**
 50  
      * @see org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityComposite#getItemDecorator()
 51  
      */
 52  
     @Override
 53  
     public MultiplicityItem getItemDecorator(StyleType style) {
 54  0
         org.kuali.student.common.ui.client.configurable.mvc.sections.RemovableItemWithHeader item = new org.kuali.student.common.ui.client.configurable.mvc.sections.RemovableItemWithHeader(style, readOnly);
 55  0
         item.setItemLabel(itemLabel + " " + itemCount);            
 56  0
         return item;
 57  
     }
 58  
 
 59  
     /**
 60  
      * @see org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityComposite#generateAddWidget()
 61  
      */
 62  
     public Widget generateAddWidget() {
 63  
             //If this is read only don't display add widgets
 64  0
             if(readOnly){
 65  0
                     return null;
 66  
             }
 67  
             
 68  
             KSButton addWidget;
 69  0
             if(style == StyleType.TOP_LEVEL){
 70  0
                     addWidget = new KSButton(addItemLabel, ButtonStyle.FORM_LARGE);
 71  
             }
 72  
             else{
 73  0
                     addWidget = new KSButton(addItemLabel, ButtonStyle.FORM_SMALL);
 74  
             }
 75  0
         addWidget.addClickHandler(new ClickHandler(){
 76  
             public void onClick(ClickEvent event) {
 77  0
                 addItem();
 78  0
             }            
 79  
         });
 80  0
         return addWidget;
 81  
     }
 82  
 
 83  
 
 84  
     public String getAddItemLabel() {
 85  0
         return addItemLabel;
 86  
     }
 87  
 
 88  
 
 89  
     public void setAddItemLabel(String addItemLabel) {
 90  0
         this.addItemLabel = addItemLabel;
 91  0
     }
 92  
 
 93  
     public String getItemLabel() {
 94  0
         return itemLabel;
 95  
     }
 96  
 
 97  
     public void setItemLabel(String itemLabel) {
 98  0
         this.itemLabel = itemLabel;
 99  0
     }
 100  
     
 101  
 
 102  
 }