On executing the command on the MenuItem, Hide the popup.
Something like this....
 
popupPanel.hide();
 
Thanks,
Kalyan.
 
 

On Thursday, June 23, 2011 5:00:09 PM UTC+2, André Salvati wrote:

> Now, with a dynamic context (defined by View). 
>
> The only problem that remains is that when I click the context menu, 
> the place changes but popup still keeps opened. 
>
> Does someone knows how to solve it? 
>
>
> public class TextCellNX extends AbstractSafeHtmlCell<String>{ 
>
>         MenuItem[] contextMenu; 
>
>         public TextCellNX(MenuItem[] contextMenu) { 
>                 super(SimpleSafeHtmlRenderer.getInstance(), 
> "contextmenu"); 
>                 this.contextMenu = contextMenu; 
>         } 
>
>         public TextCellNX(SafeHtmlRenderer<String> renderer) { 
>                 super(renderer); 
>         } 
>
>         @Override 
>         public void render(Context context, SafeHtml value, 
> SafeHtmlBuilder 
> sb) { 
>                 if (value != null) { 
>                         sb.append(value); 
>                 } 
>         } 
>
>         @Override 
>         public void onBrowserEvent(Context context, Element parent, String 
> value, NativeEvent event, ValueUpdater<String> valueUpdater) { 
>
>                 if ("contextmenu".equals(event.getType())) { 
>
>                         event.preventDefault(); 
>                         event.stopPropagation(); 
>
>                         MenuItem acao = contextMenu[0]; 
>
>                         MenuBar popupMenuBar = new MenuBar(true); 
>                         popupMenuBar.addItem(acao); 
>                         popupMenuBar.setVisible(true); 
>
>                         PopupPanel popupPanel = new PopupPanel(true); 
>                         popupPanel.add(popupMenuBar); 
>                         popupPanel.setPopupPosition(event.getClientX(), 
> event.getClientY()); 
>                         popupPanel.show(); 
>
>                 } 
>
>         } 
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Aib3AM66FdoJ.
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