Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Problem with Custom Widget .set()(Problem with Custom Widget .set())
Problem with Custom Widget .set() [message #1455536] Wed, 29 October 2014 09:20 Go to next message
Eclipse UserFriend
Hi,
i have written a simple custom widget ( my second in all ) with RAP 2.3 but encountered a problem in further implementation. Basicly i need a HTML viewer which can show html content or XML. For that purpose my custom widget creates a Iframe element and will be filled with information. The set up and creation works flawless.

Now during java server workflow this will be called

	public void setContent( String aContent ) {
		if ( this.aContent != null && !this.aContent .equals( "" ) ) {
			cliObj.set( "frmCtt", aContent ); // cliObj is my registered RemoteObject
		}
	}


The problem now is that after the .set() the property is send (i looked the network in Chrome Dev Tools) as json but the field value hasnt changed.

	/**
	 * Class prototype
	 */
	test.myCustomWidget.prototype = {

                frmCtt	: "", // Thats the Property field not changing

		ready : false,

		onReady : function() {
			this.ready = true;
			this.layout();
		},
		
		
                .... further code


If i use .call() in java instead and change the field to a function it works, but i am not sure if call triggers a new render in some kind and i DONT want to render i just want to change the value.

Thanks in advance and sorry for mistakes Embarrassed
Re: Problem with Custom Widget .set() [message #1456231 is a reply to message #1455536] Thu, 30 October 2014 02:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
did you create a JavaScript type handler for your custom widget [1]? Is
your property listed in the handler:

|rap.registerTypeHandler( "my.CustomWidgetType", {
factory : function( properties ) {
return new MyCustomWidget( properties );
},

properties : [ "||frmCtt" ]
} );|

and in your widget JS prototype you need function setFrmCtt( value )
where you will actually do the update of the property.

[1]
https://wiki.eclipse.org/RAP/Custom_Widgets_FAQ#What_is_the_basic_architecture_of_a_Custom_Widget.3F

HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Problem with Custom Widget .set() [message #1457479 is a reply to message #1456231] Fri, 31 October 2014 07:15 Go to previous messageGo to next message
Eclipse UserFriend
OK i just forgot or wasnt aware that there is a field called properties required

I added
properties : [ "frmCtt" ]


and now everything works fine.

THANK YOU VERY MUCH Very Happy
Re: Problem with Custom Widget .set() [message #1848562 is a reply to message #1456231] Wed, 08 December 2021 00:54 Go to previous message
Eclipse UserFriend
[quote title=Ivan Furnadjiev wrote on Thu, 30 October 2014 02:22]Hi,
did you create a JavaScript type handler for your custom widget [1]? Is
your property listed in the handler:

|rap.registerTypeHandler( "my.CustomWidgetType", {
factory : function( properties ) {
return new MyCustomWidget( properties );
},

properties : [ "||frmCtt" ]
} );|

and in your widget JS prototype you need function setFrmCtt( value )
where you will actually do the update of the property.


Hi, Ivan

Reversely, on Java side, how to get the value of 'frmCtt' from JavaScript?
And how to access frmCtt inside JavaScript?
Thank you so much!

David

[Updated on: Wed, 08 December 2021 02:11] by Moderator

Previous Topic:Tycho Build -jdk11, tycho 2.4.0
Next Topic:RAP e4 war export in Maven
Goto Forum:
  


Current Time: Wed Apr 30 15:17:01 EDT 2025

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

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

Back to the top