HI Ian

I tried Your example it is working very fast. but when i implement
same in my application it is taking 2 sec delay...
When i checked it in debug mode, In some file DeferredCommand checking
while condition. It is executed until execute method is finished
I guess that is taking time...

thank you


On Jul 8, 5:28 pm, Ian Bambury <[email protected]> wrote:
> I can only imagine that something is executing and causing the delay. In
> hosted mode, the code below is slow enough to let me see the first popup
>  ('Close 1') momentarily, but compiled (and run in Chrome) it's too fast to
> see, 'Close 2'. is all I see until I click the button to close it. When you
> click the 'Show Popup' button, it shows Close-1 and then in a deferred
> command, Close-2.
> If you put this in a blank project, do you still get a 1-2 sec delay?
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.event.dom.client.ClickEvent;
> import com.google.gwt.event.dom.client.ClickHandler;
> import com.google.gwt.user.client.Command;
> import com.google.gwt.user.client.DeferredCommand;
> import com.google.gwt.user.client.ui.Button;
> import com.google.gwt.user.client.ui.PopupPanel;
> import com.google.gwt.user.client.ui.RootPanel;
>
> public class Main implements EntryPoint
> {
>
>     public void onModuleLoad()
>     {
>         final PopupPanel p1 = new PopupPanel(false, false);
>         p1.add(new Button("Close 1", new ClickHandler()
>         {
>             @Override
>             public void onClick(ClickEvent event)
>             {
>                 p1.hide();
>             }
>         }));
>         RootPanel.get().add(new Button("Show Popup", new ClickHandler()
>         {
>
>             @Override
>             public void onClick(ClickEvent event)
>             {
>                 p1.center();
>                 DeferredCommand.addCommand(new Command()
>                 {
>                     @Override
>                     public void execute()
>                     {
>                         final PopupPanel p2 = new PopupPanel(false, false);
>                         p2.add(new Button("Close 2", new ClickHandler()
>                         {
>                             @Override
>                             public void onClick(ClickEvent event)
>                             {
>                                 p2.hide();
>                             }
>                         }));
>                         p2.center();
>                     }
>                 });
>             }
>         }));
>     }
>
> }
>
> Ian
>
> http://examples.roughian.com
>
> 2009/7/9 rohan <[email protected]>
>
>
>
> > Hi Ian,
>
> > I have Implemented the same thing, while testing the application I
> > found it was delaying about 1 or 2 sec.
> > To show the popup show & hide takes about 1 or 2 secs. I have to show
> > the same Popup in several places. It may cause performance issue.
> > Is there any better way to do this????
>
> > Thanks
> > Rohan
>
> > On Jul 8, 2:33 pm, Ian Bambury <[email protected]> wrote:
> > > I think the Deferred command is actually a timer set to 1ms, so 1ms is
> > > added.
> > > Also it will run after everything else that has been queued so far. This
> > > means that other deferred commands issued so far will run first, and also
> > > that any RPC/Requestbuilder requests that have been issued *might* have
> > > returned in the meantime.
>
> > > Other than that, actual performance isn't compromised, and the
> > *perceived*
> > > response time (by the user) is vastly improved :-)
>
> > > Ian
>
> > >http://examples.roughian.com
>
> > > 2009/7/8 rohan <[email protected]>
>
> > > > Thanks Ian Bambury
>
> > > > It is working fine,...is it effects the performance ?????
>
> > > > --Subbu
>
> > > > On Jul 8, 11:50 am, rohan <[email protected]> wrote:
> > > > > In my situation the code is in If block
> > > > > if( true) {
> > > > > popup.show();
> > > > > store.load() // it takes 5-6 sec.
> > > > > // It is sequence of steps like server calls, developing front end,
> > > > > other processing.
> > > > > popup.hide();}
>
> > > > > If i execute it like this popup is not shown because popup.show &
> > hide
> > > > > both are executing at a time.
> > > > > I removed popup.hide() to know whether popup is shown or not? It is
> > > > > showing popup after completion of all the process it shows popup.
> > > > > ( after execution of IF block)
> > > > > How handle this situation???/
> > > > > Thanks
> > > > > Rohan
>
> > > > > On Jul 8, 10:42 am, Mikhail M <[email protected]> wrote:
>
> > > > > > I suppose you should use listeners. And call method popup.hide();
> > in
> > > > right
> > > > > > place
> > > > > > For  example
> > > > > > popup.show();
> > > > > > store.load() // it takes 5-6 sec.
> > > > > > popup.hide();
> > > > > > INCORRECT
>
> > > > > > but
> > > > > > popup.show();
> > > > > > store.addListener(new StoreListenerAdapter() {
> > > > > >     @Override
> > > > > >     onLoad() {
> > > > > >         popup.hide();
> > > > > >     }});
>
> > > > > > works properly
>
> > > > > > Check your source code once more and use listeners
>
> > > > > > 2009/7/8 rohan <[email protected]>
>
> > > > > > > I am showing transparent screen using a popup.
>
> > > > > > > On an onclick event of a button Iam showing a popup in an ‘if’
> > block,
> > > > > > > but the popup is only shown when if returns from the if block,
> > why it
> > > > > > > behaves like this? Is there any other way to show a popup in an
> > ‘if’
> > > > > > > block?
>
> > > > > > > Below is the code
>
> > > > > > > if(Condition){
> > > > > > > popup.show();
> > > > > > > do some work;//// it takes 5-6 sec. This time my screen is
> > blocked
> > > > > > > with popup
> > > > > > > popup.hide();
>
> > > > > > > }
>
> > > > > > > But it is not working, If i remove popup.hide(), popup is shown
> > after
> > > > > > > the IF block executed. So at that time it is useless
>
> > > > > > > Can any one help me in this.
>
> > > > > > > Thanks
> > > > > > > Rohan
>
> > > > > > --
> > > > > > Best wishes
> > > > > > Mikhail Mamaev
--~--~---------~--~----~------------~-------~--~----~
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