1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.component;
21
22 import org.apache.myfaces.tobago.internal.util.Deprecation;
23
24 import javax.faces.component.UIComponent;
25 import javax.faces.context.FacesContext;
26
27 public enum LabelLayout {
28
29
30
31
32 none,
33
34
35
36
37 flexLeft,
38
39
40
41
42 flexRight,
43
44
45
46
47 top,
48
49
50
51
52 segmentLeft,
53
54
55
56
57 segmentRight,
58
59
60
61
62 flowLeft,
63
64
65
66
67 flowRight,
68
69
70
71
72
73
74 @Deprecated
75 skip,
76
77
78
79
80 gridLeft,
81
82
83
84
85 gridRight,
86
87
88
89
90 gridTop,
91
92
93
94
95 gridBottom;
96
97 private static final String SEGMENT_TO_RENDER_KEY = LabelLayout.class.getName();
98
99 public static boolean isSegment(final LabelLayout labelLayout) {
100 return labelLayout == segmentLeft || labelLayout == segmentRight;
101 }
102
103
104
105
106 @Deprecated
107 public static void setSegment(final FacesContext facesContext, final LabelLayout labelLayout) {
108 Deprecation.LOG.error("not longer supported - see javadoc");
109 }
110
111
112
113
114 @Deprecated
115 public static LabelLayout getSegment(final FacesContext facesContext) {
116 Deprecation.LOG.error("not longer supported - see javadoc");
117 return null;
118 }
119
120 public static void removeSegment(final FacesContext facesContext) {
121 facesContext.getAttributes().remove(SEGMENT_TO_RENDER_KEY);
122 }
123
124 public static boolean isGridLeft(final UIComponent component) {
125 return component instanceof SupportsLabelLayout
126 && ((SupportsLabelLayout) component).getLabelLayout() == LabelLayout.gridLeft;
127 }
128
129 public static boolean isGridRight(final UIComponent component) {
130 return component instanceof SupportsLabelLayout
131 && ((SupportsLabelLayout) component).getLabelLayout() == LabelLayout.gridRight;
132 }
133
134 public static boolean isGridTop(final UIComponent component) {
135 return component instanceof SupportsLabelLayout
136 && ((SupportsLabelLayout) component).getLabelLayout() == LabelLayout.gridTop;
137 }
138
139 public static boolean isGridBottom(final UIComponent component) {
140 return component instanceof SupportsLabelLayout
141 && ((SupportsLabelLayout) component).getLabelLayout() == LabelLayout.gridBottom;
142 }
143 }