Tuesday, March 12, 2019

Unexpected behavior

Friends:

I'm developing a Chemical drawing tool and have been progressing steadily with a lot of difficulties. My technology stack is Java 8, GWT 2.8.2, GMD 2.x, Eclipse Photon, running on a MacBook Pro, and Chrome | Firefox | Opera for testing. A limited functioning pilot is running at http://peruselab.com.

I just ran into a trouble that I couldn't figure out on my own. Below are the relevant snippets of code that's causing trouble. The call (1) ActionHandlerMap.getHandler(action) is expected to return an instance of PeruseEventHandler. I expect the sequence of execution to be 1, 2, & 3. However, upon returning from 2 (verified with the debugger) I see the control going to 4 (screen clip 1) followed by throwing an exception (screen clip 2). Any idea what could be wrong? Your help will be greatly appreciated.

...

  PeruseEventHandler eventHandler = ActionHandlerMap.getHandler(action); // 1

  Globals.currentShape = eventHandler.handle(null, null); // 3
...

public class ActionHandlerMap {

  public static final Map<Action, PeruseEventHandler> ACTION_HANDLER_MAP = new HashMap<>();


  static {

    ACTION_HANDLER_MAP.put(Action.DRAW_SINGLE_BOND, new SingleBondDrawingHandler());

  }


  public static PeruseEventHandler getHandler(Action anAction) {

    return ACTION_HANDLER_MAP.get(anAction); // 2

  }

}


public
class Globals {

  public static Action action;

  public static Shape currentShape; // 4

}

Enter code here...


Screen Shot 2019-03-12 at 5.36.35 PM.png

Screen clip 1



Screen Shot 2019-03-12 at 5.40.52 PM.png



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

No comments:

Post a Comment