
.. currentmodule:: GeoExt.state

:class:`GeoExt.state.PermalinkProvider`
================================================================================


.. cssclass:: meta


Extends
    * `Ext.state.Provider <http://dev.sencha.com/deploy/dev/docs/?class=Ext.state.Provider>`_
    






.. class:: PermalinkProvider(config)

    Create a permalink provider.




Example Use
-----------

Sample code displaying a new permalink each time the map is moved.

.. code-block:: javascript

    // create permalink provider
    var permalinkProvider = new GeoExt.state.PermalinkProvider();

    // set it in the state manager
    Ext.state.Manager.setProvider(permalinkProvider);

    // create a map panel, and make it stateful
    var mapPanel = new GeoExt.MapPanel({
        renderTo: "map",
        layers: [
            new OpenLayers.Layer.WMS(
                "Global Imagery",
                "http://maps.opengeo.org/geowebcache/service/wms",
                {layers: "bluemarble"}
            )
        ],
        stateId: "map",
        prettyStateKeys: true // for pretty permalinks
    });

    // display permalink each time state is changed
    permalinkProvider.on({
        statechanged: function(provider, name, value) {
            alert(provider.getLink());
        }
    });

    


Config Options
--------------

Configuration properties in addition to
those listed for `Ext.state.Provider <http://dev.sencha.com/deploy/dev/docs/?class=Ext.state.Provider>`_.


.. describe:: encodeType

    ``Boolean`` Specifies whether type of state values should be encoded
    and decoded. Set it to false if you work with components that don't
    require encoding types, and want pretty permalinks. Defaults to true.






Public Methods
--------------

Public methods in addition to those
listed for `Ext.state.Provider <http://dev.sencha.com/deploy/dev/docs/?class=Ext.state.Provider>`_.


.. method:: PermalinkProvider.getLink

    :param base: ``String`` The base URL, optional.
    :return: ``String`` The permalink.
    
    Return the permalink corresponding to the current state.





