Home » Eclipse Projects » Eclipse 4 » XWT. Using TableViewer.columns. Why?
XWT. Using TableViewer.columns. Why? [message #527747] |
Fri, 16 April 2010 11:08 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
As I understand, "Class.property" should be used when you want to set value of "property". However TableViewer has no property "columns" or method "setColumns()", etc. It seems that it works without wrapping TableViewerColumn-s into "TableViewer.columns", so is there reason to use it in code generation?
Here is code from xwt tests.
<TableViewer xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:x="http://www.eclipse.org/xwt"
xmlns:j="clr-namespace:java.lang"
Name="TableViewer">
<TableViewer.columns>
<TableViewerColumn width="80" text="column0"/>
<TableViewerColumn width="80" text="column1"/>
</TableViewer.columns>
</TableViewer>
But this also works
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt">
<Shell.layout>
<FillLayout type="VERTICAL"/>
</Shell.layout>
<TableViewer x:Style="BORDER | FULL_SELECTION">
<TableViewer.table headerVisible="true" linesVisible="true"/>
<TableViewerColumn width="150" text="Name"/>
<TableViewerColumn width="150" text="Age"/>
<TableViewerColumn width="150" text="Image"/>
</TableViewer>
</Shell>
Konstantin Scheglov,
Google, Inc.
|
|
| |
Re: XWT. Using TableViewer.columns. Why? [message #527841 is a reply to message #527748] |
Fri, 16 April 2010 15:22 |
Yves YANG Messages: 688 Registered: July 2009 |
Senior Member |
|
|
XWT's UI Model aligns as much as possible with SWT/JFace "model".
Unfortuately, the API of SWT/JFace is not model-driven. The Java Bean
specification is not totally respected. However, XWT is a 100% model-based
UI solution. We need to connect the SWT/Jface APIs to UI model via an
intermediate model services, which is our UI metamodel. XWT provides a
possibility to extend and overwrite the default UI metamodel.
As for the TableViewerColumn, we have added two additional attributes in the
metaclass of TableViewerColumn to make the declarative simple and
strainghtforward..
"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:hq9gs4$lo$1@build.eclipse.org...
> What I think is strange too here is that this looks like
> TableViewerColumn has the properties (name, width) which is doesn't have
> in JFace.
>
> I would have expected the attribute is column.width, ... (not sure this
> is valid XML) because in Java-Code you write
> viewerCol.getColumn().setWidth().
>
> Tom
>
> Am 16.04.10 13:08, schrieb Konstantin Scheglov:
>> As I understand, "Class.property" should be used when you want to set
>> value of "property". However TableViewer has no property "columns" or
>> method "setColumns()", etc. It seems that it works without wrapping
>> TableViewerColumn-s into "TableViewer.columns", so is there reason to
>> use it in code generation?
>>
>> Here is code from xwt tests.
>>
>> <TableViewer xmlns="http://www.eclipse.org/xwt/presentation"
>> xmlns:x="http://www.eclipse.org/xwt"
>> xmlns:j="clr-namespace:java.lang"
>> Name="TableViewer">
>> <TableViewer.columns>
>> <TableViewerColumn width="80" text="column0"/>
>> <TableViewerColumn width="80" text="column1"/>
>> </TableViewer.columns>
>> </TableViewer>
This is the model-based declaration with a virtual attribute "columns".
>>
>> But this also works
>>
>> <Shell xmlns="http://www.eclipse.org/xwt/presentation"
>> xmlns:x="http://www.eclipse.org/xwt">
>> <Shell.layout>
>> <FillLayout type="VERTICAL"/>
>> </Shell.layout>
>> <TableViewer x:Style="BORDER | FULL_SELECTION">
>> <TableViewer.table headerVisible="true" linesVisible="true"/>
>> <TableViewerColumn width="150" text="Name"/>
>> <TableViewerColumn width="150" text="Age"/>
>> <TableViewerColumn width="150" text="Image"/>
>> </TableViewer>
>> </Shell>
This is the default mechanism of XWT loader, which takes TableViewerColumn
as child of TableViewer. When XWT loads the resource, JFace API creates the
column in table. But from modeling standpoint, I think it isn't appropriate:
column should not be a child of table.
Regards
Yves
|
|
|
Re: XWT. Using TableViewer.columns. Why? [message #527887 is a reply to message #527841] |
Fri, 16 April 2010 19:09 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
Yves YANG wrote on Fri, 16 April 2010 19:22 | >> But this also works
>>
>> <Shell xmlns="http://www.eclipse.org/xwt/presentation"
>> xmlns:x="http://www.eclipse.org/xwt">
>> <Shell.layout>
>> <FillLayout type="VERTICAL"/>
>> </Shell.layout>
>> <TableViewer x:Style="BORDER | FULL_SELECTION">
>> <TableViewer.table headerVisible="true" linesVisible="true"/>
>> <TableViewerColumn width="150" text="Name"/>
>> <TableViewerColumn width="150" text="Age"/>
>> <TableViewerColumn width="150" text="Image"/>
>> </TableViewer>
>> </Shell>
This is the default mechanism of XWT loader, which takes TableViewerColumn
as child of TableViewer. When XWT loads the resource, JFace API creates the
column in table. But from modeling standpoint, I think it isn't appropriate:
column should not be a child of table.
|
To be honest, I don't understand what you mean.
In both case we create TableViewerColumn-s, which in both cases children of TableViewer (not Table).
I just wonder why special "TableViewer.columns" element is used. For example when we create Composite with children Control-s, we don't wrap children into "Composite.controls" element...
Konstantin Scheglov,
Google, Inc.
|
|
| | | |
Re: XWT. Using TableViewer.columns. Why? [message #574474 is a reply to message #527748] |
Fri, 16 April 2010 15:22 |
Yves YANG Messages: 688 Registered: July 2009 |
Senior Member |
|
|
XWT's UI Model aligns as much as possible with SWT/JFace "model".
Unfortuately, the API of SWT/JFace is not model-driven. The Java Bean
specification is not totally respected. However, XWT is a 100% model-based
UI solution. We need to connect the SWT/Jface APIs to UI model via an
intermediate model services, which is our UI metamodel. XWT provides a
possibility to extend and overwrite the default UI metamodel.
As for the TableViewerColumn, we have added two additional attributes in the
metaclass of TableViewerColumn to make the declarative simple and
strainghtforward..
"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:hq9gs4$lo$1@build.eclipse.org...
> What I think is strange too here is that this looks like
> TableViewerColumn has the properties (name, width) which is doesn't have
> in JFace.
>
> I would have expected the attribute is column.width, ... (not sure this
> is valid XML) because in Java-Code you write
> viewerCol.getColumn().setWidth().
>
> Tom
>
> Am 16.04.10 13:08, schrieb Konstantin Scheglov:
>> As I understand, "Class.property" should be used when you want to set
>> value of "property". However TableViewer has no property "columns" or
>> method "setColumns()", etc. It seems that it works without wrapping
>> TableViewerColumn-s into "TableViewer.columns", so is there reason to
>> use it in code generation?
>>
>> Here is code from xwt tests.
>>
>> <TableViewer xmlns="http://www.eclipse.org/xwt/presentation"
>> xmlns:x="http://www.eclipse.org/xwt"
>> xmlns:j="clr-namespace:java.lang"
>> Name="TableViewer">
>> <TableViewer.columns>
>> <TableViewerColumn width="80" text="column0"/>
>> <TableViewerColumn width="80" text="column1"/>
>> </TableViewer.columns>
>> </TableViewer>
This is the model-based declaration with a virtual attribute "columns".
>>
>> But this also works
>>
>> <Shell xmlns="http://www.eclipse.org/xwt/presentation"
>> xmlns:x="http://www.eclipse.org/xwt">
>> <Shell.layout>
>> <FillLayout type="VERTICAL"/>
>> </Shell.layout>
>> <TableViewer x:Style="BORDER | FULL_SELECTION">
>> <TableViewer.table headerVisible="true" linesVisible="true"/>
>> <TableViewerColumn width="150" text="Name"/>
>> <TableViewerColumn width="150" text="Age"/>
>> <TableViewerColumn width="150" text="Image"/>
>> </TableViewer>
>> </Shell>
This is the default mechanism of XWT loader, which takes TableViewerColumn
as child of TableViewer. When XWT loads the resource, JFace API creates the
column in table. But from modeling standpoint, I think it isn't appropriate:
column should not be a child of table.
Regards
Yves
|
|
|
Re: XWT. Using TableViewer.columns. Why? [message #574504 is a reply to message #527841] |
Fri, 16 April 2010 19:09 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
Yves YANG wrote on Fri, 16 April 2010 19:22
> >> But this also works
> >>
> >> <Shell xmlns="http://www.eclipse.org/xwt/presentation"
> >> xmlns:x="http://www.eclipse.org/xwt">
> >> <Shell.layout>
> >> <FillLayout type="VERTICAL"/>
> >> </Shell.layout>
> >> <TableViewer x:Style="BORDER | FULL_SELECTION">
> >> <TableViewer.table headerVisible="true" linesVisible="true"/>
> >> <TableViewerColumn width="150" text="Name"/>
> >> <TableViewerColumn width="150" text="Age"/>
> >> <TableViewerColumn width="150" text="Image"/>
> >> </TableViewer>
> >> </Shell>
>
> This is the default mechanism of XWT loader, which takes TableViewerColumn
> as child of TableViewer. When XWT loads the resource, JFace API creates the
> column in table. But from modeling standpoint, I think it isn't appropriate:
> column should not be a child of table.
To be honest, I don't understand what you mean.
In both case we create TableViewerColumn-s, which in both cases children of TableViewer (not Table).
I just wonder why special "TableViewer.columns" element is used. For example when we create Composite with children Control-s, we don't wrap children into "Composite.controls" element...
--
Konstantin Scheglov,
Instantiations, Inc.
Konstantin Scheglov,
Google, Inc.
|
|
| | |
Goto Forum:
Current Time: Thu Sep 26 18:19:07 GMT 2024
Powered by FUDForum. Page generated in 0.04817 seconds
|