Skip to content

Instantly share code, notes, and snippets.

View davidjgraph's full-sized avatar
🏠
Typing...

David Benson davidjgraph

🏠
Typing...
View GitHub Profile
@davidjgraph
davidjgraph / fastOrganicLayout.html
Created November 4, 2015 14:06
organic layout parameters
<!--
Copyright (c) 2006-2013, JGraph Ltd
Hierarchical Layout example for mxGraph. This example demonstrates the
use of the hierarchical and organic layouts. Note that the hierarchical
layout requires another script tag in the head of the page.
-->
<html>
<head>
<title>Hierarchical Layout example for mxGraph</title>
@davidjgraph
davidjgraph / webViewExportText.java
Created September 3, 2015 12:15
Testing draw.io (mxGraph) image export using Java WebView
import javafx.application.Application;
import javafx.beans.value.*;
import javafx.concurrent.Worker.State;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.Scene;
import javafx.scene.image.*;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
@davidjgraph
davidjgraph / drawWebView.java
Last active April 11, 2021 14:15
draw.io wraped in a Java WebView
import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
@davidjgraph
davidjgraph / server.c++
Created August 28, 2015 05:40
draw.io sandstorm server file
// Copyright (c) 2014 Sandstorm Development Group, Inc.
// Licensed under the MIT License:
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
var mathJaxQueue = [];
// Disables global typesetting and messages on startup, adds queue for
// asynchronous rendering while MathJax is loading
window.MathJax =
@davidjgraph
davidjgraph / nodisplay.xml
Created April 11, 2015 12:46
XML doesn't load
<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="2" parent="1" style="gradientColor=#ffffff;gradientDirection=north;spacingRight=-1.39;fillColor=#f0f0f0;shadow=1;spacingTop=-1.39;spacingLeft=-1.39;strokeColor=#404040;whiteSpace=wrap;spacingBottom=-1.39;strokeWidth=0.7;group;" value="" vertex="1"><mxGeometry as="geometry" height="70.0" width="410.0" x="150.0" y="280.0"/></mxCell><mxCell id="3" parent="2" style="gradientColor=#ffffff;gradientDirection=north;spacingRight=-1.39;fillColor=#f0f0f0;shadow=1;spacingTop=-1.39;shape=mxgraph.flowchart.process;spacingLeft=-1.39;strokeColor=#404040;whiteSpace=wrap;spacingBottom=-1.39;strokeWidth=0.7;" value="" vertex="1"><mxGeometry as="geometry" height="60.0" width="100.0" y="10.0"/></mxCell><mxCell id="4" parent="2" style="gradientColor=#ffffff;gradientDirection=north;spacingRight=-1.39;fillColor=#f0f0f0;shadow=1;spacingTop=-1.39;spacingLeft=-1.39;strokeColor=#404040;whiteSpace=wrap;spacingBottom=-1.39;strokeWidth=0.7;" value="" vertex="1"><mxG
@davidjgraph
davidjgraph / drawioClientSVG
Created January 15, 2015 11:15
The draw.io code invoked on a download as SVG
else if (format == 'svg')
{
var bg = this.editor.graph.background;
if (bg == 'none')
{
bg = null;
}
// JPG does not support transparent backgrounds
@davidjgraph
davidjgraph / mxCircleLayout.js
Created November 28, 2014 12:52
mxCircleLayout.js
/**
* Copyright (c) 2006-2013, JGraph Ltd
*/
/**
* Class: mxCircleLayout
*
* Extends <mxGraphLayout> to implement a circluar layout for a given radius.
* The vertices do not need to be connected for this layout to work and all
* connections between vertices are not taken into account.
*
/**
* $Id: mxPidValvesOld.js,v 1.1 2013/09/09 04:54:19 mate Exp $
* Copyright (c) 2006-2013, JGraph Ltd
*/
//**********************************************************************************************************************************************************
//Valve
//**********************************************************************************************************************************************************
/**
* Extends mxShape.
@davidjgraph
davidjgraph / gist:2270096a3e030849e96b
Created November 4, 2014 21:27
Legacy Google licensing code
package com.jgraph.licensing;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;