Re: Anchor does not work in IE - very strange problem!

2013-06-26 Thread Magnus
Hello,

the advice to use an UncaughtExceptionHandler was very helpful for solving 
this acutal problem.

But it also has a disadvantage: It brings to light new problems! :-)

But because it would be offtopic here I have started another thread:

CellTable - TextColumn.getValue (null) - another strange 
problemhttps://groups.google.com/forum/#!topic/google-web-toolkit/0QrMpt6Ttrg

Magnus

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-25 Thread Jens


 but why was this exception not reported as others client-side exceptions 
 are?


In IE + DevMode you would have seen a NullPointerException on the console. 
If you use Chrome/Firefox + DevMode you never see the problem because both 
browser support the Audio element and thus its never null.

In DevMode, GWT automatically registers a DefaultUncaughtExceptionHandler 
that logs uncaught exceptions to the console. This only happens in DevMode 
and not if you have compiled your app. Thus if you dont have set your own 
UncaughtExceptionHandler in your app's onModuleLoad() you will never see 
uncaught exceptions once your app is compiled.

So always set an UncaughtExceptionHandler on your own and do what you want 
to do with that exception. For example I display an information message 
that something unexpected has happened and then send the exception to the 
server where it gets logged and a new issue is automatically created in an 
issue tracker.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-24 Thread Jens


 The exception occurrs somewhere in a constructor where a panel is created. 
 At the moment it would be of help, if I could see how the source is 
 translated into JS. But IE shows only the code from the host page. No idea 
 how to update it.


Compile your app in PRETTY or DETAILED mode so that your Java 
method/class/package names won't be obfuscated in the final JS and then the 
exception text should already give you a strong hint where things go wrong.

In IE Developer Tools you need to hit the small refresh button.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-24 Thread Magnus
Hi,

setting the compiler mode to pretty did not result in a more 
comprehensive error message:

com.google.gwt.core.client.JavaScriptException: (TypeError)
description: 'null.nullField' ist Null oder kein Objekt

But I finally found the nullpointer exception by tracing. It happened in 
the newly added code for audio:

private Audio snd_Move = Audio.createIfSupported ();
...
snd_Move.setSrc(...); // snd_Move is null!!!

So the original problem is solved now. Many thanks for all the advices!

Last questions:
- Why isn't this exception alerted with a comprehensive message, without 
calling setUncaughtExceptionHandler, like other client-side exceptions?
- The fact, that Audio.createIfSupported () returns null: Does this mean 
that IE 8/9 does not support audio at all?

Magnus

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-24 Thread Andrea Boscolo
Audio element is supported from IE  8 according to 
thishttp://caniuse.com/#search=audio
.
Always use the static method isSupported() for all 
@PartialSupporthttp://www.gwtproject.org/javadoc/latest/com/google/gwt/dom/client/class-use/PartialSupport.htmlclasses
 for runtime check.

On Monday, June 24, 2013 7:21:07 PM UTC+2, Magnus wrote:

 Hi,

 setting the compiler mode to pretty did not result in a more 
 comprehensive error message:

 com.google.gwt.core.client.JavaScriptException: (TypeError)
 description: 'null.nullField' ist Null oder kein Objekt

 But I finally found the nullpointer exception by tracing. It happened in 
 the newly added code for audio:

 private Audio snd_Move = Audio.createIfSupported ();
 ...
 snd_Move.setSrc(...); // snd_Move is null!!!

 So the original problem is solved now. Many thanks for all the advices!

 Last questions:
 - Why isn't this exception alerted with a comprehensive message, without 
 calling setUncaughtExceptionHandler, like other client-side exceptions?
 - The fact, that Audio.createIfSupported () returns null: Does this mean 
 that IE 8/9 does not support audio at all?

 Magnus



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-24 Thread Magnus
Ok,

but why was this exception not reported as others client-side exceptions 
are?

For example, if you add a widget to a DockLayoutPanel after the center 
widget, you get a comprehensive error message.

In this case with the audio, I never have seen any comprehensive message, 
even after setting code style to pretty.
(Remember, I only found the reason by tracing, not by a message).

Magnus

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-23 Thread Magnus
Hi Jens!

1.) use SafeHtmlUtils instead 
 of OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml. 


Ok!
 

 2.) always use !DOCTYPE html in your host html page so that IE is in 
 standards mode to avoid head aches :)


