Home » Archived » Riena » Two questions about Treetable
Two questions about Treetable [message #547578] |
Mon, 19 July 2010 02:45 |
lushiwei lushiwei Messages: 12 Registered: June 2010 |
Junior Member |
|
|
I am a newbie for Riena, I have two questions about treetable.
1.The method of setColumnWidths does not work, Why getUIControl() always return null?
My View:
public void basicCreatePartControl(Composite parent) {
ergebnis = new Tree(container, SWT.BORDER | SWT.FULL_SELECTION);
new TreeColumn(ergebnis, SWT.NONE);
addUIControl(ergebnis, "result");
}
My Controller:
final ITreeTableRidget kunden = ((ITreeTableRidget) getRidget("result"));
// set the widths
ColumnLayoutData[] widths = new ColumnLayoutData[] { new ColumnWeightData(2), new ColumnWeightData(1) };
treeTableRidget.setColumnWidths(widths);
String[] columnValues = new String[] { "word", "upperCase" };
String[] columnHeaders = new String[] { "Word", "Uppercase" };
treeTableRidget.bindToModel(createTreeInput(), WordNode.class, "children", "parent",
columnValues, columnHeaders);
treeTableRidget.expandAll();
2. Is it posible to control the showing folder or file icon by a property in the model?
e.g. Show a folder icon for a node which doesn't have a child, but it's property is a category?
Thanks.
|
|
|
Re: Two questions about Treetable [message #547645 is a reply to message #547578] |
Mon, 19 July 2010 08:56 |
Christian Campo Messages: 597 Registered: July 2009 |
Senior Member |
|
|
Am 19.07.10 04:45, schrieb lushiwei:
> I am a newbie for Riena, I have two questions about treetable.
>
> 1.The method of setColumnWidths does not work, Why getUIControl() always
> return null?
> My View:
> public void basicCreatePartControl(Composite parent) {
> ergebnis = new Tree(container, SWT.BORDER | SWT.FULL_SELECTION);
> new TreeColumn(ergebnis, SWT.NONE);
> addUIControl(ergebnis, "result");
> }
>
> My Controller:
> final ITreeTableRidget kunden = ((ITreeTableRidget) getRidget("result"));
> // set the widths
> ColumnLayoutData[] widths = new ColumnLayoutData[] { new
> ColumnWeightData(2), new ColumnWeightData(1) };
> treeTableRidget.setColumnWidths(widths);
>
> String[] columnValues = new String[] { "word", "upperCase" };
> String[] columnHeaders = new String[] { "Word", "Uppercase" };
> treeTableRidget.bindToModel(createTreeInput(), WordNode.class,
> "children", "parent",
> columnValues, columnHeaders);
> treeTableRidget.expandAll();
>
> 2. Is it posible to control the showing folder or file icon by a
> property in the model?
> e.g. Show a folder icon for a node which doesn't have a child, but it's
> property is a category?
>
> Thanks.
getUIControl() returns null in method configureRidgets since controller and view are not "bound" yet.
Overwrite afterBind() in the controller and getUIControl() will return a result.
not sure about the others.....maybe Elias has an answer...
- christian
|
|
| | | |
Re: Two questions about Treetable [message #548012 is a reply to message #547578] |
Tue, 20 July 2010 11:59 |
Eclipse User |
|
|
|
Originally posted by: stephan.mann.compeople.de
In article <i20e8l$1qd$1@build.eclipse.org>, lushiwei@gmail.com says...
> 1.The method of setColumnWidths does not work, [..]
> My View:
> public void basicCreatePartControl(Composite parent) {
> ergebnis = new Tree(container, SWT.BORDER | SWT.FULL_SELECTION);
> new TreeColumn(ergebnis, SWT.NONE);
> addUIControl(ergebnis, "result");
> } [..]
We had the same problem just today with a Table. However, this seems to
be a SWT issue. Try putting the Tree into its own Composite like this:
@Override
protected void basicCreatePartControl(final Composite parent) {
GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(parent);
Composite tblCmp = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tblCmp);
Table table = UIControlsFactory.createTable(tblCmp,
SWT.NONE, "table");
}
It also seems to be important to *not* set any GridData to the Table.
Hope it's the same with the Tree.
If this doesn't work, try ColumnPixelData(..) or ColumnWeightData(int
weight, int minWidth).
stephan
|
|
| | | | | | |
Goto Forum:
Current Time: Sat Nov 09 02:31:46 GMT 2024
Powered by FUDForum. Page generated in 0.03980 seconds
|