Home » Eclipse Projects » GEF » Creating Graphviz "Record" shape in Draw2D(How to create Graphviz "Record" shapes in Draw2D?)
| | |
Re: Creating Graphviz "Record" shape in Draw2D [message #545280 is a reply to message #545266] |
Wed, 07 July 2010 11:03 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
u have to parse each structure and accordingly u have to create the figure...
u have write the logic,try it out....
mean while i will try to impliment structure for
"hello\nworld |{ b |{c|<here> d|e}| f}| g | h"
and will post the code in one or two days...(if i am able to)
but after that there will be many hurdels to completly implement records u have to manage that...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
| |
Re: Creating Graphviz "Record" shape in Draw2D [message #545447 is a reply to message #545363] |
Wed, 07 July 2010 19:34 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
you have to extend shapes class and draw each compartments according to the specified script....
how did u manage to do box3d, component, Mcircle,note, tab folder etc..
if you could manage these then u should be able to do this also..
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
| |
Re: Creating Graphviz "Record" shape in Draw2D [message #545579 is a reply to message #545532] |
Thu, 08 July 2010 10:14 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
Not much but Shapes is much more generic way to create shapes,
u have to just override fillShape and outlineShape and implement it.
u can see RectangularFigure and Ellipse for specifics...
for example
package org.eclipse.gef.examples.flow;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
* A test class to display a UMLFigure
*/
public class StructureShape
{
public static void main(String args[])
{
Display d = new Display();
final Shell shell = new Shell(d);
shell.setSize(400, 400);
shell.setText("UMLClassFigure Test");
LightweightSystem lws = new LightweightSystem(shell);
Figure contents = new Figure();
XYLayout contentsLayout = new XYLayout();
contents.setLayoutManager(contentsLayout);
Structure c = new Structure();
c.setBounds(new Rectangle(50, 50, 200, 100));
contents.add(c);
lws.setContents(contents);
shell.open();
while (!shell.isDisposed())
while (!d.readAndDispatch())
d.sleep();
}
public static class Structure extends Shape
{
@Override
protected void fillShape(Graphics graphics)
{
graphics.fillRectangle(bounds.getCopy().crop(new Insets(1, 1, 1, 1)));
}
@Override
protected void outlineShape(Graphics graphics)
{
Rectangle copy = bounds.getCopy();
copy = copy.crop(new Insets(1, 1, 1, 1));
graphics.drawRectangle(copy);
graphics.drawLine(copy.x + copy.width / 3, copy.y, copy.x + bounds.width / 3, copy.y
+ copy.height);
graphics.drawLine(copy.x + copy.width * 2 / 3, copy.y, copy.x + copy.width * 2 / 3,
copy.y + copy.height);
graphics.drawLine(copy.x + copy.width / 3, copy.y + copy.height / 3, copy.x
+ bounds.width * 2 / 3, copy.y + copy.height / 3);
graphics.drawLine(copy.x + copy.width / 3, copy.y + copy.height * 2 / 3, copy.x
+ bounds.width * 2 / 3, copy.y + copy.height * 2 / 3);
}
}
}
here the fraction which are multiplied will be decided by the structure script.
and how many times also will be decided by the script.
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
| | |
Re: Creating Graphviz "Record" shape in Draw2D [message #545776 is a reply to message #545655] |
Fri, 09 July 2010 05:20 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
The version of draw2d was 3.6 here,
u can remove the crop methods and do the crop manually,
The script is
digraph structs {
node [shape=record];
struct1 [label="<f0> left|<f1> mid\ dle|<f2> right"];
struct2 [label="<f0> one|<f1> two"];
struct3 [label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"];
struct1:f1 -> struct2:f0;
struct1:f2 -> struct3:here;
}
in purticular
struct3 [label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"];
which decides how many columns(sub columns) and rows(sub rows)
but as i told u
Quote: | but after that there will be many hurdels to completly implement records u have to manage that...
|
even if i want to help i will not be able to cuz there are many things to take care of...i can not dectate them from here...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
| |
Goto Forum:
Current Time: Thu Sep 19 03:53:45 GMT 2024
Powered by FUDForum. Page generated in 0.04532 seconds
|