Coverage Report - org.kuali.rice.core.api.uif.WidgetCopy
 
Classes in this File Line Coverage Branch Coverage Complexity
WidgetCopy
0%
0/17
0%
0/14
8
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.core.api.uif;
 17  
 
 18  
 /** utility class for copying widgets. */
 19  
 final class WidgetCopy {
 20  
 
 21  0
     private WidgetCopy() {
 22  0
         throw new IllegalArgumentException("do not call.");
 23  
     }
 24  
 
 25  
     public static RemotableAbstractWidget.Builder toBuilder(Widget w) {
 26  0
         if (w == null) {
 27  0
             throw new IllegalArgumentException("w is null");
 28  
         }
 29  
 
 30  0
         if (w instanceof RemotableDatepicker || w instanceof RemotableDatepicker.Builder) return RemotableDatepicker.Builder.create();
 31  0
         if (w instanceof RemotableTextExpand || w instanceof RemotableTextExpand.Builder) return RemotableTextExpand.Builder.create();
 32  
 
 33  0
         if (w instanceof RemotableQuickFinder) {
 34  0
             RemotableQuickFinder.Builder b = RemotableQuickFinder.Builder.create(((RemotableQuickFinder) w).getBaseLookupUrl(),  ((RemotableQuickFinder) w).getDataObjectClass());
 35  0
             b.setFieldConversions(((RemotableQuickFinder) w).getFieldConversions());
 36  0
             b.setLookupParameters(((RemotableQuickFinder) w).getLookupParameters());
 37  0
             return b;
 38  0
         } else if (w instanceof RemotableQuickFinder.Builder) {
 39  0
             RemotableQuickFinder.Builder b = RemotableQuickFinder.Builder.create(((RemotableQuickFinder.Builder) w).getBaseLookupUrl(),  ((RemotableQuickFinder.Builder) w).getDataObjectClass());
 40  0
             b.setFieldConversions(((RemotableQuickFinder.Builder) w).getFieldConversions());
 41  0
             b.setLookupParameters(((RemotableQuickFinder.Builder) w).getLookupParameters());
 42  0
             return b;
 43  
         }
 44  0
         throw new UnsupportedOperationException(w.getClass().getName() + " not supported");
 45  
     }
 46  
 }