Hi Etienne,

A bug was found while implementing the extension:
https://www.canoo.com/jira/browse/UBA-7097

WindowClosed event is generated when DefaultCloseOperation is
DISPOSE_ON_CLOSE.

In 6.1.1, due to the above bug, the JFrame did not generate WindowClosed
event.

Another issue is that from 6.1.1, ULCFrame has the dispose() method. Calling
this method should generate the WindowClosed event on the server side. Care
must be taken to suppress the event being sent from the client side or the
listener will be called twice.

I have provided two solutions see the attached files:

1. WindowClosedEventSnippet1: This implements all the steps specified in the
Extension Guide (I agree that we need to be more lucid with the explanation
there).

2. WindowClosedEventSnippet2: This makes use of the existing WindoEvent and
just extends the WindowListener.

I hope this helps.

Thanks and regards,

Janak

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Etienne Studer
Sent: Saturday, November 04, 2006 2:56 AM
To: [email protected]
Subject: [ULC-developer] extending existing event listener interface


Hi

How can I migrate the classes below to ULC 6.1.1? These classes allow me to
get notified about windowClosed() events. Even though I read the extension
guide, I'm still confused in how to achieve this for my scenario of
extending existing ULC core classes.

Thanks for your help, Etienne


public class CarinaWindowEvent extends WindowEvent {
    public CarinaWindowEvent(Object inSource, int inEventId) {
        super(inSource);
        _eventId = inEventId;
    }

    public void dispatch(IEventListener inListener) {
        if (_eventId == SharedCarinaDialog.WINDOW_CLOSED) {
            if (inListener instanceof ICarinaWindowListener) {
                ((ICarinaWindowListener) inListener).windowClosed(this);
            }
        } else {
            super.dispatch(inListener);
        }
    }

    private final int _eventId;
}

public interface ICarinaWindowListener extends IWindowListener {
    void windowClosed(WindowEvent inEvent);
}

public class UICarinaFrame extends UIFrame {
    public void windowClosed(WindowEvent inEvent) {
        super.windowClosed(inEvent);
        sendOptionalEventULC(IUlcEventConstants.WINDOW_EVENT,
SharedCarinaFrame.WINDOW_CLOSED);
    }
}

public abstract class SharedCarinaDialog {
    private SharedCarinaDialog() {
    }

    public static final int WINDOW_CLOSED = 2;
}

public class ULCCarinaFrame extends ULCFrame {
    public ULCCarinaFrame() {
    }

    public ULCCarinaFrame(String inTitle) {
        super(inTitle);
    }

    protected void handleEvent(int inListenerType, int inEventId, Anything
inArgs) {
        if (inListenerType == IUlcEventConstants.WINDOW_EVENT) {
            distributeToListeners(new CarinaWindowEvent(this, inEventId));
        } else {
            super.handleEvent(inListenerType, inEventId, inArgs);
        }
    }

    protected String typeString() {
        return "com.navis.framework.ulc.client.extension.UICarinaFrame";
    }
}

Attachment: WindowClosedEventSnippet2.java
Description: Binary data

Attachment: WindowClosedEventSnippet1.java
Description: Binary data

Reply via email to