Home » Eclipse Projects » Eclipse 4 » XWT. Using TableViewer.columns. Why?
XWT. Using TableViewer.columns. Why? [message #527747] |
Fri, 16 April 2010 07:08  |
Eclipse User |
|
|
|
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>
|
|
| |
Re: XWT. Using TableViewer.columns. Why? [message #527841 is a reply to message #527748] |
Fri, 16 April 2010 11:22   |
Eclipse User |
|
|
|
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 #574402 is a reply to message #527747] |
Fri, 16 April 2010 07:15  |
Eclipse User |
|
|
|
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>
>
> 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>
|
|
|
Re: XWT. Using TableViewer.columns. Why? [message #574474 is a reply to message #527748] |
Fri, 16 April 2010 11:22  |
Eclipse User |
|
|
|
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 15:09  |
Eclipse User |
|
|
|
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.
|
|
|
Re: XWT. Using TableViewer.columns. Why? [message #574578 is a reply to message #574504] |
Sat, 17 April 2010 00:29  |
Eclipse User |
|
|
|
The reason is very simple: I didn't expect the second case works.
> 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...
I think "TableViewerColumn" is not a contained child of TableViewer. They
are used to define the header and structure of TableViewer. TableViewer
should have a collection or array of TableViewerColumn in order and same
type.
Let's compare the following case in two ways:
Grouped
======
<TableViewer>
<TableViewer.filters>
<ViewerFilter>
<ViewerFilter.conditions>
<Condition property="age" value="30" operator="GT"/>
</ViewerFilter.conditions>
</ViewerFilter>
<ViewerFilter>
<ViewerFilter.conditions>
<Condition property="salary" value="50" operator="LT"/>
</ViewerFilter.conditions>
</ViewerFilter>
</TableViewer.filters>
<TableViewer.columns>
<TableViewerColumn width="150" text="Name" bindingPath="name"/>
<TableViewerColumn width="150" text="Age" bindingPath="age"/>
</TableViewer.columns>
</TableViewer>
Flat
===
<TableViewer>
<TableViewerColumn width="150" text="Name" bindingPath="name"/>
<ViewerFilter>
<ViewerFilter.conditions>
<Condition property="age" value="30" operator="GT"/>
</ViewerFilter.conditions>
</ViewerFilter>
<TableViewerColumn width="150" text="Age" bindingPath="age"/>
<ViewerFilter>
<ViewerFilter.conditions>
<Condition property="salary" value="50" operator="LT"/>
</ViewerFilter.conditions>
</ViewerFilter>
</TableViewer>
Which do you prefer?
By writting this, I have checked on the Table. I just noticed Table column
is defined in flat way. It'd better to keep the syntax (or model)
consistance between Table and TableViewer.
Regards
Yves
>
>
>
> --
> Konstantin Scheglov,
> Instantiations, Inc.
|
|
| |
Goto Forum:
Current Time: Mon Jul 07 15:34:07 EDT 2025
Powered by FUDForum. Page generated in 0.06099 seconds
|