Hello.
I have something like this

public class RoomChatTab extends Composite
public RoomChatTab(String id, Room room) {
       ..........
        contactList = new ContactList(room);
       ..........
    }


and

public class ContactListTab extends Composite
{
public ContactListTab(String id) {
        super(id);
        contactList = new ContactList(Model.instance.contacts);
    }
}

This composites have common composite include link with add
addMouseEventListener to this link

package com.successfulmatch.chat.client.view;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Composite;
import com.successfulmatch.chat.client.User;
import com.successfulmatch.chat.client.event.RedirectRequestEvent;
import rocket.event.client.MouseClickEvent;
import rocket.event.client.MouseEventListener;
import rocket.widget.client.Label;

/**
 * Hyperlink element which redirects to new window on click event.
 * Does it by sending RedirectRequestEvent with parameters on server,
where all required data will be obtained
 * and if all was succesfull, server will send back OpenNewWindow
event.
 */
public class OpenNewWindowLink extends Composite {
    private User owner;
    // html element id
    private String elementId;
    // url where to redirect
    private String redirectKey;
    // parameters of the URL
    private String[] params;

    public OpenNewWindowLink(User owner, String id, String
redirectKey, String[] params) {
        this.owner = owner;
        this.elementId = id;
        this.redirectKey = redirectKey;
        this.params = params;
        onLoad();
    }

    protected void onLoad() {
        super.onLoad();

        if (DOM.getElementById(elementId) != null) {
            Label link = new Label(DOM.getElementById(elementId));//
maybe in this line hide problem
            link.addMouseEventListener(redirectListener);
        }
    }

 ......

    /**
     * Simple redirect to redirectUrl on click event
     */
    private final MouseEventListener redirectListener = new
MouseClickEventListener() {
        public void onClick(MouseClickEvent event) {
            owner.sendEvent(new RedirectRequestEvent(redirectKey,
params));
        }
    };
}

Question: Why processing MouseEventListener on the link work only in
one composite(ContactListTab). Thanks

--

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