I'd suggest the following:
* log the time
since you suspect form.clear() to take very long, just throw in some
log statements before and after the call and find out how long this
really takes in ms:
e.g. use this to get the current time:
DateTimeFormat.getFormat("HH:mm:ss:SSS").format(new Date());

same afterwards: and then let me know how long this takes

* try without the incremental or deferred command:
since the only thing you do in the code above is calling form.clear()
- you should be able to do this directly without wrapping it in any
command.

* for long running actions - implement an IncrementalCommand:
if form.clear() really takes that long you nbeed to clear the form
yourself
the you should do the same as the FormPanel.clear() method:
  public void clear() {
    for (Field<?> f : getFields()) {
      f.setValue(null);
    }
  }
but split this up in an incremental command


On Sep 30, 7:29 pm, Vikas <mevik...@gmail.com> wrote:
> Thanks alot Martin for the prompt reply.
>
> Infact, i found it wrong too, therefore updated the code which is as
> follows:
>
>                                     if(formPanel != null &&
> formPanel.getFields().length > 1) {   // Checking length to prevent
> the control for irrelevant  clear calls.
>
>                                                 
> DeferredCommand.addCommand(new IncrementalCommand() {
>
>                                                       public boolean 
> execute() {
>
>                                                           formPanel.clear();
>
>                                                           return 
> (formPanel.getFields().length > 0);
>                                                       }
>
>                                                  });
>                                         }
>
>  It temporarily resolved the issue but later script error again popped-
> up. ()
>
> Also, then i tried to remove the component(s) directly by traversing
> each from the form panel but again hard luck.
>
>              Component[] compsArray = formPanel.getComponents();
>
>                 if(compsArray != null) {
>
>                         for(int i = 0; i < compsArray.length; i++) {
>
>                                 Component comp = compsArray[i];
>
>                                 formPanel.remove(comp, true);
>                          }
>                  }
>
> But ,as you mentioned, there is no error while redrawing the same
> count of components with their respective values
> from database. Because, Clean-up & Re-Draw are independent events.
>
> Is this approach wrong?
>
> On Sep 30, 8:21 pm, mars1412 <martin.trum...@24act.at> wrote:
>
> > why do you call clear so often?
> > calling it once should be enough, shouldn't it?
>
> > and if the clear() call takes too long, you have to split it up:
> > so don't call clear, but instead copy and adjust the code in the clear
> > function, os that e.g. only 20 of the fields of the form are cleared
> > at once.
>
> > but I really doubt that clearing 300 fields takes more than 10 secs on
> > any computer
> > so maybe there's another problem in your code:
> > maybe you add fields again, before clearing the existing once has
> > finished?
>
> > On Sep 30, 6:49 am, Vikas <mevik...@gmail.com> wrote:
>
> > > Hi all,
>
> > > I'm a newbie to GWT.
>
> > > Whenever, i try to re-load a Form Panel on Combo Box 'onSelect' event
> > > then i am getting IE script error that says:
>
> > > "A script on this page is causing Internet Explorer to run slowly. If
> > > it continues to run, your computer may become unresponsive. Do you
> > > want to abort the script?"
>
> > > My form panel contains more than 300 fields (Checkbox & TextField).
>
> > > So, in order to reload, first, i clear up the Form Panel and then
> > > redraw the components on the same and my code as follows:
>
> > >                                        if(formPanel != null) {
>
> > >                                                 
> > > DeferredCommand.addCommand(new IncrementalCommand() {
>
> > >                                                       private int
> > > index = 0;
>
> > >                                                       protected static 
> > > final int COUNT = 20;
>
> > >                                                       public boolean 
> > > execute() {
>
> > >                                                           
> > > formPanel.clear();
>
> > >                                                           return (++index 
> > > < COUNT);
> > >                                                       }
>
> > >                                                  });
> > >                                         }
>
> > >   Although, script error got resolved i made changes in Windows
> > > registry as suggested in the following link:
>
> > >    http://gwt-ext.com/forum/viewtopic.php?f=7&t=4180
>
> > >   But, i cannot ask to every user to do the same in their OS.
>
> > >   So, i request you to please guide me the right approach to resolve
> > > the issue.
>
> > >   Thanks alot in advance.
>
> > > -Vikas
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to