Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » GEF viewer in CTableTreeCell
GEF viewer in CTableTreeCell [message #11265] Thu, 14 September 2006 16:43 Go to next message
Eclipse UserFriend
Originally posted by: alnospammajor.noboxspamspoon.com

i'm attempting to get a GEF based viewer to show up in a cell.

here's (a slightly simplified version of) the code. SalesViewer is a
class that draws a diagram into its composite. it happens to use GEF to
do this, although that shouldn't matter to this code. it is setup so
that the diagram should appear in the title area of the table cell.

the viewers are being correctly initialized (checked that in debugger).
and clearly something is happening because the rows heights are changing
in the appropriate window. unfortunately, nothing is visible in the
cell, the blank background remains unchanged.

has anyone got something like this working (granted jeremy is probably
the only one who may have tried :-)? if not, does anyone have
suggestions on a troubleshooting procedure. what events should i try to
set off (paint? resize? selectio?), and where should i set the debugger,
etc. to get a handle on what might be going wrong.

regards,

al

public class ViewerCell extends CTableTreeCell {
SalesViewer fCSV;

public ViewerCell(CContainerItem item, int style) {
super(item, style | SWT.TITLE);
}

private SalesViewer getSV() {
if ( fCSV == null ) {
fCSV = new SalesViewer();
}
return fCSV;
}

protected void createTitleContents(Composite contents, int style) {
getSV().createControl(contents, SWT.NO_BACKGROUND);
}

public boolean update(Object element, String[] properties) {
if ( element instanceof AreaRefNode ) {
getSV().init(element);
}
return false;
}
}
Re: GEF viewer in CTableTreeCell [message #11302 is a reply to message #11265] Fri, 15 September 2006 15:38 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 13
Registered: July 2009
Junior Member
Hi

I vaguely remember one point where my control was not showing up in the
"contents" composite and the solution was to set the layout of contents to
a FillLayout..)or if you dont want to distort an image add a child
composite to contents. )

Also maybe you can offer a suggestion for me. I have a tree of expandable
composites, just a text cell in the child area. Everything displays
properly on expansion. However if I close a parentItem and the parent has
a childItem that is "open" the control is not erased. A redraw is called
for the container so I'm not sure where the problem lies. It paints
properly if childItems are not "open".
Re: GEF viewer in CTableTreeCell [message #11339 is a reply to message #11302] Fri, 15 September 2006 20:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alnospammajor.noboxspamspoon.com

Cal wrote:
> Hi
>
> I vaguely remember one point where my control was not showing up in the
> "contents" composite and the solution was to set the layout of contents
> to a FillLayout..)or if you dont want to distort an image add a child
> composite to contents. )
>
that worked for me. thanks!

> Also maybe you can offer a suggestion for me. I have a tree of
> expandable composites, just a text cell in the child area. Everything
> displays properly on expansion. However if I close a parentItem and the
> parent has a childItem that is "open" the control is not erased. A
> redraw is called for the container so I'm not sure where the problem
> lies. It paints properly if childItems are not "open".
>
i haven't yet got to expanding and closing tree nodes (one step at a
time :-). i'll let you know if i find anything when i get there.

thx,

