Unicode normalization in GWT [duplicate] - gwt

I tried
s=Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
But it seems that GWT API doesn't provide such fonction.
I tried also :
s=s.replace("é",e);
But it doesn't work either
The scenario is I'am trying to générate token from the clicked Widget's text for the history management

You can take ASCII folding filter from Lucene and add to your project. You can just take foldToASCII() method from ASCIIFoldingFilter (the method does not have any dependencies). There is also a patch in Jira that has a full class for that without any dependencies - see here. It should be compiled by GWT without any problems. License should be also OK, since it is Apache License, but don't quote me on it - you should ask a real lawyer.

#okrasz, the foldToASCII() worked but I found a shorter one Transform a String to URL standard String in Java

Related

Which is The best datepicker for jHipster?

I want to use datepicker in jHipster v4.8.2 project with Angular 4. I tried this answer
but it didn't work. I would be thankful if you have an idea.
As mentioned here you can use NgbTimepicker on "Instant" (= a java.time.Instant object), which jhipster.tech recommends to be most probably used instead of a "ZonedDateTime" (see Field types), or use the PrimeNG support - here you can see a code example in detail.
You can also find my PrimeNG calendar-module implementation here - trying to get the example app from Full Stack Development with JHipster done.

How to specify SonarQube rule description as a markdown/html resource file instead of using annotation?

I have my custom rule, let's say with AEM-1 key. So, as it is done here, I make my AEM-1.html resource file with some simple html content and it does not get's picked up by SonarQube 5.1. It refuses to start, because no description is provided for the rule.
I tried different packages names, tried to look for convention in source code etc. What's missing? Is there any documentation on that?
The naming convention is org/sonar/l10n/{plugin key}_{language}/rules/{repository key}/{rule key}.html.
It was documented in http://docs.sonarqube.org/display/DEV/Internationalization at the time rule descriptions supported localization. That's not the case anymore since version 4.2, but these HTML bundles are still supported.
The correct way since version 4.3 is to use the low-level API org.sonar.api.server.rule.RulesDefinition. It allows you to implement any kind over layer over it (xml, json, annotations, ...).

Exporting a class and its methods in GWT for use in native JavaScript

I'm developing a GWT project at the moment and it's been up and running for a while. New functionality that is to be added require extensive testing, visualizing and simulating of a specific algorithm. I would like to export that specific algorithm so that I may call it directly from JavaScript and do some canvas magic.
How can I export a number of classes for direct use in JavaScript from a GWT project?
I've tried using the GWT exporter, following the Getting Started section closely.
I've noticed that my output directory contains a new generator class (TestClassExporterImpl.java) but the final JavaScript output contains no trace of my TestClass or the exported methods.
I'm sure I've made a mistake somewhere on the way or didn't understand the GWT exporter correctly.
Try to disable obfuscation, it will create the same names in Javascript as in the original Java code

Grails + GWT - using the same Date Format

I am developing an app using Grails and GWT for a client side.
I want to use the same date format both on the client side and on the server side (preferably defined in one file).
So far i've understood that Grails got it's own mechanism for internationalization (grails-app/i18n). I know i can access these messages from any server code using app context.
I can also access any resource file inside web-app directory.
For the client side, i can use ConstantsWithLookup interface and GWT.Create(...) to get an instance of it.
But, i still haven't found good solution to integrate these two together, so i have date format defined in one place. Any ideas or tips?
Thanks,
Sergey
After digging into Grails more, i came to a solution.
I've put constant into .properties file under grails-app/i18n.
Then, i hook to eventCompileEnd and i copy resources from grails-app/i18n to specific package in target\generated-sources.
After this step is completed, i generate google I18N interfaces using copied property files.
I've put this functionality to separate plugin.
_Events.groovy:
includeTargets << new File("${myPluginDir}/scripts/_MyInternal.groovy")
eventCompileEnd = {
internalCopyMessageResources();
}
eventCopyMessageResourcesEnd = {
generateI18NInterface();
}
Now it is possible to access localized data from server side and from client side.

What is the use GWT generator?

I have seen that GWT framework is having generator feature.
In what case we have to use gwt generator option and why it is needed?
Can anyone tell me simply why,what is gwt generator? Done some googling. But not much helpful stuffs...
From this tutorial:
Generators allow the GWT coder to generate Java code at compile time and have it then be compiled along with the rest of the project into JavaScript.
This tutorial uses the example of generating a Map of values at compile time based on a properties file.
I've done GWT development for 3 years now and I've written one generator :) I've written a couple of linkers for experimental purposes so I think they are more common, though still rare. The classic case is where you want to write
X x = GWT.create(X.class)
and have the particular subclass or implementation of X constructed at compile time based on, perhaps, annotations in the provided X class or interface. GWT uses them for things like the CSSResource.
Search for "GWT Generator Experiments" site:development.lombardi.com on google for some info about what I did.
One of the use cases is to mimic reflection on the client side by building a factory class on the fly. I remember answering a question posted by you earlier on how to do this
How to create new instance from class name in gwt?
So i guess you already know the application. What else are you looking for? Can you be precise?
I've started using GWT Generators where I needed Java Reflection. I've documented One of the use cases for using GWT generators here:
http://jpereira.eu/2011/01/30/wheres-my-java-reflection/
Hope it helps.
If you refer to code generator, yes, there will a tool supporting GWT 2.1 code generation. For more details and a quick start, see http://www.springsource.org/roo/start
A general roo intro is here http://blog.springsource.com/2009/05/01/roo-part-1/
Another visual tutorial is at http://www.thescreencast.com/2010/05/how-to-gwt-roo.html
Check out this implementation:
http://samuelschmid.blogspot.com/2012/05/using-generator-for-generic-class.html
You can create new Instances of classes on client with foo.newInstance("fully.qualified.class.name");