<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: JGraph and BDE	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/jgraph-and-bde/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/jgraph-and-bde?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jgraph-and-bde</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Thu, 02 Jul 2015 12:42:48 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-352287</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 02 Jul 2015 12:42:48 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-352287</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-352285&quot;&gt;Sam Roberts&lt;/a&gt;.

@Sam - thanks for confirming that BDE does indeed stand for Block Diagram Editor as I&#039;ve speculated. As I noted in the main text, MathWorks removed BDE from the core Matlab in R2009b, and it&#039;s not available to the general Matlab user since then. Only users of R2009a and earlier can use it. When I wrote the article in late 2010 (for publication in Jan 2011), R2009a was still widely used. But I believe that it is not very relevant nowadays.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-352285">Sam Roberts</a>.</p>
<p>@Sam &#8211; thanks for confirming that BDE does indeed stand for Block Diagram Editor as I&#8217;ve speculated. As I noted in the main text, MathWorks removed BDE from the core Matlab in R2009b, and it&#8217;s not available to the general Matlab user since then. Only users of R2009a and earlier can use it. When I wrote the article in late 2010 (for publication in Jan 2011), R2009a was still widely used. But I believe that it is not very relevant nowadays.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sam Roberts		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-352285</link>

		<dc:creator><![CDATA[Sam Roberts]]></dc:creator>
		<pubDate>Thu, 02 Jul 2015 12:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-352285</guid>

					<description><![CDATA[Yair - just in case you&#039;re still interested (I appreciate that this is a very old post I&#039;m replying to), BDE is short for block diagram editor. It&#039;s part of SimBiology (MathWorks&#039; product for modelling, simulation and analysis of biological systems, such as pharmacokinetics and systems biology), and is used to graphically lay out components of biological models. If you take a look at the marketing pages on MathWorks website for SimBiology, you&#039;ll see plenty of screenshots that show the component in action.

It&#039;s a MathWorks-authored component, although it may (I&#039;m not sure) be a wrapper around a third-party component. I&#039;m not sure why it&#039;s included as part of MATLAB rather than just SimBiology - perhaps there&#039;s an idea that it might get reused across other products as well.

If anyone is thinking of using it, I would not rely on it to have a stable interface or behaviour across versions: MathWorks may well modify it based on requirements for SimBiology - which, as a leaf product, has much more scope to change rapidly than core MATLAB.]]></description>
			<content:encoded><![CDATA[<p>Yair &#8211; just in case you&#8217;re still interested (I appreciate that this is a very old post I&#8217;m replying to), BDE is short for block diagram editor. It&#8217;s part of SimBiology (MathWorks&#8217; product for modelling, simulation and analysis of biological systems, such as pharmacokinetics and systems biology), and is used to graphically lay out components of biological models. If you take a look at the marketing pages on MathWorks website for SimBiology, you&#8217;ll see plenty of screenshots that show the component in action.</p>
<p>It&#8217;s a MathWorks-authored component, although it may (I&#8217;m not sure) be a wrapper around a third-party component. I&#8217;m not sure why it&#8217;s included as part of MATLAB rather than just SimBiology &#8211; perhaps there&#8217;s an idea that it might get reused across other products as well.</p>
<p>If anyone is thinking of using it, I would not rely on it to have a stable interface or behaviour across versions: MathWorks may well modify it based on requirements for SimBiology &#8211; which, as a leaf product, has much more scope to change rapidly than core MATLAB.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Scott Koch		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-326984</link>

		<dc:creator><![CDATA[Scott Koch]]></dc:creator>
		<pubDate>Wed, 25 Jun 2014 18:38:50 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-326984</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-223621&quot;&gt;Markus Behle&lt;/a&gt;.

Thanks for the post Markus. Here&#039;s how I implemented your suggestion for anyone interested (Daniel). 

Overload the mxGraph class. Create a file, mymxGraph.java with the following code:

&lt;pre lang=&quot;java&quot;&gt;
import java.awt.datatransfer.DataFlavor;
import com.mxgraph.view.mxGraph;
import com.mxgraph.swing.util.mxGraphTransferable;

// Modified mxGraph to fix dragging
public class mymxGraph extends mxGraph {
  static {
    try {
      //Set enableImageSupport to false if using Mac otherwise data translation error happens.
      com.mxgraph.swing.util.mxGraphTransferable.enableImageSupport = false;
      //Following code is suggested in:
      //https://github.com/jgraph/jgraphx/blob/master/src/com/mxgraph/swing/util/mxGraphTransferable.java
      mxGraphTransferable.dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + 
      &quot;; class=com.mxgraph.swing.util.mxGraphTransferable&quot;, null, 
      new com.mxgraph.swing.util.mxGraphTransferable(null, null).getClass().getClassLoader()); 
    } catch (ClassNotFoundException e) {
      System.err.println(&quot;Caught Class Not Found Exception: &quot; + e.getMessage());;
    }
  }
}
&lt;/pre&gt;

Next, compile the class (at Matlab command line). Note that I have the jgraphx.jar in the same folder as mymxGraph.java created above which is also my Current Folder in Matlab:

&lt;pre lang=&quot;matlab&quot;&gt;
% Compile the java file being sure to include jgraphx.jar
system(&#039;javac mymxGraph.java -classpath jgraphx.jar&#039;)
% Create a jar
system(&#039;jar cf mymxGraph.jar mymxGraph.class&#039;)
% Add both mymxGraph and jgraphx to java path
javaaddpath(&#039;mymxGraph.jar&#039;);
javaaddpath(&#039;jgraphx.jar&#039;)

% Replace com.mxgraph.view.mxGraph with the new mymxGraph
graph = mymxGraph;

%Run the rest of the code above and cells should now be draggable. 
&lt;/pre&gt;

I&#039;m a java amateur so if anyone has improvements to suggest please post them.

Thanks]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-223621">Markus Behle</a>.</p>
<p>Thanks for the post Markus. Here&#8217;s how I implemented your suggestion for anyone interested (Daniel). </p>
<p>Overload the mxGraph class. Create a file, mymxGraph.java with the following code:</p>
<pre lang="java">
import java.awt.datatransfer.DataFlavor;
import com.mxgraph.view.mxGraph;
import com.mxgraph.swing.util.mxGraphTransferable;

// Modified mxGraph to fix dragging
public class mymxGraph extends mxGraph {
  static {
    try {
      //Set enableImageSupport to false if using Mac otherwise data translation error happens.
      com.mxgraph.swing.util.mxGraphTransferable.enableImageSupport = false;
      //Following code is suggested in:
      //https://github.com/jgraph/jgraphx/blob/master/src/com/mxgraph/swing/util/mxGraphTransferable.java
      mxGraphTransferable.dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + 
      "; class=com.mxgraph.swing.util.mxGraphTransferable", null, 
      new com.mxgraph.swing.util.mxGraphTransferable(null, null).getClass().getClassLoader()); 
    } catch (ClassNotFoundException e) {
      System.err.println("Caught Class Not Found Exception: " + e.getMessage());;
    }
  }
}
</pre>
<p>Next, compile the class (at Matlab command line). Note that I have the jgraphx.jar in the same folder as mymxGraph.java created above which is also my Current Folder in Matlab:</p>
<pre lang="matlab">
% Compile the java file being sure to include jgraphx.jar
system('javac mymxGraph.java -classpath jgraphx.jar')
% Create a jar
system('jar cf mymxGraph.jar mymxGraph.class')
% Add both mymxGraph and jgraphx to java path
javaaddpath('mymxGraph.jar');
javaaddpath('jgraphx.jar')

% Replace com.mxgraph.view.mxGraph with the new mymxGraph
graph = mymxGraph;

%Run the rest of the code above and cells should now be draggable. 
</pre>
<p>I&#8217;m a java amateur so if anyone has improvements to suggest please post them.</p>
<p>Thanks</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Markus Behle		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-288622</link>

		<dc:creator><![CDATA[Markus Behle]]></dc:creator>
		<pubDate>Fri, 25 Oct 2013 13:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-288622</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-280717&quot;&gt;Daniel Malmquist&lt;/a&gt;.

@Daniel

You don&#039;t need to patch jgraphx&#039; sources.
From your code I see that you use jgraphx directly on Matlab&#039;s command line (or in a .m file).
I wrote a Java program (where I put my code snippet in right at the beginning), compiled and packed it into a jar. From Matlab&#039;s command line, I use that jar as a kind of library.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-280717">Daniel Malmquist</a>.</p>
<p>@Daniel</p>
<p>You don&#8217;t need to patch jgraphx&#8217; sources.<br />
From your code I see that you use jgraphx directly on Matlab&#8217;s command line (or in a .m file).<br />
I wrote a Java program (where I put my code snippet in right at the beginning), compiled and packed it into a jar. From Matlab&#8217;s command line, I use that jar as a kind of library.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Daniel Malmquist		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-280717</link>

		<dc:creator><![CDATA[Daniel Malmquist]]></dc:creator>
		<pubDate>Thu, 10 Oct 2013 12:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-280717</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-223621&quot;&gt;Markus Behle&lt;/a&gt;.

Hi! 

I&#039;ve been trying to get this working.

Do i need to put this code in my own program or in the jgraphx sources and rebuild it?

I&#039;ve tried running it from my program with no success. I use jgraphx directly from matlab so i rewrote the code snippet for matlab:

&lt;pre lang=&quot;matlab&quot;&gt;
%Fix for movable vertices
tempobj = javaObject(&#039;com.mxgraph.swing.util.mxGraphTransferable&#039;,[], []);
mxGraphTransferable.dataFlavor = javaObject(&#039;java.awt.datatransfer.DataFlavor&#039;, ...
   [char(java.awt.datatransfer.DataFlavor.javaJVMLocalObjectMimeType)&#039;; class = com.mxgraph.swing.util.mxGraphTransferable&#039;], ...
   [], tempobj.getClass().getClassLoader())
&lt;/pre&gt;

What am I doing wrong?

Regards]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-223621">Markus Behle</a>.</p>
<p>Hi! </p>
<p>I&#8217;ve been trying to get this working.</p>
<p>Do i need to put this code in my own program or in the jgraphx sources and rebuild it?</p>
<p>I&#8217;ve tried running it from my program with no success. I use jgraphx directly from matlab so i rewrote the code snippet for matlab:</p>
<pre lang="matlab">
%Fix for movable vertices
tempobj = javaObject('com.mxgraph.swing.util.mxGraphTransferable',[], []);
mxGraphTransferable.dataFlavor = javaObject('java.awt.datatransfer.DataFlavor', ...
   [char(java.awt.datatransfer.DataFlavor.javaJVMLocalObjectMimeType)'; class = com.mxgraph.swing.util.mxGraphTransferable'], ...
   [], tempobj.getClass().getClassLoader())
</pre>
<p>What am I doing wrong?</p>
<p>Regards</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Markus Behle		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-223621</link>

		<dc:creator><![CDATA[Markus Behle]]></dc:creator>
		<pubDate>Thu, 11 Jul 2013 08:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-223621</guid>

					<description><![CDATA[&lt;b&gt;mxGraph/JGraph - Get Drag &#038; Drop (moving vertices), Cut &#038; Paste working&lt;/b&gt;

People complained about not being able to move vertices if they start a java application built with mxGraph/JGraph. I experienced the same problem and investigated it. Here&#039;s my solution how to get it working.
This article refers to Matlab R2013a and mxGraph 2.1.0.0 but it should also work with older versions of both.

Both Drag &#038; Drop (which is needed for moving vertices around) and Cut &#038; Paste rely on the &lt;i&gt;mxGraphTransferHandler&lt;/i&gt; working correctly. The &lt;i&gt;mxGraphTransferHandler&lt;/i&gt; in fact uses its own implementation of &lt;i&gt;Transferable&lt;/i&gt; (&lt;i&gt;java.awt.datatransfer.Transferable&lt;/i&gt;) called &lt;i&gt;mxGraphTransferable&lt;/i&gt;. Have a look at the source code in &lt;i&gt;jgraphx/src/com/mxgraph/swing/util/mxGraphTransferable.java&lt;/i&gt;. At the very end you&#039;ll see a static initializer whose job is to construct a suitable &lt;i&gt;DataFlavor&lt;/i&gt; (&lt;i&gt;java.awt.datatransfer.DataFlavor&lt;/i&gt;). And here is the problem! If you start your mxGraph application from Java&#039;s VM everything works fine. But if you start it from within Matlab&#039;s JVM it cannot find the class &lt;i&gt;com.mxgraph.swing.util.mxGraphTransferable&lt;/i&gt; and you&#039;ll get a &lt;i&gt;ClassNotFoundException&lt;/i&gt;. As you can see in the code this one is caught but nothing happens (&lt;i&gt;// do nothing&lt;/i&gt;). So you do not notice that the Class Loader has a problem and keep wondering why moving vertices does not work (as me).

Now here comes the solution. By the way, I found it in the source code &lt;i&gt;jgraphx/src/com/mxgraph/swing/util/mxGraphTransferable.java&lt;/i&gt; at the very top. There it says &quot;Serialized Data Flavor. Use the following code to switch to local reference flavor: ...&quot;. In fact this did not work for me. &quot;If you get a class not found exception, try the following instead: ...&quot; Et voila! Just insert their code 

&lt;pre lang=&quot;java&quot;&gt;
mxGraphTransferable.dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType
+ &quot;; class=com.mxgraph.swing.util.mxGraphTransferable&quot;, null,
new com.mxgraph.swing.util.mxGraphTransferable(null, null).getClass().getClassLoader());
&lt;/pre&gt;

at the beginning of your java code and moving vertices, Drag &#038; Drop and Cut &#038; Paste works!]]></description>
			<content:encoded><![CDATA[<p><b>mxGraph/JGraph &#8211; Get Drag &amp; Drop (moving vertices), Cut &amp; Paste working</b></p>
<p>People complained about not being able to move vertices if they start a java application built with mxGraph/JGraph. I experienced the same problem and investigated it. Here&#8217;s my solution how to get it working.<br />
This article refers to Matlab R2013a and mxGraph 2.1.0.0 but it should also work with older versions of both.</p>
<p>Both Drag &amp; Drop (which is needed for moving vertices around) and Cut &amp; Paste rely on the <i>mxGraphTransferHandler</i> working correctly. The <i>mxGraphTransferHandler</i> in fact uses its own implementation of <i>Transferable</i> (<i>java.awt.datatransfer.Transferable</i>) called <i>mxGraphTransferable</i>. Have a look at the source code in <i>jgraphx/src/com/mxgraph/swing/util/mxGraphTransferable.java</i>. At the very end you&#8217;ll see a static initializer whose job is to construct a suitable <i>DataFlavor</i> (<i>java.awt.datatransfer.DataFlavor</i>). And here is the problem! If you start your mxGraph application from Java&#8217;s VM everything works fine. But if you start it from within Matlab&#8217;s JVM it cannot find the class <i>com.mxgraph.swing.util.mxGraphTransferable</i> and you&#8217;ll get a <i>ClassNotFoundException</i>. As you can see in the code this one is caught but nothing happens (<i>// do nothing</i>). So you do not notice that the Class Loader has a problem and keep wondering why moving vertices does not work (as me).</p>
<p>Now here comes the solution. By the way, I found it in the source code <i>jgraphx/src/com/mxgraph/swing/util/mxGraphTransferable.java</i> at the very top. There it says &#8220;Serialized Data Flavor. Use the following code to switch to local reference flavor: &#8230;&#8221;. In fact this did not work for me. &#8220;If you get a class not found exception, try the following instead: &#8230;&#8221; Et voila! Just insert their code </p>
<pre lang="java">
mxGraphTransferable.dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType
+ "; class=com.mxgraph.swing.util.mxGraphTransferable", null,
new com.mxgraph.swing.util.mxGraphTransferable(null, null).getClass().getClassLoader());
</pre>
<p>at the beginning of your java code and moving vertices, Drag &amp; Drop and Cut &amp; Paste works!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60715</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 31 Oct 2011 22:04:17 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-60715</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60197&quot;&gt;Akli Benali&lt;/a&gt;.

@Akli - try to follow the code in the following File Exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/27074]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60197">Akli Benali</a>.</p>
<p>@Akli &#8211; try to follow the code in the following File Exchange submission: <a href="http://www.mathworks.com/matlabcentral/fileexchange/27074" rel="nofollow ugc">http://www.mathworks.com/matlabcentral/fileexchange/27074</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Akli Benali		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60197</link>

		<dc:creator><![CDATA[Akli Benali]]></dc:creator>
		<pubDate>Mon, 24 Oct 2011 18:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-60197</guid>

					<description><![CDATA[Yes, I added the jar files in \lib and the build.xml using the javaaddpath.]]></description>
			<content:encoded><![CDATA[<p>Yes, I added the jar files in \lib and the build.xml using the javaaddpath.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60080</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 22 Oct 2011 16:09:18 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-60080</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60019&quot;&gt;Akli Benali&lt;/a&gt;.

@Akli - did you remember to use &lt;b&gt;&lt;i&gt;javaaddpath&lt;/i&gt;&lt;/b&gt; for your JGraphT jar file(s)?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60019">Akli Benali</a>.</p>
<p>@Akli &#8211; did you remember to use <b><i>javaaddpath</i></b> for your JGraphT jar file(s)?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Akli Benali		</title>
		<link>https://undocumentedmatlab.com/articles/jgraph-and-bde#comment-60019</link>

		<dc:creator><![CDATA[Akli Benali]]></dc:creator>
		<pubDate>Fri, 21 Oct 2011 21:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2063#comment-60019</guid>

					<description><![CDATA[About JgraphT and the submission link mentioned above: I tried to follow the instructions in the link and I can&#039;t use the JgraphT in Matlab. When I do &#039;which org.matjgraph.MaximalCliques.getMaximalCliques&#039; it retrives &quot;not found&quot;. First I thought the problem was in the paths to add because the &quot;build&quot; path does not exist. I changed it to match the build.xml file and all the jar files in the \lib\ path and still it does not work.

Does anyone know what can be the problem?

Cheers

(Version R2008a, Windows Vista)]]></description>
			<content:encoded><![CDATA[<p>About JgraphT and the submission link mentioned above: I tried to follow the instructions in the link and I can&#8217;t use the JgraphT in Matlab. When I do &#8216;which org.matjgraph.MaximalCliques.getMaximalCliques&#8217; it retrives &#8220;not found&#8221;. First I thought the problem was in the paths to add because the &#8220;build&#8221; path does not exist. I changed it to match the build.xml file and all the jar files in the \lib\ path and still it does not work.</p>
<p>Does anyone know what can be the problem?</p>
<p>Cheers</p>
<p>(Version R2008a, Windows Vista)</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
