com.vaadin.polymer.iron.widget.IronIconsetSvg Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from iron-iconset-svg project by The Polymer Authors
* that is licensed with http://polymer.github.io/LICENSE.txt license.
*/
package com.vaadin.polymer.iron.widget;
import com.vaadin.polymer.iron.*;
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;
/**
* The iron-iconset-svg
element allows users to define their own icon sets
that contain svg icons. The svg icon elements should be children of the
iron-iconset-svg
element. Multiple icons should be given distinct id’s.
* Using svg elements to create icons has a few advantages over traditional
bitmap graphics like jpg or png. Icons that use svg are vector based so
they are resolution independent and should look good on any device. They
are stylable via css. Icons can be themed, colorized, and even animated.
* Example:
* <iron-iconset-svg name="my-svg-icons" size="24">
* <svg>
* <defs>
* <g id="shape">
* <rect x="12" y="0" width="12" height="24" />
* <circle cx="12" cy="12" r="12" />
* </g>
* </defs>
* </svg>
* </iron-iconset-svg>
*
*
*
This will automatically register the icon set “my-svg-icons” to the iconset
database. To use these icons from within another element, make a
iron-iconset
element and call the byId
method
to retrieve a given iconset. To apply a particular icon inside an
element use the applyIcon
method. For example:
* iconset.applyIcon(iconNode, 'car');
*
*
*
*/
public class IronIconsetSvg extends PolymerWidget {
/**
* Default Constructor.
*/
public IronIconsetSvg() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public IronIconsetSvg(String html) {
super(IronIconsetSvgElement.TAG, IronIconsetSvgElement.SRC, html);
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public IronIconsetSvgElement getPolymerElement() {
return (IronIconsetSvgElement) getElement();
}
/**
* Set to true to enable mirroring of icons where specified when they are
stamped. Icons that should be mirrored should be decorated with a
mirror-in-rtl
attribute.
* NOTE: For performance reasons, direction will be resolved once per
document per iconset, so moving icons in and out of RTL subtrees will
not cause their mirrored state to change.
*
* JavaScript Info:
* @property rtlMirroring
* @type Boolean
*
*/
public boolean getRtlMirroring() {
return getPolymerElement().getRtlMirroring();
}
/**
* Set to true to enable mirroring of icons where specified when they are
stamped. Icons that should be mirrored should be decorated with a
mirror-in-rtl
attribute.
* NOTE: For performance reasons, direction will be resolved once per
document per iconset, so moving icons in and out of RTL subtrees will
not cause their mirrored state to change.
*
* JavaScript Info:
* @property rtlMirroring
* @type Boolean
*
*/
public void setRtlMirroring(boolean value) {
getPolymerElement().setRtlMirroring(value);
}
/**
* The size of an individual icon. Note that icons must be square.
*
* JavaScript Info:
* @property size
* @type Number
*
*/
public double getSize() {
return getPolymerElement().getSize();
}
/**
* The size of an individual icon. Note that icons must be square.
*
* JavaScript Info:
* @property size
* @type Number
*
*/
public void setSize(double value) {
getPolymerElement().setSize(value);
}
/**
* The name of the iconset.
*
* JavaScript Info:
* @property name
* @type String
*
*/
public String getName() {
return getPolymerElement().getName();
}
/**
* The name of the iconset.
*
* JavaScript Info:
* @property name
* @type String
*
*/
public void setName(String value) {
getPolymerElement().setName(value);
}
// Needed in UIBinder
/**
* The size of an individual icon. Note that icons must be square.
*
* JavaScript Info:
* @attribute size
*
*/
public void setSize(String value) {
Polymer.property(this.getPolymerElement(), "size", value);
}
/**
* Remove an icon from the given element by undoing the changes effected
by applyIcon
.
*
* JavaScript Info:
* @method removeIcon
* @param {Element} element
*
*
*/
public void removeIcon(Element element) {
getPolymerElement().removeIcon(element);
}
/**
* Construct an array of all icon names in this iconset.
*
* JavaScript Info:
* @method getIconNames
*
* @return {JavaScriptObject}
*/
public JavaScriptObject getIconNames() {
return getPolymerElement().getIconNames();
}
/**
* Applies an icon to the given element.
* An svg icon is prepended to the element’s shadowRoot if it exists,
otherwise to the element itself.
* If RTL mirroring is enabled, and the icon is marked to be mirrored in
RTL, the element will be tested (once and only once ever for each
iconset) to determine the direction of the subtree the element is in.
This direction will apply to all future icon applications, although only
icons marked to be mirrored will be affected.
*
* JavaScript Info:
* @method applyIcon
* @param {Element} element
* @param {string} iconName
*
* @return {JavaScriptObject}
*/
public JavaScriptObject applyIcon(Element element, String iconName) {
return getPolymerElement().applyIcon(element, iconName);
}
}