RE: Specifying edges' appearance

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Specifying edges' appearance

Tomás Laurenzo
Dear all,



I've managed to overcome my little problem by creating a new kind of
JGraphT Edge (ObjectHolderDirectedEdge extends DirectedEdge), and using
it for my project.

By overriding it's toString() method I got the desired customization (it
also holds a value, hence it's name).

best,
  tom.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Specifying edges' appearance

Kyle Lahnakoski
Can you cut and paste the toString() code?  I would like to know what
you mean by cusomizing the look.  Your original post seemed to indicate
you wanted to change the graphical look (somehow interfacing with jgraph
to change vertex and edge graphics).  But your recent post indicates you
just wanted to change the text.

Which was it?

Thanks.


Tomás Laurenzo wrote:

> Dear all,
>
>
>
> I've managed to overcome my little problem by creating a new kind of
> JGraphT Edge (ObjectHolderDirectedEdge extends DirectedEdge), and using
> it for my project.
>
> By overriding it's toString() method I got the desired customization
> (it also holds a value, hence it's name).
>
> best,
>  tom.
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> jgrapht-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgrapht-users
>


--
----------------------------------------------------------------------
Kyle Lahnakoski                                       [hidden email]
(416) 892-7784                                    Arcavia Software Ltd



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Specifying edges' appearance

Tomás Laurenzo
Dear Kyle,

I at first wanted to customize both the graphical appearance and the text.
As you say, by overriding the toString() method I only can change it's
text. Sadly, the graphical customization remains unsolved.

best,
tom.

Kyle Lahnakoski wrote:

> Can you cut and paste the toString() code?  I would like to know what
> you mean by cusomizing the look.  Your original post seemed to
> indicate you wanted to change the graphical look (somehow interfacing
> with jgraph to change vertex and edge graphics).  But your recent post
> indicates you just wanted to change the text.
>
> Which was it?
>
> Thanks.
>
>
> Tomás Laurenzo wrote:
>
>> Dear all,
>>
>>
>>
>> I've managed to overcome my little problem by creating a new kind of
>> JGraphT Edge (ObjectHolderDirectedEdge extends DirectedEdge), and using
>> it for my project.
>>
>> By overriding it's toString() method I got the desired customization
>> (it also holds a value, hence it's name).
>>
>> best,
>>  tom.
>>
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>> from IBM. Find simple to follow Roadmaps, straightforward articles,
>> informative Webcasts and more! Get everything you need to get up to
>> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
>> _______________________________________________
>> jgrapht-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jgrapht-users
>>
>
>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Specifying edges' appearance

Tomás Laurenzo
In reply to this post by Kyle Lahnakoski
Dear Kyle et al,

I've solved my little problem and I'm posting the resulting code here.
I'm afraid that the code it's really kludgy, but as I've seen that this
is a common problem, I'm pasting it hoping that it will be useful to
someone.

// first we create an add the edge
ObjectHolderDirectedEdge edge = new ObjectHolderDirectedEdge(firstNode,
secondNode, anObject);
graph.addEdge(edge);  // graph is a JGraphT ListenableGraph

// then we modify it's appearance
Map nested = new Hashtable();
Map attributeMap = new Hashtable();
DefaultGraphCell edgeCell = jgraphAdapter.getEdgeCell(edge);  // jgraph
is, obviously a JGraph object.
                                                              //
jgraphAdapter is a JGraphModelAdapter

GraphConstants.setLineColor(attributeMap, Color.BLUE);
GraphConstants.setLineEnd(attributeMap, GraphConstants.ARROW_TECHNICAL);
GraphConstants.setEditable(attributeMap, false);

nested.put(edgeCell, attributeMap);
jgraph.getGraphLayoutCache().edit(nested, null, null, null);

hth.
best to all,
 tom.

Kyle Lahnakoski wrote:

> Can you cut and paste the toString() code?  I would like to know what
> you mean by cusomizing the look.  Your original post seemed to
> indicate you wanted to change the graphical look (somehow interfacing
> with jgraph to change vertex and edge graphics).  But your recent post
> indicates you just wanted to change the text.
>
> Which was it?
>
> Thanks.
>
>
> Tomás Laurenzo wrote:
>
>> Dear all,
>>
>>
>>
>> I've managed to overcome my little problem by creating a new kind of
>> JGraphT Edge (ObjectHolderDirectedEdge extends DirectedEdge), and using
>> it for my project.
>>
>> By overriding it's toString() method I got the desired customization
>> (it also holds a value, hence it's name).
>>
>> best,
>>  tom.
>>
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>> from IBM. Find simple to follow Roadmaps, straightforward articles,
>> informative Webcasts and more! Get everything you need to get up to
>> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
>> _______________________________________________
>> jgrapht-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jgrapht-users
>>
>
>



Loading...