GEF viewer in CTableTreeCell [message #11265] |
Thu, 14 September 2006 12:43  |
Eclipse User |
|
|
|
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 #565009 is a reply to message #11265] |
Fri, 15 September 2006 11:38  |
Eclipse User |
|
|
|
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 16:06  |
Eclipse User |
|
|
|
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 09:27  |
Eclipse User |
|
|
|
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 09:13  |
Eclipse User |
|
|
|
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 10:10  |
Eclipse User |
|
|
|
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 13:04  |
Eclipse User |
|
|
|
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.)
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.25150 seconds