[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] GEF and SWT standalone application
|
- From: Yun-Kang <ahn@xxxxxxxxxxx>
- Date: Thu, 07 Jul 2005 10:16:57 +0200
- Newsgroups: eclipse.platform.swt
- Organization: EclipseCorner
- User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
Hello,
>
> I am trying to make a StandAlone Application with GEF. I started with
> SWT but I need to make a decision tree, and that's why I have to
> implement some GEF .
>
> If you check my jpg, you will notice on the left the canvas where the
> user will draw the tree,( implemented with GEF). The other elements will
> allow the edition of the tree nodes, it is still implemented with SWT.
> And that's where the shoe pinches : I am not able to control the
> layouts as I am supposed to do .
Here is the code of my window :
protected Control createContents(Composite parent)
{
//The whole window (I suppose so)
Composite composite = new Composite(parent, SWT.BORDER);
composite.setLayout(new FillLayout());
....
//The graphical editing zone
Composite arbre = new Composite(composite, SWT.BORDER);
viewer = new ScrollingGraphicalViewer();
viewer.setEditDomain(editDomain);
viewer.createControl(arbre);
arbre.setLayout(new FillLayout());
...
FormData formArbre= new FormData();
formArbre.top = new FormAttachment(0,10);
formArbre.left = new FormAttachment(0,10);
formArbre.right = new FormAttachment(100,-10);
formArbre.bottom = new FormAttachment(50,-10);
arbre.setLayoutData(formArbre);
...
//The tabfolder zone
TabFolder tabFolder = new TabFolder(composite,SWT.NONE);
tabFolder.setLayout(new FillLayout(SWT.VERTICAL));
...
FormData formongl = new FormData();
formongl.top = new FormAttachment(arbre,10);
formongl.left = new FormAttachment(0,10);
formongl.right = new FormAttachment(30,-10);
formongl.bottom = new FormAttachment(100,-10 );
tabFolder.setLayoutData(formongl);
...
//The tabletree zone
Composite fillComp1 = new Composite(composite, SWT.BORDER);
fillComp1.setLayout(new FillLayout(SWT.HORIZONTAL));
...
FormData formComp = new FormData();
formComp.top = new FormAttachment(arbre,10);
formComp.left = new FormAttachment(tabFolder,10);
formComp.right = new FormAttachment(60,-10);
formComp.bottom = new FormAttachment(100,-10 );
fillComp1.setLayoutData(formComp);
...
// Button
Composite fillbutt = new Composite(composite, SWT.BORDER);
RowLayout rl = new RowLayout(SWT.VERTICAL);
...
FormData formButt = new FormData();
formButt.top = new FormAttachment(arbre,10);
formButt.left = new FormAttachment(fillComp1,10);
formButt.right = new FormAttachment(70,-10);
formButt.bottom = new FormAttachment(100,-10 );
fillbutt.setLayoutData(formButt);
...
//The final zone
Composite fillComp2 = new Composite(composite, SWT.BORDER);
fillComp2.setLayout(new FillLayout(SWT.VERTICAL));
...
ormData formComp2 = new FormData();
formComp2.top = new FormAttachment(arbre,10);
formComp2.left = new FormAttachment(fillbutt,10);
formComp2.right = new FormAttachment(100,-10);
formComp2.bottom = new FormAttachment(100,-10 );
fillComp2.setLayoutData(formComp2);
...
}
I had this when my graphical zone was a simple canvas using Draw 2D
>
> -----------------------------------------------------------------------
> Decision Tree
> -----------------------------------------------------------------------
> Tabfolders | Treetable to edit | Button | (Other part
> and validation buttons | the selected node | | still empty)
> ------------------------------------------------------------------------
> And you can see the result ... I use now GEF for the graphical
zone, so my window is a JFace Application Window.
so do I have to reimplement all the others elements with GEF and MVC ?
I asked this in eclipse.tools.gef, and I was answererd that I could
resolve this problem with only SWT (and/or Jface) , without using more MVC .
Thanks
