1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.core.api.uif;
17
18
19 final class WidgetCopy {
20
21 private WidgetCopy() {
22 throw new IllegalArgumentException("do not call.");
23 }
24
25 public static RemotableAbstractWidget.Builder toBuilder(RemotableWidgetContract w) {
26 if (w == null) {
27 throw new IllegalArgumentException("w is null");
28 }
29
30 if (w instanceof RemotableDatepicker || w instanceof RemotableDatepicker.Builder) return RemotableDatepicker.Builder.create();
31 if (w instanceof RemotableTextExpand || w instanceof RemotableTextExpand.Builder) return RemotableTextExpand.Builder.create();
32
33 if (w instanceof RemotableQuickFinder) {
34 RemotableQuickFinder.Builder b = RemotableQuickFinder.Builder.create(((RemotableQuickFinder) w).getBaseLookupUrl(), ((RemotableQuickFinder) w).getDataObjectClass());
35 b.setFieldConversions(((RemotableQuickFinder) w).getFieldConversions());
36 b.setLookupParameters(((RemotableQuickFinder) w).getLookupParameters());
37 return b;
38 } else if (w instanceof RemotableQuickFinder.Builder) {
39 RemotableQuickFinder.Builder b = RemotableQuickFinder.Builder.create(((RemotableQuickFinder.Builder) w).getBaseLookupUrl(), ((RemotableQuickFinder.Builder) w).getDataObjectClass());
40 b.setFieldConversions(((RemotableQuickFinder.Builder) w).getFieldConversions());
41 b.setLookupParameters(((RemotableQuickFinder.Builder) w).getLookupParameters());
42 return b;
43 }
44 throw new UnsupportedOperationException(w.getClass().getName() + " not supported");
45 }
46 }