⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jitk_taskwindow.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
📖 第 1 页 / 共 2 页
字号:
				fp_body_content_blank.setAttribute("width", "300");
				fp_body_content_blank.setAttribute("height", "250");
				fp_body_content_blank.setAttribute("alt", "");
				fp_body_content.appendChild(fp_body_content_blank);
				fp_body.appendChild(fp_body_content);		
			} else {
				fp_body_content.html("<img src='images/blank.gif' name='blank' width='300' height='250' alt='' />");
			}
		}
		
		//---------------------------------------------------
		// add the content to the body (content as rendered by XSL task framework and passed in as pageElement)
		fp_body.appendChild(this.divObject);
	
		// add body to to body wrapper
		fp_body_wrapper.appendChild(fp_body);
	
		// add body wrapper to to floating panel window
		fp_window.appendChild(fp_body_wrapper);
		
		// add floating panel window to the floating panel container
		fp_window_container.appendChild(fp_window);	
		
		// add floating panel container to the MAIN container 
		// (could be the html body or any other ueber-element)
		this.origContainer.appendChild(fp_window_container);
		
		//---------------------------------------------------
		// initialize the jquery handles used to access the various elements of the floating panel
		this.element = $(this.objName);
		this.element_body = $(this.objName+"_body");
		this.element_body_wrapper = $(this.objName+"_body_wrapper");
		this.element_message = $(this.objName+"_message");
		this.element_titlebar = $(this.objName+"_titlebar");
		this.element_toggle = $(this.objName+"_toggle");
		this.element_close = $(this.objName+"_close");

		//this.element.css("width","220px");
		//this.element.css("height","180px");
	
		//---------------------------------------------------
		// initialize the tabs
		this.initTabs();
		
		//---------------------------------------------------
		// initialize the tools of the floating panel (toggle, close, drag)
		this.initTools();
		
		if (!this.isRendered) {
			this.showLoading();
		}
		
	}
	
} 

JitkWindow.prototype.closeHandler = null; //function(new JitkWindowEventArgs(id))

/**
 * Messages (error, success, etc.)
 */
JitkWindow.prototype.showMessage = function(type, text) {
	var cssClass = "";
	switch (type) {
		case "info":
		case "information":
			cssClass = "information";
			break;
		case "success":
			cssClass = "success";
			break;
		case "question":
			cssClass = "question";
			break;
		case "warning":
		case "warn":
			cssClass = "warning";
			break;
		case "error":
		case "fail":
		case "failure":
		default:
			cssClass = "error";
			break;
	}
	// check whether text is an array or a simple string
	if (text.constructor.toString().indexOf("Array") == -1) {
		// convert to array
		text = new Array(text);
	}
	var outputText = "";

	outputText += "<div class='"+cssClass+"'><ul>";
	for (x=0; x < text.length; x++) {
		outputText += "<li>" + text[x] + "</li>";
	}
	outputText += "</ul></div>";

	var el = this.element_message;
	if (el.html() == "") {
		el.html(outputText);
		el.slideDown(this.animationSpeed);
	} else {
		el.slideUp(this.animationSpeed, function() {
			el.html(outputText);
		}).slideDown(this.animationSpeed);
	}
}
JitkWindow.prototype.hideMessage = function() {
	var el = this.element_message;
	el.slideUp(this.animationSpeed, function() {
		el.html("");
	});
}
JitkWindow.prototype.error = function(text) { this.showMessage('error', text); }
JitkWindow.prototype.failure = function(text) { this.showMessage('error', text); }
JitkWindow.prototype.fail = function(text) { this.showMessage('error', text); }
JitkWindow.prototype.warning = function(text) { this.showMessage('warning', text); }
JitkWindow.prototype.warn = function(text) { this.showMessage('warning', text); }
JitkWindow.prototype.information = function(text) { this.showMessage('information', text); }
JitkWindow.prototype.info = function(text) { this.showMessage('information', text); }
JitkWindow.prototype.success = function(text) { this.showMessage('success', text); }
JitkWindow.prototype.question = function(text) { this.showMessage('question', text); }

/**
 * Loading Indicator
 */
