com.vaadin.polymer.iron.IronInputElement Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from iron-input project by The Polymer Authors
* that is licensed with http://polymer.github.io/LICENSE.txt license.
*/
package com.vaadin.polymer.iron;
import com.vaadin.polymer.elemental.*;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
/**
* <iron-input>
adds two-way binding and custom validators using Polymer.IronValidatorBehavior
to <input>
.
* Two-way binding
* By default you can only get notified of changes to an input
‘s value
due to user input:
* <input value="{{myValue::input}}">
*
*
*
iron-input
adds the bind-value
property that mirrors the value
property, and can be used
for two-way data binding. bind-value
will notify if it is changed either by user input or by script.
* <input is="iron-input" bind-value="{{myValue}}">
*
*
*
Custom validators
* You can use custom validators that implement Polymer.IronValidatorBehavior
with <iron-input>
.
* <input is="iron-input" validator="my-custom-validator">
*
*
*
Stopping invalid input
* It may be desirable to only allow users to enter certain characters. You can use the
prevent-invalid-input
and allowed-pattern
attributes together to accomplish this. This feature
is separate from validation, and allowed-pattern
does not affect how the input is validated.
* <!-- only allow characters that match [0-9] -->
* <input is="iron-input" prevent-invalid-input allowed-pattern="[0-9]">
*
*
*
*/
@JsType(isNative=true)
public interface IronInputElement extends HTMLElement {
@JsOverlay public static final String TAG = "iron-input";
@JsOverlay public static final String SRC = "iron-input/iron-input.html";
/**
* Set to true to prevent the user from entering invalid input. If allowedPattern
is set,
any character typed by the user will be matched against that pattern, and rejected if it’s not a match.
Pasted input will have each character checked individually; if any character
doesn’t match allowedPattern
, the entire pasted string will be rejected.
If allowedPattern
is not set, it will use the type
attribute (only supported for type=number
).
*
* JavaScript Info:
* @property preventInvalidInput
* @type Boolean
*
*/
@JsProperty boolean getPreventInvalidInput();
/**
* Set to true to prevent the user from entering invalid input. If allowedPattern
is set,
any character typed by the user will be matched against that pattern, and rejected if it’s not a match.
Pasted input will have each character checked individually; if any character
doesn’t match allowedPattern
, the entire pasted string will be rejected.
If allowedPattern
is not set, it will use the type
attribute (only supported for type=number
).
*
* JavaScript Info:
* @property preventInvalidInput
* @type Boolean
*
*/
@JsProperty void setPreventInvalidInput(boolean value);
/**
* True if the last call to validate
is invalid.
*
* JavaScript Info:
* @property invalid
* @type Boolean
* @behavior VaadinDatePicker
*/
@JsProperty boolean getInvalid();
/**
* True if the last call to validate
is invalid.
*
* JavaScript Info:
* @property invalid
* @type Boolean
* @behavior VaadinDatePicker
*/
@JsProperty void setInvalid(boolean value);
/**
* Use this property instead of value
for two-way data binding.
*
* JavaScript Info:
* @property bindValue
* @type String
*
*/
@JsProperty String getBindValue();
/**
* Use this property instead of value
for two-way data binding.
*
* JavaScript Info:
* @property bindValue
* @type String
*
*/
@JsProperty void setBindValue(String value);
/**
* Name of the validator to use.
*
* JavaScript Info:
* @property validator
* @type String
* @behavior VaadinDatePicker
*/
@JsProperty String getValidator();
/**
* Name of the validator to use.
*
* JavaScript Info:
* @property validator
* @type String
* @behavior VaadinDatePicker
*/
@JsProperty void setValidator(String value);
/**
* Namespace for this validator. This property is deprecated and should
not be used. For all intents and purposes, please consider it a
read-only, config-time property.
*
* JavaScript Info:
* @property validatorType
* @type String
* @behavior VaadinDatePicker
*/
@JsProperty String getValidatorType();
/**
* Namespace for this validator. This property is deprecated and should
not be used. For all intents and purposes, please consider it a
read-only, config-time property.
*
* JavaScript Info:
* @property validatorType
* @type String
* @behavior VaadinDatePicker
*/
@JsProperty void setValidatorType(String value);
/**
* Regular expression that list the characters allowed as input.
This pattern represents the allowed characters for the field; as the user inputs text,
each individual character will be checked against the pattern (rather than checking
the entire value as a whole). The recommended format should be a list of allowed characters;
for example, [a-zA-Z0-9.+-!;:]
*
* JavaScript Info:
* @property allowedPattern
* @type String
*
*/
@JsProperty String getAllowedPattern();
/**
* Regular expression that list the characters allowed as input.
This pattern represents the allowed characters for the field; as the user inputs text,
each individual character will be checked against the pattern (rather than checking
the entire value as a whole). The recommended format should be a list of allowed characters;
for example, [a-zA-Z0-9.+-!;:]
*
* JavaScript Info:
* @property allowedPattern
* @type String
*
*/
@JsProperty void setAllowedPattern(String value);
/**
* Returns true if value
is valid. The validator provided in validator
will be used first,
then any constraints.
*
* JavaScript Info:
* @method validate
*
* @return {boolean}
*/
boolean validate();
/**
*
*
* JavaScript Info:
* @method hasValidator
* @behavior VaadinDatePicker
* @return {boolean}
*/
boolean hasValidator();
/**
* Returns true if the value
is valid, and updates invalid
. If you want
your element to have custom validation logic, do not override this method;
override _getValidity(value)
instead.
*
* JavaScript Info:
* @method validate
* @param {Object} value
* @behavior VaadinDatePicker
* @return {boolean}
*/
boolean validate(JavaScriptObject value);
}