com.vaadin.polymer.app.widget.AppRouteConverter Maven / Gradle / Ivy
/*
* This code was generated with Vaadin Web Component GWT API Generator,
* from app-route project by The Polymer Authors
* that is licensed with http://polymer.github.io/LICENSE.txt license.
*/
package com.vaadin.polymer.app.widget;
import com.vaadin.polymer.app.*;
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;
/**
* app-route-converter
provides a means to convert a path and query
parameters into a route object and vice versa. This produced route object
is to be fed into route-consuming elements such as app-route
.
*
* n.b. This element is intended to be a primitive of the routing system and for
creating bespoke routing solutions from scratch. To simply include routing in
an app, please refer to app-location
and app-route.
*
* An example of a route object that describes
https://elements.polymer-project.org/elements/app-route-converter?foo=bar&baz=qux
and should be passed to other app-route
elements:
* {
* prefix: '',
* path: '/elements/app-route-converter',
* __queryParams: {
* foo: 'bar',
* baz: 'qux'
* }
* }
*
*
*
__queryParams
is private to discourage directly data-binding to it. This is so
that routing elements like app-route
can intermediate changes to the query
params and choose whether to propagate them upstream or not. app-route
for
example will not propagate changes to its queryParams
property if it is not
currently active. A public queryParams object will also be produced in which you
should perform data-binding operations.
* Example Usage:
* <iron-location path="{{path}}" query="{{query}}"></iron-location>
* <iron-query-params
* params-string="{{query}}"
* params-object="{{queryParams}}">
* </iron-query-params>
* <app-route-converter
* path="{{path}}"
* query-params="{{queryParams}}"
* route="{{route}}">
* </app-route-converter>
* <app-route route='{{route}}' pattern='/:page' data='{{data}}'>
* </app-route>
*
*
*
This is a simplified implementation of the app-location
element. Here the
iron-location
produces a path and a query, the iron-query-params
consumes
the query and produces a queryParams object, and the app-route-converter
consumes the path and the query params and converts it into a route which is in
turn is consumed by the app-route
.
*/
public class AppRouteConverter extends PolymerWidget {
/**
* Default Constructor.
*/
public AppRouteConverter() {
this("");
}
/**
* Constructor used by UIBinder to create widgets with content.
*/
public AppRouteConverter(String html) {
super(AppRouteConverterElement.TAG, AppRouteConverterElement.SRC, html);
}
/**
* Gets a handle to the Polymer object's underlying DOM element.
*/
public AppRouteConverterElement getPolymerElement() {
return (AppRouteConverterElement) getElement();
}
/**
* A set of key/value pairs that are universally accessible to branches of
the route tree.
*
* JavaScript Info:
* @property queryParams
* @type ?Object
*
*/
public JavaScriptObject getQueryParams() {
return getPolymerElement().getQueryParams();
}
/**
* A set of key/value pairs that are universally accessible to branches of
the route tree.
*
* JavaScript Info:
* @property queryParams
* @type ?Object
*
*/
public void setQueryParams(JavaScriptObject value) {
getPolymerElement().setQueryParams(value);
}
/**
* A model representing the deserialized path through the route tree, as
well as the current queryParams.
* A route object is the kernel of the routing system. It is intended to
be fed into consuming elements such as app-route
.
*
* JavaScript Info:
* @property route
* @type ?Object
*
*/
public JavaScriptObject getRoute() {
return getPolymerElement().getRoute();
}
/**
* A model representing the deserialized path through the route tree, as
well as the current queryParams.
* A route object is the kernel of the routing system. It is intended to
be fed into consuming elements such as app-route
.
*
* JavaScript Info:
* @property route
* @type ?Object
*
*/
public void setRoute(JavaScriptObject value) {
getPolymerElement().setRoute(value);
}
/**
* The serialized path through the route tree. This corresponds to the
window.location.pathname
value, and will update to reflect changes
to that value.
*
* JavaScript Info:
* @property path
* @type String
*
*/
public String getPath() {
return getPolymerElement().getPath();
}
/**
* The serialized path through the route tree. This corresponds to the
window.location.pathname
value, and will update to reflect changes
to that value.
*
* JavaScript Info:
* @property path
* @type String
*
*/
public void setPath(String value) {
getPolymerElement().setPath(value);
}
// Needed in UIBinder
/**
* A set of key/value pairs that are universally accessible to branches of
the route tree.
*
* JavaScript Info:
* @attribute query-params
*
*/
public void setQueryParams(String value) {
Polymer.property(this.getPolymerElement(), "queryParams", value);
}
// Needed in UIBinder
/**
* A model representing the deserialized path through the route tree, as
well as the current queryParams.
* A route object is the kernel of the routing system. It is intended to
be fed into consuming elements such as app-route
.
*
* JavaScript Info:
* @attribute route
*
*/
public void setRoute(String value) {
Polymer.property(this.getPolymerElement(), "route", value);
}
}