Tuesday, August 27, 2024

Re: Is it possible to use CSS Rem unit in GWT 2.0 layout system?

You should be able to set it directly, something like this:

myPanel.getElement().getStyle().setProperty("margin", "rem(14%, 3%)");

On Wednesday 28 August 2024 at 6:54:35 am UTC+10 Chak Lai wrote:
Greetings,

Is it possible to use CSS Rem unit in GWT 2.0 layout system?

I have a legacy GWT project that uses GWT 2.0 layout system. The project has been upgraded to gwt-2.11.0 successfully. However, I notice the current Enum Style.Unit in the com.google.gwt.dom.client package does not include REM unit for CSS Viewport. I have trouble extend the project to mobile device or small screen.


Thanks.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/b2208a57-c970-4d0a-a494-b93e8e940996n%40googlegroups.com.

Is it possible to use CSS Rem unit in GWT 2.0 layout system?

Greetings,

Is it possible to use CSS Rem unit in GWT 2.0 layout system?

I have a legacy GWT project that uses GWT 2.0 layout system. The project has been upgraded to gwt-2.11.0 successfully. However, I notice the current Enum Style.Unit in the com.google.gwt.dom.client package does not include REM unit for CSS Viewport. I have trouble extend the project to mobile device or small screen.


Thanks.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/2c428636-42a1-4950-b0d8-7acae3a4a07fn%40googlegroups.com.

Tuesday, August 6, 2024

Re: location.origin is null in GWT 2.11

Thank you! Adding $wnd worked.

On Mon, Aug 5, 2024 at 7:55 PM Craig Mitchell <mail@craig-mitchell.com> wrote:
And adding $wnd might be worth a try too:

public static native void originToConsole() /*-{
console.log("location.origin = " + 
$wnd.location.origin);
}-*/;

On Tuesday 6 August 2024 at 9:49:29 am UTC+10 Craig Mitchell wrote:
Bit of a long shot, but I wonder if it's failing because you have a boolean return type, but you're not returning anything.

Ie: 
public static native boolean originToConsole()

Should be:
public static native void originToConsole()

On Tuesday 6 August 2024 at 1:16:12 am UTC+10 Jens wrote:
You could add GWT.debugger() to your code at a location that fits and then compile your production app using GWT compiler argument -style PRETTY so you can read the JS. If you open Dev Tools of your browser and then load the app and trigger the code in question, code execution should stop at GWT.debugger() and you can take a look if the generated JS code looks reasonable. Maybe a production compile has optimized some code away.

-- J.

Oleg Ravun schrieb am Samstag, 3. August 2024 um 15:23:58 UTC+2:
Hello,
After switching to GWT 2.11 from 2.9 the following code prints null. Though it works in SuperDevMode but when it is built for deployment it produces null. It breaks communications (forth and back) using window.postMessage since it relies on proper origin provided (matching). What could be the reason?
public static native boolean originToConsole() /*-{
console.log("location.origin = " + location.origin);
}-*/;

Thanks 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/11693669-364a-420b-93c8-e57862013d50n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CALeCU%3D_iDUDSKtAqe7z9Jxr%3Dk0OLgdHN3Z%3D6-%3DrpwV2%3DVsN5Hg%40mail.gmail.com.

Monday, August 5, 2024

Re: location.origin is null in GWT 2.11

And adding $wnd might be worth a try too:

public static native void originToConsole() /*-{
console.log("location.origin = " + 
$wnd.location.origin);
}-*/;

On Tuesday 6 August 2024 at 9:49:29 am UTC+10 Craig Mitchell wrote:
Bit of a long shot, but I wonder if it's failing because you have a boolean return type, but you're not returning anything.

Ie: 
public static native boolean originToConsole()

Should be:
public static native void originToConsole()

On Tuesday 6 August 2024 at 1:16:12 am UTC+10 Jens wrote:
You could add GWT.debugger() to your code at a location that fits and then compile your production app using GWT compiler argument -style PRETTY so you can read the JS. If you open Dev Tools of your browser and then load the app and trigger the code in question, code execution should stop at GWT.debugger() and you can take a look if the generated JS code looks reasonable. Maybe a production compile has optimized some code away.

-- J.

