All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.polymer.iron.widget.IronInput Maven / Gradle / Ivy

The newest version!
/*
 * 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.*;

import com.vaadin.polymer.iron.widget.event.IronInputValidateEvent;
import com.vaadin.polymer.iron.widget.event.IronInputValidateEventHandler;

import com.vaadin.polymer.*;
import com.vaadin.polymer.elemental.*;
import com.vaadin.polymer.PolymerWidget;
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-invalid-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); } /** * Gets a handle to the Polymer object's underlying DOM element. */ public IronInputElement getPolymerElement() { return (IronInputElement) getElement(); } /** *

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 * */ public boolean getPreventInvalidInput() { return getPolymerElement().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 * */ public void setPreventInvalidInput(boolean value) { getPolymerElement().setPreventInvalidInput(value); } /** *

True if the last call to validate is invalid.

* * JavaScript Info: * @property invalid * @type Boolean * @behavior VaadinDatePicker */ public boolean getInvalid() { return getPolymerElement().getInvalid(); } /** *

True if the last call to validate is invalid.

* * JavaScript Info: * @property invalid * @type Boolean * @behavior VaadinDatePicker */ public void setInvalid(boolean value) { getPolymerElement().setInvalid(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); } /** *

Name of the validator to use.

* * JavaScript Info: * @property validator * @type String * @behavior VaadinDatePicker */ public String getValidator() { return getPolymerElement().getValidator(); } /** *

Name of the validator to use.

* * JavaScript Info: * @property validator * @type String * @behavior VaadinDatePicker */ public void setValidator(String value) { getPolymerElement().setValidator(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 */ public String getValidatorType() { return getPolymerElement().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 */ public void setValidatorType(String value) { getPolymerElement().setValidatorType(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 * */ public String getAllowedPattern() { return getPolymerElement().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 * */ public void setAllowedPattern(String value) { getPolymerElement().setAllowedPattern(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} */ public boolean validate() { return getPolymerElement().validate(); } /** * * * JavaScript Info: * @method hasValidator * @behavior VaadinDatePicker * @return {boolean} */ public boolean hasValidator() { return getPolymerElement().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} */ public boolean validate(JavaScriptObject value) { return getPolymerElement().validate(value); } /** *

The iron-input-validate event is fired whenever validate() is called.

* * JavaScript Info: * @event iron-input-validate */ public HandlerRegistration addIronInputValidateHandler(IronInputValidateEventHandler handler) { return addDomHandler(handler, IronInputValidateEvent.TYPE); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy