Browse Source

6.6.0 release

Former-commit-id: 670a3bf40ff9d96ca9a8e60ccdb3c70d0659ba63
David Benson 8 years ago
parent
commit
f5a9b706a1
49 changed files with 2806 additions and 2169 deletions
  1. 8 0
      ChangeLog
  2. 1 1
      VERSION
  3. 136 105
      etc/electron/ElectronApp.js
  4. 20 5
      src/com/mxgraph/io/gliffy/importer/GliffyDiagramConverter.java
  5. 1 1
      src/com/mxgraph/io/gliffy/importer/gliffyTranslation.properties
  6. 1 1
      war/WEB-INF/appengine-web.xml
  7. 1 1
      war/cache.manifest
  8. 707 706
      war/js/app.min.js
  9. 254 254
      war/js/atlas-viewer.min.js
  10. 723 723
      war/js/atlas.min.js
  11. 10 5
      war/js/diagramly/App.js
  12. 12 5
      war/js/diagramly/EditorUi.js
  13. 24 1
      war/js/diagramly/Menus.js
  14. 380 0
      war/js/diagramly/vsdx/VsdxExport.js
  15. 1 0
      war/js/diagramly/vsdx/resources/[Content_Types].xml
  16. 1 0
      war/js/diagramly/vsdx/resources/_rels/.rels
  17. 13 0
      war/js/diagramly/vsdx/resources/allConstants.json
  18. 1 0
      war/js/diagramly/vsdx/resources/docProps/app.xml
  19. 1 0
      war/js/diagramly/vsdx/resources/docProps/core.xml
  20. 1 0
      war/js/diagramly/vsdx/resources/docProps/custom.xml
  21. 1 0
      war/js/diagramly/vsdx/resources/visio/_rels/document.xml.rels
  22. 1 0
      war/js/diagramly/vsdx/resources/visio/document.xml
  23. 1 0
      war/js/diagramly/vsdx/resources/visio/masters/_rels/masters.xml.rels
  24. 1 0
      war/js/diagramly/vsdx/resources/visio/masters/masters.xml
  25. 2 0
      war/js/diagramly/vsdx/resources/visio/pages/_rels/page1.xml.rels
  26. 1 0
      war/js/diagramly/vsdx/resources/visio/windows.xml
  27. 25 25
      war/js/embed-static.min.js
  28. 15 0
      war/js/jszip/jszip.min.js
  29. 2 2
      war/js/mxgraph/EditorUi.js
  30. 35 29
      war/js/mxgraph/Menus.js
  31. 5 3
      war/js/mxgraph/Shapes.js
  32. 25 25
      war/js/reader.min.js
  33. 264 264
      war/js/viewer.min.js
  34. 63 13
      war/plugins/update.js
  35. 7 0
      war/templates/index.xml
  36. BIN
      war/templates/venn/spider_1.png
  37. 12 0
      war/templates/venn/spider_1.xml
  38. BIN
      war/templates/venn/spider_2.png
  39. 12 0
      war/templates/venn/spider_2.xml
  40. BIN
      war/templates/venn/venn_1.png
  41. 1 0
      war/templates/venn/venn_1.xml
  42. BIN
      war/templates/venn/venn_2.png
  43. 1 0
      war/templates/venn/venn_2.xml
  44. BIN
      war/templates/venn/venn_3.png
  45. 12 0
      war/templates/venn/venn_3.xml
  46. BIN
      war/templates/venn/venn_4.png
  47. 12 0
      war/templates/venn/venn_4.xml
  48. BIN
      war/templates/venn/venn_5.png
  49. 12 0
      war/templates/venn/venn_5.xml

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+16-MAY-2017: 6.6.0
+
+- Adds Venn diagram templates
+- Starts .vsdx export functionality
+- Improvements and bug fixes for Electron build
+- Fixes for Gliffy importer
+- Adds autosave for libraries in Chrome App
+
 13-MAY-2017: 6.5.10
 
 - Fixes case sensitivity issue for template names and folders

+ 1 - 1
VERSION

@@ -1 +1 @@
-6.5.10
+6.6.0

+ 136 - 105
etc/electron/ElectronApp.js

@@ -1,3 +1,4 @@
+window.OPEN_URL = 'https://www.draw.io/open';
 window.TEMPLATE_PATH = 'templates';
 FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 
