Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Another XWT Validation Trouble
Another XWT Validation Trouble [message #931460] Wed, 03 October 2012 04:15 Go to next message
Jürgen Weinberger is currently offline Jürgen Weinberger
Messages: 35
Registered: August 2012
Member
Hey everyone!

I have a little problem with the validation mechanism in xwt. I hope somebody can help me.

I am stuck with the declaration of the xwt binding context in the xwt-file.
As soon as i insert the BindingContext={StaticResource myDBC} i get an exception that the key "myDBC" cannot be found.
But as i saw in the test-cases of xwt it should not be necessary to append anything in the loading options or somewhere else in the java code or am i wrong?
Without the BindingContext everything works fine and by the way i am using xwt in an RCP application.

<Composite xmlns="http://www.eclipse.org/xwt/presentation" 
		   xmlns:x="http://www.eclipse.org/xwt"
		   xmlns:y="clr-namespace:testapplication.uicontainers"
	 	   x:DataContext="{StaticResource myData}"
	 	   BindingContext="{StaticResource myDBC}">
	 	   
	<x:Composite.Resources>
		<y:Person x:Key="myData"/>
		<BindingContext x:Key="myDBC"/>
	</x:Composite.Resources>
	 	   
	<Composite.layout>
		<RowLayout/>
	</Composite.layout>
	
	<Text x:Style="BORDER" text="{Binding UpdateSourceTrigger=PropertyChanged, path=name}"/>
	<Button x:Class="PersonUIContainer" text="New Button" SelectionEvent="onSelection"/>

</Composite>


	private void loadFromURL() {
		try {
			XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
			loadedControl = (Control)XWT.loadWithOptions(xwtFile, getOptions());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	private Map<String, Object> getOptions() {
		HashMap<String, Object> xwtLoadingOptions = new HashMap<String, Object>();
		
		xwtLoadingOptions.put(XWTLoader.CLASS_PROPERTY, this);
		xwtLoadingOptions.put(XWTLoader.CONTAINER_PROPERTY, parentControl);
		if(model!=null) {
			xwtLoadingOptions.put(XWTLoader.DATACONTEXT_PROPERTY, model);
		}
		
		return xwtLoadingOptions;
	}


Any help would be appreciated Smile
Thanks and best regards
weinma
Re: Another XWT Validation Trouble [message #931703 is a reply to message #931460] Wed, 03 October 2012 08:49 Go to previous message
Erdal Karaca is currently offline Erdal Karaca
Messages: 729
Registered: July 2009
Senior Member
I am not sure if the Composite.Resources node should be in the x namespace: try without ns prefix...

<Composite.Resources>...</...>
Previous Topic:How to make perspective buttons right aligned ?
Next Topic:import org.eclipse.e4.ui.di.Focus; failing
Goto Forum:
  


Current Time: Tue Jul 29 21:07:06 EDT 2014

Powered by FUDForum. Page generated in 0.04858 seconds