This is already the case. In addition, I jhave already tried different 
X-UA-Compatible meta settings.
 

 The links that do not work, are these always the same links or is it 
 totally random? Does it only happen in production mode or also in DevMode? 
 If it only happens in production mode then my guess is that a native 
 JavaScriptException is thrown in IE (e.g a null access) for any reason. 
 Make sure you have activated IE's status bar and check if there is a JS 
 warning/error icon and make sure you have GWT.setUncaughtExceptionHandler() 
 set at your app startup.



This was an important advice! After setting the UncaughtExceptionHandler, I 
get this message:

com.google.gwt.core.client.JavaScriptException: (TypeError) description: 
Für die Eigenschaft Ze kann kein Wert abgerufen werden: Das Objekt ist 
Null oder undefiniert. number: -2146823281: Für die Eigenschaft Ze kann 
kein Wert abgerufen werden: Das Objekt ist Null oder undefiniert.
 
So it's not a problem wirh the anchor, but with the client code it triggers.

Maybe you should add some logging to your onBrowserEvent() methods so you 
 can see whats going on in IE in production mode: 
 https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging


The exception occurrs somewhere in a constructor where a panel is created. 
At the moment it would be of help, if I could see how the source is 
translated into JS. But IE shows only the code from the host page. No idea 
how to update it.

Magnus 

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Anchor does not work in IE - very strange problem!

2013-06-21 Thread Magnus
Hello,

I have a very strange problem with some anchors, which occurrs only in IE 
and only in certain combinations of version and browser/document modes.
The problem is, that *some* anchors will not work, allthough *all* anchors 
are built by the same method!

There is a list of chess games and at the end of each row there are some 
actions, like Open or Analyze. The actions are realized as anchors. All 
the anchors for a row/game are put into a single panel, which is inserted 
into the list.

When the problem occurrs, the first anchor Open will not work (meaning 
that nothing happens), while the second anchor Analyze works just fine.

I believe that there must be a side effect somewhere, but I could not find 
it. Perhaps there is a problem with 
OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml. I cannot remember why 
I decided to use it...

Any ideas how to find the bug or how to do it in another way?

Thanks
Magnus

-

 private Panel getActions (Game game)
 {
  HorizontalPanel p = new HorizontalPanel ();
  
  addAction (p,CMD_OPEN,game.idx,Open);
  addAction (p,CMD_ANALYZE,game.idx,Analyze);
}

 protected void addAction (Panel pnl,int cmd,int idx,String lbl)
 {
  Anchor a = createAnchor (cmd,idx,lbl,this);

  if (hasWidgets (pnl))
   pnl.add(new HTML (nbsp;));

  pnl.add(a);
 }

 private Anchor createAnchor (int cmd,int idx,String lbl,ClickHandler hdl)
 {
  SafeHtml h = new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(lbl);
  Anchor a = new Anchor (h);
  
  a.addClickHandler(hdl);
  Element e = a.getElement();
  
  e.setAttribute(cmd,Integer.toString(cmd));
  e.setAttribute(idx,Integer.toString(idx));
  
  return (a);
 }

 public void onClick(ClickEvent evt)
 {
  Object o = evt.getSource();
  
  if (o == null)
   return;
  
  if (!(o instanceof Anchor))
   return;

  Anchor a = (Anchor) o;
  String t;
  
  t = a.getElement().getAttribute(cmd);
  int cmd = Integer.parseInt(t);
  t = a.getElement().getAttribute(idx);
  int idx = Integer.parseInt(t);

  onCommand (cmd,idx);
 }

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread GWTter
Hi Magnus,

Just for the sake of thoroughness, are you sure that onCommand is even 
being called? Or is it that the click event is not being registered at all?

On Friday, June 21, 2013 11:33:47 AM UTC+2, Magnus wrote:

 Hello,

 I have a very strange problem with some anchors, which occurrs only in IE 
 and only in certain combinations of version and browser/document modes.
 The problem is, that *some* anchors will not work, allthough *all* anchors 
 are built by the same method!

 There is a list of chess games and at the end of each row there are some 
 actions, like Open or Analyze. The actions are realized as anchors. All 
 the anchors for a row/game are put into a single panel, which is inserted 
 into the list.

 When the problem occurrs, the first anchor Open will not work (meaning 
 that nothing happens), while the second anchor Analyze works just fine.

 I believe that there must be a side effect somewhere, but I could not find 
 it. Perhaps there is a problem with 
 OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml. I cannot remember why 
 I decided to use it...

 Any ideas how to find the bug or how to do it in another way?

 Thanks
 Magnus

 -

  private Panel getActions (Game game)
  {
   HorizontalPanel p = new HorizontalPanel ();
   
   addAction (p,CMD_OPEN,game.idx,Open);
   addAction (p,CMD_ANALYZE,game.idx,Analyze);
 }

  protected void addAction (Panel pnl,int cmd,int idx,String lbl)
  {
   Anchor a = createAnchor (cmd,idx,lbl,this);

   if (hasWidgets (pnl))
pnl.add(new HTML (nbsp;));

   pnl.add(a);
  }

  private Anchor createAnchor (int cmd,int idx,String lbl,ClickHandler hdl)
  {
   SafeHtml h = new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(lbl);
   Anchor a = new Anchor (h);
   
   a.addClickHandler(hdl);
   Element e = a.getElement();
   
   e.setAttribute(cmd,Integer.toString(cmd));
   e.setAttribute(idx,Integer.toString(idx));
   
   return (a);
  }

  public void onClick(ClickEvent evt)
  {
   Object o = evt.getSource();
   
   if (o == null)
return;
   
   if (!(o instanceof Anchor))
return;

   Anchor a = (Anchor) o;
   String t;
   
   t = a.getElement().getAttribute(cmd);
   int cmd = Integer.parseInt(t);
   t = a.getElement().getAttribute(idx);
   int idx = Integer.parseInt(t);

   onCommand (cmd,idx);
  }



-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread Magnus


Am Freitag, 21. Juni 2013 12:48:51 UTC+2 schrieb GWTter:

 Just for the sake of thoroughness, are you sure that onCommand is even 
 being called? Or is it that the click event is not being registered at all?


Yes! Because it works with other browsers.
In addition, the second link (Analyze) also works, when the first one 
doesn't.

Magnus

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread Magnus
Hi,

my problem is that I cannot analyze what happens.

In chrome (where it works), I can examine the code and it looks like the 
code below. The two links are exactly the same, with a space between them 
realized as nbsp;.
But maybe in IE the code looks different. The same for the JS code. IE 
always shows the code from the host page, so I cannot examine anything.

I would be happy If I at least were able to see what is going on.

Magnus

-

table cellspacing=0 cellpadding=0 style=padding-right: 10px;
 tbody
  tr
   td align=left style=vertical-align: top;
 a class=gwt-Anchor href=javascript:; cmd=1 idx=1481Öffnen/a
   /td
td align=left style=vertical-align: top;
 div class=gwt-HTMLnbsp;/div
/td
td align=left style=vertical-align: top;
 a class=gwt-Anchor href=javascript:; cmd=3 
idx=1481Analyse/a
/td
   /tr
  /tbody
 /table


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread GWTter
IE has had developer tools built in as far back as version 8, just press 
F12. If you're working with =IE7 then: IE dev 
toolshttp://www.microsoft.com/en-us/download/details.aspx?id=18359. 
Although it may work in other browsers or on the other anchor you want to 
see exactly what is or isn't occurring so you can narrow the scope of the 
issue, else it's a blind guessing game. I would put an alert or println in 
the onClick method to see first if the click is even registering for the 
first button, this will aid you in your analysis and you can then proceed 
from there. You haven't posted the onCommand method so we have no idea if 
the click is even registering in the first button case.

On Friday, June 21, 2013 2:14:26 PM UTC+2, Magnus wrote:

 Hi,

 my problem is that I cannot analyze what happens.

 In chrome (where it works), I can examine the code and it looks like the 
 code below. The two links are exactly the same, with a space between them 
 realized as nbsp;.
 But maybe in IE the code looks different. The same for the JS code. IE 
 always shows the code from the host page, so I cannot examine anything.

 I would be happy If I at least were able to see what is going on.

 Magnus

 -

 table cellspacing=0 cellpadding=0 style=padding-right: 10px;
  tbody
   tr
td align=left style=vertical-align: top;
  a class=gwt-Anchor href=javascript:; cmd=1 
 idx=1481Öffnen/a
/td
 td align=left style=vertical-align: top;
  div class=gwt-HTMLnbsp;/div
 /td
 td align=left style=vertical-align: top;
  a class=gwt-Anchor href=javascript:; cmd=3 
 idx=1481Analyse/a
 /td
