| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| WidgetCopy |
|
| 8.0;8 |
| 1 | package org.kuali.rice.core.api.uif; | |
| 2 | ||
| 3 | /** utility class for copying widgets. */ | |
| 4 | final class WidgetCopy { | |
| 5 | ||
| 6 | 0 | private WidgetCopy() { |
| 7 | 0 | throw new IllegalArgumentException("do not call."); |
| 8 | } | |
| 9 | ||
| 10 | public static RemotableAbstractWidget.Builder toBuilder(Widget w) { | |
| 11 | 0 | if (w == null) { |
| 12 | 0 | throw new IllegalArgumentException("w is null"); |
| 13 | } | |
| 14 | ||
| 15 | 0 | if (w instanceof RemotableDatepicker || w instanceof RemotableDatepicker.Builder) return RemotableDatepicker.Builder.create(); |
| 16 | 0 | if (w instanceof RemotableTextExpand || w instanceof RemotableTextExpand.Builder) return RemotableTextExpand.Builder.create(); |
| 17 | ||
| 18 | 0 | if (w instanceof RemotableQuickFinder) { |
| 19 | 0 | RemotableQuickFinder.Builder b = RemotableQuickFinder.Builder.create(((RemotableQuickFinder) w).getBaseLookupUrl(), ((RemotableQuickFinder) w).getDataObjectClass()); |
| 20 | 0 | b.setFieldConversions(((RemotableQuickFinder) w).getFieldConversions()); |
| 21 | 0 | b.setLookupParameters(((RemotableQuickFinder) w).getLookupParameters()); |
| 22 | 0 | return b; |
| 23 | 0 | } else if (w instanceof RemotableQuickFinder.Builder) { |
| 24 | 0 | RemotableQuickFinder.Builder b = RemotableQuickFinder.Builder.create(((RemotableQuickFinder.Builder) w).getBaseLookupUrl(), ((RemotableQuickFinder.Builder) w).getDataObjectClass()); |
| 25 | 0 | b.setFieldConversions(((RemotableQuickFinder.Builder) w).getFieldConversions()); |
| 26 | 0 | b.setLookupParameters(((RemotableQuickFinder.Builder) w).getLookupParameters()); |
| 27 | 0 | return b; |
| 28 | } | |
| 29 | 0 | throw new UnsupportedOperationException(w.getClass().getName() + " not supported"); |
| 30 | } | |
| 31 | } |