|
23 | 23 | import com.jwebmp.core.base.html.interfaces.GlobalFeatures;
|
24 | 24 | import com.jwebmp.core.base.html.interfaces.children.TableRowChildren;
|
25 | 25 | import com.jwebmp.core.base.html.interfaces.events.GlobalEvents;
|
26 |
| -import com.jwebmp.core.base.interfaces.IComponentHierarchyBase; |
27 | 26 | import com.jwebmp.core.base.servlets.enumarations.ComponentTypes;
|
28 |
| - |
29 | 27 | import jakarta.validation.constraints.NotNull;
|
30 | 28 |
|
31 | 29 | /**
|
|
61 | 59 | * <p>
|
62 | 60 | *
|
63 | 61 | * @param <J>
|
64 |
| - * |
65 | 62 | * @author GedMarc
|
66 | 63 | * @version 1.0
|
67 | 64 | * @since 2012/10/01
|
68 | 65 | */
|
69 | 66 | @SuppressWarnings("MissingClassJavaDoc")
|
70 | 67 | public class TableCell<J extends TableCell<J>>
|
71 |
| - extends Component<GlobalChildren, TableCellAttributes, GlobalFeatures, GlobalEvents, J> |
72 |
| - implements TableRowChildren |
| 68 | + extends Component<GlobalChildren, TableCellAttributes, GlobalFeatures, GlobalEvents, J> |
| 69 | + implements TableRowChildren |
73 | 70 | {
|
74 |
| - /** |
75 |
| - * Constructs a normal table cell |
76 |
| - */ |
77 |
| - public TableCell() |
78 |
| - { |
79 |
| - this((GlobalChildren) null); |
80 |
| - } |
| 71 | + /** |
| 72 | + * Constructs a normal table cell |
| 73 | + */ |
| 74 | + public TableCell() |
| 75 | + { |
| 76 | + this((GlobalChildren) null); |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * Constructs a table cell with the given child. |
| 81 | + * |
| 82 | + * @param dataDisplay The component that is a child |
| 83 | + */ |
| 84 | + public TableCell(GlobalChildren dataDisplay) |
| 85 | + { |
| 86 | + super(ComponentTypes.TableCell); |
| 87 | + if (dataDisplay != null) |
| 88 | + { |
| 89 | + add(dataDisplay); |
| 90 | + } |
| 91 | + } |
81 | 92 |
|
82 |
| - /** |
83 |
| - * Constructs a table cell with the given child. |
84 |
| - * |
85 |
| - * @param dataDisplay |
86 |
| - * The component that is a child |
87 |
| - */ |
88 |
| - public TableCell(GlobalChildren dataDisplay) |
89 |
| - { |
90 |
| - super(ComponentTypes.TableCell); |
91 |
| - if (dataDisplay != null) |
92 |
| - { |
93 |
| - add(dataDisplay); |
94 |
| - } |
95 |
| - } |
| 93 | + /** |
| 94 | + * A paragraph as a child. Good for testing or Render on Load |
| 95 | + * |
| 96 | + * @param dataDisplay The display for the table cell |
| 97 | + */ |
| 98 | + public TableCell(String dataDisplay) |
| 99 | + { |
| 100 | + this((GlobalChildren) null); |
| 101 | + setText(dataDisplay); |
| 102 | + } |
96 | 103 |
|
97 |
| - /** |
98 |
| - * A paragraph as a child. Good for testing or Render on Load |
99 |
| - * |
100 |
| - * @param dataDisplay |
101 |
| - * The display for the table cell |
102 |
| - */ |
103 |
| - public TableCell(String dataDisplay) |
104 |
| - { |
105 |
| - this((GlobalChildren) null); |
106 |
| - setText(dataDisplay); |
107 |
| - } |
| 104 | + /** |
| 105 | + * Returns this table cell column span |
| 106 | + * |
| 107 | + * @return Integer of Column Span |
| 108 | + */ |
| 109 | + public int getColumnSpan() |
| 110 | + { |
| 111 | + String s = getAttribute(TableCellAttributes.ColSpan); |
| 112 | + if (Strings.isNullOrEmpty(s)) |
| 113 | + { |
| 114 | + s = "0"; |
| 115 | + } |
| 116 | + return Integer.parseInt(s); |
| 117 | + } |
108 | 118 |
|
109 |
| - /** |
110 |
| - * Returns this table cell column span |
111 |
| - * |
112 |
| - * @return Integer of Column Span |
113 |
| - */ |
114 |
| - public int getColumnSpan() |
115 |
| - { |
116 |
| - String s = getAttribute(TableCellAttributes.ColSpan); |
117 |
| - if (Strings.isNullOrEmpty(s)) |
118 |
| - { |
119 |
| - s = "0"; |
120 |
| - } |
121 |
| - return Integer.parseInt(s); |
122 |
| - } |
| 119 | + /** |
| 120 | + * @param columnSpan Sets this table cells column span |
| 121 | + */ |
| 122 | + @NotNull |
| 123 | + @SuppressWarnings("unchecked") |
| 124 | + public J setColumnSpan(int columnSpan) |
| 125 | + { |
| 126 | + addAttribute(TableCellAttributes.ColSpan, columnSpan); |
| 127 | + return (J) this; |
| 128 | + } |
123 | 129 |
|
124 |
| - /** |
125 |
| - * @param columnSpan |
126 |
| - * Sets this table cells column span |
127 |
| - */ |
128 |
| - @NotNull |
129 |
| - @SuppressWarnings("unchecked") |
130 |
| - public J setColumnSpan(int columnSpan) |
131 |
| - { |
132 |
| - addAttribute(TableCellAttributes.ColSpan, columnSpan); |
133 |
| - return (J) this; |
134 |
| - } |
| 130 | + /** |
| 131 | + * Gets this table cells row span |
| 132 | + * |
| 133 | + * @return Integer of Row Span |
| 134 | + */ |
| 135 | + public int getRowSpan() |
| 136 | + { |
| 137 | + return Integer.parseInt(getAttribute(TableCellAttributes.RowSpan)); |
| 138 | + } |
135 | 139 |
|
136 |
| - /** |
137 |
| - * Gets this table cells row span |
138 |
| - * |
139 |
| - * @return Integer of Row Span |
140 |
| - */ |
141 |
| - public int getRowSpan() |
142 |
| - { |
143 |
| - return Integer.parseInt(getAttribute(TableCellAttributes.RowSpan)); |
144 |
| - } |
| 140 | + /** |
| 141 | + * Sets this objects row span |
| 142 | + * |
| 143 | + * @param rowSpan Integer that is row span |
| 144 | + */ |
| 145 | + @NotNull |
| 146 | + @SuppressWarnings("unchecked") |
| 147 | + public J setRowSpan(int rowSpan) |
| 148 | + { |
| 149 | + addAttribute(TableCellAttributes.RowSpan, Integer.toString(rowSpan)); |
| 150 | + return (J) this; |
| 151 | + } |
145 | 152 |
|
146 |
| - /** |
147 |
| - * Sets this objects row span |
148 |
| - * |
149 |
| - * @param rowSpan |
150 |
| - * Integer that is row span |
151 |
| - */ |
152 |
| - @NotNull |
153 |
| - @SuppressWarnings("unchecked") |
154 |
| - public J setRowSpan(int rowSpan) |
155 |
| - { |
156 |
| - addAttribute(TableCellAttributes.RowSpan, Integer.toString(rowSpan)); |
157 |
| - return (J) this; |
158 |
| - } |
| 153 | + @Override |
| 154 | + public J bind(String variableName) |
| 155 | + { |
| 156 | + setText("{{" + variableName + "}}"); |
| 157 | + return (J) this; |
| 158 | + } |
159 | 159 | }
|
0 commit comments