/tr
   /tbody
  /table




-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread Steve C
I've found that with the IE developer tools, you need to refresh the DOM 
view within the tools (there's a refresh icon in the HTML view section). 
The view doesn't seem to take the JS changes to the page into account 
initially.  (And sometimes you never see CSS that GWT injects, but that's 
off-topic.)

BTW, I ran your code and it worked fine in IE-7-10 as provided by the dev 
tools in IE10 (I just had onCommand do an alert with the two values), so 
maybe the issue is further down the line. 


On Friday, June 21, 2013 8:40:12 AM UTC-4, GWTter wrote:

 IE has had developer tools built in as far back as version 8, just press 
 F12. If you're working with =IE7 then: IE dev 
 toolshttp://www.microsoft.com/en-us/download/details.aspx?id=18359. 
 Although it may work in other browsers or on the other anchor you want to 
 see exactly what is or isn't occurring so you can narrow the scope of the 
 issue, else it's a blind guessing game. I would put an alert or println in 
 the onClick method to see first if the click is even registering for the 
 first button, this will aid you in your analysis and you can then proceed 
 from there. You haven't posted the onCommand method so we have no idea if 
 the click is even registering in the first button case.




-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread Magnus
Hello,

I found another hint, that may be useful: Within the same application I do 
the same thin in a toally other way: This time, the list is a CellTable and 
the commands are rendered as a custom cell (see below). The anchors are 
created in a totally different way. But the same problem exists here, too! 
Isn't that strange?

I hope that these observations brings us closer to the solution.

(BTW: I wanted to try the HyperLink class, but when rendering into a cell 
one has put everything into a SafeHtmlBuilder. Can I use a HyperLink widget 
here?)

Magnus

public class ListCommandCell extends AbstractCellListCommandContext
{
 public ListCommandCell ()
 {
  super (click);
 }

 @Override
 public void render (Context context,ListCommandContext 
value,SafeHtmlBuilder sb)
 {
  boolean first = true;
  
  for (ListCommand c : value.cmd)
  {
   if (first)
first = false;
   else
sb.appendHtmlConstant(nbsp;);

   
   String e = ListCommand.enc(c);
   String l = c.getLbl();
   String t = renderCommand (e,l);
   
   sb.appendHtmlConstant(t);
  }
 }
 
 public String renderCommand (String cmd,String lbl)
 {
  String t = a href='javascript:;' style='cursor: hand;' cmd=' + cmd + 
' + lbl + /a;
  
  return (t);
 }

 @Override
 public void onBrowserEvent (Context context, Element parent,/*Game*/ 
ListCommandContext value,NativeEvent event, 
ValueUpdater/*Game*/ListCommandContext valueUpdater)
 {
  super.onBrowserEvent(context, parent, value, event, valueUpdater);
  
  EventTarget tgt = event.getEventTarget();
  Element e = Element.as(tgt);
  
  String a = e.getAttribute(cmd);
  
  ListCommand c = ListCommand.dec(a);
  
  value.prc.onListCommand(c,value.idx);
 }
}

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Anchor does not work in IE - very strange problem!

2013-06-21 Thread Jens
General advice:
1.) use SafeHtmlUtils instead 
of OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml. 
2.) always use !DOCTYPE html in your host html page so that IE is in 
standards mode to avoid head aches :) Also, if possible in your setup, let 
the webserver/appserver detect if IE is running in compatibility mode. If 
it is in compatibility mode, serve a nice help site that describes how 
compatibility mode can be turned off (= clicking this small broken paper 
icon in the address bar).


Regarding your problem:

The links that do not work, are these always the same links or is it 
totally random? Does it only happen in production mode or also in DevMode? 
If it only happens in production mode then my guess is that a native 
JavaScriptException is thrown in IE (e.g a null access) for any reason. 
Make sure you have activated IE's status bar and check if there is a JS 
warning/error icon and make sure you have GWT.setUncaughtExceptionHandler() 
set at your app startup.

If there are no exceptions then maybe there is a hidden div above your link 
in certain situations, so that the click event can never reach the link. 
But in this case I would assume that you would have the problem in all 
browsers, not just IE.

Maybe you should add some logging to your onBrowserEvent() methods so you 
can see whats going on in IE in production 
mode: https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.