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 MIT 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-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
* #fff
*
*
* --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
* {}
*
*
*
*/
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);
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 PaperMenuButtonElement getPolymerElement() {
try {
return (PaperMenuButtonElement) getElement();
} catch (ClassCastException e) {
jsinteropError();
return null;
}
}
/**
* Hide the dropdown content.
*
* JavaScript Info:
* @method close
*
*/
public void close() {
getPolymerElement().close();
}
/**
* 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);
}
/**
* 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) {
getPolymerElement().setAttribute("close-animation-config", value);
}
/**
* The content element that is contained by the menu button, if any.
*
* JavaScript Info:
* @method contentElement
*
*/
public void contentElement() {
getPolymerElement().contentElement();
}
/**
* 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);
}
/**
* 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);
}
/**
* 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) {
getPolymerElement().setAttribute("horizontal-offset", 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);
}
/**
* Make the dropdown content appear as an overlay positioned relative
to the dropdown trigger.
*
* JavaScript Info:
* @method open
*
*/
public void open() {
getPolymerElement().open();
}
/**
* 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
opening of the dropdown.
*
* JavaScript Info:
* @attribute open-animation-config
*
*/
public void setOpenAnimationConfig(String value) {
getPolymerElement().setAttribute("open-animation-config", 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);
}
/**
* 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);
}
/**
* 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);
}
/**
* 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) {
getPolymerElement().setAttribute("vertical-offset", value);
}
/**
*
*
* 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);
}
/**
* 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);
}
/**
*
*
* JavaScript Info:
* @property keyBindings
* @type Object
* @behavior PaperTab
*/
public JavaScriptObject getKeyBindings(){
return getPolymerElement().getKeyBindings();
}
/**
*
*
* JavaScript Info:
* @property keyBindings
* @type Object
* @behavior PaperTab
*/
public void setKeyBindings(JavaScriptObject value) {
getPolymerElement().setKeyBindings(value);
}
/**
* 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 attached
* @behavior PaperTab
*/
public void attached() {
getPolymerElement().attached();
}
/**
*
*
* JavaScript Info:
* @method detached
* @behavior PaperTab
*/
public void detached() {
getPolymerElement().detached();
}
/**
*
*
* 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);
}
/**
*
*
* JavaScript Info:
* @method registered
* @behavior PaperTab
*/
public void registered() {
getPolymerElement().registered();
}
/**
* 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);
}
/**
* 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);
}
}