alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Struts example source code file (ToolbarDndSupport.js)

This example Struts source code file (ToolbarDndSupport.js) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Struts tags/keywords

no, no, tb_toolbar, tb_toolbar, tb_toolbarset, tb_toolbarset

The Struts ToolbarDndSupport.js source code

/*
	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/community/licensing.shtml
*/



dojo.provide("dojo.widget.Editor2Plugin.ToolbarDndSupport");
dojo.require("dojo.dnd.*");
dojo.event.topic.subscribe("dojo.widget.Editor2::preLoadingToolbar", function (editor) {
	dojo.dnd.dragManager.nestedTargets = true;
	var p = new dojo.widget.Editor2Plugin.ToolbarDndSupport(editor);
});
dojo.declare("dojo.widget.Editor2Plugin.ToolbarDndSupport", null, {lookForClass:"dojoEditorToolbarDnd TB_ToolbarSet TB_Toolbar", initializer:function (editor) {
	this.editor = editor;
	dojo.event.connect(this.editor, "toolbarLoaded", this, "setup");
	this.editor.registerLoadedPlugin(this);
}, setup:function () {
	dojo.event.disconnect(this.editor, "toolbarLoaded", this, "setup");
	var tbw = this.editor.toolbarWidget;
	dojo.event.connect("before", tbw, "destroy", this, "destroy");
	var nodes = dojo.html.getElementsByClass(this.lookForClass, tbw.domNode, null, dojo.html.classMatchType.ContainsAny);
	if (!nodes) {
		dojo.debug("dojo.widget.Editor2Plugin.ToolbarDndSupport: No dom node with class in " + this.lookForClass);
		return;
	}
	for (var i = 0; i < nodes.length; i++) {
		var node = nodes[i];
		var droptarget = node.getAttribute("dojoETDropTarget");
		if (droptarget) {
			(new dojo.dnd.HtmlDropTarget(node, [droptarget + tbw.widgetId])).vertical = true;
		}
		var dragsource = node.getAttribute("dojoETDragSource");
		if (dragsource) {
			new dojo.dnd.HtmlDragSource(node, dragsource + tbw.widgetId);
		}
	}
}, destroy:function () {
	this.editor.unregisterLoadedPlugin(this);
}});

Other Struts examples (source code examples)

Here is a short list of links related to this Struts ToolbarDndSupport.js source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.