Oleg Ravun schrieb am Samstag, 3. August 2024 um 15:23:58 UTC+2:
Hello,
After switching to GWT 2.11 from 2.9 the following code prints null. Though it works in SuperDevMode but when it is built for deployment it produces null. It breaks communications (forth and back) using window.postMessage since it relies on proper origin provided (matching). What could be the reason?
public static native boolean originToConsole() /*-{
console.log("location.origin = " + location.origin);
}-*/;

Thanks 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/11693669-364a-420b-93c8-e57862013d50n%40googlegroups.com.

Re: location.origin is null in GWT 2.11

Bit of a long shot, but I wonder if it's failing because you have a boolean return type, but you're not returning anything.

Ie: 
public static native boolean originToConsole()

Should be:
public static native void originToConsole()

On Tuesday 6 August 2024 at 1:16:12 am UTC+10 Jens wrote:
You could add GWT.debugger() to your code at a location that fits and then compile your production app using GWT compiler argument -style PRETTY so you can read the JS. If you open Dev Tools of your browser and then load the app and trigger the code in question, code execution should stop at GWT.debugger() and you can take a look if the generated JS code looks reasonable. Maybe a production compile has optimized some code away.

-- J.

Oleg Ravun schrieb am Samstag, 3. August 2024 um 15:23:58 UTC+2:
Hello,
After switching to GWT 2.11 from 2.9 the following code prints null. Though it works in SuperDevMode but when it is built for deployment it produces null. It breaks communications (forth and back) using window.postMessage since it relies on proper origin provided (matching). What could be the reason?
public static native boolean originToConsole() /*-{
console.log("location.origin = " + location.origin);
}-*/;

Thanks 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/95ba1f6a-220a-4af0-9276-3423d6716904n%40googlegroups.com.

Re: Gwt upgrade to 2.11.0 from 2.6.1

Don't the javax.servlet classses get pulled in from the web server libs you decide to use?

Also, if you use the latest web servers, you'll need to use the Jakarta GWT libs:  https://mvnrepository.com/artifact/org.gwtproject/gwt-servlet-jakarta/2.11.0

I recommend creating a sample project, and seeing how it fits together:  https://www.gwtproject.org/gettingstarted-v2.html

On Friday 2 August 2024 at 8:18:09 pm UTC+10 jyothindrapavan kondepati wrote:
Hi

Currently we are planning to upgrade to java 21 from java 8. GWT 2.11.0 is tested for java 21. But our current version for gwt is gwt-2.6.1. so we planning to upgrade to gwt-2.11.0 first before upgrading to java-21.

Please Required help in upgrading to gwt-2.11.0 from gwt-2.6.1 
Tried upgrading to 2.11.0 getting compile time errors

javax.servlet packages are not there in current gwt-user-2.11.0 .jar getting compile errors for those classes.

Please guide in this 
Thanks
 
Below are the dependencies used in ivy file 

<dependency org="com.google.gwt" name="gwt-servlet" rev="2.6.1" conf="production->default" />

<dependency org="com.google.gwt" name="gwt-user" rev="2.6.1" conf="compile->default" >
  <exclude org="javax.validation" module="validation-api" name="*" type="*" ext="*" conf="" matcher="exact" />
</dependency>

<dependency org="com.google.gwt.inject" name="gin" rev="2.1.2" conf="compile->default" />

<dependency org="com.extjs" name="gxt" rev="2.3.1a-gwt22" conf="production->default" />


<module >

<inherits name="com.google.gwt.user.User" />

<inherits name="com.google.gwt.i18n.I18N"/>

<inherits name='com.extjs.gxt.ui.GXT'/>

<inherits name="com.google.gwt.resources.Resources" />

<inherits name="com.google.gwt.inject.Inject" />

<inherits name="com.google.gwt.json.JSON"/>

<set-configuration-property name="locale.useragent" value="Y"/>

<set-property name="locale" value="default"/>

<inherits name="com.google.gwt.logging.Logging"/>

<set-property name="gwt.logging.logLevel" value="WARNING"/>

<set-property name="gwt.logging.enabled" value="TRUE"/>

<!-- Enable the simple remote handler -->

<set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />

<set-property name="gwt.logging.firebugHandler" value="ENABLED" />

