Re: Using JsInterop to create JS object literals

2024-05-21 Thread Marco Tenti (IoProgrammo88)
I thank you Thomas for the clarification unfortunately I am forced to use setters and getters because I cannot find another way to set the values and compile the GWT java client. As you said I seem to have solved it with: @JsProperty public native String getCodeAdministration(); @JsProperty pub

Re: Using JsInterop to create JS object literals

2024-05-21 Thread Thomas Broyer
With the following: @JsType(namespace = JsPackage.GLOBAL, name = "Object", isNative = true) public class XXXGWT { public String codiceAmministrazione; } you should be able to write: var xxx = new XXXGWT(); xxx.codiceAmministrazione = "foo"; and have it translate more or less to: let xxx =

Re: Using JsInterop to create JS object literals

2024-05-21 Thread Marco Tenti (IoProgrammo88)
Just to be clear on my use case this is my java class: @JsType(namespace = JsPackage.GLOBAL, name = "Object", isNative = true) public class XXXGWT { private String codiceAmministrazione; @JsConstructor public DocumentoPAC4DTOGWT() {} public native String getCodiceAmministrazione();

Re: Using JsInterop to create JS object literals

2024-05-21 Thread Marco Tenti (IoProgrammo88)
Sorry Thomas about your last comment " I'd rather user fields than getters/setters for such objects " can you point me out to some example for this ? Il giorno mercoledì 29 giugno 2022 alle 09:48:49 UTC+2 Thomas Broyer ha scritto: > Using isNative=true, you're telling GWT that you're only "m

Re: Using JsInterop to create JS object literals

2022-06-29 Thread Thomas Broyer
Using isNative=true, you're telling GWT that you're only "mapping" in Java a *type* that exists in JS. The default naming rule is that the full name of that type is the fully qualified name of the Java class, you can change the simple name with 'name', and the *prefix* with namespace (which def

Re: Using JsInterop to create JS object literals

2022-06-28 Thread Nicolas Chamouard
Thank you ! It is a bit mysterious to me, but with *name = "Object"* the constructor works :) Le mercredi 29 juin 2022 à 00:47:32 UTC+2, m.conr...@gmail.com a écrit : > try adding name = "Object" so that it uses an empty javascript Object as > the wrapped item. > > I found this via Googling: >

Re: Using JsInterop to create JS object literals

2022-06-28 Thread Michael Conrad
try adding name = "Object" so that it uses an empty javascript Object as the wrapped item. I found this via Googling: @JsType(namespace = JsPackage.GLOBAL, isNative = true, name = "Object") public class MyPluginConfig { @JsProperty public void set(String str); @JsProperty public Strin

Re: Using JsInterop to create JS object literals

2022-06-28 Thread Nicolas Chamouard
Yes, it does not change anything : @JsType(*isNative*=*true*, *namespace* = JsPackage.*GLOBAL*) *public* *class* OptionOverrides { @JsConstructor *public* OptionOverrides() {} @JsProperty *public* *native* String getInitialView(); @JsProperty *public* *native

Re: Using JsInterop to create JS object literals

2022-06-28 Thread Michael Conrad
Have you tried giving the class a constructor? On Tue, Jun 28, 2022 at 4:04 PM Nicolas Chamouard wrote: > Hello, > > I am using JsInterop to integrate FullCalendar to my GWT application. > As described here https://fullcalendar.io/docs/initialize-globals, I am > supposed to create an object lit

Using JsInterop to create JS object literals

2022-06-28 Thread Nicolas Chamouard
Hello, I am using JsInterop to integrate FullCalendar to my GWT application. As described here https://fullcalendar.io/docs/initialize-globals, I am supposed to create an object literal and pass it to the Calendar() constructor. I have managed to create this class : @JsType(*namespace* = JsPa