gwt-linux-1.5.3.

here is a Sample code, i didn't compile it: it's just to give the idea

public class Commands {
        //com.google.gwt.user.client.Command
        private  Map<String, Command> commands;
        private static Commands instance;

        private Commands() {
                commands = new HashMap<String, Command>();
        }

        public static synchronized Commands getInstance() {
                if (instance == null)
                        instance = new Commands();
                return instance;
        }

        public void addCommand(String key, Command command) {
                commands.put(key, command);
        }

        public Command getCommand(String key) {
                return commands.get(key);
        }

}

In this case, calling: Commands.getInstance().addCommand
("showSomeView", someCommandInstance); was causing the problem: it
works fine in the hosted mode, with no exceptions, and shows nothing
on FF 3.0.4 (still in the hosted mode - Compile/Browse btn).

splitting the line into a number of lines
Commands commands = Commands.getInstance();
commands.addCommand(....); solved the problem.

please note that after the initializations, calling the method in one
is ok, for example after adding the commands, i was able to call:
Commands.getInstance().getCommand("someKey").execute();

thanks

On Jan 28, 9:43 am, Daniel Kurka <[email protected]> wrote:
> Could you post a code short code example demonstrating that issue?
> by the way: which gwt version are you using?
>
> 2009/1/27 Yousef.Ghandour <[email protected]>
>
>
>
> > I've created a single class, with singleton patter, and called the
> > method getInstance() to obtaine a reference to that object. Everything
> > went fine on the hosted browser, however, things get weired once
> > deployed and used with FF. An error with null reference was thrown and
> > nothing else, not even a single panels :-(. I was using a one line
> > command to get an instance to the singleton class and issue a call to
> > one method within the class, something like this
> > SinglitonClass.getInstance().addSomeOtherClassObject(Param1,
> > Param2, ...);
>
> > The strange thing is that when I splitted the line over a number of
> > single comands, everything went fine?!!!!
> > SinglitonClass singletonClass =  SinglitonClass.getInstance();
> > singletonClass.addSomeOtherClassObject(ParamList);
>
> > in the second approach everything went fine, and FF was able to render
> > everything just as in the hosted mode.
>
> > I guess there is something with translating the command into
> > javascript, which leave one object with null value and being used
> > before initialization.
>
> > Do any one have a clue of what exactly the problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to