com.vaadin.polymer.paper.widget.PaperMenu Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from paper-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.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>
implements an accessible menu control with Material Design styling. The focused item
is highlighted, and the selected item has bolded text.
* <paper-menu>
* <paper-item>Item 1</paper-item>
* <paper-item>Item 2</paper-item>
* </paper-menu>
*
*
*
Make a multi-select menu with the multi
attribute. Items in a multi-select menu can be deselected,
and multiple item can be selected.
* <paper-menu multi>
* <paper-item>Item 1</paper-item>
* <paper-item>Item 2</paper-item>
* </paper-menu>
*
*
*
Styling
* The following custom properties and mixins are available for styling:
*
*
*
* Custom property
* Description
* Default
*
*
*
*
* --paper-menu-background-color
* Menu background color
* --primary-background-color
*
*
* -paper-menu-color
* Menu foreground color
* --primary-text-color
*
*
* --paper-menu-disabled-color
* Foreground color for a disabled item
* --disabled-text-color
*
*
* --paper-menu
* Mixin applied to the menu
* {}
*
*
* --paper-menu-selected-item
* Mixin applied to the selected item
* {}
*
*
* --paper-menu-focused-item
* Mixin applied to the focused item
* {}
*
*
* --paper-menu-focused-item-after
* Mixin applied to the ::after pseudo-element for the focused item
* {}
*
*
*
* Accessibility
* <paper-menu>
has role="menu"
by default. A multi-select menu will also have
aria-multiselectable
set. It implements key bindings to navigate through the menu with the up and
down arrow keys, esc to exit the menu, and enter to activate a menu item. Typing the first letter
of a menu item will also focus it.
*/
public class PaperMenu extends PolymerWidget {
/**
* Default Constructor.
*/
public PaperMenu() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public PaperMenu(String html) {
super(PaperMenuElement.TAG, PaperMenuElement.SRC, html);
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public PaperMenuElement getPolymerElement() {
return (PaperMenuElement) getElement();
}
/**
* The attribute to use on menu items to look up the item title. Typing the first
letter of an item when the menu is open focuses that item. If unset, textContent
will be used.
*
* JavaScript Info:
* @property attrForItemTitle
* @type String
* @behavior PaperTabs
*/
public String getAttrForItemTitle(){
return getPolymerElement().getAttrForItemTitle();
}
/**
* The attribute to use on menu items to look up the item title. Typing the first
letter of an item when the menu is open focuses that item. If unset, textContent
will be used.
*
* JavaScript Info:
* @property attrForItemTitle
* @type String
* @behavior PaperTabs
*/
public void setAttrForItemTitle(String value) {
getPolymerElement().setAttrForItemTitle(value);
}
/**
* Returns the currently focused item.
*
* JavaScript Info:
* @property focusedItem
* @type Object
* @behavior PaperTabs
*/
public JavaScriptObject getFocusedItem(){
return getPolymerElement().getFocusedItem();
}
/**
* Returns the currently focused item.
*
* JavaScript Info:
* @property focusedItem
* @type Object
* @behavior PaperTabs
*/
public void setFocusedItem(JavaScriptObject value) {
getPolymerElement().setFocusedItem(value);
}
/**
* Returns the currently focused item.
*
* JavaScript Info:
* @attribute focused-item
* @behavior PaperTabs
*/
public void setFocusedItem(String value) {
getPolymerElement().setAttribute("focused-item", value);
}
/**
*
*
* JavaScript Info:
* @property keyBindings
* @type Object
* @behavior PaperTabs
*/
public JavaScriptObject getKeyBindings(){
return getPolymerElement().getKeyBindings();
}
/**
*
*
* JavaScript Info:
* @property keyBindings
* @type Object
* @behavior PaperTabs
*/
public void setKeyBindings(JavaScriptObject value) {
getPolymerElement().setKeyBindings(value);
}
/**
*
*
* JavaScript Info:
* @method select
* @param {} value
* @behavior PaperTabs
*/
public void select(JavaScriptObject value) {
getPolymerElement().select(value);
}
/**
*
*
* JavaScript Info:
* @property hostAttributes
* @type Object
* @behavior PaperTabs
*/
public JavaScriptObject getHostAttributes(){
return getPolymerElement().getHostAttributes();
}
/**
*
*
* JavaScript Info:
* @property hostAttributes
* @type Object
* @behavior PaperTabs
*/
public void setHostAttributes(JavaScriptObject value) {
getPolymerElement().setHostAttributes(value);
}
/**
*
*
* JavaScript Info:
* @property listeners
* @type Object
* @behavior PaperTabs
*/
public JavaScriptObject getListeners(){
return getPolymerElement().getListeners();
}
/**
*
*
* JavaScript Info:
* @property listeners
* @type Object
* @behavior PaperTabs
*/
public void setListeners(JavaScriptObject value) {
getPolymerElement().setListeners(value);
}
/**
*
*
* JavaScript Info:
* @property observers
* @type Array
* @behavior PaperTabs
*/
public JsArray getObservers(){
return getPolymerElement().getObservers();
}
/**
*
*
* JavaScript Info:
* @property observers
* @type Array
* @behavior PaperTabs
*/
public void setObservers(JsArray value) {
getPolymerElement().setObservers(value);
}
/**
* If true, multiple selections are allowed.
*
* JavaScript Info:
* @property multi
* @type Boolean
* @behavior PaperTabs
*/
public boolean getMulti(){
return getPolymerElement().getMulti();
}
/**
* If true, multiple selections are allowed.
*
* JavaScript Info:
* @property multi
* @type Boolean
* @behavior PaperTabs
*/
public void setMulti(boolean value) {
getPolymerElement().setMulti(value);
}
/**
*
*
* JavaScript Info:
* @method multiChanged
* @param {} multi
* @behavior PaperTabs
*/
public void multiChanged(JavaScriptObject multi) {
getPolymerElement().multiChanged(multi);
}
/**
* Returns an array of currently selected items.
*
* JavaScript Info:
* @property selectedItems
* @type Array
* @behavior PaperTabs
*/
public JsArray getSelectedItems(){
return getPolymerElement().getSelectedItems();
}
/**
* Returns an array of currently selected items.
*
* JavaScript Info:
* @property selectedItems
* @type Array
* @behavior PaperTabs
*/
public void setSelectedItems(JsArray value) {
getPolymerElement().setSelectedItems(value);
}
/**
* Returns an array of currently selected items.
*
* JavaScript Info:
* @attribute selected-items
* @behavior PaperTabs
*/
public void setSelectedItems(String value) {
getPolymerElement().setAttribute("selected-items", value);
}
/**
* Gets or sets the selected elements. This is used instead of selected
when multi
is true.
*
* JavaScript Info:
* @property selectedValues
* @type Array
* @behavior PaperTabs
*/
public JsArray getSelectedValues(){
return getPolymerElement().getSelectedValues();
}
/**
* Gets or sets the selected elements. This is used instead of selected
when multi
is true.
*
* JavaScript Info:
* @property selectedValues
* @type Array
* @behavior PaperTabs
*/
public void setSelectedValues(JsArray value) {
getPolymerElement().setSelectedValues(value);
}
/**
* Gets or sets the selected elements. This is used instead of selected
when multi
is true.
*
* JavaScript Info:
* @attribute selected-values
* @behavior PaperTabs
*/
public void setSelectedValues(String value) {
getPolymerElement().setAttribute("selected-values", value);
}
/**
* The event that fires from items when they are selected. Selectable
will listen for this event from items and update the selection state.
Set to empty string to listen to no events.
*
* JavaScript Info:
* @property activateEvent
* @type string
* @behavior NeonAnimatedPages
*/
public String getActivateEvent(){
return getPolymerElement().getActivateEvent();
}
/**
* The event that fires from items when they are selected. Selectable
will listen for this event from items and update the selection state.
Set to empty string to listen to no events.
*
* JavaScript Info:
* @property activateEvent
* @type string
* @behavior NeonAnimatedPages
*/
public void setActivateEvent(String value) {
getPolymerElement().setActivateEvent(value);
}
/**
* If you want to use the attribute value of an element for selected
instead of the index,
set this to the name of the attribute.
*
* JavaScript Info:
* @property attrForSelected
* @type string
* @behavior NeonAnimatedPages
*/
public String getAttrForSelected(){
return getPolymerElement().getAttrForSelected();
}
/**
* If you want to use the attribute value of an element for selected
instead of the index,
set this to the name of the attribute.
*
* JavaScript Info:
* @property attrForSelected
* @type string
* @behavior NeonAnimatedPages
*/
public void setAttrForSelected(String value) {
getPolymerElement().setAttrForSelected(value);
}
/**
*
*
* JavaScript Info:
* @property excludedLocalNames
* @type Object
* @behavior NeonAnimatedPages
*/
public JavaScriptObject getExcludedLocalNames(){
return getPolymerElement().getExcludedLocalNames();
}
/**
*
*
* JavaScript Info:
* @property excludedLocalNames
* @type Object
* @behavior NeonAnimatedPages
*/
public void setExcludedLocalNames(JavaScriptObject value) {
getPolymerElement().setExcludedLocalNames(value);
}
/**
* Returns the index of the given item.
*
* JavaScript Info:
* @method indexOf
* @param {Object} item
* @behavior NeonAnimatedPages
*/
public void indexOf(JavaScriptObject item) {
getPolymerElement().indexOf(item);
}
/**
* Returns an array of selectable items.
*
* JavaScript Info:
* @method items
* @behavior NeonAnimatedPages
*/
public void items() {
getPolymerElement().items();
}
/**
* Selects the next item.
*
* JavaScript Info:
* @method selectNext
* @behavior NeonAnimatedPages
*/
public void selectNext() {
getPolymerElement().selectNext();
}
/**
* Selects the previous item.
*
* JavaScript Info:
* @method selectPrevious
* @behavior NeonAnimatedPages
*/
public void selectPrevious() {
getPolymerElement().selectPrevious();
}
/**
* This is a CSS selector sting. If this is set, only items that matches the CSS selector
are selectable.
*
* JavaScript Info:
* @property selectable
* @type string
* @behavior NeonAnimatedPages
*/
public String getSelectable(){
return getPolymerElement().getSelectable();
}
/**
* This is a CSS selector sting. If this is set, only items that matches the CSS selector
are selectable.
*
* JavaScript Info:
* @property selectable
* @type string
* @behavior NeonAnimatedPages
*/
public void setSelectable(String value) {
getPolymerElement().setSelectable(value);
}
/**
* Gets or sets the selected element. The default is to use the index of the item.
*
* JavaScript Info:
* @property selected
* @type string
* @behavior NeonAnimatedPages
*/
public String getSelected(){
return getPolymerElement().getSelected();
}
/**
* Gets or sets the selected element. The default is to use the index of the item.
*
* JavaScript Info:
* @property selected
* @type string
* @behavior NeonAnimatedPages
*/
public void setSelected(String value) {
getPolymerElement().setSelected(value);
}
/**
* The attribute to set on elements when selected.
*
* JavaScript Info:
* @property selectedAttribute
* @type string
* @behavior NeonAnimatedPages
*/
public String getSelectedAttribute(){
return getPolymerElement().getSelectedAttribute();
}
/**
* The attribute to set on elements when selected.
*
* JavaScript Info:
* @property selectedAttribute
* @type string
* @behavior NeonAnimatedPages
*/
public void setSelectedAttribute(String value) {
getPolymerElement().setSelectedAttribute(value);
}
/**
* The class to set on elements when selected.
*
* JavaScript Info:
* @property selectedClass
* @type string
* @behavior NeonAnimatedPages
*/
public String getSelectedClass(){
return getPolymerElement().getSelectedClass();
}
/**
* The class to set on elements when selected.
*
* JavaScript Info:
* @property selectedClass
* @type string
* @behavior NeonAnimatedPages
*/
public void setSelectedClass(String value) {
getPolymerElement().setSelectedClass(value);
}
/**
* Returns the currently selected item.
*
* JavaScript Info:
* @property selectedItem
* @type Object
* @behavior NeonAnimatedPages
*/
public JavaScriptObject getSelectedItem(){
return getPolymerElement().getSelectedItem();
}
/**
* Returns the currently selected item.
*
* JavaScript Info:
* @property selectedItem
* @type Object
* @behavior NeonAnimatedPages
*/
public void setSelectedItem(JavaScriptObject value) {
getPolymerElement().setSelectedItem(value);
}
/**
* Returns the currently selected item.
*
* JavaScript Info:
* @attribute selected-item
* @behavior NeonAnimatedPages
*/
public void setSelectedItem(String value) {
getPolymerElement().setAttribute("selected-item", value);
}
/**
*
*
* JavaScript Info:
* @method attached
* @behavior NeonAnimatedPages
*/
public void attached() {
getPolymerElement().attached();
}
/**
*
*
* JavaScript Info:
* @method detached
* @behavior NeonAnimatedPages
*/
public void detached() {
getPolymerElement().detached();
}
/**
* 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 PaperTabs
*/
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 PaperTabs
*/
public JavaScriptObject getKeyEventTarget(){
return getPolymerElement().getKeyEventTarget();
}
/**
* The HTMLElement that will be firing relevant KeyboardEvents.
*
* JavaScript Info:
* @property keyEventTarget
* @type Object
* @behavior PaperTabs
*/
public void setKeyEventTarget(JavaScriptObject value) {
getPolymerElement().setKeyEventTarget(value);
}
/**
* The HTMLElement that will be firing relevant KeyboardEvents.
*
* JavaScript Info:
* @attribute key-event-target
* @behavior PaperTabs
*/
public void setKeyEventTarget(String value) {
getPolymerElement().setAttribute("key-event-target", value);
}
/**
*
*
* JavaScript Info:
* @method keyboardEventMatchesKeys
* @param {} event
* @param {} eventString
* @behavior PaperTabs
*/
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 PaperTabs
*/
public void removeOwnKeyBindings() {
getPolymerElement().removeOwnKeyBindings();
}
/**
*
*
* JavaScript Info:
* @method registered
* @behavior PaperTabs
*/
public void registered() {
getPolymerElement().registered();
}
}