Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptorReadOnly
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldDescriptorReadOnly
0%
0/17
0%
0/6
1.8
 
 1  
 package org.kuali.student.common.ui.client.configurable.mvc;
 2  
 
 3  
 import org.kuali.student.common.ui.client.widgets.KSLabel;
 4  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
 5  
 import org.kuali.student.core.assembly.data.Metadata;
 6  
 
 7  
 import com.google.gwt.user.client.ui.Widget;
 8  
 
 9  
 public class FieldDescriptorReadOnly extends FieldDescriptor{
 10  
 
 11  
         public FieldDescriptorReadOnly(String fieldKey, MessageKeyInfo messageKey,
 12  
                         Metadata metadata) {
 13  0
                 super(fieldKey, messageKey, metadata);
 14  0
         }
 15  
         
 16  
         public FieldDescriptorReadOnly(String fieldKey, MessageKeyInfo messageKey,
 17  
                         Metadata metadata, Widget widget) {
 18  0
                 super(fieldKey, messageKey, metadata, widget);
 19  0
         }
 20  
 
 21  
         
 22  
         @Override
 23  
         protected Widget createFieldWidget() {
 24  0
             if (metadata == null) {
 25  0
                     Widget result = new KSLabel();
 26  0
                     addStyleToWidget(result);
 27  0
                     return result;
 28  
             } else {
 29  0
                     Widget result = DefaultWidgetFactory.getInstance().getReadOnlyWidget(metadata);
 30  0
                     addStyleToWidget(result);
 31  0
                     return result;
 32  
             }
 33  
         }
 34  
         
 35  
         @Override
 36  
         protected void addStyleToWidget(Widget w) {
 37  0
             if(fieldKey != null && !fieldKey.isEmpty()){
 38  0
                     String style = this.fieldKey.replaceAll("/", "-");
 39  0
                     style = style + "readOnly";
 40  0
                     w.addStyleName(style);
 41  
             }
 42  0
         }
 43  
 
 44  
         @Override
 45  
     protected void setupField() {
 46  
             // do nothing for read-only fields
 47  0
     }
 48  
 }