[Commits] r2538 - in sandbox/cmoullet/ux/Profile: examples lib/GeoExt.ux
commits at geoext.org
commits at geoext.org
Mon Dec 27 07:47:38 CET 2010
Author: cmoullet
Date: 2010-12-27 07:47:38 +0100 (Mon, 27 Dec 2010)
New Revision: 2538
Added:
sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileFitToParentWindow.js
Modified:
sandbox/cmoullet/ux/Profile/examples/profile.html
sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileAction.js
sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileBox.js
Log:
Resize profile to parent window
Modified: sandbox/cmoullet/ux/Profile/examples/profile.html
===================================================================
--- sandbox/cmoullet/ux/Profile/examples/profile.html 2010-12-27 05:44:14 UTC (rev 2537)
+++ sandbox/cmoullet/ux/Profile/examples/profile.html 2010-12-27 06:47:38 UTC (rev 2538)
@@ -19,6 +19,7 @@
<script type="text/javascript" src="../lib/GeoExt.ux/ProfileControl.js"></script>
<script type="text/javascript" src="../lib/GeoExt.ux/ProfileAction.js"></script>
<script type="text/javascript" src="../lib/GeoExt.ux/ProfileBox.js"></script>
+ <script type="text/javascript" src="../lib/GeoExt.ux/ProfileFitToParentWindow.js"></script>
<!--[if IE]>
<script language="javascript" type="text/javascript" src="../lib/jquery/excanvas.min.js"></script><![endif]-->
Modified: sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileAction.js
===================================================================
--- sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileAction.js 2010-12-27 05:44:14 UTC (rev 2537)
+++ sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileAction.js 2010-12-27 06:47:38 UTC (rev 2538)
@@ -19,6 +19,7 @@
* @include OpenLayers/Style.js
* @include Profile/lib/GeoExt.ux/ProfileBox.js
* @include Profile/lib/GeoExt.ux/ProfileControl.js
+ * @include Profile/lib/GeoExt.ux/ProfileFitToParentWindow.js
*/
/** api: (define)
@@ -89,7 +90,7 @@
profileHeight: 600,
text: OpenLayers.i18n('Profile'),
styleMarker: new OpenLayers.Style(
- OpenLayers.Feature.Vector.style["default"]).defaultStyle});
+ OpenLayers.Feature.Vector.style["default"]).defaultStyle});
if (!this.vector) {
this.vector = new OpenLayers.Layer.Vector("Profile", {displayInLayerSwitcher: false});
@@ -187,6 +188,7 @@
});
} else {
this._profileWindow = new Ext.Window({
+ id: 'profileWindow',
width:this.profileWidth,
height:this.profileHeight,
items: new GeoExt.ux.ProfileBox({
@@ -198,7 +200,9 @@
profileEpsg: this._profileEpsg,
width: this.profileWidth - 15,
height: this.profileHeight - 30,
- styleMarker: this.styleMarker
+ styleMarker: this.styleMarker,
+ plugins: [
+ new GeoExt.ux.ProfileFitToParentWindow()]
})
});
this._profileWindow.on('close', function() {
Modified: sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileBox.js
===================================================================
--- sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileBox.js 2010-12-27 05:44:14 UTC (rev 2537)
+++ sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileBox.js 2010-12-27 06:47:38 UTC (rev 2538)
@@ -89,8 +89,6 @@
this.el.appendChild(this.jqueryDiv);
- this.on('resize', this.handleResize, this);
-
this.drawProfile();
GeoExt.ux.ProfileBox.superclass.afterRender.apply(this, arguments);
@@ -98,7 +96,16 @@
// private
handleResize : function(me, newWidth, newHeight) {
- //TODO
+ if (me.jqueryDiv.getWidth() == newWidth-15 && me.jqueryDiv.getHeight() == newHeight-30) {
+
+ } else {
+ me.jqueryDiv.remove();
+ me.jqueryDiv = new Ext.Element(document.createElement('div'));
+ me.jqueryDiv.setWidth(newWidth-15);
+ me.jqueryDiv.setHeight(newHeight-30);
+ me.el.appendChild(me.jqueryDiv);
+ me.drawProfile();
+ }
},
destroy: function() {
Added: sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileFitToParentWindow.js
===================================================================
--- sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileFitToParentWindow.js (rev 0)
+++ sandbox/cmoullet/ux/Profile/lib/GeoExt.ux/ProfileFitToParentWindow.js 2010-12-27 06:47:38 UTC (rev 2538)
@@ -0,0 +1,26 @@
+/*global GeoExt:true, Ext: true */
+
+Ext.namespace("GeoExt.ux");
+/**
+ * @class GeoExt.ux.ProfileFitToParentWindow
+ * @extends Object
+ * <p>Plugin for {@link Ext.BoxComponent BoxComponent} and descendants that adjusts the size of the component to fit inside a parent element</p>
+ */
+GeoExt.ux.ProfileFitToParentWindow = Ext.extend(Object, {
+ /**
+ * @constructor
+ */
+ constructor: function(config) {
+ config = config || {};
+ Ext.apply(this, config);
+ },
+ init: function(c) {
+ this.component = c;
+ c.on('render', function(c) {
+ this.parent = Ext.getCmp('profileWindow');
+ this.parent.on('resize', function(c, height, width) {
+ this.component.handleResize(this.component, height, width);
+ }, this);
+ }, this);
+ }
+});
\ No newline at end of file
More information about the Commits
mailing list