True its WidgetCollection that has a 'contains' method but a RootPanel.get returns a RootPanel object which is a sub-class of ComplexPanel.

ComplexPanel has a getWidgetIndex methods which return -1 for getWidgetIndex(Widget) and null for getWidgetIndex(HasWidget) when the requested object isn't in the widget list. You can derive your own 'contains' logic from the above.


Its purely a matter of style, but I'd personally prefer to avoid having extra state flags to manipulate and would rather use state that's already in the data of the object in question.


Alan


On 8/1/2011 11:51 AM, Deepak Singh wrote:
There is no contains(widget) available like RootPanel.get("id).contains(widget).



On Mon, Aug 1, 2011 at 10:48 PM, Alan Chaney <[email protected] <mailto:[email protected]>> wrote:

    How about:
        if (!RootPanel.get("id).contains(widget)) {
            RootPanel.get("id").add(widget);

    Because of the nature of javascript and web browsers the above
    call is inherently "thread safe".

    HTH

    Alan



    On 8/1/2011 9:23 AM, Deepak Singh wrote:
    I am making 2 seperate RPC calls.
     Whichever is finished first, i would add
    RootPanel.get("id").add(widget) into onSuccess.

    I can not add same widgets two times in both onSuccess(). So i am
    out of mind how to resolve this.

    Any logic pls.

    On Mon, Aug 1, 2011 at 9:08 PM, Jens <[email protected]
    <mailto:[email protected]>> wrote:

        Its not possible to stop execution as RPC requests are async.
        The only thing you can do is to put your code that has to
        wait into the onSuccess method of your RPC call.

        -- J.
-- 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/-/hgRZHjACARUJ.


        To post to this group, send email to
        [email protected]
        <mailto:[email protected]>.
        To unsubscribe from this group, send email to
        [email protected]
        <mailto:google-web-toolkit%[email protected]>.
        For more options, visit this group at
        http://groups.google.com/group/google-web-toolkit?hl=en.


-- 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]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/google-web-toolkit?hl=en.

-- 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]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:google-web-toolkit%[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/google-web-toolkit?hl=en.


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

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