Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
114 lines (89 loc) · 2.55 KB

File metadata and controls

114 lines (89 loc) · 2.55 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* $Id: mxDomUtils.java,v 1.1 2012/11/15 13:26:39 gaudenz Exp $
* Copyright (c) 2007-2012, JGraph Ltd
*/
package com.mxgraph.util;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* Contains various DOM API helper methods for use with mxGraph.
*/
public class mxDomUtils
{
/**
* Returns a new, empty DOM document.
*
* @return Returns a new DOM document.
*/
public static Document createDocument()
{
Document result = null;
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
result = parser.newDocument();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
return result;
}
/**
* Creates a new SVG document for the given width and height.
*/
public static Document createSvgDocument(int width, int height)
{
Document document = createDocument();
Element root = document.createElement("svg");
String w = String.valueOf(width);
String h = String.valueOf(height);
root.setAttribute("width", w);
root.setAttribute("height", h);
root.setAttribute("viewBox", "0 0 " + w + " " + h);
root.setAttribute("version", "1.1");
root.setAttribute("xmlns", mxConstants.NS_SVG);
root.setAttribute("xmlns:xlink", mxConstants.NS_XLINK);
document.appendChild(root);
return document;
}
/**
*
*/
public static Document createVmlDocument()
{
Document document = createDocument();
Element root = document.createElement("html");
root.setAttribute("xmlns:v", "urn:schemas-microsoft-com:vml");
root.setAttribute("xmlns:o", "urn:schemas-microsoft-com:office:office");
document.appendChild(root);
Element head = document.createElement("head");
Element style = document.createElement("style");
style.setAttribute("type", "text/css");
style.appendChild(document
.createTextNode("<!-- v\\:* {behavior: url(#default#VML);} -->"));
head.appendChild(style);
root.appendChild(head);
Element body = document.createElement("body");
root.appendChild(body);
return document;
}
/**
* Returns a document with a HTML node containing a HEAD and BODY node.
*/
public static Document createHtmlDocument()
{
Document document = createDocument();
Element root = document.createElement("html");
document.appendChild(root);
Element head = document.createElement("head");
root.appendChild(head);
Element body = document.createElement("body");
root.appendChild(body);
return document;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.