| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a2d7821 commit d173beb
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,6 +56,7 @@ public class Form extends BaseComponent<HTMLFormElement, Form> implements | |||
| 56 | 56 | ||
| 57 | 57 | // ------------------------------------------------------ factory | |
| 58 | 58 | ||
| 59 | + /** Creates a new form component with browser validation disabled. */ | ||
| 59 | 60 | public static Form form() { | |
| 60 | 61 | return new Form(); | |
| 61 | 62 | } | |
@@ -76,6 +77,7 @@ public static Form form() { | |||
| 76 | 77 | ||
| 77 | 78 | // ------------------------------------------------------ add | |
| 78 | 79 | ||
| 80 | + /** Adds multiple form groups created by the given display function. */ | ||
| 79 | 81 | public <T> Form addItems(Iterable<T> items, Function<T, FormGroup> display) { | |
| 80 | 82 | for (T item : items) { | |
| 81 | 83 | FormGroup group = display.apply(item); | |
@@ -84,10 +86,12 @@ public <T> Form addItems(Iterable<T> items, Function<T, FormGroup> display) { | |||
| 84 | 86 | return this; | |
| 85 | 87 | } | |
| 86 | 88 | ||
| 89 | + /** Same as {@link #add(FormGroup)} */ | ||
| 87 | 90 | public Form addItem(FormGroup item) { | |
| 88 | 91 | return add(item); | |
| 89 | 92 | } | |
| 90 | 93 | ||
| 94 | + /** Same as {@link #add(FormGroup)} */ | ||
| 91 | 95 | public Form addGroup(FormGroup group) { | |
| 92 | 96 | return add(group); | |
| 93 | 97 | } | |
@@ -99,66 +103,46 @@ public Form add(FormGroup item) { | |||
| 99 | 103 | return aur.added(item); | |
| 100 | 104 | } | |
| 101 | 105 | ||
| 102 | - /** | ||
| 103 | - * Adds an alert to the form. The alert will be displayed in the context of the form, allowing the user to see | ||
| 104 | - * context-specific notifications or warnings. | ||
| 105 | - * | ||
| 106 | - * @param alert the alert to be added to the form | ||
| 107 | - * @return the updated form instance with the added alert | ||
| 108 | - */ | ||
| 106 | + /** Same as {@link #add(Alert)}. Convenience shortcut that wraps the alert in a {@link FormAlert}. */ | ||
| 109 | 107 | public Form addAlert(Alert alert) { | |
| 110 | 108 | return add(alert); | |
| 111 | 109 | } | |
| 112 | 110 | ||
| 113 | - /** | ||
| 114 | - * Adds an alert to the form. This method integrates the specified alert into the form's structure, allowing it to be | ||
| 115 | - * displayed within the form for user visibility and context-specific notifications or warnings. | ||
| 116 | - * | ||
| 117 | - * @param alert the alert to be added to the form | ||
| 118 | - * @return the updated instance of the form after adding the alert | ||
| 119 | - */ | ||
| 111 | + /** Wraps the alert in a new {@link FormAlert} and inserts it at the top of the form. */ | ||
| 120 | 112 | public Form add(Alert alert) { | |
| 121 | 113 | return add(formAlert().addAlert(alert)); | |
| 122 | 114 | } | |
| 123 | 115 | ||
| 124 | - /** | ||
| 125 | - * Adds a {@link FormAlert} to the form. The alert will be displayed within the form, allowing for context-specific | ||
| 126 | - * notifications or warnings to be presented to the user. | ||
| 127 | - * | ||
| 128 | - * @param alert the {@link FormAlert} to be added to the form | ||
| 129 | - * @return the updated {@link Form} instance with the added alert | ||
| 130 | - */ | ||
| 116 | + /** Same as {@link #add(FormAlert)} */ | ||
| 131 | 117 | public Form addAlert(FormAlert alert) { | |
| 132 | 118 | return add(alert); | |
| 133 | 119 | } | |
| 134 | 120 | ||
| 135 | - /** | ||
| 136 | - * Adds a {@link FormAlert} to this form. The alert will be displayed within the form, providing context-specific | ||
| 137 | - * notifications or warnings to the user. | ||
| 138 | - * | ||
| 139 | - * @param alert the {@link FormAlert} to be added to the form | ||
| 140 | - * @return the updated {@link Form} instance with the added alert | ||
| 141 | - */ | ||
| 121 | + /** Adds a {@link FormAlert} and inserts it at the top of the form. */ | ||
| 142 | 122 | public Form add(FormAlert alert) { | |
| 143 | 123 | alerts.add(alert); | |
| 144 | 124 | insertFirst(element(), alert.element()); | |
| 145 | 125 | return this; | |
| 146 | 126 | } | |
| 147 | 127 | ||
| 128 | + /** Adds a {@link FormSection} to the form. */ | ||
| 148 | 129 | public Form addSection(FormSection section) { | |
| 149 | 130 | return add(section); | |
| 150 | 131 | } | |
| 151 | 132 | ||
| 133 | + /** Adds a {@link FormFieldGroup} to the form. */ | ||
| 152 | 134 | public Form addFieldGroup(FormFieldGroup fieldGroup) { | |
| 153 | 135 | return add(fieldGroup); | |
| 154 | 136 | } | |
| 155 | 137 | ||
| 138 | + /** Adds a {@link FormActionGroup} to the form. */ | ||
| 156 | 139 | public Form addActionGroup(FormActionGroup actionGroup) { | |
| 157 | 140 | return add(actionGroup); | |
| 158 | 141 | } | |
| 159 | 142 | ||
| 160 | 143 | // ------------------------------------------------------ builder | |
| 161 | 144 | ||
| 145 | + /** Limits the form width to a maximum width. Adds {@linkplain Classes#modifier(String) modifier(limitWidth)}. */ | ||
| 162 | 146 | public Form limitWidth() { | |
| 163 | 147 | return css(modifier(limitWidth)); | |
| 164 | 148 | } | |
@@ -238,6 +222,7 @@ public void clear() { | |||
| 238 | 222 | } | |
| 239 | 223 | } | |
| 240 | 224 | ||
| 225 | + /** Removes all alerts from this form. */ | ||
| 241 | 226 | public void clearAlerts() { | |
| 242 | 227 | for (FormAlert alert : alerts) { | |
| 243 | 228 | failSafeRemoveFromParent(alert); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments