com.vaadin.polymer.iron.widget.IronInput 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.widget;
import com.vaadin.polymer.iron.element.*;
import com.vaadin.polymer.iron.widget.event.IronInputValidateEvent;
import com.vaadin.polymer.iron.widget.event.IronInputValidateEventHandler;
import com.vaadin.polymer.PolymerWidget;
import com.vaadin.polymer.elemental.*;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.core.client.JavaScriptObject;
/**
* <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-invaild-input allowed-pattern="[0-9]">
*
*
*
*/
public class IronInput extends PolymerWidget {
/**
* Default Constructor.
*/
public IronInput() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public IronInput(String html) {
super(IronInputElement.TAG, IronInputElement.SRC, html);
getPolymerElement().addEventListener(
com.vaadin.polymer.iron.element.event.IronInputValidateEvent.NAME,
new com.vaadin.polymer.iron.element.event.IronInputValidateEvent.Listener() {
@Override
protected void handleEvent(com.vaadin.polymer.iron.element.event.IronInputValidateEvent event) {
fireEvent(new IronInputValidateEvent(event));
}
});
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public IronInputElement getPolymerElement() {
return (IronInputElement) getElement();
}
/**
* Regular expression to match valid input characters.
*
* JavaScript Info:
* @property allowedPattern
* @type String
*
*/
public String getAllowedPattern(){
return getPolymerElement().getAllowedPattern();
}
/**
* Regular expression to match valid input characters.
*
* JavaScript Info:
* @property allowedPattern
* @type String
*
*/
public void setAllowedPattern(String value) {
getPolymerElement().setAllowedPattern(value);
}
/**
* Use this property instead of value
for two-way data binding.
*
* JavaScript Info:
* @property bindValue
* @type String
*
*/
public String getBindValue(){
return getPolymerElement().getBindValue();
}
/**
* Use this property instead of value
for two-way data binding.
*
* JavaScript Info:
* @property bindValue
* @type String
*
*/
public void setBindValue(String value) {
getPolymerElement().setBindValue(value);
}
/**
* Set to true to prevent the user from entering invalid input. The new input characters are
matched with allowedPattern
if it is set, otherwise it will use the pattern
attribute if
set, or the type
attribute (only supported for type=number
).
*
* JavaScript Info:
* @property preventInvalidInput
* @type Boolean
*
*/
public boolean getPreventInvalidInput(){
return getPolymerElement().getPreventInvalidInput();
}
/**
* Set to true to prevent the user from entering invalid input. The new input characters are
matched with allowedPattern
if it is set, otherwise it will use the pattern
attribute if
set, or the type
attribute (only supported for type=number
).
*
* JavaScript Info:
* @property preventInvalidInput
* @type Boolean
*
*/
public void setPreventInvalidInput(boolean value) {
getPolymerElement().setPreventInvalidInput(value);
}
/**
* Returns true if value
is valid. The validator provided in validator
will be used first,
then any constraints.
*
* JavaScript Info:
* @method validate
*
*/
public void validate() {
getPolymerElement().validate();
}
/**
*
*
* JavaScript Info:
* @property extends
* @type string
*
*/
public String getExtends(){
return getPolymerElement().getExtends();
}
/**
*
*
* JavaScript Info:
* @property extends
* @type string
*
*/
public void setExtends(String value) {
getPolymerElement().setExtends(value);
}
/**
*
*
* JavaScript Info:
* @property listeners
* @type Object
*
*/
public JavaScriptObject getListeners(){
return getPolymerElement().getListeners();
}
/**
*
*
* JavaScript Info:
* @property listeners
* @type Object
*
*/
public void setListeners(JavaScriptObject value) {
getPolymerElement().setListeners(value);
}
/**
*
*
* JavaScript Info:
* @method hasValidator
* @behavior IronInput
*/
public void hasValidator() {
getPolymerElement().hasValidator();
}
/**
* True if the last call to validate
is invalid.
*
* JavaScript Info:
* @property invalid
* @type Boolean
* @behavior IronInput
*/
public boolean getInvalid(){
return getPolymerElement().getInvalid();
}
/**
* True if the last call to validate
is invalid.
*
* JavaScript Info:
* @property invalid
* @type Boolean
* @behavior IronInput
*/
public void setInvalid(boolean value) {
getPolymerElement().setInvalid(value);
}
/**
* Name of the validator to use.
*
* JavaScript Info:
* @property validator
* @type String
* @behavior IronInput
*/
public String getValidator(){
return getPolymerElement().getValidator();
}
/**
* Name of the validator to use.
*
* JavaScript Info:
* @property validator
* @type String
* @behavior IronInput
*/
public void setValidator(String value) {
getPolymerElement().setValidator(value);
}
/**
* Namespace for this validator.
*
* JavaScript Info:
* @property validatorType
* @type String
* @behavior IronInput
*/
public String getValidatorType(){
return getPolymerElement().getValidatorType();
}
/**
* Namespace for this validator.
*
* JavaScript Info:
* @property validatorType
* @type String
* @behavior IronInput
*/
public void setValidatorType(String value) {
getPolymerElement().setValidatorType(value);
}
/**
*
*
* JavaScript Info:
* @property observers
* @type Array
* @behavior IronInput
*/
public JsArray getObservers(){
return getPolymerElement().getObservers();
}
/**
*
*
* JavaScript Info:
* @property observers
* @type Array
* @behavior IronInput
*/
public void setObservers(JsArray value) {
getPolymerElement().setObservers(value);
}
/**
* The iron-input-validate
event is fired whenever validate()
is called.
*
* JavaScript Info:
* @event iron-input-validate
*/
public HandlerRegistration addIronInputValidateHandler(IronInputValidateEventHandler handler) {
return addHandler(handler, IronInputValidateEvent.TYPE);
}
}