al
Re: GEF viewer in CTableTreeCell [message #11411 is a reply to message #11302] Mon, 18 September 2006 13:27 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
Cal,

Thanks for helping with Al's question, that was great to see!

To add a little more detail, people should note that this is also the
case for the creation of the child area. There are many instances in
the Eclipse platform and JFace dialogs where the parent control already
has a layout on it and custom code is supposed to start with a new
composite and add children to that. This is not the case here as that
one extra composite could mean 1,000 extra composites as a table fills
up! The title area and child area composites are intended to contain
controls directly, if possible, and thus no layout is pre-set so that
the cell designer may choose their own right from the start.

> Also maybe you can offer a suggestion for me. I have a tree of
> expandable composites, just a text cell in the child area. Everything
> displays properly on expansion. However if I close a parentItem and the
> parent has a childItem that is "open" the control is not erased. A
> redraw is called for the container so I'm not sure where the problem
> lies. It paints properly if childItems are not "open".
this a bug!
Redrawing the container just draws itself and the item pieces that are
custom drawn via the GC - embedded widgets fend for themselves!
When CContainer updates paintable items, it should probably toggle the
visibility of both the title area and child area composites. I'll try
to look into soon and post back.
Re: GEF viewer in CTableTreeCell [message #11666 is a reply to message #11302] Tue, 19 September 2006 13:13 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
Cal wrote:
> Also maybe you can offer a suggestion for me. I have a tree of
> expandable composites, just a text cell in the child area. Everything
> displays properly on expansion. However if I close a parentItem and the
> parent has a childItem that is "open" the control is not erased. A
> redraw is called for the container so I'm not sure where the problem
> lies. It paints properly if childItems are not "open".

this should be taken care of in CVS... but I only have a Linux box this
week so please let me know if you see weird things on windows :)
Re: GEF viewer in CTableTreeCell [message #11702 is a reply to message #11666] Tue, 19 September 2006 14:10 Go to previous messageGo to next message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Ok great, am I ever glad youre back!:)

I'm trying to size my expandable composite in relation to the size of the
column as was done for SWT.SIMPLE cell.

I modified the format method from MultiLineCell to rewrap the text control
using a TextLayout instead of a breakIterator for line-by-line processing.
But the TextLayout needs the width measurement to size itself.

I tried using both the computeSize & update methods. The problem is that
the getClientArea() function for the container and the cell both return (I
think value is) -1, also tableTree.getColumn(treeColumn).width (or
getWidth()?) returns a negative number or zero. For the latter case, I
have setFillLayout(true) on the column dont know if that means it doesnt
return a measurement.

(In update(), the root cell returns the correct measurement but all other
cells -1 again.)
Re: GEF viewer in CTableTreeCell [message #11738 is a reply to message #11702] Thu, 21 September 2006 17:04 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
I'm admittedly a little confused here - would you be able to post the
code for your cell?
thanks!

Cal wrote:
> Ok great, am I ever glad youre back!:)
>
> I'm trying to size my expandable composite in relation to the size of
> the column as was done for SWT.SIMPLE cell.
> I modified the format method from MultiLineCell to rewrap the text
> control using a TextLayout instead of a breakIterator for line-by-line
> processing. But the TextLayout needs the width measurement to size itself.
>
> I tried using both the computeSize & update methods. The problem is that
> the getClientArea() function for the container and the cell both return
> (I think value is) -1, also tableTree.getColumn(treeColumn).width (or
> getWidth()?) returns a negative number or zero. For the latter case, I
> have setFillLayout(true) on the column dont know if that means it doesnt
> return a measurement.
> (In update(), the root cell returns the correct measurement but all
> other cells -1 again.)
>
>
>
Re: GEF viewer in CTableTreeCell [message #12598 is a reply to message #11666] Thu, 28 September 2006 13:36 Go to previous message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Hi

Had to work on another project for a bit.

I just downloaded the updates and the expand/collapse is repainting the
tree perfectly.

Cali
Re: GEF viewer in CTableTreeCell [message #565009 is a reply to message #11265] Fri, 15 September 2006 15:38 Go to previous message
No real name is currently offline No real nameFriend
Messages: 13
Registered: July 2009
Junior Member
Hi

I vaguely remember one point where my control was not showing up in the
"contents" composite and the solution was to set the layout of contents to
a FillLayout..)or if you dont want to distort an image add a child
composite to contents. )

Also maybe you can offer a suggestion for me. I have a tree of expandable
composites, just a text cell in the child area. Everything displays
properly on expansion. However if I close a parentItem and the parent has
a childItem that is "open" the control is not erased. A redraw is called
for the container so I'm not sure where the problem lies. It paints
properly if childItems are not "open".
Re: GEF viewer in CTableTreeCell [message #565039 is a reply to message #11302] Fri, 15 September 2006 20:06 Go to previous message
Al Major is currently offline Al MajorFriend
Messages: 72
Registered: July 2009
Member
Cal wrote:
> Hi
>
> I vaguely remember one point where my control was not showing up in the
> "contents" composite and the solution was to set the layout of contents
> to a FillLayout..)or if you dont want to distort an image add a child
> composite to contents. )
>
that worked for me. thanks!

> Also maybe you can offer a suggestion for me. I have a tree of
> expandable composites, just a text cell in the child area. Everything
> displays properly on expansion. However if I close a parentItem and the
> parent has a childItem that is "open" the control is not erased. A
> redraw is called for the container so I'm not sure where the problem
> lies. It paints properly if childItems are not "open".
>
i haven't yet got to expanding and closing tree nodes (one step at a
time :-). i'll let you know if i find anything when i get there.

