001package react4j.dom.proptypes.html;
002
003import javax.annotation.Nonnull;
004import javax.annotation.Nullable;
005import jsinterop.annotations.JsOverlay;
006import jsinterop.annotations.JsPackage;
007import jsinterop.annotations.JsType;
008import react4j.dom.events.DragEventHandler;
009import react4j.dom.events.FocusEventHandler;
010import react4j.dom.events.FormEventHandler;
011import react4j.dom.events.KeyboardEventHandler;
012import react4j.dom.events.MouseEventHandler;
013import react4j.dom.events.TouchEventHandler;
014import react4j.dom.proptypes.html.attributeTypes.ButtonType;
015
016/**
017 * Props for button elements. Refer to http://www.w3schools.com/tags/tag_button.asp
018 */
019@JsType( isNative = true, namespace = JsPackage.GLOBAL, name = "Object" )
020public class BtnProps
021  extends HtmlGlobalFields<BtnProps>
022{
023  @JsOverlay
024  @Nonnull
025  public final BtnProps autoFocus()
026  {
027    return autoFocus( true );
028  }
029
030  @JsOverlay
031  @Nonnull
032  public final BtnProps autoFocus( boolean b )
033  {
034    setAutoFocus( b );
035    return self();
036  }
037
038  @JsOverlay
039  @Nonnull
040  public final BtnProps disabled()
041  {
042    return disabled( true );
043  }
044
045  @JsOverlay
046  @Nonnull
047  public final BtnProps disabled( boolean b )
048  {
049    setDisabled( b );
050    return self();
051  }
052
053  @JsOverlay
054  @Nonnull
055  public final BtnProps from( String s )
056  {
057    setForm( s );
058    return self();
059  }
060
061  @JsOverlay
062  @Nonnull
063  public final BtnProps formAction( String s )
064  {
065    setFormAction( s );
066    return self();
067  }
068
069  @JsOverlay
070  @Nonnull
071  public final BtnProps formEncType( String s )
072  {
073    setFormEncType( s );
074    return self();
075  }
076
077  @JsOverlay
078  @Nonnull
079  public final BtnProps formMethod( String s )
080  {
081    setFormMethod( s );
082    return self();
083  }
084
085  @JsOverlay
086  @Nonnull
087  public final BtnProps formNoValidate()
088  {
089    return formNoValidate( true );
090  }
091
092  @JsOverlay
093  @Nonnull
094  public final BtnProps formNoValidate( boolean b )
095  {
096    setFormNoValidate( b );
097    return self();
098  }
099
100  @JsOverlay
101  @Nonnull
102  public final BtnProps formTarget( String s )
103  {
104    setFormTarget( s );
105    return self();
106  }
107
108  @JsOverlay
109  @Nonnull
110  public final BtnProps name( String s )
111  {
112    setName( s );
113    return self();
114  }
115
116  @JsOverlay
117  @Nonnull
118  public final BtnProps type( @Nonnull @ButtonType final String type )
119  {
120    setType( type );
121    return self();
122  }
123
124  @JsOverlay
125  @Nonnull
126  public final BtnProps value( String s )
127  {
128    setValue( s );
129    return self();
130  }
131
132  //React Specific
133
134  @JsOverlay
135  @Nonnull
136  public final BtnProps defaultChecked()
137  {
138    return defaultChecked( true );
139  }
140
141  @JsOverlay
142  @Nonnull
143  public final BtnProps defaultChecked( boolean b )
144  {
145    setDefaultChecked( b );
146    return self();
147  }
148
149  @JsOverlay
150  @Nonnull
151  public final BtnProps defaultValue( String s )
152  {
153    setDefaultValue( s );
154    return self();
155  }
156
157  //Applicable Event Handlers
158
159  // Focus Events
160  @JsOverlay
161  @Nonnull
162  public final BtnProps onBlur( @Nullable final FocusEventHandler handler )
163  {
164    setOnBlur( handler );
165    return self();
166  }
167
168  @JsOverlay
169  @Nonnull
170  public final BtnProps onFocus( @Nullable final FocusEventHandler handler )
171  {
172    setOnFocus( handler );
173    return self();
174  }
175
176  // Form Events
177  @JsOverlay
178  @Nonnull
179  public final BtnProps onSubmit( @Nullable final FormEventHandler handler )
180  {
181    setOnSubmit( handler );
182    return self();
183  }
184
185  // Keyboard Events
186  @JsOverlay
187  @Nonnull
188  public final BtnProps onKeyDown( @Nullable final KeyboardEventHandler handler )
189  {
190    setOnKeyDown( handler );
191    return self();
192  }
193
194  @JsOverlay
195  @Nonnull
196  public final BtnProps onKeyPress( @Nullable final KeyboardEventHandler handler )
197  {
198    setOnKeyPress( handler );
199    return self();
200  }
201
202  @JsOverlay
203  @Nonnull
204  public final BtnProps onKeyUp( @Nullable final KeyboardEventHandler handler )
205  {
206    setOnKeyUp( handler );
207    return self();
208  }
209
210  @JsOverlay
211  @Nonnull
212  public final BtnProps onClick( @Nullable final MouseEventHandler handler )
213  {
214    setOnClick( handler );
215    return self();
216  }
217
218  @JsOverlay
219  @Nonnull
220  public final BtnProps onContextMenu( @Nullable final MouseEventHandler handler )
221  {
222    setOnContextMenu( handler );
223    return self();
224  }
225
226  @JsOverlay
227  @Nonnull
228  public final BtnProps onDoubleClick( @Nullable final MouseEventHandler handler )
229  {
230    setOnDoubleClick( handler );
231    return self();
232  }
233
234  @JsOverlay
235  @Nonnull
236  public final BtnProps onDrag( @Nullable final DragEventHandler handler )
237  {
238    setOnDrag( handler );
239    return self();
240  }
241
242  @JsOverlay
243  @Nonnull
244  public final BtnProps onDragEnd( @Nullable final DragEventHandler handler )
245  {
246    setOnDragEnd( handler );
247    return self();
248  }
249
250  @JsOverlay
251  @Nonnull
252  public final BtnProps onDragEnter( @Nullable final DragEventHandler handler )
253  {
254    setOnDragEnter( handler );
255    return self();
256  }
257
258  @JsOverlay
259  @Nonnull
260  public final BtnProps onDragExit( @Nullable final DragEventHandler handler )
261  {
262    setOnDragExit( handler );
263    return self();
264  }
265
266  @JsOverlay
267  @Nonnull
268  public final BtnProps onDragLeave( @Nullable final DragEventHandler handler )
269  {
270    setOnDragLeave( handler );
271    return self();
272  }
273
274  @JsOverlay
275  @Nonnull
276  public final BtnProps onDragOver( @Nullable final DragEventHandler handler )
277  {
278    setOnDragOver( handler );
279    return self();
280  }
281
282  @JsOverlay
283  @Nonnull
284  public final BtnProps onDragStart( @Nullable final DragEventHandler handler )
285  {
286    setOnDragStart( handler );
287    return self();
288  }
289
290  @JsOverlay
291  @Nonnull
292  public final BtnProps onDrop( @Nullable final DragEventHandler handler )
293  {
294    setOnDrop( handler );
295    return self();
296  }
297
298  @JsOverlay
299  @Nonnull
300  public final BtnProps onMouseDown( @Nullable final MouseEventHandler handler )
301  {
302    setOnMouseDown( handler );
303    return self();
304  }
305
306  @JsOverlay
307  @Nonnull
308  public final BtnProps onMouseEnter( @Nullable final MouseEventHandler handler )
309  {
310    setOnMouseEnter( handler );
311    return self();
312  }
313
314  @JsOverlay
315  @Nonnull
316  public final BtnProps onMouseLeave( @Nullable final MouseEventHandler handler )
317  {
318    setOnMouseLeave( handler );
319    return self();
320  }
321
322  @JsOverlay
323  @Nonnull
324  public final BtnProps onMouseMove( @Nullable final MouseEventHandler handler )
325  {
326    setOnMouseMove( handler );
327    return self();
328  }
329
330  @JsOverlay
331  @Nonnull
332  public final BtnProps onMouseOut( @Nullable final MouseEventHandler handler )
333  {
334    setOnMouseOut( handler );
335    return self();
336  }
337
338  @JsOverlay
339  @Nonnull
340  public final BtnProps onMouseOver( @Nullable final MouseEventHandler handler )
341  {
342    setOnMouseOver( handler );
343    return self();
344  }
345
346  @JsOverlay
347  @Nonnull
348  public final BtnProps onMouseUp( @Nullable final MouseEventHandler handler )
349  {
350    setOnMouseUp( handler );
351    return self();
352  }
353
354  // Touch Events
355  @JsOverlay
356  @Nonnull
357  public final BtnProps onTouchCancel( @Nullable final TouchEventHandler handler )
358  {
359    setOnTouchCancel( handler );
360    return self();
361  }
362
363  @JsOverlay
364  @Nonnull
365  public final BtnProps onTouchEnd( @Nullable final TouchEventHandler handler )
366  {
367    setOnTouchEnd( handler );
368    return self();
369  }
370
371  @JsOverlay
372  @Nonnull
373  public final BtnProps onTouchMove( @Nullable final TouchEventHandler handler )
374  {
375    setOnTouchMove( handler );
376    return self();
377  }
378
379  @JsOverlay
380  @Nonnull
381  public final BtnProps onTouchStart( @Nullable final TouchEventHandler handler )
382  {
383    setOnTouchStart( handler );
384    return self();
385  }
386}