com.vaadin.polymer.paper.widget.PaperMenuButton Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from paper-menu-button 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.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.*;
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 buttons
* paper-menu-button
allows one to compose a designated “trigger” element with
another element that represents “content”, to create a dropdown menu that
displays the “content” when the “trigger” is clicked.
* The child element with the class dropdown-trigger
will be used as the
“trigger” element. The child element with the class dropdown-content
will be
used as the “content” element.
* The paper-menu-button
is sensitive to its content’s iron-select
events. If
the “content” element triggers an iron-select
event, the paper-menu-button
will close automatically.
* Example:
* <paper-menu-button>
* <paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
* <paper-menu class="dropdown-content">
* <paper-item>Share</paper-item>
* <paper-item>Settings</paper-item>
* <paper-item>Help</paper-item>
* </paper-menu>
* </paper-menu-button>
*
*
*
Styling
* The following custom properties and mixins are also available for styling:
*
*
*
* Custom property
* Description
* Default
*
*
*
*
* --paper-menu-button-dropdown-background
* Background color of the paper-menu-button dropdown
* --primary-background-color
*
*
* --paper-menu-button
* Mixin applied to the paper-menu-button
* {}
*
*
* --paper-menu-button-disabled
* Mixin applied to the paper-menu-button when disabled
* {}
*
*
* --paper-menu-button-dropdown
* Mixin applied to the paper-menu-button dropdown
* {}
*
*
* --paper-menu-button-content
* Mixin applied to the paper-menu-button content
* {}
*
*
*
*/
public class PaperMenuButton extends PolymerWidget {
/**
* Default Constructor.
*/
public PaperMenuButton() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public PaperMenuButton(String html) {
super(PaperMenuButtonElement.TAG, PaperMenuButtonElement.SRC, html);
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public PaperMenuButtonElement getPolymerElement() {
return (PaperMenuButtonElement) getElement();
}
/**
* 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);
}
/**
* A pixel value that will be added to the position calculated for the
given horizontalAlign
. Use a negative value to offset to the
left, or a positive value to offset to the right.
*
* JavaScript Info:
* @property horizontalOffset
* @type Number
*
*/
public double getHorizontalOffset() {
return getPolymerElement().getHorizontalOffset();
}
/**
* A pixel value that will be added to the position calculated for the
given horizontalAlign
. Use a negative value to offset to the
left, or a positive value to offset to the right.
*
* JavaScript Info:
* @property horizontalOffset
* @type Number
*
*/
public void setHorizontalOffset(double value) {
getPolymerElement().setHorizontalOffset(value);
}
/**
* An animation config. If provided, this will be used to animate the
opening of the dropdown.
*
* JavaScript Info:
* @property openAnimationConfig
* @type Object
*
*/
public JavaScriptObject getOpenAnimationConfig() {
return getPolymerElement().getOpenAnimationConfig();
}
/**
* An animation config. If provided, this will be used to animate the
opening of the dropdown.
*
* JavaScript Info:
* @property openAnimationConfig
* @type Object
*
*/
public void setOpenAnimationConfig(JavaScriptObject value) {
getPolymerElement().setOpenAnimationConfig(value);
}
/**
* An animation config. If provided, this will be used to animate the
closing of the dropdown.
*
* JavaScript Info:
* @property closeAnimationConfig
* @type Object
*
*/
public JavaScriptObject getCloseAnimationConfig() {
return getPolymerElement().getCloseAnimationConfig();
}
/**
* An animation config. If provided, this will be used to animate the
closing of the dropdown.
*
* JavaScript Info:
* @property closeAnimationConfig
* @type Object
*
*/
public void setCloseAnimationConfig(JavaScriptObject value) {
getPolymerElement().setCloseAnimationConfig(value);
}
/**
* To be used to express what combination of keys will trigger the relative
callback. e.g. keyBindings: { 'esc': '_onEscPressed'}
*
* JavaScript Info:
* @property keyBindings
* @type !Object
* @behavior VaadinDatePicker
*/
public JavaScriptObject getKeyBindings() {
return getPolymerElement().getKeyBindings();
}
/**
* To be used to express what combination of keys will trigger the relative
callback. e.g. keyBindings: { 'esc': '_onEscPressed'}
*
* JavaScript Info:
* @property keyBindings
* @type !Object
* @behavior VaadinDatePicker
*/
public void setKeyBindings(JavaScriptObject value) {
getPolymerElement().setKeyBindings(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);
}
/**
* A pixel value that will be added to the position calculated for the
given verticalAlign
. Use a negative value to offset towards the
top, or a positive value to offset towards the bottom.
*
* JavaScript Info:
* @property verticalOffset
* @type Number
*
*/
public double getVerticalOffset() {
return getPolymerElement().getVerticalOffset();
}
/**
* A pixel value that will be added to the position calculated for the
given verticalAlign
. Use a negative value to offset towards the
top, or a positive value to offset towards the bottom.
*
* JavaScript Info:
* @property verticalOffset
* @type Number
*
*/
public void setVerticalOffset(double value) {
getPolymerElement().setVerticalOffset(value);
}
/**
* Set to true to disable automatically closing the dropdown after
a selection has been made.
*
* JavaScript Info:
* @property ignoreSelect
* @type Boolean
*
*/
public boolean getIgnoreSelect() {
return getPolymerElement().getIgnoreSelect();
}
/**
* Set to true to disable automatically closing the dropdown after
a selection has been made.
*
* JavaScript Info:
* @property ignoreSelect
* @type Boolean
*
*/
public void setIgnoreSelect(boolean value) {
getPolymerElement().setIgnoreSelect(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, the dropdown will be positioned so that it doesn’t overlap
the button.
*
* JavaScript Info:
* @property noOverlap
* @type Boolean
*
*/
public boolean getNoOverlap() {
return getPolymerElement().getNoOverlap();
}
/**
* If true, the dropdown will be positioned so that it doesn’t overlap
the button.
*
* JavaScript Info:
* @property noOverlap
* @type Boolean
*
*/
public void setNoOverlap(boolean value) {
getPolymerElement().setNoOverlap(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 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 content is currently displayed.
*
* JavaScript Info:
* @property opened
* @type Boolean
*
*/
public boolean getOpened() {
return getPolymerElement().getOpened();
}
/**
* True if the content is currently displayed.
*
* JavaScript Info:
* @property opened
* @type Boolean
*
*/
public void setOpened(boolean value) {
getPolymerElement().setOpened(value);
}
/**
* Whether focus should be restored to the button when the menu closes.
*
* JavaScript Info:
* @property restoreFocusOnClose
* @type Boolean
*
*/
public boolean getRestoreFocusOnClose() {
return getPolymerElement().getRestoreFocusOnClose();
}
/**
* Whether focus should be restored to the button when the menu closes.
*
* JavaScript Info:
* @property restoreFocusOnClose
* @type Boolean
*
*/
public void setRestoreFocusOnClose(boolean value) {
getPolymerElement().setRestoreFocusOnClose(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, 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 enable automatically closing the dropdown after an
item has been activated, even if the selection did not change.
*
* JavaScript Info:
* @property closeOnActivate
* @type Boolean
*
*/
public boolean getCloseOnActivate() {
return getPolymerElement().getCloseOnActivate();
}
/**
* Set to true to enable automatically closing the dropdown after an
item has been activated, even if the selection did not change.
*
* JavaScript Info:
* @property closeOnActivate
* @type Boolean
*
*/
public void setCloseOnActivate(boolean value) {
getPolymerElement().setCloseOnActivate(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);
}
// Needed in UIBinder
/**
* An animation config. If provided, this will be used to animate the
closing of the dropdown.
*
* JavaScript Info:
* @attribute close-animation-config
*
*/
public void setCloseAnimationConfig(String value) {
Polymer.property(this.getPolymerElement(), "closeAnimationConfig", value);
}
// Needed in UIBinder
/**
* To be used to express what combination of keys will trigger the relative
callback. e.g. keyBindings: { 'esc': '_onEscPressed'}
*
* JavaScript Info:
* @attribute key-bindings
* @behavior VaadinDatePicker
*/
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
/**
* A pixel value that will be added to the position calculated for the
given horizontalAlign
. Use a negative value to offset to the
left, or a positive value to offset to the right.
*
* JavaScript Info:
* @attribute horizontal-offset
*
*/
public void setHorizontalOffset(String value) {
Polymer.property(this.getPolymerElement(), "horizontalOffset", value);
}
// Needed in UIBinder
/**
* A pixel value that will be added to the position calculated for the
given verticalAlign
. Use a negative value to offset towards the
top, or a positive value to offset towards the bottom.
*
* JavaScript Info:
* @attribute vertical-offset
*
*/
public void setVerticalOffset(String value) {
Polymer.property(this.getPolymerElement(), "verticalOffset", value);
}
// Needed in UIBinder
/**
* An animation config. If provided, this will be used to animate the
opening of the dropdown.
*
* JavaScript Info:
* @attribute open-animation-config
*
*/
public void setOpenAnimationConfig(String value) {
Polymer.property(this.getPolymerElement(), "openAnimationConfig", 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);
}
/**
* Hide the dropdown content.
*
* JavaScript Info:
* @method close
*
*
*/
public void close() {
getPolymerElement().close();
}
/**
* When called, will remove all imperatively-added key bindings.
*
* JavaScript Info:
* @method removeOwnKeyBindings
* @behavior VaadinDatePicker
*
*/
public void removeOwnKeyBindings() {
getPolymerElement().removeOwnKeyBindings();
}
/**
* Make the dropdown content appear as an overlay positioned relative
to the dropdown trigger.
*
* JavaScript Info:
* @method open
*
*
*/
public void open() {
getPolymerElement().open();
}
/**
* Toggles the drowpdown content between opened and closed.
*
* JavaScript Info:
* @method toggle
*
*
*/
public void toggle() {
getPolymerElement().toggle();
}
/**
* 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);
}
/**
* Fired when the dropdown closes.
*
* JavaScript Info:
* @event paper-dropdown-close
*/
public HandlerRegistration addPaperDropdownCloseHandler(PaperDropdownCloseEventHandler handler) {
return addDomHandler(handler, PaperDropdownCloseEvent.TYPE);
}
/**
* Fired when the dropdown opens.
*
* JavaScript Info:
* @event paper-dropdown-open
*/
public HandlerRegistration addPaperDropdownOpenHandler(PaperDropdownOpenEventHandler handler) {
return addDomHandler(handler, PaperDropdownOpenEvent.TYPE);
}
}