thx,

al
Re: GEF viewer in CTableTreeCell [message #565086 is a reply to message #11302] Mon, 18 September 2006 13:27 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
Cal,

Thanks for helping with Al's question, that was great to see!

To add a little more detail, people should note that this is also the
case for the creation of the child area. There are many instances in
the Eclipse platform and JFace dialogs where the parent control already
has a layout on it and custom code is supposed to start with a new
composite and add children to that. This is not the case here as that
one extra composite could mean 1,000 extra composites as a table fills
up! The title area and child area composites are intended to contain
controls directly, if possible, and thus no layout is pre-set so that
the cell designer may choose their own right from the start.

> Also maybe you can offer a suggestion for me. I have a tree of
> expandable composites, just a text cell in the child area. Everything
> displays properly on expansion. However if I close a parentItem and the
> parent has a childItem that is "open" the control is not erased. A
> redraw is called for the container so I'm not sure where the problem
> lies. It paints properly if childItems are not "open".
this a bug!
Redrawing the container just draws itself and the item pieces that are
custom drawn via the GC - embedded widgets fend for themselves!
When CContainer updates paintable items, it should probably toggle the
visibility of both the title area and child area composites. I'll try
to look into soon and post back.
Re: GEF viewer in CTableTreeCell [message #565256 is a reply to message #11302] Tue, 19 September 2006 13:13 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
Cal wrote:
> Also maybe you can offer a suggestion for me. I have a tree of
> expandable composites, just a text cell in the child area. Everything
> displays properly on expansion. However if I close a parentItem and the
> parent has a childItem that is "open" the control is not erased. A
> redraw is called for the container so I'm not sure where the problem
> lies. It paints properly if childItems are not "open".

this should be taken care of in CVS... but I only have a Linux box this
week so please let me know if you see weird things on windows :)
Re: GEF viewer in CTableTreeCell [message #565292 is a reply to message #11666] Tue, 19 September 2006 14:10 Go to previous message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Ok great, am I ever glad youre back!:)

I'm trying to size my expandable composite in relation to the size of the
column as was done for SWT.SIMPLE cell.

I modified the format method from MultiLineCell to rewrap the text control
using a TextLayout instead of a breakIterator for line-by-line processing.
But the TextLayout needs the width measurement to size itself.

I tried using both the computeSize & update methods. The problem is that
the getClientArea() function for the container and the cell both return (I
think value is) -1, also tableTree.getColumn(treeColumn).width (or
getWidth()?) returns a negative number or zero. For the latter case, I
have setFillLayout(true) on the column dont know if that means it doesnt
return a measurement.

(In update(), the root cell returns the correct measurement but all other
cells -1 again.)
Re: GEF viewer in CTableTreeCell [message #565318 is a reply to message #11702] Thu, 21 September 2006 17:04 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 181
Registered: July 2009
Senior Member
I'm admittedly a little confused here - would you be able to post the
code for your cell?
thanks!

Cal wrote:
> Ok great, am I ever glad youre back!:)
>
> I'm trying to size my expandable composite in relation to the size of
> the column as was done for SWT.SIMPLE cell.
> I modified the format method from MultiLineCell to rewrap the text
> control using a TextLayout instead of a breakIterator for line-by-line
> processing. But the TextLayout needs the width measurement to size itself.
>
> I tried using both the computeSize & update methods. The problem is that
> the getClientArea() function for the container and the cell both return
> (I think value is) -1, also tableTree.getColumn(treeColumn).width (or
> getWidth()?) returns a negative number or zero. For the latter case, I
> have setFillLayout(true) on the column dont know if that means it doesnt
> return a measurement.
> (In update(), the root cell returns the correct measurement but all
> other cells -1 again.)
>
>
>
Re: GEF viewer in CTableTreeCell [message #565644 is a reply to message #11666] Thu, 28 September 2006 13:36 Go to previous message
Cal is currently offline CalFriend
Messages: 70
Registered: July 2009
Member
Hi

Had to work on another project for a bit.

I just downloaded the updates and the expand/collapse is repainting the
tree perfectly.

Cali
Previous Topic:variable CTableTreeCell
Next Topic:ColumnWidth for setFillLayout(true) column
Goto Forum:
  


Current Time: Wed Nov 26 17:52:01 GMT 2014

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

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