@@ -86,7 +87,7 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 		// Replaces file menu to replace openFrom menu with open and rename downloadAs to export
 		this.put('file', new Menu(mxUtils.bind(this, function(menu, parent)
 		{
-			this.addMenuItems(menu, ['new', 'open', '-', 'save', 'saveAs', '-'], parent);
+			this.addMenuItems(menu, ['new', 'open', '-', 'save', 'saveAs', '-', 'import'], parent);
 			this.addSubmenu('exportAs', menu, parent);
 			this.addSubmenu('embed', menu, parent);
 			this.addMenuItems(menu, ['-', 'newLibrary', 'openLibrary', '-', 'documentProperties', 'print'], parent);
@@ -94,6 +95,8 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 		
 		this.put('extras', new Menu(mxUtils.bind(this, function(menu, parent)
 		{
+			this.addSubmenu('insert', menu, parent);
+			menu.addSeparator(parent);
 			this.addMenuItems(menu, ['copyConnect', 'collapseExpand', '-', 'mathematicalTypesetting', 'autosave', '-',
 			                         'createShape', 'editDiagram', '-', 'online'], parent);
 		})));
@@ -129,88 +132,99 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			editorUi.pickLibrary(App.MODE_DEVICE);
 		}));
 
-//		// Replaces import action
-//		this.actions.addAction('import...', mxUtils.bind(this, function()
-//		{
-//			if (this.getCurrentFile() != null)
-//			{
-//				chrome.fileSystem.chooseEntry({type: 'openFile', acceptsAllTypes: true}, mxUtils.bind(this, function(fileEntry)
-//				{
-//					if (!chrome.runtime.lastError)
-//					{
-//						fileEntry.file(mxUtils.bind(this, function(fileObject)
-//						{
-//							if (editorUi.spinner.spin(document.body, mxResources.get('loading')))
-//							{
-//								var reader = new FileReader();
-//								
-//								reader.onload = function(evt)
-//								{
-//									editorUi.spinner.stop();
-//									
-//									try
-//									{
-//										var data = reader.result;
-//										
-//										if (fileObject.type.substring(0, 9) == 'image/png')
-//										{
-//											data = editorUi.extractGraphModelFromPng(data);
-//										}
-//										else if (fileObject.type.substring(0, 6) == 'image/')
-//										{
-//											data = null;
-//										}
-//										
-//										if (data != null)
-//										{
-//											graph.setSelectionCells(editorUi.importXml(data));
-//										}
-//										else
-//										{
-//											var img = new Image();
-//											img.onload = function()
-//											{
-//												editorUi.resizeImage(img, reader.result, function(data2, w, h)
-//												{
-//													var pt = graph.getInsertPoint();
-//													graph.setSelectionCell(graph.insertVertex(null, null, '', pt.x, pt.y, w, h,
-//														'shape=image;aspect=fixed;image=' + editorUi.convertDataUri(data2) + ';'));
-//												}, true);
-//											};
-//											img.src = reader.result;
-//										}
-//									}
-//									catch(e)
-//									{
-//										console.log(e);
-//										editorUi.handleError(e);
-//									}
-//								};
-//								
-//								reader.onerror = function(ev)
-//								{
-//									editorUi.spinner.stop();
-//									editorUi.handleError(ev);
-//								};
-//							
-//								if (fileObject.type.substring(0, 6) == 'image/')
-//								{
-//									reader.readAsDataURL(fileObject);
-//								}
-//								else
-//								{
-//									reader.readAsText(fileObject);
-//								}
-//							}
-//						}));
-//					}
-//					else if (chrome.runtime.lastError.message != 'User cancelled')
-//					{
-//						editorUi.handleError(chrome.runtime.lastError);
-//					}
-//				}));
-//			}
-//		}));
+		// Replaces import action
+		this.actions.addAction('import...', mxUtils.bind(this, function()
+		{
+			if (editorUi.getCurrentFile() != null)
+			{
+				const electron = require('electron');
+				var remote = electron.remote;
+				var dialog = remote.dialog;
+
+		        var paths = dialog.showOpenDialog({properties: ['openFile']});
+			           
+		        if (paths !== undefined && paths[0] != null)
+		        {
+		        	var fs = require('fs');
+		        	var path = paths[0];
+		        	var index = path.lastIndexOf('.png');
+		        	var isPng = index > -1 && index == path.length - 4;
+		        	var encoding = (isPng || /\.gif$/i.test(path) || /\.jpe?g$/i.test(path) ||
+		        		/\.vsdx$/i.test(path)) ? 'base64' : 'utf-8'
+
+					if (editorUi.spinner.spin(document.body, mxResources.get('loading')))
+					{
+			        	fs.readFile(path, encoding, mxUtils.bind(this, function (e, data)
+			        	{
+			        		if (e)
+			        		{
+			        			editorUi.spinner.stop();
+			        			editorUi.handleError(e);
+			        		}
+			        		else
+			        		{
+								try
+								{
+									if (isPng)
+									{
+										var tmp = editorUi.extractGraphModelFromPng(data);
+										
+										if (tmp != null)
+										{
+											data = tmp;
+										}
+									}
+									
+									if (!editorUi.isOffline() && new XMLHttpRequest().upload && editorUi.isRemoteFileFormat(data, path))
+									{
+										// Asynchronous parsing via server
+										editorUi.parseFile(editorUi.base64ToBlob(data, 'application/octet-stream'), mxUtils.bind(this, function(xhr)
+										{
+											if (xhr.readyState == 4)
+											{
+												editorUi.spinner.stop();
+												
+												if (xhr.status >= 200 && xhr.status <= 299)
+												{
+													
+													editorUi.editor.graph.setSelectionCells(editorUi.insertTextAt(xhr.responseText, 0, 0, true));
+												}
+											}
+										}), path);
+									}
+									else if (isPng || /\.gif$/i.test(path) || /\.jpe?g$/i.test(path))
+									{
+										var img = new Image();
+										img.onload = function()
+										{
+											editorUi.resizeImage(img, img.src, function(data2, w, h)
+											{
+												editorUi.spinner.stop();
+												var pt = graph.getInsertPoint();
+												graph.setSelectionCell(graph.insertVertex(null, null, '', pt.x, pt.y, w, h,
+													'shape=image;aspect=fixed;image=' + editorUi.convertDataUri(data2) + ';'));
+											}, true);
+										};
+										
+										img.src = 'data:image/png;base64,' + data;
+									}
+									else if (data != null)
+									{
+										editorUi.spinner.stop();
+										graph.setSelectionCells(editorUi.importXml(data));
+									}
+								}
+								catch(e)
+								{
+									editorUi.spinner.stop();
+									editorUi.handleError(e);
+								}
+			        		}
+			        	}));
+					}
+		        }
+			}
+		}));
 		
 		// Replaces new action
 		var oldNew = this.actions.get('new').funct;
@@ -292,9 +306,16 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 	{
 		this.chooseFileEntry(mxUtils.bind(this, function(fileEntry, data)
 		{
-			var library = new LocalLibrary(this, data, fileEntry.name);
-			library.fileObject = fileEntry;
-			this.loadLibrary(library);
+			try
+			{
+				var library = new LocalLibrary(this, data, fileEntry.name);
+				library.fileObject = fileEntry;
+				this.loadLibrary(library);
+			}
+			catch (e)
+			{
+				this.handleError(e, mxResources.get('errorLoadingFile'));
+			}
 		}));
 	};
 	
@@ -305,7 +326,7 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 		var remote = electron.remote;
 		var dialog = remote.dialog;
 
-        var paths = dialog.showOpenDialog({properties: [ 'openFile' ] });
+        var paths = dialog.showOpenDialog({properties: ['openFile']});
 	           
         if (paths !== undefined && paths[0] != null)
         {
@@ -352,7 +373,7 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 
 	LocalFile.prototype.isAutosave = function()
 	{
-		return this.ui.editor.autosave;
+		return this.ui.editor.autosave && this.fileObject != null;
 	};
 	
 	LocalFile.prototype.isAutosaveOptional = function()
@@ -362,12 +383,12 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 	
 	LocalLibrary.prototype.isAutosave = function()
 	{
-		return true;
+		return this.fileObject != null;
 	};
 	
 	LocalFile.prototype.getTitle = function()
 	{
-		return (this.fileObject != null) ? this.fileObject.name : null;
+		return (this.fileObject != null) ? this.fileObject.name : this.title;
 	};
 
 	LocalFile.prototype.isRenamable = function()
@@ -385,11 +406,6 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 		this.saveFile(revision, success, error);
 	};
 	
-	LocalLibrary.prototype.save = function(revision, success, error)
-	{
-		this.saveFile(revision, success, error);
-	};
-	
 	LocalFile.prototype.saveFile = function(revision, success, error)
 	{
 		var fn = mxUtils.bind(this, function()
@@ -423,8 +439,8 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 		        		{
 							this.savingFile = false;
 							this.isModified = prevModified;
-							
 							this.contentChanged();
+							this.lastData = data;
 							
 							if (success != null)
 							{
@@ -436,7 +452,10 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 				else
 				{
 					// TODO, already saving. Need a better error
-					error();
+					if (error != null)
+					{
+        				error();
+					}
 				}
 			});
 
@@ -511,8 +530,8 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			const electron = require('electron');
 			var remote = electron.remote;
 			var dialog = remote.dialog;
-			
-	        var path = dialog.showSaveDialog({defaultPath: this.title});
+
+			var path = dialog.showSaveDialog({defaultPath: this.title});
 
 	        if (path != null)
 	        {
@@ -522,12 +541,21 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 				this.fileObject.type = 'utf-8';
 				fn();
 			}
+	        else if (error != null)
+			{
+				error();
+			}
 		}
 		else
 		{
 			fn();
 		}
 	};
+
+	LocalLibrary.prototype.save = function(revision, success, error)
+	{
+		LocalFile.prototype.saveFile.apply(this, arguments);
+	};
 	
 	LocalFile.prototype.saveAs = function(title, success, error)
 	{
@@ -543,7 +571,7 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			filename += '.xml';
 		}
 		
-        var path = dialog.showSaveDialog({defaultPath: filename});
+		var path = dialog.showSaveDialog({defaultPath: filename});
         
         if (path != null)
         {
@@ -553,6 +581,10 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			this.fileObject.type = 'utf-8';
 			this.save(false, success, error);
 		}
+        else if (error != null)
+		{
+			error();
+		}
 	};
 
 	App.prototype.saveFile = function(forceDialog)
