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

com.vaadin.polymer.paper.widget.PaperDropdownMenu Maven / Gradle / Ivy

The newest version!
/*
 * This code was generated with Vaadin Web Component GWT API Generator, 
 * from paper-dropdown-menu project by The Polymer Authors
 * that is licensed with http://polymer.github.io/LICENSE.txt license.
 */
package com.vaadin.polymer.paper.widget;

import com.vaadin.polymer.paper.*;

import com.vaadin.polymer.iron.widget.event.IronFormElementRegisterEvent;
import com.vaadin.polymer.iron.widget.event.IronFormElementRegisterEventHandler;

import com.vaadin.polymer.iron.widget.event.IronFormElementUnregisterEvent;
import com.vaadin.polymer.iron.widget.event.IronFormElementUnregisterEventHandler;

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;

/**
 * 

Material design: Dropdown menus

*

paper-dropdown-menu is similar to a native browser select element.
paper-dropdown-menu works with selectable content. The currently selected
item is displayed in the control. If no item is selected, the label is
displayed instead.

*

Example:

*
<paper-dropdown-menu label="Your favourite pastry">
 *   <paper-listbox class="dropdown-content">
 *     <paper-item>Croissant</paper-item>
 *     <paper-item>Donut</paper-item>
 *     <paper-item>Financier</paper-item>
 *     <paper-item>Madeleine</paper-item>
 *   </paper-listbox>
 * </paper-dropdown-menu>
 * 
 * 
 * 

This example renders a dropdown menu with 4 options.

*

The child element with the class dropdown-content is used as the dropdown
menu. This can be a paper-listbox, or any other or
element that acts like an iron-selector.

*

Specifically, the menu child must fire an
iron-select event when one of its
children is selected, and an iron-deselect
event when a child is deselected. The selected or deselected item must
be passed as the event’s detail.item property.

*

Applications can listen for the iron-select and iron-deselect events
to react when options are selected and deselected.

*

Styling

*

The following custom properties and mixins are also available for styling:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Custom propertyDescriptionDefault
--paper-dropdown-menuA mixin that is applied to the element host{}
--paper-dropdown-menu-disabledA mixin that is applied to the element host when disabled{}
--paper-dropdown-menu-rippleA mixin that is applied to the internal ripple{}
--paper-dropdown-menu-buttonA mixin that is applied to the internal menu button{}
--paper-dropdown-menu-inputA mixin that is applied to the internal paper input{}
--paper-dropdown-menu-iconA mixin that is applied to the internal icon{}
*

You can also use any of the paper-input-container and paper-menu-button
style mixins and custom properties to style the internal input and menu button
respectively.

*/ public class PaperDropdownMenu extends PolymerWidget { /** * Default Constructor. */ public PaperDropdownMenu() { this(""); } /** * Constructor used by UIBinder to create widgets with content. */ public PaperDropdownMenu(String html) { super(PaperDropdownMenuElement.TAG, PaperDropdownMenuElement.SRC, html); } /** * Gets a handle to the Polymer object's underlying DOM element. */ public PaperDropdownMenuElement getPolymerElement() { return (PaperDropdownMenuElement) getElement(); } /** *

If true, the user is currently holding down the button.

* * JavaScript Info: * @property pressed * @type Boolean * @behavior PaperTab */ public boolean getPressed() { return getPolymerElement().getPressed(); } /** *

If true, the user is currently holding down the button.

* * JavaScript Info: * @property pressed * @type Boolean * @behavior PaperTab */ public void setPressed(boolean value) { getPolymerElement().setPressed(value); } /** * * * JavaScript Info: * @property keyBindings * @type Object * */ public JavaScriptObject getKeyBindings() { return getPolymerElement().getKeyBindings(); } /** * * * JavaScript Info: * @property keyBindings * @type Object * */ public void setKeyBindings(JavaScriptObject value) { getPolymerElement().setKeyBindings(value); } /** *

The last selected item. An item is selected if the dropdown menu has
a child with class dropdown-content, and that child triggers an
iron-select event with the selected item in the detail.

* * JavaScript Info: * @property selectedItem * @type ?Object * */ public JavaScriptObject getSelectedItem() { return getPolymerElement().getSelectedItem(); } /** *

The last selected item. An item is selected if the dropdown menu has
a child with class dropdown-content, and that child triggers an
iron-select event with the selected item in the detail.

* * JavaScript Info: * @property selectedItem * @type ?Object * */ public void setSelectedItem(JavaScriptObject value) { getPolymerElement().setSelectedItem(value); } /** *

The EventTarget that will be firing relevant KeyboardEvents. Set it to
null to disable the listeners.

* * JavaScript Info: * @property keyEventTarget * @type ?EventTarget * @behavior VaadinDatePicker */ public JavaScriptObject getKeyEventTarget() { return getPolymerElement().getKeyEventTarget(); } /** *

The EventTarget that will be firing relevant KeyboardEvents. Set it to
null to disable the listeners.

* * JavaScript Info: * @property keyEventTarget * @type ?EventTarget * @behavior VaadinDatePicker */ public void setKeyEventTarget(JavaScriptObject value) { getPolymerElement().setKeyEventTarget(value); } /** *

If true, the button is a toggle and is currently in the active state.

* * JavaScript Info: * @property active * @type Boolean * @behavior PaperTab */ public boolean getActive() { return getPolymerElement().getActive(); } /** *

If true, the button is a toggle and is currently in the active state.

* * JavaScript Info: * @property active * @type Boolean * @behavior PaperTab */ public void setActive(boolean value) { getPolymerElement().setActive(value); } /** *

True if the dropdown is open. Otherwise, false.

* * JavaScript Info: * @property opened * @type Boolean * */ public boolean getOpened() { return getPolymerElement().getOpened(); } /** *

True if the dropdown is open. Otherwise, false.

* * JavaScript Info: * @property opened * @type Boolean * */ public void setOpened(boolean value) { getPolymerElement().setOpened(value); } /** *

If true, the horizontalAlign and verticalAlign properties will
be considered preferences instead of strict requirements when
positioning the dropdown and may be changed if doing so reduces
the area of the dropdown falling outside of fitInto.

* * JavaScript Info: * @property dynamicAlign * @type Boolean * */ public boolean getDynamicAlign() { return getPolymerElement().getDynamicAlign(); } /** *

If true, the horizontalAlign and verticalAlign properties will
be considered preferences instead of strict requirements when
positioning the dropdown and may be changed if doing so reduces
the area of the dropdown falling outside of fitInto.

* * JavaScript Info: * @property dynamicAlign * @type Boolean * */ public void setDynamicAlign(boolean value) { getPolymerElement().setDynamicAlign(value); } /** *

True if the element is currently being pressed by a “pointer,” which
is loosely defined as mouse or touch input (but specifically excluding
keyboard input).

* * JavaScript Info: * @property pointerDown * @type Boolean * @behavior PaperTab */ public boolean getPointerDown() { return getPolymerElement().getPointerDown(); } /** *

True if the element is currently being pressed by a “pointer,” which
is loosely defined as mouse or touch input (but specifically excluding
keyboard input).

* * JavaScript Info: * @property pointerDown * @type Boolean * @behavior PaperTab */ public void setPointerDown(boolean value) { getPolymerElement().setPointerDown(value); } /** *

Set to true to always float the label. Bind this to the
<paper-input-container>‘s alwaysFloatLabel property.

* * JavaScript Info: * @property alwaysFloatLabel * @type Boolean * */ public boolean getAlwaysFloatLabel() { return getPolymerElement().getAlwaysFloatLabel(); } /** *

Set to true to always float the label. Bind this to the
<paper-input-container>‘s alwaysFloatLabel property.

* * JavaScript Info: * @property alwaysFloatLabel * @type Boolean * */ public void setAlwaysFloatLabel(boolean value) { getPolymerElement().setAlwaysFloatLabel(value); } /** *

True if the input device that caused the element to receive focus
was a keyboard.

* * JavaScript Info: * @property receivedFocusFromKeyboard * @type Boolean * @behavior PaperTab */ public boolean getReceivedFocusFromKeyboard() { return getPolymerElement().getReceivedFocusFromKeyboard(); } /** *

True if the input device that caused the element to receive focus
was a keyboard.

* * JavaScript Info: * @property receivedFocusFromKeyboard * @type Boolean * @behavior PaperTab */ public void setReceivedFocusFromKeyboard(boolean value) { getPolymerElement().setReceivedFocusFromKeyboard(value); } /** *

If true, the button toggles the active state with each tap or press
of the spacebar.

* * JavaScript Info: * @property toggles * @type Boolean * @behavior PaperTab */ public boolean getToggles() { return getPolymerElement().getToggles(); } /** *

If true, the button toggles the active state with each tap or press
of the spacebar.

* * JavaScript Info: * @property toggles * @type Boolean * @behavior PaperTab */ public void setToggles(boolean value) { getPolymerElement().setToggles(value); } /** *

Whether focus should be restored to the dropdown when the menu closes.

* * JavaScript Info: * @property restoreFocusOnClose * @type Boolean * */ public boolean getRestoreFocusOnClose() { return getPolymerElement().getRestoreFocusOnClose(); } /** *

Whether focus should be restored to the dropdown when the menu closes.

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

Set to true to mark the input as required. If used in a form, a
custom element that uses this behavior should also use
Polymer.IronValidatableBehavior and define a custom validation method.
Otherwise, a required element will always be considered valid.
It’s also strongly recommended to provide a visual style for the element
when its value is invalid.

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

Set to true to mark the input as required. If used in a form, a
custom element that uses this behavior should also use
Polymer.IronValidatableBehavior and define a custom validation method.
Otherwise, a required element will always be considered valid.
It’s also strongly recommended to provide a visual style for the element
when its value is invalid.

* * JavaScript Info: * @property required * @type Boolean * @behavior VaadinDatePicker */ public void setRequired(boolean value) { getPolymerElement().setRequired(value); } /** *

If true, the element currently has focus.

* * JavaScript Info: * @property focused * @type Boolean * @behavior PaperTab */ public boolean getFocused() { return getPolymerElement().getFocused(); } /** *

If true, the element currently has focus.

* * JavaScript Info: * @property focused * @type Boolean * @behavior PaperTab */ public void setFocused(boolean value) { getPolymerElement().setFocused(value); } /** *

If true, the user cannot interact with this element.

* * JavaScript Info: * @property disabled * @type Boolean * @behavior PaperTab */ public boolean getDisabled() { return getPolymerElement().getDisabled(); } /** *

If true, the user cannot interact with this element.

* * JavaScript Info: * @property disabled * @type Boolean * @behavior PaperTab */ public void setDisabled(boolean value) { getPolymerElement().setDisabled(value); } /** *

Set to true to disable animations when opening and closing the
dropdown.

* * JavaScript Info: * @property noAnimations * @type Boolean * */ public boolean getNoAnimations() { return getPolymerElement().getNoAnimations(); } /** *

Set to true to disable animations when opening and closing the
dropdown.

* * JavaScript Info: * @property noAnimations * @type Boolean * */ public void setNoAnimations(boolean value) { getPolymerElement().setNoAnimations(value); } /** *

If true, this property will cause the implementing element to
automatically stop propagation on any handled KeyboardEvents.

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

If true, this property will cause the implementing element to
automatically stop propagation on any handled KeyboardEvents.

* * JavaScript Info: * @property stopKeyboardEventPropagation * @type Boolean * @behavior VaadinDatePicker */ public void setStopKeyboardEventPropagation(boolean value) { getPolymerElement().setStopKeyboardEventPropagation(value); } /** *

Set to true to disable the floating label. Bind this to the
<paper-input-container>‘s noLabelFloat property.

* * JavaScript Info: * @property noLabelFloat * @type Boolean * */ public boolean getNoLabelFloat() { return getPolymerElement().getNoLabelFloat(); } /** *

Set to true to disable the floating label. Bind this to the
<paper-input-container>‘s noLabelFloat property.

* * JavaScript Info: * @property noLabelFloat * @type Boolean * */ public void setNoLabelFloat(boolean value) { getPolymerElement().setNoLabelFloat(value); } /** *

By default, the dropdown will constrain scrolling on the page
to itself when opened.
Set to true in order to prevent scroll from being constrained
to the dropdown when it opens.

* * JavaScript Info: * @property allowOutsideScroll * @type Boolean * */ public boolean getAllowOutsideScroll() { return getPolymerElement().getAllowOutsideScroll(); } /** *

By default, the dropdown will constrain scrolling on the page
to itself when opened.
Set to true in order to prevent scroll from being constrained
to the dropdown when it opens.

* * JavaScript Info: * @property allowOutsideScroll * @type Boolean * */ public void setAllowOutsideScroll(boolean value) { getPolymerElement().setAllowOutsideScroll(value); } /** *

The aria attribute to be set if the button is a toggle and in the
active state.

* * JavaScript Info: * @property ariaActiveAttribute * @type String * @behavior PaperTab */ public String getAriaActiveAttribute() { return getPolymerElement().getAriaActiveAttribute(); } /** *

The aria attribute to be set if the button is a toggle and in the
active state.

* * JavaScript Info: * @property ariaActiveAttribute * @type String * @behavior PaperTab */ public void setAriaActiveAttribute(String value) { getPolymerElement().setAriaActiveAttribute(value); } /** *

The value for this element that will be used when submitting in
a form. It is read only, and will always have the same value
as selectedItemLabel.

* * JavaScript Info: * @property value * @type String * */ public String getValue() { return getPolymerElement().getValue(); } /** *

The value for this element that will be used when submitting in
a form. It is read only, and will always have the same value
as selectedItemLabel.

* * JavaScript Info: * @property value * @type String * */ public void setValue(String value) { getPolymerElement().setValue(value); } /** *

The name of this element.

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

The name of this element.

* * JavaScript Info: * @property name * @type String * @behavior VaadinDatePicker */ public void setName(String value) { getPolymerElement().setName(value); } /** *

The derived “label” of the currently selected item. This value
is the label property on the selected item if set, or else the
trimmed text content of the selected item.

* * JavaScript Info: * @property selectedItemLabel * @type String * */ public String getSelectedItemLabel() { return getPolymerElement().getSelectedItemLabel(); } /** *

The derived “label” of the currently selected item. This value
is the label property on the selected item if set, or else the
trimmed text content of the selected item.

* * JavaScript Info: * @property selectedItemLabel * @type String * */ public void setSelectedItemLabel(String value) { getPolymerElement().setSelectedItemLabel(value); } /** *

The placeholder for the dropdown.

* * JavaScript Info: * @property placeholder * @type String * */ public String getPlaceholder() { return getPolymerElement().getPlaceholder(); } /** *

The placeholder for the dropdown.

* * JavaScript Info: * @property placeholder * @type String * */ public void setPlaceholder(String value) { getPolymerElement().setPlaceholder(value); } /** *

The orientation against which to align the menu dropdown
vertically relative to the dropdown trigger.

* * JavaScript Info: * @property verticalAlign * @type String * */ public String getVerticalAlign() { return getPolymerElement().getVerticalAlign(); } /** *

The orientation against which to align the menu dropdown
vertically relative to the dropdown trigger.

* * JavaScript Info: * @property verticalAlign * @type String * */ public void setVerticalAlign(String value) { getPolymerElement().setVerticalAlign(value); } /** *

The orientation against which to align the menu dropdown
horizontally relative to the dropdown trigger.

* * JavaScript Info: * @property horizontalAlign * @type String * */ public String getHorizontalAlign() { return getPolymerElement().getHorizontalAlign(); } /** *

The orientation against which to align the menu dropdown
horizontally relative to the dropdown trigger.

* * JavaScript Info: * @property horizontalAlign * @type String * */ public void setHorizontalAlign(String value) { getPolymerElement().setHorizontalAlign(value); } /** *

The error message to display when invalid.

* * JavaScript Info: * @property errorMessage * @type String * */ public String getErrorMessage() { return getPolymerElement().getErrorMessage(); } /** *

The error message to display when invalid.

* * JavaScript Info: * @property errorMessage * @type String * */ public void setErrorMessage(String value) { getPolymerElement().setErrorMessage(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); } /** *

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); } /** *

The label for the dropdown.

* * JavaScript Info: * @property label * @type String * */ public String getLabel() { return getPolymerElement().getLabel(); } /** *

The label for the dropdown.

* * JavaScript Info: * @property label * @type String * */ public void setLabel(String value) { getPolymerElement().setLabel(value); } // Needed in UIBinder /** * * * JavaScript Info: * @attribute key-bindings * @behavior PaperTab */ public void setKeyBindings(String value) { Polymer.property(this.getPolymerElement(), "keyBindings", value); } // Needed in UIBinder /** *

The EventTarget that will be firing relevant KeyboardEvents. Set it to
null to disable the listeners.

* * JavaScript Info: * @attribute key-event-target * @behavior VaadinDatePicker */ public void setKeyEventTarget(String value) { Polymer.property(this.getPolymerElement(), "keyEventTarget", value); } // Needed in UIBinder /** *

The last selected item. An item is selected if the dropdown menu has
a child with class dropdown-content, and that child triggers an
iron-select event with the selected item in the detail.

* * JavaScript Info: * @attribute selected-item * */ public void setSelectedItem(String value) { Polymer.property(this.getPolymerElement(), "selectedItem", value); } /** *

Can be used to imperatively add a key binding to the implementing
element. This is the imperative equivalent of declaring a keybinding
in the keyBindings prototype property.

* * JavaScript Info: * @method addOwnKeyBinding * @param {} eventString * @param {} handlerName * @behavior VaadinDatePicker * */ public void addOwnKeyBinding(Object eventString, Object handlerName) { getPolymerElement().addOwnKeyBinding(eventString, handlerName); } /** * * * JavaScript Info: * @method hasValidator * @behavior VaadinDatePicker * @return {boolean} */ public boolean hasValidator() { return getPolymerElement().hasValidator(); } /** *

Hide the dropdown content.

* * JavaScript Info: * @method close * * */ public void close() { getPolymerElement().close(); } /** *

Show the dropdown content.

* * JavaScript Info: * @method open * * */ public void open() { getPolymerElement().open(); } /** *

When called, will remove all imperatively-added key bindings.

* * JavaScript Info: * @method removeOwnKeyBindings * @behavior VaadinDatePicker * */ public void removeOwnKeyBindings() { getPolymerElement().removeOwnKeyBindings(); } /** *

Returns true if a keyboard event matches eventString.

* * JavaScript Info: * @method keyboardEventMatchesKeys * @param {KeyboardEvent} event * @param {string} eventString * @behavior VaadinDatePicker * @return {boolean} */ public boolean keyboardEventMatchesKeys(JavaScriptObject event, String eventString) { return getPolymerElement().keyboardEventMatchesKeys(event, eventString); } /** *

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); } /** *

Fired when the element is added to an iron-form.

* * JavaScript Info: * @event iron-form-element-register */ public HandlerRegistration addIronFormElementRegisterHandler(IronFormElementRegisterEventHandler handler) { return addDomHandler(handler, IronFormElementRegisterEvent.TYPE); } /** *

Fired when the element is removed from an iron-form.

* * JavaScript Info: * @event iron-form-element-unregister */ public HandlerRegistration addIronFormElementUnregisterHandler(IronFormElementUnregisterEventHandler handler) { return addDomHandler(handler, IronFormElementUnregisterEvent.TYPE); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy