Problem with GWT 2.8

2016-11-15 Thread Kevin Langille
Hi everyone,

I have discovered a strange behavior in GWT 2.8. We were experiencing a bug 
in our code and I have boiled it down to one line in the client side code.

The following line returns false which is expected.

Math.abs(Double.NaN) < 0.0001

But applying not operator to the same line also returns false.

!(Math.abs(Double.NaN) < 0.0001)

We are able to avoid this situation with additional checks but its seems 
like a bug to me. Is anyone else able to confirm this issue? This was 
working as expected in 2.7.

Thanks,
Kevin

-- 
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.


Possible issue in GWT 2.8

2016-11-15 Thread Kevin Langille
Hi everybody

I have discovered an issue in GWT 2.8.

Evaluating the statement the following statement results in false as 
expected.

Math.abs(Double.NaN) < 0.001 

But applying the not operation to the same line also returns false.

!(Math.abs(Double.NaN) < 0.001)


Is anyone else able to see this problem. We are able to work around it but 
it seems like a bug to me. This was working correctly in GWT 2.7.

Thanks,
Kevin Langille

-- 
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.


Re: Class cast problem

2016-11-15 Thread Kirill Prazdnikov
In this situation, for some reason, a call to 
  castToNative(Object src, JavaScriptObject jsType) (Cast.java:155)
is generated. And no parameter jsType is present. 
However it seems reasonable to call to castToJso(Object src).


-- 
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.


Class cast problem

2016-11-15 Thread Kirill Prazdnikov
Hi 
I have two JsNative classes:

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public abstract class ArrayBuffer {...}


and


@JsType(isNative = true)
public interface JSObject {
  @SuppressWarnings("unchecked")
  @JsOverlay
  default  T cast() {
  return (T) this;
  }
}


and I have a native (XHR result) js method that is declared so that it returns 
JSObject

And then I cast it to ArrayBuffer and I got a runtime exception.


Shouldn't the type checking be disabled for isNative @JsType ?


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+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.


Re: Using js libraries

2016-11-15 Thread zakaria amine
Hi, 

I have succeeded in partially automating JsInterop classes generation for 
Leaflet: https://github.com/gwidgets/gwty-leaflet  from their 
documentation. I first tried to find patterns and then I used Jsoup to 
extract methods and properties from the .html and Apache Velocity to 
generate classes. Off course there is always some manual work.

You can also try out some Javascript IDE like Webstorm that can generate an 
outline with methods and properties for a .js library. 
 

-- 
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.


Re: Using js libraries

2016-11-15 Thread Vassilis Virvilis
In order to get some experience with jsinterop I started wiring some
libraries in a need to use basis. The libraries are requiring other
libraries so until now I have __partial__ bindings for the following
libraries:

1) jquery
2) DataTables
3) D3
4) Bootstrap - Modals
5) DateRangePicker
7) Moment

Here are the lessons learned so far.
1) you need to do it in order to get the handle of it. I can't imagine this
thing can be automated. There are too many pitfalls and way too many ways
to do it. Somebody need to balance the pluses and minuses of every approach
2) this forum is really valuable (thanks Thomas, Jens). Without it I
wouldn't have moved any further than the first 2-3 initial roadblocks.
3) There are still many rough spots and missing functionality. Some of the
top of my head are
  a) Casting is logical but weird. You have to fight at the IDE/java level
and then at the SDM level. It may produce difficult to understand runtime
errors. With chrome and --preety you can understand what's going on through.
  b) Integers are weird. Doubles and String are mostly working...
  c) JavaScriptObject and JSNI and some util functions are still required
for some functions
  d) Casting to/from JavaScriptObject is not obvious. Casting to other java
primitive types may work except some times doesn't.
  e) Some semantics may suprise you like @JsType(isNative = false)
requiring extra compile time flags. If you read the Q&A discussion it
actually makes sense
  f) Javascript this is not supported without hoops
  g) Creating config objects out of strings is not trivial like in js. Some
libraries are very keen to config objects DataTables being the prime
example.
 4) There is a question if we could somehow create a repository of
jsinterop bindings? Someone mentioned http://http://jsinterop.xyz
 5) Another question is how to use these bindings (that somebody else
created)? I mean - if I only need only js binding - should I pay the price
for several java js bindings just because they arepackaged together - or
they are ignored thanks to the GWT compiler?

  Just my 2cents

   Vassilis



On Tue, Nov 15, 2016 at 4:10 PM, Max Fromberger 
wrote:

> Hello GWT users,
>
> Status quo - correct me if I'm wrong:
> GWT has become even more awesome with JSInterop and Elemental. There are
> several wrappers for various JS libraries available, some up-to-date, even
> using JSInterop, while others being outdated (JSNI, compatibility only for
> older GWT versions) or abandoned.
>
> I was wondering if there is a best practise for using JS libraries in GWT.
> Does it always have to be a manual writing of JSInterop glue types, oder
> can it be automated as it is the case with Elemental (different case, I
> know)?
>
> As an example: I'm currently dealing with a 3D WebGL project. I am trying
> to migrate it from a widgets based GUI to a pure Elemental GUI. The
> application currently employs parallax3d (GWT 3D library incorporating
> three.js, i.e. a wrapper with some additional functionality and some lost
> functionality with respect to naked three.js). This migration requires
> stepping away from parallax3d, as this library is also widgets based. So
> I'd like to use pure three.js and wonder if I have to write my own
> JSInterop overlay types. Or there is a way of auto-generation these?
>
> This brings up another question: what is the recommended way of using
> widgets and the Elemental approach in one single GWT application? I end up
> getting and setting innerHTML()-Strings.
>
> Looking forward to a general discussion of this topics; thanks for any
> feedback and input.
>
> Kind regards,
> Max
>
>
>
>
> --
> 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.
>



-- 
Vassilis Virvilis

-- 
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.


Using js libraries

2016-11-15 Thread Max Fromberger
Hello GWT users,

Status quo - correct me if I'm wrong:
GWT has become even more awesome with JSInterop and Elemental. There are 
several wrappers for various JS libraries available, some up-to-date, even 
using JSInterop, while others being outdated (JSNI, compatibility only for 
older GWT versions) or abandoned.

I was wondering if there is a best practise for using JS libraries in GWT. 
Does it always have to be a manual writing of JSInterop glue types, oder 
can it be automated as it is the case with Elemental (different case, I 
know)?

As an example: I'm currently dealing with a 3D WebGL project. I am trying 
to migrate it from a widgets based GUI to a pure Elemental GUI. The 
application currently employs parallax3d (GWT 3D library incorporating 
three.js, i.e. a wrapper with some additional functionality and some lost 
functionality with respect to naked three.js). This migration requires 
stepping away from parallax3d, as this library is also widgets based. So 
I'd like to use pure three.js and wonder if I have to write my own 
JSInterop overlay types. Or there is a way of auto-generation these?

This brings up another question: what is the recommended way of using 
widgets and the Elemental approach in one single GWT application? I end up 
getting and setting innerHTML()-Strings.

Looking forward to a general discussion of this topics; thanks for any 
feedback and input.

Kind regards,
Max




-- 
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.


Re: Problems with ClickEvents when using CellTree within DataGrid.

2016-11-15 Thread magnus . persson


On Monday, November 14, 2016 at 11:06:19 AM UTC+1, Thomas Broyer wrote:
>
>
>
> On Monday, November 14, 2016 at 10:51:35 AM UTC+1, magnus@raybased.com 
> wrote:
>>
>> I have some problems when using a CellTree within a DataGrid.
>> Everything works except when clicking on the tree, nothing happens.
>> I would expect the tree to expand/retract.
>> Does anyone know of a solution ?
>>
> […] 
>
>> private void buildCell(Node rowValue, String cellStyles, 
>> TableRowBuilder row) {
>> NodesTree hw = new NodesTree(rowValue);
>> TableCellBuilder td = row.startTD().colSpan(5);
>> td.className(cellStyles);
>> DivBuilder div = td.startDiv();
>> String t = hw.getWidget().getElement().getInnerHTML();
>>
>
> First, widgets' event wiring is done in such a way that they need to be 
> "attached" for the events to actually be listened to; see 
> https://github.com/gwtproject/old_google_code_wiki/blob/master/DomEventsAndMemoryLeaks.wiki.md
>  
> for an oldish explanation.
> Second, even if that wasn't the case, you couldn't expect event handlers 
> to be preserved when "serializing" the widget's element to HTML and then 
> re-parse it (moreover, you're taking the innerHTML of the element here, 
> which excludes the element itself, therefore would have excluded all event 
> handlers set on the element, *if* serialization would have preserved them, 
> which is not the case)
>
> So, sorry, but that's not going to work.
> It might be possible hacking around: generate placeholder elements in 
> buildCell and schedule a task that will "attach" the CellTree to the 
> placeholder element; each time the cell is re-rendered.
>

Thank you for the reply. I would like to try your hack. Which class could i 
use as a placeholder ?
Do you have some example-code to do that ? (I am not an expert of GWT)... 

-- 
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.


Problem when clicking on a CellTree within a DataGrid.

2016-11-15 Thread magnus . persson
I have put a GWT-CellTree in a DataGrid. It works except for one thing: 
 When clicking on the tree-expand-icon, nothing happens.
How can this be fixed ?

best regards, Magnus

package com.raybased.gwt.configtool.client.grid;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.cellview.client.DataGrid;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.SimpleLayoutPanel;

public class HelloWorld implements EntryPoint {
public void onModuleLoad() {
   DataGrid grid= (DataGrid) new NodesGrid().getTable();
   grid.setWidth("100%");
   SimpleLayoutPanel slp = new SimpleLayoutPanel();
   slp.add(grid);
   RootLayoutPanel.get().add(slp);
}
}


package com.raybased.gwt.configtool.client.grid;

import com.google.gwt.cell.client.ClickableTextCell;
import com.google.gwt.cell.client.FieldUpdater;
import com.google.gwt.dom.client.Style;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.text.shared.AbstractSafeHtmlRenderer;
import com.google.gwt.text.shared.SafeHtmlRenderer;
import com.google.gwt.user.cellview.client.*;
import 
com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.view.client.ListDataProvider;

import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;

public class NodesGrid {
private AbstractCellTable table = new DataGrid<>();
private Column nameColumn;
private Column showBlocksColumn;
private final Set showBlocks = new HashSet<>();


public Column getNameColumn() {
   return nameColumn;
}

public AbstractCellTable getTable() {
   return table;
}

public NodesGrid() {
   table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
   table.setWidth("100%");
   CustomCellTableBuilder c = new CustomCellTableBuilder(this, table);
   table.setTableBuilder(c);
   Node nodes = new Node();
   nodes.setName("hello");
   nodes.setId(123);
   Node n2 = new Node();
   n2.setName("testing");
   nodes.getBlocks().add(n2);
   ListDataProvider dataProvider = new ListDataProvider<>();
   dataProvider.addDataDisplay(table);
   List list = dataProvider.getList();
   list.add(nodes);
   addShowBlocks();
   nameColumn = getSorter(list, "Name", 
Comparator.comparing(Node::getName), Node::getName);
}

private Column getSorter(List list,
String name,
Comparator cmp,
Function supplier) {
   TextColumn column = new TextColumn() {
@Override
public String getValue(Node object) {
   return supplier.apply(object);
}
   };
   table.addColumn(column, name);
   column.setSortable(true);
   ColumnSortEvent.ListHandler columnSortHandler = new 
ColumnSortEvent.ListHandler<>(list);
   columnSortHandler.setComparator(column, cmp);
   table.addColumnSortHandler(columnSortHandler);
   table.getColumnSortList().push(column);
   return column;
}

public Column getShowBlocksColumn() {
   return showBlocksColumn;
}

public Set getShowBlocks() {
   return showBlocks;
}

void addShowBlocks() {
   SafeHtmlRenderer anchorRenderer = new 
AbstractSafeHtmlRenderer() {
@Override
public SafeHtml render(String object) {
   SafeHtmlBuilder sb = new SafeHtmlBuilder();
   sb.appendHtmlConstant("(").appendEscaped(object)
   .appendHtmlConstant(")");
   return sb.toSafeHtml();
}
   };
   showBlocksColumn = new Column(new 
ClickableTextCell(anchorRenderer)) {
@Override
public String getValue(Node node) {
   if (showBlocks.contains(node.getId())) {
return "hide blocks";
   } else {
return "show blocks";
   }
}
   };
   showBlocksColumn.setFieldUpdater(new FieldUpdater() {
@Override
public void update(int index, Node node, String value) {
   if (showBlocks.contains(node.getId())) {
showBlocks.remove(node.getId());
   } else {
showBlocks.add(node.getId());
   }
   table.redrawRow(index);
}
   });
   table.addColumn(showBlocksColumn);
   table.setColumnWidth(0, 10, Style.Unit.EM);
}
}


package com.raybased.gwt.configtool.client.grid;

import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.cell.client.TextCell;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.cellview.client.CellTree;
import 
com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.user.cellview.client.TreeNode;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.SingleSelectionModel;
import com.google.gwt.view.client.TreeViewModel;

import java.util.ArrayList;
import java.util.List;

public class NodesTree {
private CellTree tree;

public NodesTree(Node node) {
   TreeViewModel model = new CustomTreeModel(node);
   tree = new CellTree(model, null);
  

Re: GWT 2.8 RC1 - Could not merge 2 super sourced packages

2016-11-15 Thread Ali Jalal
Hi,

Just try comparing classes inside "gwtx.jar\com\googlecode\gwtx\java" (for
example: for "java.util" package, look inside
"gwtx.jar\com\googlecode\gwtx\java\util\emul\java\util") and
"gwt-user.jar\com\google\gwt\emul\java" and remove classes from gwtx.jar
which exists in gwt-user.jar. In my case, java.util.Locale was the only one
conflicting class which by deleting
"com\googlecode\gwtx\java\util\emul\java\util\Locale.java" file from
gwtx.jar, problem solved.

Regards,
Ali.

On Tue, Nov 15, 2016 at 11:16 AM, Saurabh Joshi 
wrote:

> Hi Ali,
>
> I am facing the same issue what you have described (while upgrading from
> GWT 2.7 to 2.8) in your post also I am using GWTx library in my
> dependencies, so I wanted to try your solution but unfortunately I did not
> understand the solution.
> Can you please elaborate on how did you remove java.util.Locale.java from
> emulated classes of GWTx?
>
> Thanks,
> Saurabh.
>
> On Tuesday, 2 August 2016 14:02:01 UTC+5:30, Ali Jalal wrote:
>>
>> I compared emulated classes in 'java.util' and 'java.beans' packages of
>> GWT and GWTx and I found *java.util.Locale.java* which emulated in both
>> packages. By removing java.util.Locale.java from emulated classes of GWTx,
>> problem solved.
>>
>> Thanks Thomas.
>>
>>
>> On Tue, Aug 2, 2016 at 9:44 AM, Ali Jalal  wrote:
>>
>>> Hi,
>>>
>>> I compiled project with -strict and almost same errors logged (I think
>>> GWT compiler does not merge 2 super-source packages like 'java.util' and
>>> 'java.beans'). Here is the stacktrace:
>>>
>>>  [java] Compiling module com.test.sample.Sample
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.cell.client.EditTextCell'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/cell/client/Ed
>>> itTextCell.java'
>>>  [java]  [ERROR] Line 336: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type '
>>> com.google.gwt.dom.builder.client.DomStylesBuilder'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/dom/builder/cl
>>> ient/DomStylesBuilder.java'
>>>  [java]  [ERROR] Line 113: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.dom.client.DataTransfer'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/dom/client/Dat
>>> aTransfer.java'
>>>  [java]  [ERROR] Line 127: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.user.cellview.client.AbstractCellTable'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/user/cellview/
>>> client/AbstractCellTable.java'
>>>  [java]  [ERROR] Line 744: ROOT cannot be resolved or is not
>>> a field
>>>  [java]  [ERROR] Line 477: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.user.client.ui.MultiWordSuggestOracle'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/user/client/ui
>>> /MultiWordSuggestOracle.java'
>>>  [java]  [ERROR] Line 534: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.dom.client.HeadingElement'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/dom/client/Hea
>>> dingElement.java'
>>>  [java]  [ERROR] Line 91: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.user.client.ui.AbsolutePanel'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/user/client/ui
>>> /AbsolutePanel.java'
>>>  [java]  [ERROR] Line 280: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.user.client.ui.UIObject'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/user/client/ui
>>> /UIObject.java'
>>>  [java]  [ERROR] Line 657: ROOT cannot be resolved or is not
>>> a field
>>>  [java]  [ERROR] Line 775: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.safehtml.shared.UriUtils'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/safehtml/share
>>> d/UriUtils.java'
>>>  [java]  [ERROR] Line 240: ROOT cannot be resolved or is not
>>> a field
>>>  [java]  [ERROR] Line 235: ROOT cannot be resolved or is not
>>> a field
>>>  [java]  [ERROR] Line 84: ROOT cannot be resolved or is not
>>> a field
>>>  [java]Tracing compile failure path for type
>>> 'com.google.gwt.user.cellview.client.CellBasedWidgetImplTrident'
>>>  [java]   [ERROR] Errors in 'com/google/gwt/user/cellview/
>>> client/CellBasedWidgetImplTrident.java'
>>>  [java]  [ERROR] Line 253: ROOT cannot be resolved or is not
>>> a field
>>>  [java]  [ERROR] Line 191: ROOT cannot be resolved or is not
>>> a fie

Re: Internet Explorer Google Web Toolkit Plugin Installing but not Working.

2016-11-15 Thread Thomas Broyer


On Tuesday, November 15, 2016 at 12:55:01 AM UTC+1, Slava Pankov wrote:
>
> Dev mode works just fine with GWT 2.8 in old Firefox 24 esr and IE11. 
>

Thanks for the confirmation.
Just after I sent my mail, I new I was probably wrong: devmode doesn't use 
the Java Runtime Emulation (JRE) library, and JsInterop is currently only 
used in the JRE.

-- 
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.