Re: float[] is super slow

2017-02-07 Thread Colin Alworth
There are other problems too, like supporting object instanceof float[] (or 
even instanceof Object), not that you likely do a lot of things like that. 
I had a patch once upon a time that would let you optionally use typed 
arrays _or_ js lists as primitive arrays (except longs of course), but it 
added small runtime costs in odd places, so was turned down (outside of the 
code review, separate discussion).

The patch is old and stale, but its possible you could do something with 
it, at least for a personal gwt branch. 
https://gwt-review.googlesource.com/#/c/8321/

There is another option too, depending on how this data looks in your array 
- consider java.nio.FloatBuffer. GWT can get support for it from PlayN 
(backed by js typedarrays, as you would expect), I have experience with it 
and have found you can get pretty amazing performance using it). This is 
still cross platform, won't mess with instanceof, only downside is that 
you'll have to do some not-so-cross platform stuff to interact with the 
typedarray side if you need (serializing, writing to canvas, etc). If you 
need more info, let me know, I have a few projects that use it. PlayN is 
still moving forward, just released their 2.0-rc4, and I've found that the 
buffer impls all behave as expected still.

On Monday, February 6, 2017 at 6:09:33 AM UTC-6, Jens wrote:
>
>
> The reason I'm asking is because Super-source solution can not change all 
>> "new int[...]" invocations in my program. 
>> As far as I understand, the SS solution can change some ArrayFactory and 
>> each time I need to use it I have to write ArrayFactory.createFloatArray. 
>> "new float[]" will not be altered with souper-source.   
>>
>> Am I right ?
>>
>
> yes you would need a factory with super source so you can change the way 
> the array is created.
>
> -- J. 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


java.lang.ClassCastException: org.apache.tomcat.SimpleInstanceManager cannot be cast to org.apache.tomcat.InstanceManager

2017-02-07 Thread canan
I am trying to compile an application with Eclipse using GWT Plugin and 
when I try to display the application from browser It throws the following 
exception.
I could not find any way to make it work. Any help would be appreciated.

org.apache.jasper.JasperException: java.lang.ClassCastException: 
org.apache.tomcat.SimpleInstanceManager cannot be cast to 
org.apache.tomcat.InstanceManager

at org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:585)

at org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:396)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:405)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349)

at org.eclipse.jetty.jsp.JettyJspServlet.service(JettyJspServlet.java:107)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587
)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(
ScopedHandler.java:143)

at org.eclipse.jetty.security.SecurityHandler.handle(
SecurityHandler.java:577)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(
SessionHandler.java:223)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
ContextHandler.java:1127)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)

at org.eclipse.jetty.server.session.SessionHandler.doScope(
SessionHandler.java:185)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(
ContextHandler.java:1061)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(
ScopedHandler.java:141)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
HandlerWrapper.java:97)

at org.eclipse.jetty.server.handler.RequestLogHandler.handle(
RequestLogHandler.java:95)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
HandlerWrapper.java:97)

at org.eclipse.jetty.server.Server.handle(Server.java:499)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)

at org.eclipse.jetty.server.HttpConnection.onFillable(
HttpConnection.java:257)

at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544
)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
QueuedThreadPool.java:635)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(
QueuedThreadPool.java:555)

at java.lang.Thread.run(Thread.java:745)

Caused by: 

java.lang.ClassCastException: org.apache.tomcat.SimpleInstanceManager 
cannot be cast to org.apache.tomcat.InstanceManager

at org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(
InstanceManagerFactory.java:29)

at org.apache.jsp.index_jsp._jspInit(index_jsp.java:32)

at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)

at org.apache.jasper.servlet.JspServletWrapper.getServlet(
JspServletWrapper.java:180)

at org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:369)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:405)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349)

at org.eclipse.jetty.jsp.JettyJspServlet.service(JettyJspServlet.java:107)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587
)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(
ScopedHandler.java:143)

at org.eclipse.jetty.security.SecurityHandler.handle(
SecurityHandler.java:577)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(
SessionHandler.java:223)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
ContextHandler.java:1127)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)

at org.eclipse.jetty.server.session.SessionHandler.doScope(
SessionHandler.java:185)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(
ContextHandler.java:1061)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(
ScopedHandler.java:141)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
HandlerWrapper.java:97)

at org.eclipse.jetty.server.handler.RequestLogHandler.handle(
RequestLogHandler.java:95)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
HandlerWrapper.java:97)

at org.eclipse.jetty.server.Server.handle(Server.java:499)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)

at org.eclipse.jetty.server.HttpConnection.onFillable(
HttpConnection.java:257)

at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544
)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
QueuedThreadPool.java:635)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(
QueuedThreadPool.java:555)

at java.lang.Thread.run(Thread.java:745)

[ERROR] 500 - GET /index.jsp (127.0.0.1)

   Request headers

  Host: 127.0.0.1:

  Connection: keep-alive

  Ca

Re: html5 date input as Editor

2017-02-07 Thread Thomas Broyer
I think I'd have extended ValueBoxBase instead (which already implements 
LeafValueEditor –through IsEditor and ValueBoxEditor– and handles malformed 
input by recording an error on an EditorDelegate — ValueBox could also be 
used, just make sure you set the type=date after you called the super 
constructor as it asserts type=text); use a DateTimeFormatRenderer and 
implement a Parser using your DateTimeFormat.

Alternatively, extend FocusWidget (no need for a composite here) and 
directly use the input's valueAsDate property (as a JsDate, turn it 
into/from a java.util.Date using getTime(), or 
getDate()/getMonth()/getFullYear() if you prefer).
The benefit of the ValueBoxBase and working from the text value though is 
that it works even in browsers that don't support the type=date input (e.g. 
Firefox; as they fallback to a type=text input in this case.) This is also 
why it's important to handle malformed input: you cannot count on the 
browser to sanitize the value if it doesn't support type=date, and you 
should then return 'null' rather than throwing.

In any case, to create the input, you don't need JSNI; use 
com.google.gwt.dom.client.Document.get().createElement("input") then 
setPropertyString("type", "date").
BTW, your JSNI should have used $doc rather than document.

On Tuesday, February 7, 2017 at 8:40:44 AM UTC+1, 129pierre wrote:
>
> Hi,
>
> I did it like this. Any comment/improvement ?
>
> public class DateEditor extends Composite implements LeafValueEditor 
> {
> static final DateTimeFormat html5Fmt = 
> DateTimeFormat.getFormat("-MM-dd");
>
> TextBox textBox;
>
> public DateEditor() {
> super();
> textBox = new TextBox(createDateInput());
> initWidget(textBox);
> }
>
> @Override
> public void setValue(Datevalue) {
> if (value == null)
> {
> textBox.setText("");
> }
> else
> {
> textBox.setText(html5Fmt.format(value));
> }
>
> }
>
> @Override
> public Date getValue() {
> // TODO Auto-generated method stub
> String value = textBox.getText();
> if (value == null || value.trim().length() == 0) {
> return null;
> }
> return new Date(html5Fmt.parse(value));
> }
>
> private static native InputElement createDateInput() /*-{
> var input = document.createElement("input");
> input.setAttribute("type", "date");
> return input;
> }-*/;
> } 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.