JitkWindow.prototype.submit = function(element) {
	element.disabled = true;

	// show the loading indicator of the task window
	this.showLoading();
	
	// hide all messages (will be populated on server again if error still exists)
	this.hideMessage();
	
	// set the currently selected tab if tabs are used
	if (this.tabsElement != null) {
		this.setSelectedTab(this.tabsElement.data('selected.tabs'));
	}
}
JitkWindow.prototype.showLoading = function() {
	// IE work around to hide form elements that would shine through
	var self = this;
	if ($.browser.msie) {
		jQuery.each(jQuery.browser, function(i, val) {
			if (i=="msie" && parseInt(jQuery.browser.version.substr(0,3),10)<7) {
				$(self.objName+" select").each(function (i) {
					$(this).css("visibility", "hidden");
				});
			}
		});
	}
	this.element_body.fadeTo(1, 0.25);
}
JitkWindow.prototype.hideLoading = function() {
	var self = this;
	if ($.browser.msie) {
		jQuery.each(jQuery.browser, function(i, val) {
			if (i=="msie" && parseInt(jQuery.browser.version.substr(0,3),10)<7) {
				$(self.objName+" select").each(function (i) {
					$(this).css("visibility", "visible");
				});
				// apply PNG fix to newly rendered content
				$(self.objName+" img").ifixpng();
			}
		});
	}
	this.element_body.fadeTo(1, 1);
}

JitkWindow.prototype.setSelectedTab = function(selectedTab) {
	if (this.tabsElement != null) {
		jitkTaskWindowSelectedTabs[this.divObject.id] = parseInt(selectedTab,10);
	}
}

JitkWindow.prototype.initTabs = function() {
	// initialize the tabs
	var self = this;
	
	selectedIndex = (jitkTaskWindowSelectedTabs[this.divObject.id] != null) ? jitkTaskWindowSelectedTabs[this.divObject.id] : 0;
	
	this.tabsElement = $("#"+this.divObject.id+" > ul").tabs({selected:selectedIndex});
	/*
	// cannot use this event handler because esri_core cannot process it
	.bind("tabsshow", function(event, ui) {
		self.fit();
		return false;
	});
	*/
}
JitkWindow.prototype.initTools = function() {
	/* window toggle expand/collapse */
	var self = this;
	var animationSpeed = this.animationSpeed;
	if (this.collapsable) {
		var el_body_wrapper = this.element_body_wrapper;
		var el_main = this.element;
		var el_body = this.element_body;
		this.element_toggle.show();
		this.element_toggle.toggle(
			function () {
				var el = $(this);
				el_main.css("height","");
				//el_body.css("height","");
				el_body_wrapper.slideUp(animationSpeed,function() {
					self.collapsed = false;
					el.attr("class", "expand");
				});
			},
			function () {
				var el = $(this);
				el_body_wrapper.slideDown(animationSpeed,function() {
					self.collapsed = true;
					el.attr("class", "collapse");
				});
			}
		);
	} else {
		this.element_toggle.hide();		// hide the toggle button
	}

	/* window close */
	if (this.closable) {
		var el = this.element;
		this.element_close.show();
		this.element_close.click(function(){
			var width = el.css("width");
			//var height = el.css("height"); // replaced with "auto"
			el.animate({ 
				width: "0px",
				height: "0px"
			}, animationSpeed, "", function() {
				el.hide();
				el.css("width",width);
				el.css("height","auto");
			});
			this.closed = true;
			//$("body").trigger("jitkCustomEventTaskWindowClose", [ self ]);
			if (self.closeHandler != null) {
				self.closeHandler(new JitkWindowEventArgs(self.name));
			}
			return false;
		});
	} else {
		this.element_close.hide();		// hide the close button	
	}

	/* window drag */	
	var el = this.element;
	el.draggable();
	el.draggable("disable");
	if (this.movable) {
		$(".jitk-floating-panel-titlebar").css("cursor","move");
	} else {
		$(".jitk-floating-panel-titlebar").css("cursor","");
	}
	this.element_titlebar.mouseout(function(){
		if (self.movable) {
			el.draggable("disable");
		}
	}).mouseover(function() {
		self.show();
		if (self.movable) {
			el.draggable("enable");
		}
	});
}


JitkWindow.prototype.setWindowManager = function(wm) {
	this.windowMgr = wm;
}

JitkWindow.prototype.addUpdateListener = function(name, listener) {
  if (this.updateListenerNames.indexOf(name) == -1) this.updateListenerNames.push(name);
  this.updateListeners[name] = listener;
}

JitkWindow.prototype.removeUpdateListener = function(name) {
  var index = this.updateListenerNames.indexOf(name);
  if (index != -1) {
    this.updateListenerNames.splice(index, 1);
    this.updateListeners[name] = null;
  }
}

//JitkWindow.prototype.toggleVisibility = function() { this.element.css("display")=="none" ? this.show() : this.hide(); }
JitkWindow.prototype.toggleVisibility = function() { this.show();this.fit(); }

JitkWindow.prototype.jitkGetGlobalZIndex = function() {
	return zIndexAll;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -