[fusion-commits] r2514 - sandbox/adsk/2.4j/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Jan 12 22:09:18 EST 2012


Author: liuar
Date: 2012-01-12 19:09:18 -0800 (Thu, 12 Jan 2012)
New Revision: 2514

Modified:
   sandbox/adsk/2.4j/lib/ApplicationDefinition.js
   sandbox/adsk/2.4j/lib/MapMessage.js
Log:
Submit on behalf of Mars Wu
It's for ticket: http://trac.osgeo.org/fusion/ticket/479 

Modified: sandbox/adsk/2.4j/lib/ApplicationDefinition.js
===================================================================
--- sandbox/adsk/2.4j/lib/ApplicationDefinition.js	2012-01-10 05:35:11 UTC (rev 2513)
+++ sandbox/adsk/2.4j/lib/ApplicationDefinition.js	2012-01-13 03:09:18 UTC (rev 2514)
@@ -698,14 +698,14 @@
         //not sure why this is here and it creates an area on the map where 
         //the mouse can't interact with the map
         // is this a debug widget? madair
-        /*
+        
         this.mapWidget.message = new Fusion.MapMessage(this.mapWidget.oMapOL.viewPortDiv);
         this.mapWidget.registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED, (function(){
                 if (this.message != null){
                     this.message.refreshLayout();
                 }
             }).bind(this.mapWidget));
-            */
+        
             
         //create all the other widgets for the widget set
         for (var i=0; i<this.widgetTags.length; i++) {

Modified: sandbox/adsk/2.4j/lib/MapMessage.js
===================================================================
--- sandbox/adsk/2.4j/lib/MapMessage.js	2012-01-10 05:35:11 UTC (rev 2513)
+++ sandbox/adsk/2.4j/lib/MapMessage.js	2012-01-13 03:09:18 UTC (rev 2514)
@@ -4,111 +4,135 @@
  * It is to show a floating message bar over the main map viewer
  */
 Fusion.MapMessage = OpenLayers.Class({
-	parentNode : null,
-	domObj : null,
-	leadingIcon : null,
-	textCell : null,
-	message : "",
-	
-	infoIconName : "images/icons/info.png",
-	warningIconName : "images/icons/warning.png",
-	errorIconName : "images/icons/error.png",
-	
-	containerCssText : "position:absolute; z-index:10000; padding:10px; border:solid 2px #ECECEC; background:#FFFFBB",
-	iconCssText : "margin-right:10px",
-	textCellCssText : "width:100%; vertical-align:top; font: 8pt Tahoma",
+    parentNode : null,
+    domObj : null,
+    leadingIcon : null,
+    textCell : null,
+    message : "",
+    
+    infoIconName : "images/icons/info.png",
+    warningIconName : "images/icons/warning.png",
+    errorIconName : "images/icons/error.png",
+    
+    containerCssText : "position:absolute; z-index:10000; padding:10px; border:solid 2px #ECECEC; background:#FFFFBB",
+    iconCssText : "margin-right:10px",
+    textCellCssText : "width:100%; vertical-align:top; font: 8pt Tahoma",
 
-	opacity: 0.95,
-	
-	initialize : function(parentNode)
-	{
-		this.parentNode = $(parentNode);
-		// Create the div container
-		var container   = document.createElement("div");
-		container.style.visibility = "hidden";
-		this.container  = $(container);
-		parentNode.appendChild(container);
+    opacity: 0.95,
+    
+    initialize : function(parentNode)
+    {
+        this.parentNode = $(parentNode);
+    },
+    
+    createBar : function()
+    {
+        if (!this.container)
+        {
+            // Create the div container
+            var container   = document.createElement("div");
+            container.style.visibility = "hidden";
+            this.container  = $(container);
+            this.parentNode.appendChild(container);
+        }
 
-		container.style.cssText = this.containerCssText;
-		var offset = {left:10, top:10};
-		container.style.left = offset.left + "px";
-		container.style.top  = offset.top  + "px";
-		
-		// Create the inner table
-		var table = document.createElement("table");
-		container.appendChild(table);
-		table.style.width = "100%";
-		table.cellSpacing = "0";
-		table.cellPadding = "0";
-		table.border      = "0";
-		// Create the table row
-		var row   = table.insertRow(0);
-		// The icon cell
-		var cell  = row.insertCell(0);
-		// Add the info icon by default
-		var icon  = document.createElement("img");
-		icon.src  = this.infoIconName;
-		cell.appendChild(icon);
-		icon.style.cssText = this.iconCssText;
-		this.leadingIcon   = icon;
-		// Create the text cell
-		cell      = row.insertCell(1);
-		cell.style.cssText = this.textCellCssText;
-		this.textCell = $(cell);
-		this.textCell.innerHTML = this.message;
-		
-		this.refreshLayout();
-		// Hide message bar by default
-		this.container.setOpacity(0);
-		this.container.style.visibility = "visible";
-	},
-	
-	info : function(message)
-	{
-		this.message = message;
-		this.leadingIcon.src = this.infoIconName;
-		this.show();
-	},
-	
-	warn : function(message)
-	{
-		this.message = message;
-		this.leadingIcon.src = this.warningIconName;
-		this.show();
-	},
-	
-	error : function(message)
-	{
-		this.message = message;
-		this.leadingIcon.src = this.errorIconName;
-		this.show();
-	},
-	
-	clear : function()
-	{
-		this.message = "";
-		this.textCell.innerHTML = "";
-		this.hide();
-	},
-	
-	show : function()
-	{
-		this.textCell.innerHTML = this.message;
-		this.container.fade(this.opacity);
-	},
-	
-	hide : function()
-	{
-		this.container.fade(0);
-	},
-	
-	refreshLayout: function()
-	{
-		// 44 = 2 * padding (10) + 2 * offset(10) + 2 * border (2)
-        var newWidth = this.parentNode.offsetWidth - 44;
-        if (newWidth >= 0)
-            this.container.style.width  = this.parentNode.offsetWidth - 44 + "px";
-	},
-	
-	CLASS_NAME: "Fusion.MapMessage"
+        container.style.cssText = this.containerCssText;
+        var offset = {left:10, top:10};
+        container.style.left = offset.left + "px";
+        container.style.top  = offset.top  + "px";
+        
+        // Create the inner table
+        var table = document.createElement("table");
+        container.appendChild(table);
+        table.style.width = "100%";
+        table.cellSpacing = "0";
+        table.cellPadding = "0";
+        table.border      = "0";
+        // Create the table row
+        var row   = table.insertRow(0);
+        // The icon cell
+        var cell  = row.insertCell(0);
+        // Add the info icon by default
+        var icon  = document.createElement("img");
+        icon.src  = this.infoIconName;
+        cell.appendChild(icon);
+        icon.style.cssText = this.iconCssText;
+        this.leadingIcon   = icon;
+        // Create the text cell
+        cell      = row.insertCell(1);
+        cell.style.cssText = this.textCellCssText;
+        this.textCell = $(cell);
+        this.textCell.innerHTML = this.message;
+        
+        this.refreshLayout();
+        // Hide message bar by default
+        this.container.setOpacity(0);
+        this.container.style.visibility = "visible";
+    },
+    
+    removeBar : function()
+    {
+        if (typeof (this.container) != "undefined" && this.container != null)
+        {
+            this.container.fade(0);
+            window.setTimeout((function()
+            {
+                this.container.parentNode.removeChild(this.container);
+                this.container = null;
+            }).bind(this), 500);
+        }
+    },
+    
+    info : function(message)
+    {
+        this.message = message;
+        this.show();
+        this.leadingIcon.src = this.infoIconName;
+    },
+    
+    warn : function(message)
+    {
+        this.message = message;
+        this.show();
+        this.leadingIcon.src = this.warningIconName;
+    },
+    
+    error : function(message)
+    {
+        this.message = message;
+        this.show();
+        this.leadingIcon.src = this.errorIconName;
+    },
+    
+    clear : function()
+    {
+        this.message = "";
+        this.textCell.innerHTML = "";
+        this.hide();
+    },
+    
+    show : function()
+    {
+        this.createBar();
+        this.textCell.innerHTML = this.message;
+        this.container.fade(this.opacity);
+    },
+    
+    hide : function()
+    {
+        this.removeBar();
+    },
+    
+    refreshLayout: function()
+    {
+        if (typeof (this.container) != "undefined" && this.container != null)
+        {
+            // 44 = 2 * padding (10) + 2 * offset(10) + 2 * border (2)
+            var newWidth = this.parentNode.offsetWidth - 44;
+            if (newWidth >= 0)
+                this.container.style.width  = this.parentNode.offsetWidth - 44 + "px";
+        }
+    },
+    
+    CLASS_NAME: "Fusion.MapMessage"
 });
\ No newline at end of file



More information about the fusion-commits mailing list