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.editor;
35
36 import info.magnolia.i18nsystem.I18nText;
37 import info.magnolia.ui.framework.WithImplementation;
38
39 import java.util.List;
40
41 import lombok.Data;
42
43
44
45
46
47
48
49 @EditorType("multiFormEditor")
50 public interface MultiFormDefinition<T> extends EditorDefinition<T> {
51
52 MultiFormView.EntryResolution.Definition<T> getEntryResolution();
53
54 OrderHandlerDefinition<T> getOrderHandler();
55
56 boolean isCanRemoveItems();
57
58 @I18nText(fallback = "buttons.add")
59 default String getButtonSelectAddLabel() {
60 return null;
61 }
62
63 @I18nText(fallback = "buttons.delete")
64 default String getButtonSelectRemoveLabel() {
65 return null;
66 }
67
68 default boolean isRequired() {
69 return false;
70 }
71
72 @I18nText(fallback = "validation.message.required")
73 default String getRequiredErrorMessage() {
74 return null;
75 };
76
77 interface OrderHandler<T> {
78 void applyOrder(List<T> items);
79 }
80
81 @Data
82 class OrderHandlerDefinition<T> implements WithImplementation<OrderHandler<T>> {
83 Class<? extends OrderHandler<T>> implementationClass;
84
85 public static class Noop<T> extends OrderHandlerDefinition<T> {
86 public Noop() {
87 setImplementationClass((Class) NoopOrderHandler.class);
88 }
89 }
90 }
91
92 class NoopOrderHandler<T> implements OrderHandler<T> {
93
94 @Override
95 public void applyOrder(List<T> items) {
96 }
97 }
98
99 }