@@ -693,11 +725,10 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			
 			fs.writeFile(this.fileObject.path, data, this.fileObject.type, mxUtils.bind(this, function (e)
 		    {
-        		if (e)
-        		{
-        			// TODO
-        		}
-
+				if (e)
+				{
+					this.handleError({message: mxResources.get('errorSavingFile')});
+				}
         	}));
 		}
 	};

+ 20 - 5
src/com/mxgraph/io/gliffy/importer/GliffyDiagramConverter.java

@@ -13,6 +13,8 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -62,6 +64,8 @@ public class GliffyDiagramConverter
 	private mxGraphHeadless drawioDiagram;
 
 	private Map<Integer, GliffyObject> vertices;
+	
+	private Pattern rotationPattern = Pattern.compile("rotation=(\\-?\\w+)");
 
 	/**
 	 * Constructs a new converter and starts a conversion.
@@ -323,7 +327,6 @@ public class GliffyDiagramConverter
 		mxGeometry geometry = new mxGeometry((int) gliffyObject.x, (int) gliffyObject.y, (int) gliffyObject.width, (int) gliffyObject.height);
 		cell.setGeometry(geometry);
 		
-		String text;
 		GliffyObject textObject = null;
 		String link = null;
 
@@ -463,7 +466,6 @@ public class GliffyDiagramConverter
 			}
 
 			GliffyObject header = gliffyObject.children.get(0);// first child is the header of the swimlane
-			GliffyObject headerText = header.children.get(0);
 			
 			GliffyShape shape = header.graphic.getShape();
 			style.append("strokeWidth=" + shape.strokeWidth).append(";");
@@ -472,8 +474,6 @@ public class GliffyDiagramConverter
 			style.append("strokeColor=" + shape.strokeColor).append(";");
 			style.append("whiteSpace=wrap;");
 
-			text = headerText.getText();
-
 			for (int i = 1; i < gliffyObject.children.size(); i++) // rest of the children are lanes
 			{
 				GliffyObject gLane = gliffyObject.children.get(i);
@@ -521,7 +521,22 @@ public class GliffyDiagramConverter
 
 		if (gliffyObject.rotation != 0)
 		{
-			style.append("rotation=" + gliffyObject.rotation + ";");
+			//if there's a rotation by default, add to it
+			if(style.lastIndexOf("rotation") != -1) 
+			{
+				Matcher m = rotationPattern.matcher(style);
+				if(m.find())
+				{
+					String rot = m.group(1);
+					Float rotation = Float.parseFloat(rot) + gliffyObject.rotation;
+					
+					m.replaceFirst("rotation=" + rotation.toString());
+				}
+			}
+			else 
+			{
+				style.append("rotation=" + gliffyObject.rotation + ";");
+			}
 		}
 
 		if (!gliffyObject.isLine() && textObject != null)

+ 1 - 1
src/com/mxgraph/io/gliffy/importer/gliffyTranslation.properties

@@ -1,7 +1,7 @@
 #
 # BASIC
 #
-com.gliffy.shape.basic.basic_v1.default.triangle=triangle
+com.gliffy.shape.basic.basic_v1.default.triangle=triangle;rotation=90
 com.gliffy.shape.basic.basic_v1.default.ellipse=ellipse
 com.gliffy.shape.basic.basic_v1.default.rectangle=rect
 com.gliffy.shape.basic.basic_v1.default.circle=ellipse

+ 1 - 1
war/WEB-INF/appengine-web.xml

@@ -2,7 +2,7 @@
 <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
 	<application>drawdotio</application>
 	<!-- IMPORTANT! DO NOT CHANGE THIS VALUE IN SOURCE CONTROL! -->
-	<version>6-5-10</version>
+	<version>6-6-0</version>
 	
 	<!-- Configure java.util.logging -->
 	<system-properties>

+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 05/13/2017 12:10 AM
+# 05/16/2017 02:39 PM
 
 app.html
 index.html?offline=1

File diff suppressed because it is too large
+ 707 - 706
war/js/app.min.js


File diff suppressed because it is too large
+ 254 - 254
war/js/atlas-viewer.min.js


File diff suppressed because it is too large
+ 723 - 723
war/js/atlas.min.js


+ 10 - 5
war/js/diagramly/App.js

@@ -840,10 +840,8 @@ App.prototype.init = function()
 											'<img border="0" align="absmiddle" style="margin-top:-4px;" src="images/glyphicons_star.png"/>&nbsp;&nbsp;Google Docs Add-on</a>',
 											'<a title="Google Chrome App" href="https://chrome.google.com/webstore/detail/drawio-desktop/pebppomjfocnoigkeepgbmcifnnlndla" target="_blank">' +
 											'<img border="0" align="absmiddle" style="margin-top:-4px;" src="images/glyphicons_star.png"/>&nbsp;&nbsp;Google Chrome App</a>',
-//											'<a title="Please help us to 5 stars" href="https://chrome.google.com/webstore/detail/drawio-pro/onlkggianjhjenigcpigpjehhpplldkc/reviews" target="_blank">' +
-//											'<img border="0" align="absmiddle" style="margin-top:-4px;" src="images/glyphicons_star.png"/>&nbsp;&nbsp;Please help us to 5 stars</a>'];
-											'<a title="Please star this issue" href="https://issuetracker.google.com/issues/36761624" target="_blank">' +
-											'<img border="0" align="absmiddle" style="margin-top:-4px;" src="images/glyphicons_star.png"/>&nbsp;&nbsp;Please star this issue</a>'];
+											'<a title="Please help us to 5 stars" href="https://chrome.google.com/webstore/detail/drawio-pro/onlkggianjhjenigcpigpjehhpplldkc/reviews" target="_blank">' +
+											'<img border="0" align="absmiddle" style="margin-top:-4px;" src="images/glyphicons_star.png"/>&nbsp;&nbsp;Please help us to 5 stars</a>'];
 							this.updateAd(this.adsHtml.length - 1);
 						}
 						
@@ -2631,7 +2629,14 @@ App.prototype.pickLibrary = function(mode)
 			{
 				if (optionalFile != null)
 				{
-					this.loadLibrary(optionalFile);
+					try
+					{
+						this.loadLibrary(optionalFile);
+					}
+					catch (e)
+					{
+						this.handleError(e, mxResources.get('errorLoadingFile'));
+					}
 				}
 				else
 				{

+ 12 - 5
war/js/diagramly/EditorUi.js

@@ -1716,7 +1716,9 @@
 			
 			var saveLibrary = mxUtils.bind(this, function(evt)
 			{
-				if (file.constructor != LocalLibrary && file.isAutosave())
+				file.setModified(true);
+				
+				if (file.isAutosave())
 				{
 					if (spinBtn != null && spinBtn.parentNode != null)
 					{
@@ -1751,10 +1753,15 @@
 					mxEvent.addListener(saveBtn, 'click', mxUtils.bind(this, function(evt)
 					{
 						this.saveLibrary(file.getTitle(), images, file, file.getMode(),
-							file.constructor == LocalLibrary, true);
-						saveBtn.parentNode.removeChild(saveBtn);
-						saveBtn = null;
-						title.style.paddingRight = (buttons.childNodes.length * btnWidth) + 'px';
+							file.constructor == LocalLibrary, true, function()
+							{
+								if (saveBtn != null && !file.isModified())
+								{
+									title.style.paddingRight = (buttons.childNodes.length * btnWidth) + 'px';
+									saveBtn.parentNode.removeChild(saveBtn);
+									saveBtn = null;
+								}
+							});
 						
 						mxEvent.consume(evt);
 					}));

+ 24 - 1
war/js/diagramly/Menus.js

@@ -40,7 +40,7 @@
 			item.firstChild.nextSibling.appendChild(link);
 		}
 	};
-	
+
 	var menusInit = Menus.prototype.init;
 	Menus.prototype.init = function()
 	{
@@ -2476,4 +2476,27 @@
 			}
 		})));
 	};
+
+	/**
+	 * Replaces help menu label with icon on small screen
+	 */
+	var menuCreated = Menus.prototype.menuCreated;
+	
+	Menus.prototype.menuCreated = function(menu, elt)
+	{
+		if (screen.width <= 480 && menu == this.get('help'))
+		{
+			elt.style.paddingRight = '0px';
+			elt.style.paddingLeft = '0px';
+			elt.innerHTML = '';
+			
+			var icon = document.createElement('img');
+			icon.setAttribute('border', '0');
+			icon.setAttribute('valign', 'bottom');
+			icon.setAttribute('src', Editor.helpImage);
+			elt.appendChild(icon);
+		}
+		
+		menuCreated.apply(this, arguments);
+	};
 })();

File diff suppressed because it is too large
+ 380 - 0
war/js/diagramly/vsdx/VsdxExport.js


File diff suppressed because it is too large
+ 1 - 0
war/js/diagramly/vsdx/resources/[Content_Types].xml


File diff suppressed because it is too large
+ 1 - 0
war/js/diagramly/vsdx/resources/_rels/.rels


File diff suppressed because it is too large
+ 13 - 0
war/js/diagramly/vsdx/resources/allConstants.json


+ 1 - 0
war/js/diagramly/vsdx/resources/docProps/app.xml

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Properties xmlns='http://schemas.openxmlformats.org/officeDocument/2006/extended-properties' xmlns:vt='http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'><Application>Microsoft Visio</Application><AppVersion>15.0000</AppVersion><Template /><Manager /><Company /><HyperlinkBase /></Properties>

+ 1 - 0
war/js/diagramly/vsdx/resources/docProps/core.xml

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp='http://schemas.openxmlformats.org/package/2006/metadata/core-properties' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:dcterms='http://purl.org/dc/terms/' xmlns:dcmitype='http://purl.org/dc/dcmitype/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><dc:title /><dc:subject /><dc:creator /><cp:keywords /><dc:description /><cp:category /><dc:language>en-US</dc:language></cp:coreProperties>

+ 1 - 0
war/js/diagramly/vsdx/resources/docProps/custom.xml

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Properties xmlns='http://schemas.openxmlformats.org/officeDocument/2006/custom-properties' xmlns:vt='http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes' />

File diff suppressed because it is too large
+ 1 - 0
war/js/diagramly/vsdx/resources/visio/_rels/document.xml.rels


File diff suppressed because it is too large
+ 1 - 0
war/js/diagramly/vsdx/resources/visio/document.xml


+ 1 - 0
war/js/diagramly/vsdx/resources/visio/masters/_rels/masters.xml.rels

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns='http://schemas.openxmlformats.org/package/2006/relationships' />

+ 1 - 0
war/js/diagramly/vsdx/resources/visio/masters/masters.xml

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><Masters xmlns='http://schemas.microsoft.com/office/visio/2012/main' xmlns:r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' xml:space='preserve' />

+ 2 - 0
war/js/diagramly/vsdx/resources/visio/pages/_rels/page1.xml.rels

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Relationships xmlns='http://schemas.openxmlformats.org/package/2006/relationships' />

+ 1 - 0
war/js/diagramly/vsdx/resources/visio/windows.xml

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Windows ClientWidth='0' ClientHeight='0' xmlns='http://schemas.microsoft.com/office/visio/2012/main' xmlns:r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' xml:space='preserve' />