<set-property name="gwt.logging.popupHandler" value="DISABLED" />

<set-property name="gwt.logging.consoleHandler" value="ENABLED" />

<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />

<set-property name="gwt.logging.popupHandler" value="DISABLED" />

<set-property name="gwt.logging.systemHandler" value="ENABLED" />

<source path="client" />

<source path="shared" />

<!-- Everything above this line needs to be identical between trm and trm-dev -->

<set-property name="user.agent" value="safari,ie9,gecko1_8"/>

<set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />

<!-- Super Dev Mode -->

<add-linker name="xsiframe"/>

<set-configuration-property name="devModeRedirectEnabled" value="true"/>

</module>

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/15a182d4-10eb-4302-90c7-3a04b2745ee0n%40googlegroups.com.

Re: location.origin is null in GWT 2.11

You could add GWT.debugger() to your code at a location that fits and then compile your production app using GWT compiler argument -style PRETTY so you can read the JS. If you open Dev Tools of your browser and then load the app and trigger the code in question, code execution should stop at GWT.debugger() and you can take a look if the generated JS code looks reasonable. Maybe a production compile has optimized some code away.

-- J.

Oleg Ravun schrieb am Samstag, 3. August 2024 um 15:23:58 UTC+2:
Hello,
After switching to GWT 2.11 from 2.9 the following code prints null. Though it works in SuperDevMode but when it is built for deployment it produces null. It breaks communications (forth and back) using window.postMessage since it relies on proper origin provided (matching). What could be the reason?
public static native boolean originToConsole() /*-{
console.log("location.origin = " + location.origin);
}-*/;

Thanks 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/bc2c4978-c0fa-41da-959a-7952615f2d3an%40googlegroups.com.

Saturday, August 3, 2024

location.origin is null in GWT 2.11

Hello,
After switching to GWT 2.11 from 2.9 the following code prints null. Though it works in SuperDevMode but when it is built for deployment it produces null. It breaks communications (forth and back) using window.postMessage since it relies on proper origin provided (matching). What could be the reason?
public static native boolean originToConsole() /*-{
console.log("location.origin = " + location.origin);
}-*/;

Thanks 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/918f3527-0dfa-425b-8026-8f79c428af55n%40googlegroups.com.

Thursday, August 1, 2024

Re: CSP issues with UiBinder

Apologies.  Didn't realise CSP isn't enabled in browsers by default.

On Friday 2 August 2024 at 11:26:55 am UTC+10 Craig Mitchell wrote:
What am I missing here.  I use CssResource and don't have "style-src unsafe-inline" anywhere, and it all works fine.

Ie:

public class ResourcesCommon {
  private static final ResourcesCommonDefinitions INSTANCE = GWT.create(ResourcesCommonDefinitions.class);
  public static ResourcesCommonDefinitions inst() {
    return INSTANCE;
  }
}

public interface ResourcesCommonDefinitions extends ClientBundle {
  @Source("style.css") ResourcesCommonCSS css();
}

public interface ResourcesCommonCSS extends CssResource {
  @ClassName("someStyle") String someStyle();
}

Have all the css in style.css:

.someStyle {
  
color: red;
}

And in the ui.xml files:

<ui:with field="resCommon" type="proj.my.ResourcesCommon" />

<g:HTMLPanel>
  <div ui:field="myDiv" class="{resCommon.inst.css. someStyle  }">
  </div>
</g:HTMLPanel>

On Thursday 1 August 2024 at 1:11:45 pm UTC+10 Colin Alworth wrote:
After some discussion in gitter a few hours ago, we filed https://github.com/gwtproject/gwt/issues/9990 as a research topic to look more deeply into this within GWT itself.

It looks to me as though a separate StyleInjector implementation could be provided that no longer batches style tag creation, but instead inserts each individually. When the app is compiled, the hash for each block of CSS could be computed (...minus any runtime value interpolation), and a generated file made available to the server so that appropriate CSP headers can be set on http responses.

Creating many individual css files and loading them via <link> tags is an option too, but won't load synchronously that way, unless you hit them all at startup (which then would mean that you may load them unnecessarily).

Alternatively, a nonce could be specified and injected with each style tag - but that seems like a weaker approach in general, since it requires making the nonce available to the page's script code.

