[Commits] r1877 - in extensions/geoext.ux: examples tests ux ux/SimplePrint ux/SimplePrint/examples ux/SimplePrint/lib ux/SimplePrint/lib/GeoExt.ux ux/SimplePrint/tests ux/SimplePrint/tests/lib ux/SimplePrint/tests/lib/GeoExt.ux
commits at geoext.org
commits at geoext.org
Tue Feb 9 15:58:50 CET 2010
Author: ahocevar
Date: 2010-02-09 15:58:50 +0100 (Tue, 09 Feb 2010)
New Revision: 1877
Added:
extensions/geoext.ux/ux/SimplePrint/
extensions/geoext.ux/ux/SimplePrint/examples/
extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.html
extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.js
extensions/geoext.ux/ux/SimplePrint/lib/
extensions/geoext.ux/ux/SimplePrint/lib/GeoExt.ux/
extensions/geoext.ux/ux/SimplePrint/lib/GeoExt.ux/SimplePrint.js
extensions/geoext.ux/ux/SimplePrint/lib/loader.js
extensions/geoext.ux/ux/SimplePrint/tests/
extensions/geoext.ux/ux/SimplePrint/tests/index.html
extensions/geoext.ux/ux/SimplePrint/tests/lib/
extensions/geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/
extensions/geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/SimplePrint.html
extensions/geoext.ux/ux/SimplePrint/tests/list-tests.html
Modified:
extensions/geoext.ux/examples/index.html
extensions/geoext.ux/tests/list-tests.html
Log:
Added a form with interactive print extent to set up a print page. Thanks eleomine for making this work with the updated patch for #204. p=elemoine,me, r=elemoine,me (closes #213)
Modified: extensions/geoext.ux/examples/index.html
===================================================================
--- extensions/geoext.ux/examples/index.html 2010-02-09 14:49:35 UTC (rev 1876)
+++ extensions/geoext.ux/examples/index.html 2010-02-09 14:58:50 UTC (rev 1877)
@@ -7,6 +7,7 @@
<ul>
<li><a href="../ux/GeoNamesSearchCombo/examples/GeoNamesSearchComboExample.html">GeoNames search combobox</a></li>
<li><a href="../ux/PrintPreview/examples/PrintPreview.html">PrintPreview using GeoExt.data.PrintProvider</a></li>
+ <li><a href="../ux/SimplePrint/examples/SimplePrint.html">SimplePrint Form using GeoExt.data.PrintProvider</a></li>
</ul>
</body>
</html>
Modified: extensions/geoext.ux/tests/list-tests.html
===================================================================
--- extensions/geoext.ux/tests/list-tests.html 2010-02-09 14:49:35 UTC (rev 1876)
+++ extensions/geoext.ux/tests/list-tests.html 2010-02-09 14:58:50 UTC (rev 1877)
@@ -1,4 +1,5 @@
<ul id="testlist">
<li>../../geoext.ux/ux/GeoNamesSearchCombo/tests/lib/GeoExt.ux.geonames/GeoNamesSearchCombo.html</li>
<li>../../geoext.ux/ux/PrintPreview/tests/lib/GeoExt.ux/PrintPreview.html</li>
+ <li>../../geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/SimplePrint.html</li>
</ul>
Added: extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.html
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.html (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.html 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,50 @@
+<html>
+ <head>
+ <title>Printing ux SimplePrint Example</title>
+
+ <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/adapter/ext/ext-base.js"></script>
+ <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/ext-all.js"></script>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
+ <script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script>
+ <script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script>
+
+ <!-- script resources for this ux -->
+ <script type="text/javascript" src="../lib/GeoExt.ux/SimplePrint.js"></script>
+
+ <script type="text/javascript" src="SimplePrint.js"></script>
+
+ <!--
+ Using the script tag method to get the print service capabilities and
+ make them available in the printCapabilities variable.
+ The script tag below can be removed when configuring the printProvider
+ with url instead of capabilities
+ -->
+ <script type="text/javascript" src="http://demo.opengeo.org/geoserver/pdf/info.json?var=printCapabilities"></script>
+
+ </head>
+ <body>
+ <h1>SimplePrint Form using GeoExt.data.PrintProvider</h1>
+
+ <p>This example shows how to use GeoExt.ux.SimplePrint to talk
+ to the <a href="http://trac.mapfish.org/trac/mapfish/wiki/PrintModuleInstallation">Mapfish print module</a>,
+ which is also available as
+ <a href="http://geoserver.org/display/GEOS/Printing+2.0+HOWTO">GeoServer print module</a>.</p>
+
+ <p>The rectangle and handles on the map can be used to change center,
+ scale and rotation. Dragging one of the handles will change the scale.
+ Dragging the corner handles on their edges will rotate the extent, if
+ supported by the layout. Holding the SHIFT key will constrain rotation
+ to 45° steps.</p>
+
+ <p>Note that this example uses GET requests to communicate with the
+ print servlet (provided by the OpenGeo demo server). This saves us a
+ proxy, but has limitations (URL length in Internet Explorer, and
+ character encoding issues). For production use, the POST method is
+ recommended.</p>
+
+ <p>See <a href="SimplePrint.js">SimplePrint.js</a> for the source code.</p>
+
+ <div id="content"></div>
+ </body>
+</html>
Added: extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.js
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.js (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/examples/SimplePrint.js 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,138 @@
+var printProvider, printForm;
+
+Ext.onReady(function() {
+
+ printProvider = new GeoExt.data.PrintProvider({
+ // using get for remote service access without same origin restriction.
+ // For asynchronous requests, we would set method to "POST".
+ method: "GET",
+ //method: "POST",
+
+ // capabilities from script tag in Printing.html. For asynchonous
+ // loading, we would configure url instead of capabilities.
+ capabilities: printCapabilities
+ //url: "/geoserver/pdf/"
+ });
+
+ var mapPanel = new GeoExt.MapPanel({
+ region: "center",
+ layers: [new OpenLayers.Layer.WMS("Global Imagery",
+ "http://labs.metacarta.com/wms/vmap0",
+ {layers: "basic"})],
+ center: [16,48],
+ zoom: 5
+ });
+
+ // create a vector layer, which will also be printed.
+ var redline = new OpenLayers.Layer.Vector("vector", {
+ styleMap: new OpenLayers.StyleMap({
+ strokeColor: "red",
+ fillColor: "red",
+ fillOpacity: 0.7,
+ strokeWidth: 2,
+ pointRadius: 12,
+ externalGraphic: "http://openlayers.org/dev/img/marker-blue.png"
+ })
+ });
+ var geom = OpenLayers.Geometry.fromWKT, Vec = OpenLayers.Feature.Vector;
+ redline.addFeatures([
+ new Vec(geom("POLYGON(15 47, 15 46, 16 47, 16 48)")),
+ new Vec(geom("LINESTRING(14 48, 14 47, 15 48, 14 49, 16 49)")),
+ new Vec(geom("POINT(16 49)"))
+ ]);
+ mapPanel.map.addLayer(redline);
+
+ // Create a vector layer for the print page extent and handles.
+ // We only do this because we want fancy styles for the handles,
+ // otherwise SimplePrint's PrintExtent would auto-create one for us.
+ var extentLayer = new OpenLayers.Layer.Vector("print", {
+ displayInLayerSwitcher: false,
+ styleMap: new OpenLayers.StyleMap(new OpenLayers.Style(Ext.applyIf({
+ pointRadius: 4,
+ graphicName: "square",
+ rotation: "${getRotation}",
+ strokeColor: "${getStrokeColor}",
+ fillOpacity: "${getFillOpacity}"
+ }, OpenLayers.Feature.Vector.style["default"]), {
+ context: {
+ getRotation: function(feature) {
+ return printForm.printPage.rotation;
+ },
+ getStrokeColor: function(feature) {
+ return feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point" ?
+ "#000" : "#ee9900";
+ },
+ getFillOpacity: function(feature) {
+ return feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point" ?
+ 0 : 0.4;
+ }
+ }
+ })
+ )});
+
+ // a simple print form
+ printForm = new GeoExt.ux.SimplePrint({
+ mapPanel: mapPanel,
+ layer: extentLayer, // optional
+ autoFit: true,
+ printProvider: printProvider,
+ bodyStyle: {padding: "5px"},
+ labelWidth: 65,
+ defaults: {width: 115},
+ region: "east",
+ border: false,
+ width: 200
+ });
+
+ // add custom fields to the form
+ printForm.insert(0, {
+ xtype: "textfield",
+ name: "mapTitle",
+ fieldLabel: "Title",
+ value: "A custom title",
+ plugins: new GeoExt.plugins.PrintPageField({
+ printPage: printForm.printPage
+ })
+ });
+ printForm.insert(1, {
+ xtype: "textarea",
+ fieldLabel: "Comment",
+ name: "comment",
+ value: "A custom comment",
+ plugins: new GeoExt.plugins.PrintPageField({
+ printPage: printForm.printPage
+ })
+ });
+
+ var formCt = new Ext.Panel({
+ layout: "fit",
+ region: "east",
+ width: 200
+ });
+
+ new Ext.Panel({
+ renderTo: "content",
+ layout: "border",
+ width: 800,
+ height: 350,
+ items: [mapPanel, formCt]
+ });
+
+ /* add the print form to its container and make sure that the print page
+ * fits the max extent
+ */
+ formCt.add(printForm);
+ formCt.doLayout();
+
+ /* use this code block instead of the above one if you configured the
+ * printProvider with url instead of capabilities
+ var myMask = new Ext.LoadMask(formCt.body, {msg:"Loading data..."});
+ myMask.show();
+ printProvider.on("loadcapabilities", function() {
+ myMask.hide();
+ formCt.add(printForm);
+ formCt.doLayout();
+ });
+ */
+
+});
Added: extensions/geoext.ux/ux/SimplePrint/lib/GeoExt.ux/SimplePrint.js
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/lib/GeoExt.ux/SimplePrint.js (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/lib/GeoExt.ux/SimplePrint.js 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,263 @@
+/**
+ * Copyright (c) 2008-2009 The Open Source Geospatial Foundation
+ *
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+
+Ext.namespace("GeoExt.ux")
+
+/** api: (define)
+ * module = GeoExt.form
+ * class = SimplePrint
+ * base_link = `Ext.form.FormPanel <http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel>`_
+ */
+
+/** api: constructor
+ * .. class:: SimplePrint
+ *
+ * An instance of this form creates a single print page. Layout, DPI, scale
+ * and rotation are configurable in the form. A Print button is also added to
+ * the form.
+ */
+GeoExt.ux.SimplePrint = Ext.extend(Ext.form.FormPanel, {
+
+ /* begin i18n */
+ /** api: config[layoutText] ``String`` i18n */
+ layoutText: "Layout",
+ /** api: config[dpiText] ``String`` i18n */
+ dpiText: "DPI",
+ /** api: config[scaleText] ``String`` i18n */
+ scaleText: "Scale",
+ /** api: config[rotationText] ``String`` i18n */
+ rotationText: "Rotation",
+ /** api: config[printText] ``String`` i18n */
+ printText: "Print",
+ /** api: config[creatingPdfText] ``String`` i18n */
+ creatingPdfText: "Creating PDF...",
+ /* end i18n */
+
+ /** api: config[printProvider]
+ * :class:`GeoExt.data.PrintProvider` The print provider this form
+ * is connected to.
+ */
+
+ /** api: config[mapPanel]
+ * :class:`GeoExt.MapPanel` The map panel that this form should be
+ * connected to.
+ */
+
+ /** api: config[layer]
+ * ``OpenLayers.Layer`` Layer to render page extents and handles
+ * to. Useful e.g. for setting a StyleMap. Optional, will be auto-created
+ * if not provided.
+ */
+
+ /** api: config[printOptions]
+ * ``Object`` Optional options for the printProvider's print command.
+ */
+
+ /** api: property[printOptions]
+ * ``Object`` Optional options for the printProvider's print command.
+ */
+ printOptions: null,
+
+ /** api: config[hideUnique]
+ * ``Boolean`` If set to false, combo boxes for stores with just one value
+ * will be rendered. Default is true.
+ */
+
+ /** api: config[hideRotation]
+ * ``Boolean`` If set to true, the Rotation field will not be rendered.
+ * Default is false.
+ */
+
+ /** api: config[busyMask]
+ * ``Ext.LoadMask`` A LoadMask to use while the print document is
+ * prepared. Optional, will be auto-created with ``creatingPdfText` if
+ * not provided.
+ */
+
+ /** private: property[busyMask]
+ * ``Ext.LoadMask``
+ */
+ busyMask: null,
+
+ /** private: property[printExtent]
+ * :class:`GeoExt.plugins.PrintExtent`
+ */
+ printExtent: null,
+
+ /** api: property[printPage]
+ * :class:`GeoExt.data.PrintPage` The print page for this form. Useful
+ * e.g. for rotating handles when used in a style map context. Read-only.
+ */
+ printPage: null,
+
+ /** private: method[initComponent]
+ */
+ initComponent: function() {
+ GeoExt.ux.SimplePrint.superclass.initComponent.call(this);
+
+ this.printExtent = new GeoExt.plugins.PrintExtent({
+ printProvider: this.initialConfig.printProvider,
+ layer: this.initialConfig.layer
+ });
+ this.printPage = this.printExtent.pages[0];
+
+ this.mapPanel.initPlugin(this.printExtent);
+
+ if (!this.busyMask) {
+ this.busyMask = new Ext.LoadMask(Ext.getBody(), {
+ msg: this.creatingPdfText
+ });
+ }
+
+ this.printExtent.printProvider.on({
+ "beforeprint": this.busyMask.show,
+ "print": this.busyMask.hide,
+ scope: this.busyMask
+ });
+
+ if(this.printExtent.printProvider.capabilities) {
+ this.initForm();
+ } else {
+ this.printExtent.printProvider.on({
+ "loadcapabilities": this.initForm,
+ scope: this,
+ single: true
+ });
+ }
+
+ //for accordion
+ this.on('expand', this.setUp, this);
+ this.on('collapse', this.tearDown, this);
+
+ //for tabs
+ this.on('activate', this.setUp, this);
+ this.on('deactivate', this.tearDown, this);
+
+ //for manual enable/disable
+ this.on('enable', this.setUp, this);
+ this.on('disable', this.tearDown, this);
+
+ //for use in an Ext.Window with closeAction close
+ this.on('destroy', this.tearDown, this);
+ },
+
+ /** private: method[initForm]
+ * Creates and adds items to the form.
+ */
+ initForm: function() {
+ var p = this.printExtent.printProvider;
+ var hideUnique = this.initialConfig.hideUnique !== false;
+ !(hideUnique && p.layouts.getCount() <= 1) && this.add({
+ xtype: "combo",
+ fieldLabel: this.layoutText,
+ store: p.layouts,
+ displayField: "name",
+ typeAhead: true,
+ mode: "local",
+ forceSelection: true,
+ triggerAction: "all",
+ selectOnFocus: true,
+ plugins: new GeoExt.plugins.PrintProviderField()
+ });
+ !(hideUnique && p.dpis.getCount() <= 1) && this.add({
+ xtype: "combo",
+ fieldLabel: this.dpiText,
+ store: p.dpis,
+ displayField: "name",
+ typeAhead: true,
+ mode: "local",
+ forceSelection: true,
+ triggerAction: "all",
+ selectOnFocus: true,
+ plugins: new GeoExt.plugins.PrintProviderField()
+ });
+ !(hideUnique && p.scales.getCount() <= 1) && this.add({
+ xtype: "combo",
+ fieldLabel: this.scaleText,
+ store: p.scales,
+ displayField: "name",
+ typeAhead: true,
+ mode: "local",
+ forceSelection: true,
+ triggerAction: "all",
+ selectOnFocus: true,
+ plugins: new GeoExt.plugins.PrintPageField({
+ printPage: this.printPage
+ })
+ });
+ this.initialConfig.hideRotation !== true && this.add({
+ xtype: "textfield",
+ fieldLabel: this.rotationText,
+ name: "rotation",
+ enableKeyEvents: true,
+ validator: function(v) {
+ return !isNaN(v)
+ },
+ plugins: new GeoExt.plugins.PrintPageField({
+ printPage: this.printPage
+ })
+ });
+
+ this.addButton({
+ text: this.printText,
+ handler: function() {
+ this.printExtent.print(this.printOptions);
+ },
+ scope: this
+ });
+
+ this.doLayout();
+
+ if(this.autoFit === true) {
+ this.onMoveend();
+ this.mapPanel.map.events.on({
+ "moveend": this.onMoveend,
+ scope: this
+ })
+ }
+ },
+
+ /** private: method[onMoveend]
+ * Handler for the map's moveend event
+ */
+ onMoveend: function() {
+ this.printPage.fit(this.mapPanel.map);
+ },
+
+ /** private: method[beforeDestroy]
+ */
+ beforeDestroy: function() {
+ var p = this.printExtent.printProvider;
+ p.un("beforePrint", this.busyMask.show, this.busyMask);
+ p.un("print", this.busyMask.hide, this.busyMask);
+ if(this.autoFit === true) {
+ this.mapPanel.map.events.un({
+ "moveend": this.onMoveend,
+ scope: this
+ })
+ }
+ GeoExt.ux.SimplePrint.superclass.beforeDestroy.apply(this, arguments);
+ },
+
+ /** private: method[setUp]
+ * Handler for the panel's expand/activate/enable event
+ */
+ setUp: function() {
+ this.printExtent.setUp();
+ },
+
+ /** private: method[tearDown]
+ * Handler for the panel's collapse/deactivate/disable/destroy event
+ */
+ tearDown: function() {
+ this.printExtent.tearDown();
+ }
+});
+
+/** api: xtype = gxux_simpleprint */
+Ext.reg("gxux_simpleprint", GeoExt.ux.SimplePrint);
Added: extensions/geoext.ux/ux/SimplePrint/lib/loader.js
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/lib/loader.js (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/lib/loader.js 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2008-2009 The Open Source Geospatial Foundation
+ *
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+
+/*
+ * The code in this file is based on code taken from OpenLayers.
+ *
+ * Copyright (c) 2006-2007 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license.
+ */
+
+(function() {
+
+ /**
+ * The relative path of this script.
+ */
+ var scriptName = "lib/loader.js";
+
+ /**
+ * Function returning the path of this script.
+ */
+ var getScriptLocation = function() {
+ var scriptLocation = "";
+ // If we load other scripts right before GeoExt using the same
+ // mechanism to add script resources dynamically (e.g. OpenLayers),
+ // document.getElementsByTagName will not find the GeoExt script tag
+ // in FF2. Using document.documentElement.getElementsByTagName instead
+ // works around this issue.
+ var scripts = document.documentElement.getElementsByTagName('script');
+ for(var i=0, len=scripts.length; i<len; i++) {
+ var src = scripts[i].getAttribute('src');
+ if(src) {
+ var index = src.lastIndexOf(scriptName);
+ // set path length for src up to a query string
+ var pathLength = src.lastIndexOf('?');
+ if(pathLength < 0) {
+ pathLength = src.length;
+ }
+ // is it found, at the end of the URL?
+ if((index > -1) && (index + scriptName.length == pathLength)) {
+ scriptLocation = src.slice(0, pathLength - scriptName.length);
+ break;
+ }
+ }
+ }
+ return scriptLocation;
+ };
+
+ var jsfiles = new Array(
+ "GeoExt.ux/SimplePrint.js"
+ );
+
+ var agent = navigator.userAgent;
+ var docWrite = (agent.match("MSIE") || agent.match("Safari"));
+ if(docWrite) {
+ var allScriptTags = new Array(jsfiles.length);
+ }
+ var host = getScriptLocation() + "lib/";
+ for (var i=0, len=jsfiles.length; i<len; i++) {
+ if (docWrite) {
+ allScriptTags[i] = "<script src='" + host + jsfiles[i] +
+ "'></script>";
+ } else {
+ var s = document.createElement("script");
+ s.src = host + jsfiles[i];
+ var h = document.getElementsByTagName("head").length ?
+ document.getElementsByTagName("head")[0] :
+ document.body;
+ h.appendChild(s);
+ }
+ }
+ if (docWrite) {
+ document.write(allScriptTags.join(""));
+ }
+})();
Added: extensions/geoext.ux/ux/SimplePrint/tests/index.html
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/tests/index.html (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/tests/index.html 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,4 @@
+<html>
+ <head><meta http-equiv="refresh" content="0;url=../../../../geoext/tests/run-tests.html?testlist=../../geoext.ux/ux/SimplePrint/tests/list-tests.html"></head>
+ <body></body>
+</html>
Added: extensions/geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/SimplePrint.html
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/SimplePrint.html (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/SimplePrint.html 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html debug="true">
+ <head>
+ <script type="text/javascript" src="http://dev.openlayers.org/nightly/OpenLayers.js"></script>
+ <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/adapter/ext/ext-base.js"></script>
+ <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/ext-all.js"></script>
+ <script type="text/javascript" src="../../../../../../geoext/lib/GeoExt.js"></script>
+ <script type="text/javascript" src="../../../lib/GeoExt.ux/SimplePrint.js"></script>
+
+ <script type="text/javascript">
+ var printCapabilities = {"scales":[{"name":"1:25,000","value":"25000"},{"name":"1:50,000","value":"50000"},{"name":"1:100,000","value":"100000"},{"name":"1:200,000","value":"200000"},{"name":"1:500,000","value":"500000"},{"name":"1:1,000,000","value":"1000000"},{"name":"1:2,000,000","value":"2000000"},{"name":"1:4,000,000","value":"4000000"}],"dpis":[{"name":"75","value":"75"},{"name":"150","value":"150"},{"name":"300","value":"300"}],"layouts":[{"name":"A4 portrait","map":{"width":440,"height":483},"rotation":true},{"name":"Legal","map":{"width":440,"height":483},"rotation":false}],"printURL":"http://demo.opengeo.org/geoserver/pdf/print.pdf","createURL":"http://demo.opengeo.org/geoserver/pdf/create.json"};
+
+ function test_initComponent(t) {
+ t.plan(5);
+
+ var mapPanel = new GeoExt.MapPanel({
+ renderTo: "mappanel",
+ width: 256,
+ height: 256,
+ layers: [new OpenLayers.Layer.WMS("Tasmania State Boundaries",
+ "http://demo.opengeo.org/geoserver/wms",
+ {layers: "topp:tasmania_state_boundaries"}, {singleTile: true})],
+ center: [146.56, -41.56],
+ zoom: 7
+ });
+ var printProvider = new GeoExt.data.PrintProvider({
+ capabilities: printCapabilities
+ });
+ var printForm = new GeoExt.ux.SimplePrint({
+ renderTo: "printform",
+ width: 200,
+ height: 400,
+ mapPanel: mapPanel,
+ printProvider: printProvider
+ });
+
+ t.ok(printForm.printExtent, "PrintExtent created.");
+ t.ok(printForm.printExtent.map == mapPanel.map, "PrintExtent added to map.");
+ t.ok(printForm.printPage, "PrintPage assigned.");
+ t.eq(printForm.items.getCount(), 4, "Form has four items.");
+ t.ok(printForm.busyMask, "busy mask created.");
+
+ printForm.destroy();
+ mapPanel.destroy();
+ }
+
+ </script>
+ <body>
+ <div id="mappanel"></div>
+ <div id="printform"></div>
+ </body>
+</html>
Added: extensions/geoext.ux/ux/SimplePrint/tests/list-tests.html
===================================================================
--- extensions/geoext.ux/ux/SimplePrint/tests/list-tests.html (rev 0)
+++ extensions/geoext.ux/ux/SimplePrint/tests/list-tests.html 2010-02-09 14:58:50 UTC (rev 1877)
@@ -0,0 +1,3 @@
+<ul id="testlist">
+ <li>../../geoext.ux/ux/SimplePrint/tests/lib/GeoExt.ux/SimplePrint.html</li>
+</ul>
\ No newline at end of file
More information about the Commits
mailing list