File diff suppressed because it is too large
+ 25 - 25
war/js/embed-static.min.js


File diff suppressed because it is too large
+ 15 - 0
war/js/jszip/jszip.min.js


+ 2 - 2
war/js/mxgraph/EditorUi.js

@@ -1283,7 +1283,7 @@ EditorUi.prototype.initCanvas = function()
 	
 	if (this.editor.chromeless)
 	{
-		resize = mxUtils.bind(this, function(autoscale)
+		resize = mxUtils.bind(this, function(autoscale, maxScale)
 	   	{
 			if (graph.container != null)
 			{
@@ -1310,7 +1310,7 @@ EditorUi.prototype.initCanvas = function()
 				var cw = graph.container.offsetWidth - sb;
 				var ch = graph.container.offsetHeight - sb;
 				
-				var ns = (autoscale) ? Math.max(0.3, Math.min(1, cw / b.width)) : s;
+				var ns = (autoscale) ? Math.max(0.3, Math.min(maxScale || 1, cw / b.width)) : s;
 				var dx = Math.max((cw - ns * b.width) / 2, 0) / ns;
 				var dy = Math.max((ch - ns * b.height) / 4, 0) / ns;
 				

+ 35 - 29
war/js/mxgraph/Menus.js

@@ -30,9 +30,7 @@ Menus.prototype.defaultFontSize = '12';
 /**
  * Sets the default font size.
  */
-Menus.prototype.defaultMenuItems = (screen.width > 480) ?
-	['file', 'edit', 'view', 'arrange', 'extras', 'help'] :
-	['file', 'edit', 'view', 'arrange', 'extras'];
+Menus.prototype.defaultMenuItems = ['file', 'edit', 'view', 'arrange', 'extras', 'help'];
 
 /**
  * Adds the label menu items to the given menu and parent.
@@ -1093,38 +1091,46 @@ Menus.prototype.createMenubar = function(container)
 				menu.funct.apply(this, arguments);
 			}));
 			
-			if (elt != null)
-			{
-				menu.addListener('stateChanged', function()
-				{
-					elt.enabled = menu.enabled;
-					
-					if (!menu.enabled)
-					{
-						elt.className = 'geItem mxDisabled';
-						
-						if (document.documentMode == 8)
-						{
-							elt.style.color = '#c3c3c3';
-						}
-					}
-					else
-					{
-						elt.className = 'geItem';
-						
-						if (document.documentMode == 8)
-						{
-							elt.style.color = '';
-						}
-					}
-				});
-			}
+			this.menuCreated(menu, elt);
 		}))(this.get(menus[i]));
 	}
 
 	return menubar;
 };
 
+/**
+ * Creates the keyboard event handler for the current graph and history.
+ */
+Menus.prototype.menuCreated = function(menu, elt)
+{
+	if (elt != null)
+	{
+		menu.addListener('stateChanged', function()
+		{
+			elt.enabled = menu.enabled;
+			
+			if (!menu.enabled)
+			{
+				elt.className = 'geItem mxDisabled';
+				
+				if (document.documentMode == 8)
+				{
+					elt.style.color = '#c3c3c3';
+				}
+			}
+			else
+			{
+				elt.className = 'geItem';
+				
+				if (document.documentMode == 8)
+				{
+					elt.style.color = '';
+				}
+			}
+		});
+	}
+};
+
 /**
  * Construcs a new menubar for the given editor.
  */

+ 5 - 3
war/js/mxgraph/Shapes.js

@@ -2927,8 +2927,9 @@
 				//if (this.graph.isCellResizable(this.state.cell) || this.graph.isCellMovable(this.state.cell))
 				{
 					var name = this.state.style['shape'];
-					
-					if (this.state.view.graph.cellRenderer.defaultShapes[name] == null)
+
+					if (this.state.view.graph.cellRenderer.defaultShapes[name] == null &&
+						mxStencilRegistry.getStencil(name) == null)
 					{
 						name = mxConstants.SHAPE_RECTANGLE;
 					}
@@ -2951,7 +2952,8 @@
 			{
 				var name = this.state.style['shape'];
 				
-				if (this.state.view.graph.cellRenderer.defaultShapes[name] == null)
+				if (this.state.view.graph.cellRenderer.defaultShapes[name] == null &&
+					mxStencilRegistry.getStencil(name) == null)
 				{
 					name = mxConstants.SHAPE_CONNECTOR;
 				}

File diff suppressed because it is too large
+ 25 - 25
war/js/reader.min.js


File diff suppressed because it is too large
+ 264 - 264
war/js/viewer.min.js


+ 63 - 13
war/plugins/update.js

@@ -8,8 +8,12 @@
  * <update ...>
  * <model>...</model>
  * <view ...>
+ * <fit ...>
  * </updates>
  * 
+ * The outermost updates node may contain an optional url and interval property
+ * to change the current updateUrl and updateInterval.
+ * 
  * Where update must contain an id attribute to reference the cell in the diagram.
  * 
  * - An optional value attribute that contains XML markup is used as the value for
@@ -56,13 +60,17 @@
  * scale and translate.
  * 
  * Example: <view scale="0.5" dx="100" dy="100"/>
+ * 
+ * - A fit node may be specified with a max-scale property to fit the diagram to the
+ * available viewport with the specified max-scale.
  */
 Draw.loadPlugin(function(editorUi)
 {
 	if (editorUi.editor.chromeless)
 	{
 		var graph = editorUi.editor.graph;
-		var interval = 60000;
+		var updateInterval = 60000;
+		var updateUrl = null;
 		
 		function createOverlay(desc)
 		{
@@ -83,18 +91,32 @@ Draw.loadPlugin(function(editorUi)
 			if (xml != null && xml.length > 0)
 			{
 				var doc = mxUtils.parseXml(xml);
+				var node = (doc != null) ? doc.documentElement : null;
 				
-				if (doc != null && doc.documentElement != null)
+				if (node != null && node.nodeName == 'updates')
 				{
-					var node = doc.documentElement.firstChild;
+					if (node.hasAttribute('url'))
+					{
+						updateUrl = node.getAttribute('url');
+					}
+					
+					if (node.hasAttribute('interval'))
+					{
+						updateInterval = node.getAttribute('interval');
+					}
+					
 					var model = graph.getModel();
 					model.beginUpdate();
 					var fit = null;
-					
+
 					try
 					{
+						node = node.firstChild;
+						
 						while (node != null)
 						{
+							console.log('processing', node.nodeName);
+							
 							if (node.nodeName == 'update')
 							{
 								// Resolves the cell ID
@@ -228,8 +250,19 @@ Draw.loadPlugin(function(editorUi)
 							} // if node.nodeName == 'update
 							else if (node.nodeName == 'model')
 							{
-								var dec = new mxCodec(node.ownerDocument);
-								dec.decode(node.firstChild, model);
+								// Finds first child element
+								var dataNode = node.firstChild;
+								
+								while (dataNode != null && dataNode.nodeType != mxConstants.NODETYPE_ELEMENT)
+								{
+									dataNode = dataNode.nextSibling;
+								}
+								
+								if (dataNode != null)
+								{
+									var dec = new mxCodec(node.firstChild);
+									dec.decode(dataNode, model);
+								}
 							}
 							else if (node.nodeName == 'view')
 							{
@@ -244,6 +277,17 @@ Draw.loadPlugin(function(editorUi)
 										parseFloat(node.getAttribute('dy') || 0));
 								}
 							}
+							else if (node.nodeName == 'fit')
+							{
+								if (node.hasAttribute('max-scale'))
+								{
+									fit = parseFloat(node.getAttribute('max-scale'));
+								}
+								else
+								{
+									fit = 1;
+								}
+							}
 							
 							node = node.nextSibling;
 						} // end of while
@@ -252,6 +296,11 @@ Draw.loadPlugin(function(editorUi)
 					{
 						model.endUpdate();
 					}
+					
+					if (fit != null && editorUi.chromelessResize)
+					{
+						editorUi.chromelessResize(true, fit);
+					}
 				}
 			}
 		};
@@ -260,30 +309,31 @@ Draw.loadPlugin(function(editorUi)
 		
 		function scheduleUpdates()
 		{
+			var page = editorUi.currentPage;
 			var root = editorUi.editor.graph.getModel().getRoot();
 			var result = false;
 			
 			if (root.value != null && typeof(root.value) == 'object')
 			{
-				interval = parseInt(root.value.getAttribute('updateInterval') || interval);
-				var url = root.value.getAttribute('updateUrl');
+				updateInterval = parseInt(root.value.getAttribute('updateInterval') || updateInterval);
+				updateUrl = root.value.getAttribute('updateUrl') || updateUrl;
 				
-				if (url != null)
+				if (updateUrl != null)
 				{
 					var currentXml = mxUtils.getXml(editorUi.editor.getGraphXml());
 					
 					function doUpdate()
 					{
-						if (url === 'demo')
+						if (updateUrl === 'demo')
 						{
 							parseResponse(mxUtils.getXml(createDemoResponse().documentElement));	
 							schedule();
 						}
 						else
 						{
-							mxUtils.post(url, 'xml=' + encodeURIComponent(currentXml), function(req)
+							mxUtils.post(updateUrl, 'xml=' + encodeURIComponent(currentXml), function(req)
 							{
-								if (root === editorUi.editor.graph.getModel().getRoot())
+								if (page === editorUi.currentPage)
 								{
 									if (req.getStatus() >= 200 && req.getStatus() <= 300)
 									{
@@ -305,7 +355,7 @@ Draw.loadPlugin(function(editorUi)
 					
 					function schedule()
 					{
-						currentThread = window.setTimeout(doUpdate, interval);
+						currentThread = window.setTimeout(doUpdate, updateInterval);
 					};
 					
 					doUpdate();

+ 7 - 0
war/templates/index.xml

@@ -58,4 +58,11 @@
 <template url="uml/sysml.xml" libs="general;uml;sysml"/>
 <template url="uml/uml_1.xml" libs="general;uml"/>
 <template url="uml/uml_2.xml" libs="general;uml"/>
+<template url="venn/spider_1.xml" libs="general"/>
+<template url="venn/spider_2.xml" libs="general"/>
+<template url="venn/venn_1.xml" libs="general"/>
+<template url="venn/venn_2.xml" libs="general"/>
+<template url="venn/venn_3.xml" libs="general"/>
+<template url="venn/venn_4.xml" libs="general"/>
+<template url="venn/venn_5.xml" libs="general"/>
 </templates>

BIN
war/templates/venn/spider_1.png


File diff suppressed because it is too large
+ 12 - 0
war/templates/venn/spider_1.xml


BIN
war/templates/venn/spider_2.png


File diff suppressed because it is too large
+ 12 - 0
war/templates/venn/spider_2.xml


BIN
war/templates/venn/venn_1.png


File diff suppressed because it is too large
+ 1 - 0
war/templates/venn/venn_1.xml


BIN
war/templates/venn/venn_2.png


File diff suppressed because it is too large
+ 1 - 0
war/templates/venn/venn_2.xml


BIN
war/templates/venn/venn_3.png


File diff suppressed because it is too large
+ 12 - 0
war/templates/venn/venn_3.xml


BIN
war/templates/venn/venn_4.png


File diff suppressed because it is too large
+ 12 - 0
war/templates/venn/venn_4.xml


BIN
war/templates/venn/venn_5.png


File diff suppressed because it is too large
+ 12 - 0
war/templates/venn/venn_5.xml