com.vaadin.polymer.paper.widget.PaperDropdownMenu Maven / Gradle / Ivy
/*
* 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.element.*;
import com.vaadin.polymer.paper.widget.event.PaperDropdownCloseEvent;
import com.vaadin.polymer.paper.widget.event.PaperDropdownCloseEventHandler;
import com.vaadin.polymer.paper.widget.event.PaperDropdownOpenEvent;
import com.vaadin.polymer.paper.widget.event.PaperDropdownOpenEventHandler;
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;
/**
* 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.
* The child element with the class dropdown-content
will be used as the dropdown
menu. It could be a paper-menu
or element that triggers iron-select
when
selecting its children.
* Example:
* <paper-dropdown-menu label="Your favourite pastry">
* <paper-menu class="dropdown-content">
* <paper-item>Croissant</paper-item>
* <paper-item>Donut</paper-item>
* <paper-item>Financier</paper-item>
* <paper-item>Madeleine</paper-item>
* </paper-menu>
* </paper-dropdown-menu>
*
*
*
This example renders a dropdown menu with 4 options.
* Styling
* The following custom properties and mixins are also available for styling:
*
*
*
* Custom property
* Description
* Default
*
*
*
*
* --paper-dropdown-menu
* A mixin that is applied to the element host
* {}
*
*
* --paper-dropdown-menu-disabled
* A mixin that is applied to the element host when disabled
* {}
*
*
* --paper-dropdown-menu-ripple
* A mixin that is applied to the internal ripple
* {}
*
*
* --paper-dropdown-menu-button
* A mixin that is applied to the internal menu button
* {}
*
*
* --paper-dropdown-menu-input
* A mixin that is applied to the internal paper input
* {}
*
*
* --paper-dropdown-menu-icon
* A 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);
getPolymerElement().addEventListener(
com.vaadin.polymer.paper.element.event.PaperDropdownCloseEvent.NAME,
new com.vaadin.polymer.paper.element.event.PaperDropdownCloseEvent.Listener() {
@Override
protected void handleEvent(com.vaadin.polymer.paper.element.event.PaperDropdownCloseEvent event) {
fireEvent(new PaperDropdownCloseEvent(event));
}
});
getPolymerElement().addEventListener(
com.vaadin.polymer.paper.element.event.PaperDropdownOpenEvent.NAME,
new com.vaadin.polymer.paper.element.event.PaperDropdownOpenEvent.Listener() {
@Override
protected void handleEvent(com.vaadin.polymer.paper.element.event.PaperDropdownOpenEvent event) {
fireEvent(new PaperDropdownOpenEvent(event));
}
});
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public PaperDropdownMenuElement getPolymerElement() {
try {
return (PaperDropdownMenuElement) getElement();
} catch (ClassCastException e) {
jsinteropError();
return null;
}
}
/**
* 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);
}
/**
* Hide the dropdown content.
*
* JavaScript Info:
* @method close
*
*/
public void close() {
getPolymerElement().close();
}
/**
* The content element that is contained by the dropdown menu, if any.
*
* JavaScript Info:
* @method contentElement
*
*/
public void contentElement() {
getPolymerElement().contentElement();
}
/**
*
*
* 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 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* Show the dropdown content.
*
* JavaScript Info:
* @method open
*
*/
public void open() {
getPolymerElement().open();
}
/**
* 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);
}
/**
* 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 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 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) {
getPolymerElement().setAttribute("selected-item", 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);
}
/**
*
*
* JavaScript Info:
* @method attached
*
*/
public void attached() {
getPolymerElement().attached();
}
/**
*
*
* JavaScript Info:
* @property hostAttributes
* @type Object
*
*/
public JavaScriptObject getHostAttributes(){
return getPolymerElement().getHostAttributes();
}
/**
*
*
* JavaScript Info:
* @property hostAttributes
* @type Object
*
*/
public void setHostAttributes(JavaScriptObject value) {
getPolymerElement().setHostAttributes(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);
}
/**
* 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);
}
/**
* 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);
}
/**
*
*
* JavaScript Info:
* @property observers
* @type Array
* @behavior PaperTab
*/
public JsArray getObservers(){
return getPolymerElement().getObservers();
}
/**
*
*
* JavaScript Info:
* @property observers
* @type Array
* @behavior PaperTab
*/
public void setObservers(JsArray value) {
getPolymerElement().setObservers(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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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 PaperTab
*/
public void addOwnKeyBinding(JavaScriptObject eventString, JavaScriptObject handlerName) {
getPolymerElement().addOwnKeyBinding(eventString, handlerName);
}
/**
* The HTMLElement that will be firing relevant KeyboardEvents.
*
* JavaScript Info:
* @property keyEventTarget
* @type Object
* @behavior PaperTab
*/
public JavaScriptObject getKeyEventTarget(){
return getPolymerElement().getKeyEventTarget();
}
/**
* The HTMLElement that will be firing relevant KeyboardEvents.
*
* JavaScript Info:
* @property keyEventTarget
* @type Object
* @behavior PaperTab
*/
public void setKeyEventTarget(JavaScriptObject value) {
getPolymerElement().setKeyEventTarget(value);
}
/**
* The HTMLElement that will be firing relevant KeyboardEvents.
*
* JavaScript Info:
* @attribute key-event-target
* @behavior PaperTab
*/
public void setKeyEventTarget(String value) {
getPolymerElement().setAttribute("key-event-target", value);
}
/**
*
*
* JavaScript Info:
* @method keyboardEventMatchesKeys
* @param {} event
* @param {} eventString
* @behavior PaperTab
*/
public void keyboardEventMatchesKeys(JavaScriptObject event, JavaScriptObject eventString) {
getPolymerElement().keyboardEventMatchesKeys(event, eventString);
}
/**
* When called, will remove all imperatively-added key bindings.
*
* JavaScript Info:
* @method removeOwnKeyBindings
* @behavior PaperTab
*/
public void removeOwnKeyBindings() {
getPolymerElement().removeOwnKeyBindings();
}
/**
*
*
* JavaScript Info:
* @method detached
* @behavior PaperTab
*/
public void detached() {
getPolymerElement().detached();
}
/**
*
*
* JavaScript Info:
* @method registered
* @behavior PaperTab
*/
public void registered() {
getPolymerElement().registered();
}
/**
* Fired when the dropdown closes.
*
* JavaScript Info:
* @event paper-dropdown-close
*/
public HandlerRegistration addPaperDropdownCloseHandler(PaperDropdownCloseEventHandler handler) {
return addHandler(handler, PaperDropdownCloseEvent.TYPE);
}
/**
* Fired when the dropdown opens.
*
* JavaScript Info:
* @event paper-dropdown-open
*/
public HandlerRegistration addPaperDropdownOpenHandler(PaperDropdownOpenEventHandler handler) {
return addHandler(handler, PaperDropdownOpenEvent.TYPE);
}
}