-
Notifications
You must be signed in to change notification settings - Fork 5
/
Style.java
149 lines (120 loc) · 4.73 KB
/
Style.java
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package org.genericsystem.reactor.annotations;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.function.BiConsumer;
import org.genericsystem.reactor.Tag;
import org.genericsystem.reactor.annotations.Style.FlexDirectionStyle.FlexDirectionStyleProcessor;
import org.genericsystem.reactor.annotations.Style.FlexDirectionStyle.FlexDirections;
import org.genericsystem.reactor.annotations.Style.GenericValueBackgroundColor.GenericValueBackgroundColorProcessor;
import org.genericsystem.reactor.annotations.Style.GenericValueBackgroundColor.GenericValueBackgroundColors;
import org.genericsystem.reactor.annotations.Style.KeepFlexDirection.KeepFlexDirectionProcessor;
import org.genericsystem.reactor.annotations.Style.KeepFlexDirection.KeepFlexDirections;
import org.genericsystem.reactor.annotations.Style.ReverseFlexDirection.ReverseFlexDirectionProcessor;
import org.genericsystem.reactor.annotations.Style.ReverseFlexDirection.ReverseFlexDirections;
import org.genericsystem.reactor.annotations.Style.StyleProcessor;
import org.genericsystem.reactor.annotations.Style.Styles;
import org.genericsystem.reactor.gscomponents.FlexDirection;
import org.genericsystem.reactor.gscomponents.TagImpl;
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Repeatable(Styles.class)
@Process(value = StyleProcessor.class, repeatable = true)
public @interface Style {
Class<? extends TagImpl>[] path() default {};
String name();
String value();
int[] pos() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface Styles {
Style[] value();
}
public static class StyleProcessor implements BiConsumer<Annotation, Tag> {
@Override
public void accept(Annotation annotation, Tag tag) {
tag.getRootTag().processStyle(tag, ((Style) annotation).name(), ((Style) annotation).value());
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Repeatable(FlexDirections.class)
@Process(FlexDirectionStyleProcessor.class)
public @interface FlexDirectionStyle {
Class<? extends TagImpl>[] path() default {};
FlexDirection value();
int[] pos() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface FlexDirections {
FlexDirectionStyle[] value();
}
public static class FlexDirectionStyleProcessor implements BiConsumer<Annotation, Tag> {
@Override
public void accept(Annotation annotation, Tag tag) {
tag.getRootTag().processFlexDirectionStyle(tag, ((FlexDirectionStyle) annotation).value());
}
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Repeatable(KeepFlexDirections.class)
@Process(KeepFlexDirectionProcessor.class)
public @interface KeepFlexDirection {
Class<? extends TagImpl>[] path() default {};
int[] pos() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface KeepFlexDirections {
KeepFlexDirection[] value();
}
public static class KeepFlexDirectionProcessor implements BiConsumer<Annotation, Tag> {
@Override
public void accept(Annotation annotation, Tag tag) {
tag.getRootTag().processKeepFlexDirection(tag);
}
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Repeatable(ReverseFlexDirections.class)
@Process(ReverseFlexDirectionProcessor.class)
public @interface ReverseFlexDirection {
Class<? extends TagImpl>[] path() default {};
int[] pos() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface ReverseFlexDirections {
ReverseFlexDirection[] value();
}
public static class ReverseFlexDirectionProcessor implements BiConsumer<Annotation, Tag> {
@Override
public void accept(Annotation annotation, Tag tag) {
tag.getRootTag().processReverseFlexDirection(tag);
}
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@Repeatable(GenericValueBackgroundColors.class)
@Process(GenericValueBackgroundColorProcessor.class)
public @interface GenericValueBackgroundColor {
Class<? extends TagImpl>[] path() default {};
String value();
int[] pos() default {};
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface GenericValueBackgroundColors {
GenericValueBackgroundColor[] value();
}
public static class GenericValueBackgroundColorProcessor implements BiConsumer<Annotation, Tag> {
@Override
public void accept(Annotation annotation, Tag tag) {
tag.getRootTag().processGenericValueBackgroundColor(tag, ((GenericValueBackgroundColor) annotation).value());
}
}
}
}