tags:

views:

222

answers:

0

I am developing a graphical view of data using PREFUSE library.

I have 3 kinds of nodes in my graph:

  1. APPLICATION
  2. DATABASE
  3. INTERFACE

Below are some excerpts from my .xml file containing graph

<node id="AP-1">
<data key="name">Application1</data>
<data key="type">APPLICATION</data>
</node>

<node id="DB-1">
<data key="name">Database1</data>
<data key="type">DATABASE</data>
</node>

<node id="IT-1">
<data key="name">Interface1</data>
<data key="type">INTERFACE</data>
</node>

I want to show the above 3 diff. kinds of nodes with 3 diff. kinds of shapes as follows:

  1. APPLICATION by Rectangle
  2. DATABASE by custom shape (shape of a cylinder, usually used to denote a database)
  3. INTERFACE by circle

I have first read the .xml file in a

Graph g

Q1. Now how can I distinguish these 3 kinds of nodes in a datagroup. I think I should write predicates. I have read the whole predicates and expressions manuals for prefuse but couldn't write a predicate to distinguish them. So what will be the predicate for that?

Q2. How to specify my custom shape and how to set a renderer that can render the custom shape developed by me?