1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.ui.contentapp.detail;
35
36 import info.magnolia.ui.api.view.View;
37 import info.magnolia.ui.dialog.formdialog.FormView;
38
39 import com.vaadin.ui.Component;
40
41
42
43
44
45
46 public interface DetailView extends View {
47
48 default void setItemView(FormView formView, ViewType viewType) {
49 setItemView(formView.asVaadinComponent(), viewType);
50 }
51
52
53
54
55 @Deprecated
56 void setItemView(Component formView, ViewType viewType);
57
58
59
60
61
62
63
64
65 enum ViewType {
66 ADD("add", "icon-add-item"),
67 EDIT("edit", "icon-edit"),
68 VIEW("view", "icon-view");
69
70 private String text;
71 private String icon;
72
73 ViewType(String text, String icon) {
74 this.text = text;
75 this.icon = icon;
76 }
77
78 public String getText() {
79 return this.text;
80 }
81
82 public String getIcon() {
83 return icon;
84 }
85
86 public static ViewType fromString(String text) {
87 if (text != null && !text.isEmpty()) {
88 for (ViewType type : ViewType.values()) {
89 if (text.equalsIgnoreCase(type.text)) {
90 return type;
91 }
92 }
93 }
94 return defaultViewType();
95
96 }
97
98 private static ViewType defaultViewType() {
99 return EDIT;
100 }
101
102 }
103
104 @Deprecated
105 default void setListener(Listener listener) {
106
107 }
108
109 @Deprecated
110 default void refresh() {
111
112 }
113
114
115 @Deprecated
116 default ViewType getViewType() {
117 throw new UnsupportedOperationException();
118 }
119
120 @Deprecated
121 default void setWide(boolean isWide) {
122
123 }
124
125
126
127
128 @Deprecated
129 interface Listener {
130
131 }
132 }