Re: Blank view when implementing CTableTree [message #9343] |
Mon, 21 August 2006 09:14  |
Eclipse User |
|
|
|
> 3.The setCellProvider() determines which class to use(render?) when the
> cell is expanded.
There is an additional feature that I am currently working on similar to
this that would allow the child area of a cell to be provided by
reflection, similar to how the cells are currently provided.
This would allow plugins to provide additional functionality to the
table/tree, without requiring the plugins to be loaded until the user
actually expands the item.
|
|
|
|
|
|
|
|
Re: Another step: Text cell added but.. [message #9528 is a reply to message #9483] |
Fri, 25 August 2006 16:19   |
Eclipse User |
|
|
|
Override the computeSize() method in custom CTableTreeCell to get my text
control to resize along with column resize. Inserted this in both
Title&ChildArea branches for testing with SWT.SIMPLE and SWT.EXPAND
respectively. Added necessary private variables to CTableTreeCell to get
this to work (iBounds...etc.). This allowed me to get two solutions.
1. A simple cell that resized properly but couldnt expand to view children
2. An expanded cell that would resize properly, I think the problem with
this was the two toggles, it might cause confusion for the user, and 2., I
really want *one* focus area in a hierarchy. This gives 2, title & child.
3. If I remember correctly, the custom cell was aligned the toggle rather
than the titleArea text. I didnt try to fix that I figured it would be
easy to adjust. Getting an SWT.SIMPLE cell to display a tree hierarchy
would be the perfect solution....
If all else fails by Tuesday I'm going with the expanded cell solution.
from overriden computeSize()....
if(stepText != null)
{ TextLayout layout = new TextLayout(Display.getCurrent());
Rectangle cellRect = stepText.getBounds();
layout.setWidth(container.getColumn(2).getWidth());
layout.setText(stepText.getText());
int lineHeight = CTableTree.staticGC.stringExtent(stepText.getText()).y;
int lineCount = layout.getLineCount();
layout.dispose();
newHeight = lineHeight * (lineCount+1);
//+1 because narrow cells always seemed to be 1 line short for display
}
And here is my attempt at restructuring the tableTreeCell itself. In the
layout () method:
//SUPPOSE I POSITION MY CHILD AREA
//TO THE RIGHT OF THE TITLEAREA....
childArea.setBounds(
bounds.x+marginWidth+toggleBounds.width,
bounds.y/**REMOVE** titleHeight*/+childSpacing,
bounds.width-(/**ADD IN**/
titleWidth/**/+marginWidth+toggleBounds.width+rightChildInde nt),
bounds.height-(/*titleHeight*/+childSpacing+childSpacing));
And Here is my custom cell:
protected void createTitleContents(Composite contents, int style) {
//contents.setLayout COMMENTED AT SOME POINT
//SO THAT I COULD POSITION THE NEW COMPOSITE AS I LIKED.
//I'm not sure if I tried to reposition "contents" itself...
contents.setLayout(new FillLayout());
FillLayout layout = new FillLayout();
Composite composite = new Composite(contents, SWT.NONE);
composite.setLayout(layout);
mwidth = container.getColumn(2).getWidth();
stepText = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.MULTI );
stepText.setText("This is a text box with multiple lines ");
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Successfully got tree in view [message #564109 is a reply to message #9364] |
Wed, 23 August 2006 18:01  |
Eclipse User |
|
|
|
Hi
I got the tree in the view with the updated classes.
Couple of problems
1. Only the root node expands when I click the toggle
2. The custom cell isnt being displayed on expansion. I did set my
cellProvider.
Gonna go through the code again to see if I've missed something.
Thanks again!!
Cal
|
|
|
Another step: Text cell added but.. [message #564210 is a reply to message #9388] |
Fri, 25 August 2006 09:21  |
Eclipse User |
|
|
|
Hi
I moved one more step forward to my goal. I got a text cell added to the
titleArea of the cell. The only problem now is that the toggle doesnt work
anymore, i.e. clicking it wont expand the item to show the child items. I
"believe" its because the cell type is now SWT.SIMPLE. That's what I'm
working on today.
A smaller problem, if I progressively make my column smaller, at a certain
point the Text component wont assign sufficient height to show all of its
string. It clips about a line of the text.
Thanks!
Cal
|
|
|
Re: Another step: Text cell added but.. [message #564239 is a reply to message #9459] |
Fri, 25 August 2006 13:30  |
Eclipse User |
|
|
|
You are correct in that the SWT.SIMPLE style is probably causing
problems with the expansion. This is mainly because I have not yet had
a use case to work with on this and having both a Title Area Composite
and a Child Area Composite is not fully worked out...
Sounds like this may be a good time to get started :)
If you can post your cell, I'd be happy to work on it with you.
Cal wrote:
> Hi
>
> I moved one more step forward to my goal. I got a text cell added to the
> titleArea of the cell. The only problem now is that the toggle doesnt
> work anymore, i.e. clicking it wont expand the item to show the child
> items. I "believe" its because the cell type is now SWT.SIMPLE. That's
> what I'm working on today.
> A smaller problem, if I progressively make my column smaller, at a
> certain point the Text component wont assign sufficient height to show
> all of its string. It clips about a line of the text.
>
> Thanks!
> Cal
>
|
|
|
Re: Another step: Text cell added but.. [message #564261 is a reply to message #9483] |
Fri, 25 August 2006 15:34  |
Eclipse User |
|
|
|
Ok, I'll post it in a bit I've been trying various ideas out and I'm not
sure what I have at the moment, so many scrambled approaches in my head!
Using SWT.SIMPLE:
-----------------
1. I created another composite with a FillLayout within the titleArea to
hold my Text cell.
2. I positioned the composite over a little to allow space for a toggle.
3. In the paint? method, I commented the "if SWT.SIMPLE then return", so
that the toggle could be painted (and commented
setToggleVisible(..false..) somewhere in the ContainerItem constructor I
believe)
At one point I could see a portion of a toggle but couldnt figure out what
was painting over it.
USING SWT.EXPAND:
-----------------
The approach I'm trying out at this very minute... Instead of having a
titleArea above the childArea, position them horizontally. The titleArea
is to the left. Its painting , i.e. the toggle and childArea are at the
same y position. I'm getting some error which I havent stepped through yet
but it doesnt cause a crash.
My issues with this approach are:
1. Can I default the childArea to always OPEN so I dont need a toggle to
see the childArea (or alternatively an option for alwaysOpen)
2. Can I get that new cell in column-0 *with* the toggle for the tree
hierarchy also in column-0. (This approach with treeColumn(0) & expanded
cell in column(0) fails at the moment)
I'll post in a minute (or several depending on how quickly I can
reconstruct..)
|
|
|
Re: Another step: Text cell added but.. [message #564284 is a reply to message #9483] |
Fri, 25 August 2006 16:19  |
Eclipse User |
|
|
|
Override the computeSize() method in custom CTableTreeCell to get my text
control to resize along with column resize. Inserted this in both
Title&ChildArea branches for testing with SWT.SIMPLE and SWT.EXPAND
respectively. Added necessary private variables to CTableTreeCell to get
this to work (iBounds...etc.). This allowed me to get two solutions.
1. A simple cell that resized properly but couldnt expand to view children
2. An expanded cell that would resize properly, I think the problem with
this was the two toggles, it might cause confusion for the user, and 2., I
really want *one* focus area in a hierarchy. This gives 2, title & child.
3. If I remember correctly, the custom cell was aligned the toggle rather
than the titleArea text. I didnt try to fix that I figured it would be
easy to adjust. Getting an SWT.SIMPLE cell to display a tree hierarchy
would be the perfect solution....
If all else fails by Tuesday I'm going with the expanded cell solution.
from overriden computeSize()....
if(stepText != null)
{ TextLayout layout = new TextLayout(Display.getCurrent());
Rectangle cellRect = stepText.getBounds();
layout.setWidth(container.getColumn(2).getWidth());
layout.setText(stepText.getText());
int lineHeight = CTableTree.staticGC.stringExtent(stepText.getText()).y;
int lineCount = layout.getLineCount();
layout.dispose();
newHeight = lineHeight * (lineCount+1);
//+1 because narrow cells always seemed to be 1 line short for display
}
And here is my attempt at restructuring the tableTreeCell itself. In the
layout () method:
//SUPPOSE I POSITION MY CHILD AREA
//TO THE RIGHT OF THE TITLEAREA....
childArea.setBounds(
bounds.x+marginWidth+toggleBounds.width,
bounds.y/**REMOVE** titleHeight*/+childSpacing,
bounds.width-(/**ADD IN**/
titleWidth/**/+marginWidth+toggleBounds.width+rightChildInde nt),
bounds.height-(/*titleHeight*/+childSpacing+childSpacing));
And Here is my custom cell:
protected void createTitleContents(Composite contents, int style) {
//contents.setLayout COMMENTED AT SOME POINT
//SO THAT I COULD POSITION THE NEW COMPOSITE AS I LIKED.
//I'm not sure if I tried to reposition "contents" itself...
contents.setLayout(new FillLayout());
FillLayout layout = new FillLayout();
Composite composite = new Composite(contents, SWT.NONE);
composite.setLayout(layout);
mwidth = container.getColumn(2).getWidth();
stepText = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.MULTI );
stepText.setText("This is a text box with multiple lines ");
}
|
|
|
Re: Another step: Text cell added but.. [message #564309 is a reply to message #9528] |
Sun, 27 August 2006 14:59  |
Eclipse User |
|
|
|
Cal,
I just checked in a bunch of changes to help use toggles in SIMPLE style
cells. I also changed the style constant from SIMPLE to TITLE because
SIMPLE no longer fits at all - from the SWT javadoc for SIMPLE: "Style
constant for simple (not drop down) behavior".
Cal wrote:
> 1. A simple cell that resized properly but couldnt expand to view children
This should work now - take a look at the MultiLineTextCell in the
snippets section.
> 2. An expanded cell that would resize properly, I think the problem with
> this was the two toggles, it might cause confusion for the user, and 2.,
This was my thought as well - two toggles does not make allot of sense
and thus is not implemented.
let me know how the latest in CVS works for you
|
|
|
|
|
Re: Cant find MultiLineTextCell [message #564372 is a reply to message #9593] |
Sun, 27 August 2006 18:21  |
Eclipse User |
|
|
|
it's in the org.eclipse.swt.nebula.snippets project, in the
org.eclipse.swt.nebula module
yes, the ctabletree widgets were also updated
Cal wrote:
> Checking the CVS at this moment under widgets.tests nothing found yet...
>
|
|
|
Re: Cant find MultiLineTextCell [message #564391 is a reply to message #9615] |
Sun, 27 August 2006 18:24  |
Eclipse User |
|
|
|
I should also mention that CTableTreeSnippet3 uses the
MultiLineTextCell, so doing a right-click "Run As..." and running that
as an SWT App should let you see it pretty quick.
Jeremy Dowdall wrote:
> it's in the org.eclipse.swt.nebula.snippets project, in the
> org.eclipse.swt.nebula module
>
> yes, the ctabletree widgets were also updated
>
> Cal wrote:
>> Checking the CVS at this moment under widgets.tests nothing found yet...
>>
|
|
|
|
Looks good to me! [message #564415 is a reply to message #9639] |
Sun, 27 August 2006 19:08  |
Eclipse User |
|
|
|
Just ran it, looks like exactly what I want, going to try to put in a view
now.
If you ever run for president I will vote for you..
|
|
|
Re: Looks good to me! [message #564434 is a reply to message #9682] |
Mon, 28 August 2006 09:14  |
Eclipse User |
|
|
|
Cal wrote:
> Just ran it, looks like exactly what I want, going to try to put in a
Good to hear!
The cell doesn't have much for features or robustness, but I think it is
a good one to use for the CTableTree examples / snippets, so if you find
bugs or have feature requests please let me know.
> If you ever run for president I will vote for you..
If the software gig doesn't pan out, I may take you up on this ;)
|
|
|
Re: Looks good to me! [message #564449 is a reply to message #10193] |
Mon, 28 August 2006 09:24  |
Eclipse User |
|
|
|
Hi
I tried to put the cell in my treeview but it wasnt displaying as it
should. What I'm going to try to do is add a treeview to the example code
and see what happens...
The only other thing that I'd request would be the option to have lines
drawn from parent to child like a native tree
|
|
|
Re: Looks good to me! [message #564474 is a reply to message #10204] |
Mon, 28 August 2006 09:41  |
Eclipse User |
|
|
|
> The only other thing that I'd request would be the option to have lines
> drawn from parent to child like a native tree
CTableTree has a bugzilla component now - for features like this, please
create a new bug and label it with something like: "[WIN32 EMULATION]".
Additionally, a (small) picture would be helpful too.
I'll be creating the example page for CTableTree shortly too, but... time...
|
|
|
|
|