Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:20 Go to next message
Maciej Gorski is currently offline Maciej GorskiFriend
Messages: 4
Registered: October 2014
Junior Member
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 06:22 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 11:15 Go to previous messageGo to next message
Maciej Gorski is currently offline Maciej GorskiFriend
Messages: 4
Registered: October 2014
Junior Member
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 05:54 Go to previous message
David Lee is currently offline David LeeFriend
Messages: 80
Registered: May 2013
Member
[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 07:11]

Report message to a moderator

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


Current Time: Wed Jun 19 07:36:56 GMT 2024

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

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

Back to the top