Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » data binding
data binding [message #554088] Fri, 20 August 2010 07:05 Go to next message
FD  is currently offline FD Friend
Messages: 15
Registered: August 2010
Junior Member
In the following example I don't know how to write the path to a specific data. e.g. the id of the Property with the name prop1 of the Entity with the name Entity1.

<Composite xmlns="http://www.eclipse.org/xwt/presentation"
	xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:testxwt"
	xmlns:k="clr-namespace:java.lang" DataContext="{StaticResource MyData}">
	<Composite.layout>
		<GridLayout numColumns="2" />
	</Composite.layout>
	<Composite.Resources>
		<j:Data x:Key="MyData">
			<j:Data.members>
				<j:Entity Name="Entity1" Id="1">
					<j:Entity.properties>
						<j:Property Name="prop1" Id="1" Value="32" Type="String" />
						<j:Property Name="prop2" Id="2" Value="27" Type="String" />
					</j:Entity.properties>
				</j:Entity>
				<j:Entity Name="Entity2" Id="2">
					<j:Entity.properties>
						<j:Property Name="prop1" Id="1" Value="32" Type="String" />
						<j:Property Name="prop1" Id="1" Value="32" Type="String" />
					</j:Entity.properties>
				</j:Entity>
			</j:Data.members>
		</j:Data>
	</Composite.Resources>
	<TableViewer Name="DataViewer" input="{Binding Path=members}">
		<TableViewer.columns>
			<TableViewerColumn width="150" text="Name"
				bindingPath="name" />
			<TableViewerColumn width="150" text="Id"
				bindingPath="id" />
		</TableViewer.columns>
		<TableViewer.table HeaderVisible="true" />

		<TableViewer.control.layoutData>
			<GridData horizontalAlignment="FILL" horizontalSpan="2"
				grabExcessHorizontalSpace="true" />
		</TableViewer.control.layoutData>
	</TableViewer>
	<Label
		text="{Binding ElementName=DataViewer,path=singleSelection.(j:Entity.name)}">
		<Label.layoutData>
			<GridData horizontalAlignment="FILL"
				grabExcessHorizontalSpace="true" />
		</Label.layoutData>
	</Label>
	<TableViewer Name="CompanyViewer"
		input="{Binding ElementName=DataViewer,Path=singleSelection.(j:Entity.properties)}">
		<TableViewer.columns>
			<TableViewerColumn width="150" text="Name"
				bindingPath="name" />
			<TableViewerColumn width="150" text="Id"
				bindingPath="id" />
			<TableViewerColumn width="150" text="Type"
				bindingPath="type" />
			<TableViewerColumn width="150" text="Value"
				bindingPath="value" />
		</TableViewer.columns>
		<TableViewer.table HeaderVisible="true" />

		<TableViewer.control.layoutData>
			<GridData horizontalAlignment="FILL" verticalAlignment="FILL"
				heightHint="200" grabExcessHorizontalSpace="true"
				grabExcessVerticalSpace="true" />
		</TableViewer.control.layoutData>
	</TableViewer>

	<Text  x:style="SWT.NONE"

                text="{Binding Path= the id of the prop1 of Entity1}"
        
         ></Text>

	</Composite>


Thanks for help

Re: data binding [message #554263 is a reply to message #554088] Fri, 20 August 2010 19:49 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You should name this entity in the resources (for example Entity1) and then
<Text x:style="SWT.NONE"
text="{Binding Source={staticresource Entity1} Path=prop1}"
></Text>

Best regards
Yves YANG
"FD" <dubfa@hotmail.com> wrote in message
news:i4l9gg$fpg$1@build.eclipse.org...
> In the following example I don't know how to write the path to a specific
> data. e.g. the id of the Property with the name prop1 of the Entity with
> the name Entity1.
>
>
> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
> xmlns:x="http://www.eclipse.org/xwt" xmlns:j="clr-namespace:testxwt"
> xmlns:k="clr-namespace:java.lang" DataContext="{StaticResource MyData}">
> <Composite.layout>
> <GridLayout numColumns="2" />
> </Composite.layout>
> <Composite.Resources>
> <j:Data x:Key="MyData">
> <j:Data.members>
> <j:Entity Name="Entity1" Id="1">
> <j:Entity.properties>
> <j:Property Name="prop1" Id="1" Value="32" Type="String" />
> <j:Property Name="prop2" Id="2" Value="27" Type="String" />
> </j:Entity.properties>
> </j:Entity>
> <j:Entity Name="Entity2" Id="2">
> <j:Entity.properties>
> <j:Property Name="prop1" Id="1" Value="32" Type="String" />
> <j:Property Name="prop1" Id="1" Value="32" Type="String" />
> </j:Entity.properties>
> </j:Entity>
> </j:Data.members>
> </j:Data>
> </Composite.Resources>
> <TableViewer Name="DataViewer" input="{Binding Path=members}">
> <TableViewer.columns>
> <TableViewerColumn width="150" text="Name"
> bindingPath="name" />
> <TableViewerColumn width="150" text="Id"
> bindingPath="id" />
> </TableViewer.columns>
> <TableViewer.table HeaderVisible="true" />
>
> <TableViewer.control.layoutData>
> <GridData horizontalAlignment="FILL" horizontalSpan="2"
> grabExcessHorizontalSpace="true" />
> </TableViewer.control.layoutData>
> </TableViewer>
> <Label
> text="{Binding
> ElementName=DataViewer,path=singleSelection.(j:Entity.name)} ">
> <Label.layoutData>
> <GridData horizontalAlignment="FILL"
> grabExcessHorizontalSpace="true" />
> </Label.layoutData>
> </Label>
> <TableViewer Name="CompanyViewer"
> input="{Binding
> ElementName=DataViewer,Path=singleSelection.(j:Entity.proper ties)} ">
> <TableViewer.columns>
> <TableViewerColumn width="150" text="Name"
> bindingPath="name" />
> <TableViewerColumn width="150" text="Id"
> bindingPath="id" />
> <TableViewerColumn width="150" text="Type"
> bindingPath="type" />
> <TableViewerColumn width="150" text="Value"
> bindingPath="value" />
> </TableViewer.columns>
> <TableViewer.table HeaderVisible="true" />
>
> <TableViewer.control.layoutData>
> <GridData horizontalAlignment="FILL" verticalAlignment="FILL"
> heightHint="200" grabExcessHorizontalSpace="true"
> grabExcessVerticalSpace="true" />
> </TableViewer.control.layoutData>
> </TableViewer>
>
> <Text x:style="SWT.NONE"
>
> text="{Binding Path= the id of the prop1 of Entity1}"
> ></Text>
>
> </Composite>
>
>
> Thanks for help
>
>
Re: data binding [message #554628 is a reply to message #554088] Mon, 23 August 2010 18:48 Go to previous message
FD  is currently offline FD Friend
Messages: 15
Registered: August 2010
Junior Member
Thanks.
Previous Topic:xwt browser
Next Topic:data binding
Goto Forum:
  


Current Time: Tue Apr 23 13:58:54 GMT 2024

Powered by FUDForum. Page generated in 0.03444 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top