com.vaadin.polymer.iron.widget.IronSwipeableContainer Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from iron-swipeable-container 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.iron.widget.event.IronSwipeEvent;
import com.vaadin.polymer.iron.widget.event.IronSwipeEventHandler;
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;
/**
* <iron-swipeable-container>
is a container that allows any of its nested
children (native or custom elements) to be swiped away. By default it supports
a curved or horizontal transition, but the transition duration and properties
can be customized.
* Example:
* <iron-swipeable-container>
* <div>I can be swiped</div>
* <paper-card heading="Me too!"></paper-card>
* </iron-swipeable-container>
*
*
*
To disable swiping on individual children, you must give them the .disable-swipe
class. Alternatively, to disable swiping on the whole container, you can use its
disable-swipe
attribute:
* <iron-swipeable-container>
* <div class="disable-swipe">I cannot be swiped be swiped</div>
* <paper-card heading="But I can!"></paper-card>
* </iron-swipeable-container>
*
* <iron-swipeable-container disable-swipe>
* <div>I cannot be swiped</div>
* <paper-card heading="Me neither :("></paper-card>
* </iron-swipeable-container>
*
*
*
It is a good idea to disable text selection on any of the children that you
want to be swiped:
* .swipe {
* -moz-user-select: none;
* -ms-user-select: none;
* -webkit-user-select: none;
* user-select: none;
* cursor: default;
* }
*
*
*
*/
public class IronSwipeableContainer extends PolymerWidget {
/**
* Default Constructor.
*/
public IronSwipeableContainer() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public IronSwipeableContainer(String html) {
super(IronSwipeableContainerElement.TAG, IronSwipeableContainerElement.SRC, html);
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public IronSwipeableContainerElement getPolymerElement() {
return (IronSwipeableContainerElement) getElement();
}
/**
* If true, then the container will not allow swiping.
*
* JavaScript Info:
* @property disabled
* @type Boolean
*
*/
public boolean getDisabled() {
return getPolymerElement().getDisabled();
}
/**
* If true, then the container will not allow swiping.
*
* JavaScript Info:
* @property disabled
* @type Boolean
*
*/
public void setDisabled(boolean value) {
getPolymerElement().setDisabled(value);
}
/**
* The ratio of the total animation distance after which the opacity
transformation begins. For example, if the widthRatio
is 1 and
the opacityRate
is 0.5, then the element needs to travel half its
width before its opacity starts decreasing.
*
* JavaScript Info:
* @property opacityRate
* @type Number
*
*/
public double getOpacityRate() {
return getPolymerElement().getOpacityRate();
}
/**
* The ratio of the total animation distance after which the opacity
transformation begins. For example, if the widthRatio
is 1 and
the opacityRate
is 0.5, then the element needs to travel half its
width before its opacity starts decreasing.
*
* JavaScript Info:
* @property opacityRate
* @type Number
*
*/
public void setOpacityRate(double value) {
getPolymerElement().setOpacityRate(value);
}
/**
* The ratio of the width of the element that the translation animation
should happen over. For example, if the widthRatio
is 3, the
animation will take place on a distance 3 times the width of the
element being swiped.
*
* JavaScript Info:
* @property widthRatio
* @type Number
*
*/
public double getWidthRatio() {
return getPolymerElement().getWidthRatio();
}
/**
* The ratio of the width of the element that the translation animation
should happen over. For example, if the widthRatio
is 3, the
animation will take place on a distance 3 times the width of the
element being swiped.
*
* JavaScript Info:
* @property widthRatio
* @type Number
*
*/
public void setWidthRatio(double value) {
getPolymerElement().setWidthRatio(value);
}
/**
* The style in which to swipe the card. Currently supported
options are curve | horizontal
. If left unspecified, the default
is assumed to be horizontal
.
*
* JavaScript Info:
* @property swipeStyle
* @type String
*
*/
public String getSwipeStyle() {
return getPolymerElement().getSwipeStyle();
}
/**
* The style in which to swipe the card. Currently supported
options are curve | horizontal
. If left unspecified, the default
is assumed to be horizontal
.
*
* JavaScript Info:
* @property swipeStyle
* @type String
*
*/
public void setSwipeStyle(String value) {
getPolymerElement().setSwipeStyle(value);
}
/**
* The CSS transition applied while swiping.
*
* JavaScript Info:
* @property transition
* @type String
*
*/
public String getTransition() {
return getPolymerElement().getTransition();
}
/**
* The CSS transition applied while swiping.
*
* JavaScript Info:
* @property transition
* @type String
*
*/
public void setTransition(String value) {
getPolymerElement().setTransition(value);
}
// Needed in UIBinder
/**
* The ratio of the total animation distance after which the opacity
transformation begins. For example, if the widthRatio
is 1 and
the opacityRate
is 0.5, then the element needs to travel half its
width before its opacity starts decreasing.
*
* JavaScript Info:
* @attribute opacity-rate
*
*/
public void setOpacityRate(String value) {
Polymer.property(this.getPolymerElement(), "opacityRate", value);
}
// Needed in UIBinder
/**
* The ratio of the width of the element that the translation animation
should happen over. For example, if the widthRatio
is 3, the
animation will take place on a distance 3 times the width of the
element being swiped.
*
* JavaScript Info:
* @attribute width-ratio
*
*/
public void setWidthRatio(String value) {
Polymer.property(this.getPolymerElement(), "widthRatio", value);
}
/**
* Fired when a child element is swiped away.
*
* JavaScript Info:
* @event iron-swipe
*/
public HandlerRegistration addIronSwipeHandler(IronSwipeEventHandler handler) {
return addDomHandler(handler, IronSwipeEvent.TYPE);
}
}