Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » capturing diagram on shell
capturing diagram on shell [message #415252] Fri, 07 December 2007 11:35 Go to next message
Eclipse UserFriend
Originally posted by: ziashahid123.gmail.com

Hi All!

I am developing a plugin for eclipse, to provide a particular
functionality i have to render a diagram on shell without opening the
shell and then capture that diagram.

My program is working fine when i am using draw2d widgets provided by Java
APIs but when i am using my figure (which i made by extending "Figure"
class) it losts the layout.

What could be the problem? I am attaching both the program.

Regards,
Zia

Code of Demo Program which is working fine:
*******************************************

public class CaptureScreen
{
public static void main(String args[])
{
final InternalDemo2 internalDemo2 = new InternalDemo2();
internalDemo2.initialize();
}
}

//In this class I've used widgets provided by draw2d.

class InternalDemo2
{
public Shell shell;
public Figure contents;
LightweightSystem lws;

public void initialize() {

shell = new Shell();
lws = new LightweightSystem(shell);
contents = new Figure();
contents.setLayoutManager(new XYLayout());
lws.setContents(contents);
Clickable button = new org.eclipse.draw2d.Button("Click me");
button.setBounds(new org.eclipse.draw2d.geometry.Rectangle(5,5, 50, 30));
Clickable checkbox = new CheckBox("Checkbox");
checkbox.setBounds(new org.eclipse.draw2d.geometry.Rectangle(10,30, 100,
30));
Shape ellipse = new Ellipse();
ellipse.setBackgroundColor(ColorConstants.yellow);
ellipse.setBounds(new org.eclipse.draw2d.geometry.Rectangle(120,200, 40,
50));
Shape rectangle = new RectangleFigure();
rectangle.setBounds(new org.eclipse.draw2d.geometry.Rectangle(120,150,
80,40));
rectangle.setBackgroundColor(ColorConstants.lightBlue);
contents.add(button, new org.eclipse.draw2d.geometry.Rectangle(5, 5, 50,
30));
contents.add(checkbox, new org.eclipse.draw2d.geometry.Rectangle(10, 30,
100, 30));
contents.add(ellipse, new
org.eclipse.draw2d.geometry.Rectangle(120,200,40,50));
contents.add(rectangle, new org.eclipse.draw2d.geometry.Rectangle(120,150,
80, 40));

//Capturing starts here.
Image img1 = new Image(null, new org.eclipse.swt.graphics.Rectangle(0, 0,
300, 300));
GC gc1 = new GC(img1);
Graphics grap1 = new SWTGraphics(gc1);
contents.paint(grap1);
ImageLoader loader1 = new ImageLoader();
loader1.data = new ImageData[] {img1.getImageData()};
loader1.save("c:/draw2d.jpeg", SWT.IMAGE_JPEG);

gc1.dispose();
grap1.dispose();
gc1.ddispose();
}
}
------------------------------------------------------------ ---------------------------

Code which is not working Fine:
This time i am using figures defined by
CompartmentFigure and UMLClassFigure classes which extend "Figure".
********************************

//Main Class
public class UMLClassFigureTest2 {
public static void main(String args[])
{
final InternalDemo2 internalDemo2 = new InternalDemo2();
internalDemo2.initialize();

}
}


class CompartmentFigure extends Figure
{
public CompartmentFigure()
{
ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(false);
layout.setSpacing(2);
setLayoutManager(layout);
setBorder(new CompartmentFigureBorder());
}
}

class CompartmentFigureBorder extends AbstractBorder {
public Insets getInsets(IFigure figure)
{
return new Insets(1,0,0,0);
}
public void paint(IFigure figure, Graphics graphics, Insets insets)
{
graphics.drawLine(getPaintRectangle(figure, insets).getTopLeft(),
tempRect.getTopRight());
}
}

class UMLClassFigure extends Figure
{
public static Color classColor = new Color(null,255,255,206);
private CompartmentFigure attributeFigure = new CompartmentFigure();
private CompartmentFigure methodFigure = new CompartmentFigure();
public UMLClassFigure(Label name)
{
ToolbarLayout layout = new ToolbarLayout();
setLayoutManager(layout);
setBorder(new LineBorder(ColorConstants.black,1));
setBackgroundColor(classColor);
setOpaque(true);

add(name);
add(attributeFigure);
add(methodFigure);
}
public CompartmentFigure getAttributesCompartment()
{
return attributeFigure;
}
public CompartmentFigure getMethodsCompartment()
{
return methodFigure;
}
}


class InternalDemo2
{
public Shell shell;
public Figure contents;
LightweightSystem lws;

public void initialize()
{
shell = new Shell(Display.getDefault());
shell.setText("UMLClassFigure Test");
lws = new LightweightSystem(shell);
contents = new Figure();
XYLayout contentsLayout = new XYLayout();
contents.setLayoutManager(contentsLayout);
lws.setContents(contents);

Font classFont = new Font(null, "Arial", 12, SWT.BOLD);
Label classLabel1 = new Label("Table");
classLabel1.setFont(classFont);

Label classLabel2 = new Label("Column");
classLabel2.setFont(classFont);

final UMLClassFigure classFigure = new UMLClassFigure(classLabel1);
final UMLClassFigure classFigure2 = new UMLClassFigure(classLabel2);

Label attribute1 = new Label("columns: Column[]");
Label attribute2 = new Label("rows: Row[]");
Label attribute3 = new Label("columnID: int");
Label attribute4 = new Label("items: List");

classFigure.getAttributesCompartment().add(attribute1);
classFigure.getAttributesCompartment().add(attribute2);
classFigure2.getAttributesCompartment().add(attribute3);
classFigure2.getAttributesCompartment().add(attribute4);

Label method1 = new Label("getColumns(): Column[]");
Label method2 = new Label("getRows(): Row[]");
Label method3 = new Label("getColumnID(): int");
Label method4 = new Label("getItems(): List");

classFigure.getMethodsCompartment().add(method1);
classFigure.getMethodsCompartment().add(method2);
classFigure2.getMethodsCompartment().add(method3);
classFigure2.getMethodsCompartment().add(method4);

contentsLayout.setConstraint(classFigure, new
Rectangle(10,10,-1,-1));
contentsLayout.setConstraint(classFigure2, new Rectangle(200, 200,
-1, -1));

PolylineConnection c = new PolylineConnection();
ChopboxAnchor sourceAnchor = new ChopboxAnchor(classFigure);
ChopboxAnchor targetAnchor = new ChopboxAnchor(classFigure2);
c.setSourceAnchor(sourceAnchor);
c.setTargetAnchor(targetAnchor);

PolygonDecoration decoration = new PolygonDecoration();
PointList decorationPointList = new PointList();
decorationPointList.addPoint(0,0);
decorationPointList.addPoint(-2,2);
decorationPointList.addPoint(-4,0);
decorationPointList.addPoint(-2,-2);
decoration.setTemplate(decorationPointList);
c.setSourceDecoration(decoration);

ConnectionEndpointLocator targetEndpointLocator = new
ConnectionEndpointLocator(c, true);
targetEndpointLocator.setVDistance(15);
Label targetMultiplicityLabel = new Label("1..*");
c.add(targetMultiplicityLabel, targetEndpointLocator);

ConnectionEndpointLocator sourceEndpointLocator = new
ConnectionEndpointLocator(c, false);
sourceEndpointLocator.setVDistance(15);
Label sourceMultiplicityLabel = new Label("1");
c.add(sourceMultiplicityLabel, sourceEndpointLocator);

ConnectionEndpointLocator relationshipLocator = new
ConnectionEndpointLocator(c,true);
relationshipLocator.setUDistance(10);
relationshipLocator.setVDistance(-20);
Label relationshipLabel = new Label("contains");
c.add(relationshipLabel,relationshipLocator);

contents.add(classFigure);
contents.add(classFigure2);
contents.add(c);
}
}
Re: capturing diagram on shell [message #415256 is a reply to message #415252] Fri, 07 December 2007 14:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030707070802070101060101
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Zia,

This isn't an EMF question and I'm not really sure if this is a GEF
question or what. Please try to direct your question to the newsgroup
that provides the classes you are asking about. If it's purely a GEF
question, use

news://news.eclipse.org/eclipse.tools.gef


Zia Shahid wrote:
> Hi All!
>
> I am developing a plugin for eclipse, to provide a particular
> functionality i have to render a diagram on shell without opening the
> shell and then capture that diagram.
>
> My program is working fine when i am using draw2d widgets provided by
> Java APIs but when i am using my figure (which i made by extending
> "Figure" class) it losts the layout.
>
> What could be the problem? I am attaching both the program.
>
> Regards,
> Zia
>
> Code of Demo Program which is working fine:
> *******************************************
>
> public class CaptureScreen
> {
> public static void main(String args[])
> {
> final InternalDemo2 internalDemo2 = new InternalDemo2();
> internalDemo2.initialize();
> }
> }
>
> //In this class I've used widgets provided by draw2d.
>
> class InternalDemo2 {
> public Shell shell;
> public Figure contents;
> LightweightSystem lws;
>
> public void initialize() {
>
> shell = new Shell();
> lws = new LightweightSystem(shell);
> contents = new Figure();
> contents.setLayoutManager(new XYLayout());
> lws.setContents(contents);
> Clickable button = new org.eclipse.draw2d.Button("Click me");
> button.setBounds(new org.eclipse.draw2d.geometry.Rectangle(5,5, 50,
> 30));
> Clickable checkbox = new CheckBox("Checkbox");
> checkbox.setBounds(new org.eclipse.draw2d.geometry.Rectangle(10,30,
> 100, 30));
> Shape ellipse = new Ellipse();
> ellipse.setBackgroundColor(ColorConstants.yellow);
> ellipse.setBounds(new org.eclipse.draw2d.geometry.Rectangle(120,200,
> 40, 50));
> Shape rectangle = new RectangleFigure();
> rectangle.setBounds(new org.eclipse.draw2d.geometry.Rectangle(120,150,
> 80,40));
> rectangle.setBackgroundColor(ColorConstants.lightBlue);
> contents.add(button, new org.eclipse.draw2d.geometry.Rectangle(5, 5,
> 50, 30));
> contents.add(checkbox, new org.eclipse.draw2d.geometry.Rectangle(10,
> 30, 100, 30));
> contents.add(ellipse, new
> org.eclipse.draw2d.geometry.Rectangle(120,200,40,50));
> contents.add(rectangle, new
> org.eclipse.draw2d.geometry.Rectangle(120,150, 80, 40));
>
> //Capturing starts here.
> Image img1 = new Image(null, new org.eclipse.swt.graphics.Rectangle(0,
> 0, 300, 300));
> GC gc1 = new GC(img1);
> Graphics grap1 = new SWTGraphics(gc1);
> contents.paint(grap1);
> ImageLoader loader1 = new ImageLoader(); loader1.data = new
> ImageData[] {img1.getImageData()}; loader1.save("c:/draw2d.jpeg",
> SWT.IMAGE_JPEG);
>
> gc1.dispose();
> grap1.dispose();
> gc1.ddispose();
> }
> }
> ------------------------------------------------------------ ---------------------------
>
>
> Code which is not working Fine: This time i am using figures defined by
> CompartmentFigure and UMLClassFigure classes which extend "Figure".
> ********************************
>
> //Main Class
> public class UMLClassFigureTest2 {
> public static void main(String args[])
> {
> final InternalDemo2 internalDemo2 = new InternalDemo2();
> internalDemo2.initialize();
>
> }
> }
>
>
> class CompartmentFigure extends Figure {
> public CompartmentFigure() {
> ToolbarLayout layout = new ToolbarLayout();
> layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
> layout.setStretchMinorAxis(false);
> layout.setSpacing(2);
> setLayoutManager(layout);
> setBorder(new CompartmentFigureBorder());
> }
> }
>
> class CompartmentFigureBorder extends AbstractBorder {
> public Insets getInsets(IFigure figure) {
> return new Insets(1,0,0,0);
> }
> public void paint(IFigure figure, Graphics graphics, Insets insets)
> {
> graphics.drawLine(getPaintRectangle(figure, insets).getTopLeft(),
> tempRect.getTopRight());
> }
> }
>
> class UMLClassFigure extends Figure
> {
> public static Color classColor = new Color(null,255,255,206);
> private CompartmentFigure attributeFigure = new
> CompartmentFigure();
> private CompartmentFigure methodFigure = new CompartmentFigure();
> public UMLClassFigure(Label name)
> {
> ToolbarLayout layout = new ToolbarLayout();
> setLayoutManager(layout);
> setBorder(new LineBorder(ColorConstants.black,1));
> setBackgroundColor(classColor);
> setOpaque(true);
>
> add(name);
> add(attributeFigure);
> add(methodFigure);
> }
> public CompartmentFigure getAttributesCompartment()
> {
> return attributeFigure;
> }
> public CompartmentFigure getMethodsCompartment()
> {
> return methodFigure;
> }
> }
>
>
> class InternalDemo2 {
> public Shell shell;
> public Figure contents;
> LightweightSystem lws;
> public void initialize() {
> shell = new Shell(Display.getDefault());
> shell.setText("UMLClassFigure Test");
> lws = new LightweightSystem(shell);
> contents = new Figure();
> XYLayout contentsLayout = new XYLayout();
> contents.setLayoutManager(contentsLayout);
> lws.setContents(contents);
>
> Font classFont = new Font(null, "Arial", 12, SWT.BOLD);
> Label classLabel1 = new Label("Table");
> classLabel1.setFont(classFont);
>
> Label classLabel2 = new Label("Column");
> classLabel2.setFont(classFont);
>
> final UMLClassFigure classFigure = new UMLClassFigure(classLabel1);
> final UMLClassFigure classFigure2 = new UMLClassFigure(classLabel2);
>
> Label attribute1 = new Label("columns: Column[]");
> Label attribute2 = new Label("rows: Row[]");
> Label attribute3 = new Label("columnID: int");
> Label attribute4 = new Label("items: List");
>
> classFigure.getAttributesCompartment().add(attribute1);
> classFigure.getAttributesCompartment().add(attribute2);
> classFigure2.getAttributesCompartment().add(attribute3);
> classFigure2.getAttributesCompartment().add(attribute4);
>
> Label method1 = new Label("getColumns(): Column[]");
> Label method2 = new Label("getRows(): Row[]");
> Label method3 = new Label("getColumnID(): int");
> Label method4 = new Label("getItems(): List");
>
> classFigure.getMethodsCompartment().add(method1);
> classFigure.getMethodsCompartment().add(method2);
> classFigure2.getMethodsCompartment().add(method3);
> classFigure2.getMethodsCompartment().add(method4);
>
> contentsLayout.setConstraint(classFigure, new
> Rectangle(10,10,-1,-1));
> contentsLayout.setConstraint(classFigure2, new Rectangle(200,
> 200, -1, -1));
>
> PolylineConnection c = new PolylineConnection();
> ChopboxAnchor sourceAnchor = new ChopboxAnchor(classFigure);
> ChopboxAnchor targetAnchor = new ChopboxAnchor(classFigure2);
> c.setSourceAnchor(sourceAnchor);
> c.setTargetAnchor(targetAnchor);
>
> PolygonDecoration decoration = new PolygonDecoration();
> PointList decorationPointList = new PointList();
> decorationPointList.addPoint(0,0);
> decorationPointList.addPoint(-2,2);
> decorationPointList.addPoint(-4,0);
> decorationPointList.addPoint(-2,-2);
> decoration.setTemplate(decorationPointList);
> c.setSourceDecoration(decoration);
>
> ConnectionEndpointLocator targetEndpointLocator = new
> ConnectionEndpointLocator(c, true);
> targetEndpointLocator.setVDistance(15);
> Label targetMultiplicityLabel = new Label("1..*");
> c.add(targetMultiplicityLabel, targetEndpointLocator);
>
> ConnectionEndpointLocator sourceEndpointLocator = new
> ConnectionEndpointLocator(c, false);
> sourceEndpointLocator.setVDistance(15);
> Label sourceMultiplicityLabel = new Label("1");
> c.add(sourceMultiplicityLabel, sourceEndpointLocator);
>
> ConnectionEndpointLocator relationshipLocator = new
> ConnectionEndpointLocator(c,true);
> relationshipLocator.setUDistance(10);
> relationshipLocator.setVDistance(-20);
> Label relationshipLabel = new Label("contains");
> c.add(relationshipLabel,relationshipLocator);
>
> contents.add(classFigure);
> contents.add(classFigure2);
> contents.add(c);
> }
> }
>
>
>
>


--------------030707070802070101060101
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Zia,<br>
<br>
This isn't an EMF question and I'm not really sure if this is a GEF
question or what.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: capturing diagram on shell [message #415257 is a reply to message #415256] Fri, 07 December 2007 14:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040706030000050404020504
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Zia,

And also please don't cross post the question to multiple newsgroups.


Ed Merks wrote:
> Zia,
>
> This isn't an EMF question and I'm not really sure if this is a GEF
> question or what. Please try to direct your question to the newsgroup
> that provides the classes you are asking about. If it's purely a GEF
> question, use
>
> news://news.eclipse.org/eclipse.tools.gef
>
>
> Zia Shahid wrote:
>> Hi All!
>>
>> I am developing a plugin for eclipse, to provide a particular
>> functionality i have to render a diagram on shell without opening the
>> shell and then capture that diagram.
>>
>> My program is working fine when i am using draw2d widgets provided by
>> Java APIs but when i am using my figure (which i made by extending
>> "Figure" class) it losts the layout.
>>
>> What could be the problem? I am attaching both the program.
>>
>> Regards,
>> Zia
>>
>> Code of Demo Program which is working fine:
>> *******************************************
>>
>> public class CaptureScreen
>> {
>> public static void main(String args[])
>> {
>> final InternalDemo2 internalDemo2 = new InternalDemo2();
>> internalDemo2.initialize();
>> }
>> }
>>
>> //In this class I've used widgets provided by draw2d.
>>
>> class InternalDemo2 {
>> public Shell shell;
>> public Figure contents;
>> LightweightSystem lws;
>>
>> public void initialize() {
>>
>> shell = new Shell();
>> lws = new LightweightSystem(shell);
>> contents = new Figure();
>> contents.setLayoutManager(new XYLayout());
>> lws.setContents(contents);
>> Clickable button = new org.eclipse.draw2d.Button("Click me");
>> button.setBounds(new org.eclipse.draw2d.geometry.Rectangle(5,5, 50,
>> 30));
>> Clickable checkbox = new CheckBox("Checkbox");
>> checkbox.setBounds(new org.eclipse.draw2d.geometry.Rectangle(10,30,
>> 100, 30));
>> Shape ellipse = new Ellipse();
>> ellipse.setBackgroundColor(ColorConstants.yellow);
>> ellipse.setBounds(new org.eclipse.draw2d.geometry.Rectangle(120,200,
>> 40, 50));
>> Shape rectangle = new RectangleFigure();
>> rectangle.setBounds(new
>> org.eclipse.draw2d.geometry.Rectangle(120,150, 80,40));
>> rectangle.setBackgroundColor(ColorConstants.lightBlue);
>> contents.add(button, new org.eclipse.draw2d.geometry.Rectangle(5, 5,
>> 50, 30));
>> contents.add(checkbox, new org.eclipse.draw2d.geometry.Rectangle(10,
>> 30, 100, 30));
>> contents.add(ellipse, new
>> org.eclipse.draw2d.geometry.Rectangle(120,200,40,50));
>> contents.add(rectangle, new
>> org.eclipse.draw2d.geometry.Rectangle(120,150, 80, 40));
>>
>> //Capturing starts here.
>> Image img1 = new Image(null, new
>> org.eclipse.swt.graphics.Rectangle(0, 0, 300, 300));
>> GC gc1 = new GC(img1);
>> Graphics grap1 = new SWTGraphics(gc1);
>> contents.paint(grap1);
>> ImageLoader loader1 = new ImageLoader(); loader1.data = new
>> ImageData[] {img1.getImageData()}; loader1.save("c:/draw2d.jpeg",
>> SWT.IMAGE_JPEG);
>>
>> gc1.dispose();
>> grap1.dispose();
>> gc1.ddispose();
>> }
>> }
>> ------------------------------------------------------------ ---------------------------
>>
>>
>> Code which is not working Fine: This time i am using figures defined by
>> CompartmentFigure and UMLClassFigure classes which extend "Figure".
>> ********************************
>>
>> //Main Class
>> public class UMLClassFigureTest2 {
>> public static void main(String args[])
>> {
>> final InternalDemo2 internalDemo2 = new InternalDemo2();
>> internalDemo2.initialize();
>>
>> }
>> }
>>
>>
>> class CompartmentFigure extends Figure {
>> public CompartmentFigure() {
>> ToolbarLayout layout = new ToolbarLayout();
>> layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
>> layout.setStretchMinorAxis(false);
>> layout.setSpacing(2);
>> setLayoutManager(layout);
>> setBorder(new CompartmentFigureBorder());
>> }
>> }
>>
>> class CompartmentFigureBorder extends AbstractBorder {
>> public Insets getInsets(IFigure figure) {
>> return new Insets(1,0,0,0);
>> }
>> public void paint(IFigure figure, Graphics graphics, Insets
>> insets) {
>> graphics.drawLine(getPaintRectangle(figure, insets).getTopLeft(),
>> tempRect.getTopRight());
>> }
>> }
>>
>> class UMLClassFigure extends Figure
>> {
>> public static Color classColor = new Color(null,255,255,206);
>> private CompartmentFigure attributeFigure = new
>> CompartmentFigure();
>> private CompartmentFigure methodFigure = new CompartmentFigure();
>> public UMLClassFigure(Label name)
>> {
>> ToolbarLayout layout = new ToolbarLayout();
>> setLayoutManager(layout);
>> setBorder(new LineBorder(ColorConstants.black,1));
>> setBackgroundColor(classColor);
>> setOpaque(true);
>>
>> add(name);
>> add(attributeFigure);
>> add(methodFigure);
>> }
>> public CompartmentFigure getAttributesCompartment()
>> {
>> return attributeFigure;
>> }
>> public CompartmentFigure getMethodsCompartment()
>> {
>> return methodFigure;
>> }
>> }
>>
>>
>> class InternalDemo2 {
>> public Shell shell;
>> public Figure contents;
>> LightweightSystem lws;
>> public void initialize() {
>> shell = new Shell(Display.getDefault());
>> shell.setText("UMLClassFigure Test");
>> lws = new LightweightSystem(shell);
>> contents = new Figure();
>> XYLayout contentsLayout = new XYLayout();
>> contents.setLayoutManager(contentsLayout);
>> lws.setContents(contents);
>>
>> Font classFont = new Font(null, "Arial", 12, SWT.BOLD);
>> Label classLabel1 = new Label("Table");
>> classLabel1.setFont(classFont);
>>
>> Label classLabel2 = new Label("Column");
>> classLabel2.setFont(classFont);
>>
>> final UMLClassFigure classFigure = new UMLClassFigure(classLabel1);
>> final UMLClassFigure classFigure2 = new
>> UMLClassFigure(classLabel2);
>>
>> Label attribute1 = new Label("columns: Column[]");
>> Label attribute2 = new Label("rows: Row[]");
>> Label attribute3 = new Label("columnID: int");
>> Label attribute4 = new Label("items: List");
>>
>> classFigure.getAttributesCompartment().add(attribute1);
>> classFigure.getAttributesCompartment().add(attribute2);
>> classFigure2.getAttributesCompartment().add(attribute3);
>> classFigure2.getAttributesCompartment().add(attribute4);
>>
>> Label method1 = new Label("getColumns(): Column[]");
>> Label method2 = new Label("getRows(): Row[]");
>> Label method3 = new Label("getColumnID(): int");
>> Label method4 = new Label("getItems(): List");
>>
>> classFigure.getMethodsCompartment().add(method1);
>> classFigure.getMethodsCompartment().add(method2);
>> classFigure2.getMethodsCompartment().add(method3);
>> classFigure2.getMethodsCompartment().add(method4);
>>
>> contentsLayout.setConstraint(classFigure, new
>> Rectangle(10,10,-1,-1));
>> contentsLayout.setConstraint(classFigure2, new Rectangle(200,
>> 200, -1, -1));
>>
>> PolylineConnection c = new PolylineConnection();
>> ChopboxAnchor sourceAnchor = new ChopboxAnchor(classFigure);
>> ChopboxAnchor targetAnchor = new ChopboxAnchor(classFigure2);
>> c.setSourceAnchor(sourceAnchor);
>> c.setTargetAnchor(targetAnchor);
>>
>> PolygonDecoration decoration = new PolygonDecoration();
>> PointList decorationPointList = new PointList();
>> decorationPointList.addPoint(0,0);
>> decorationPointList.addPoint(-2,2);
>> decorationPointList.addPoint(-4,0);
>> decorationPointList.addPoint(-2,-2);
>> decoration.setTemplate(decorationPointList);
>> c.setSourceDecoration(decoration);
>>
>> ConnectionEndpointLocator targetEndpointLocator = new
>> ConnectionEndpointLocator(c, true);
>> targetEndpointLocator.setVDistance(15);
>> Label targetMultiplicityLabel = new Label("1..*");
>> c.add(targetMultiplicityLabel, targetEndpointLocator);
>>
>> ConnectionEndpointLocator sourceEndpointLocator = new
>> ConnectionEndpointLocator(c, false);
>> sourceEndpointLocator.setVDistance(15);
>> Label sourceMultiplicityLabel = new Label("1");
>> c.add(sourceMultiplicityLabel, sourceEndpointLocator);
>>
>> ConnectionEndpointLocator relationshipLocator = new
>> ConnectionEndpointLocator(c,true);
>> relationshipLocator.setUDistance(10);
>> relationshipLocator.setVDistance(-20);
>> Label relationshipLabel = new Label("contains");
>> c.add(relationshipLabel,relationshipLocator);
>>
>> contents.add(classFigure);
>> contents.add(classFigure2);
>> contents.add(c);
>> }
>> }
>>
>>
>>
>>
>


--------------040706030000050404020504
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Zia,<br>
<br>
And also please don't cross post the question to multiple newsgroups.<br>
<br>
<br>
Ed Merks wrote:
<blockquote cite="mid:fjbknv$r67$1@build.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
Zia,<br>
<br>
This isn't an EMF question and I'm not really sure if this is a GEF
question or what.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: capturing diagram on shell [message #415282 is a reply to message #415257] Mon, 10 December 2007 10:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ziashahid.mail2capricorn.com

Dear ED!

It wasn't known to me that eclipse.org and eclipsezone.com is maintaining the same forum.

Anyways, Sorry for the inconvenience and thanks for your advice.

Regards,

Zia
Re: capturing diagram on shell [message #415283 is a reply to message #415257] Mon, 10 December 2007 10:44 Go to previous message
Eclipse UserFriend
Originally posted by: ziashahid.mail2capricorn.com

Dear ED!

It wasn't known to me that eclipse.org and eclipsezone.com is maintaining the same forum.

Anyways, Sorry for the inconvenience and thanks for your advice.

Now, i did send this query to GEF forum coz this query belongs to <b>draw2d</b>, And, i think there won't be any problem in this.

Regards,

Zia
Previous Topic:SDO 2.0 and EMF
Next Topic:Loading Multiple files using EMF resource load?
Goto Forum:
  


Current Time: Fri Apr 26 12:55:14 GMT 2024

Powered by FUDForum. Page generated in 0.04041 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top