On Wednesday, July 31, 2024 at 8:26:57 PM UTC-5 ma...@craig-mitchell.com wrote:
There are multiple ways of using CSS in the UIBinder, I'm not sure which one uses injectStyleSheet behind the scenes.  Are you referring to using:
  1. The <ui:style> tag in the ui.xml files.
  2. Resources with CssResource and the <ui:with ...> tag in the ui.xml files.
  3. Or are you programmatically injecting CSS in the code.
The obvious workaround would be to put your CSS in the main index.html file, and reference it from there, however, that might not be practical for your situation.

On Thursday 1 August 2024 at 1:42:16 am UTC+10 mighty...@gmail.com wrote:
Hello all. I am working to make our webapp compliant with our CSP, and have removed `style-src unsafe-inline`. I am working through any errors that have popped up, but one is stumping me

At runtime, it appears that GWT is injecting all the CSS from our Ui Binder files using StyleInjectorImpl `injectStyleSheet` method. 

This is violating the CSP. Is there any way around this? I'm aware that the main way to ensure CSP compliance is to use a nonce value, but due to some quirks with our setup, this is not possible. 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/aacc5451-fce6-406b-9742-d046b1d3f237n%40googlegroups.com.

Re: CSP issues with UiBinder

What am I missing here.  I use CssResource and don't have "style-src unsafe-inline" anywhere, and it all works fine.

Ie:

public class ResourcesCommon {
  private static final ResourcesCommonDefinitions INSTANCE = GWT.create(ResourcesCommonDefinitions.class);
  public static ResourcesCommonDefinitions inst() {
    return INSTANCE;
  }
}

public interface ResourcesCommonDefinitions extends ClientBundle {
  @Source("style.css") ResourcesCommonCSS css();
}

public interface ResourcesCommonCSS extends CssResource {
  @ClassName("someStyle") String someStyle();
}

Have all the css in style.css:

.someStyle {
  
color: red;
}

And in the ui.xml files:

<ui:with field="resCommon" type="proj.my.ResourcesCommon" />

<g:HTMLPanel>
  <div ui:field="myDiv" class="{resCommon.inst.css. someStyle  }">
  </div>
</g:HTMLPanel>

On Thursday 1 August 2024 at 1:11:45 pm UTC+10 Colin Alworth wrote:
After some discussion in gitter a few hours ago, we filed https://github.com/gwtproject/gwt/issues/9990 as a research topic to look more deeply into this within GWT itself.

It looks to me as though a separate StyleInjector implementation could be provided that no longer batches style tag creation, but instead inserts each individually. When the app is compiled, the hash for each block of CSS could be computed (...minus any runtime value interpolation), and a generated file made available to the server so that appropriate CSP headers can be set on http responses.

Creating many individual css files and loading them via <link> tags is an option too, but won't load synchronously that way, unless you hit them all at startup (which then would mean that you may load them unnecessarily).

Alternatively, a nonce could be specified and injected with each style tag - but that seems like a weaker approach in general, since it requires making the nonce available to the page's script code.

On Wednesday, July 31, 2024 at 8:26:57 PM UTC-5 ma...@craig-mitchell.com wrote:
There are multiple ways of using CSS in the UIBinder, I'm not sure which one uses injectStyleSheet behind the scenes.  Are you referring to using:
  1. The <ui:style> tag in the ui.xml files.
  2. Resources with CssResource and the <ui:with ...> tag in the ui.xml files.
  3. Or are you programmatically injecting CSS in the code.
The obvious workaround would be to put your CSS in the main index.html file, and reference it from there, however, that might not be practical for your situation.

On Thursday 1 August 2024 at 1:42:16 am UTC+10 mighty...@gmail.com wrote:
Hello all. I am working to make our webapp compliant with our CSP, and have removed `style-src unsafe-inline`. I am working through any errors that have popped up, but one is stumping me

At runtime, it appears that GWT is injecting all the CSS from our Ui Binder files using StyleInjectorImpl `injectStyleSheet` method. 

This is violating the CSP. Is there any way around this? I'm aware that the main way to ensure CSP compliance is to use a nonce value, but due to some quirks with our setup, this is not possible. 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/c6889143-04cb-4ca8-a907-11d408a0434fn%40googlegroups.com.