Search in sources :

Example 16 with EventListenerList

use of org.eclipse.scout.rt.platform.util.EventListenerList in project scout.rt by eclipse.

the class AbstractClientSession method setDesktop.

@Override
public void setDesktop(IDesktop desktop) {
    if (desktop == null) {
        throw new IllegalArgumentException("argument must not be null");
    }
    if (m_desktop != null) {
        throw new IllegalStateException("desktop is active");
    }
    m_desktop = desktop;
    if (m_virtualDesktop != null) {
        for (DesktopListener listener : m_virtualDesktop.getDesktopListeners()) {
            m_desktop.addDesktopListener(listener);
        }
        for (Map.Entry<String, EventListenerList> e : m_virtualDesktop.getPropertyChangeListenerMap().entrySet()) {
            String propName = e.getKey();
            EventListenerList list = e.getValue();
            if (propName == null) {
                for (PropertyChangeListener listener : list.getListeners(PropertyChangeListener.class)) {
                    m_desktop.addPropertyChangeListener(listener);
                }
            } else {
                for (PropertyChangeListener listener : list.getListeners(PropertyChangeListener.class)) {
                    m_desktop.addPropertyChangeListener(propName, listener);
                }
            }
        }
        for (Map.Entry<Object, EventListenerList> e : m_virtualDesktop.getDataChangeListenerMap().entrySet()) {
            Object dataType = e.getKey();
            EventListenerList list = e.getValue();
            if (dataType == null) {
                for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
                    m_desktop.addDataChangeListener(listener);
                }
            } else {
                for (DataChangeListener listener : list.getListeners(DataChangeListener.class)) {
                    m_desktop.addDataChangeListener(listener, dataType);
                }
            }
        }
        m_virtualDesktop = null;
    }
    m_desktop.initDesktop();
}
Also used : PropertyChangeListener(java.beans.PropertyChangeListener) DesktopListener(org.eclipse.scout.rt.client.ui.desktop.DesktopListener) EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList) DataChangeListener(org.eclipse.scout.rt.client.ui.DataChangeListener) IExtensibleObject(org.eclipse.scout.rt.shared.extension.IExtensibleObject) Map(java.util.Map) PropertyMap(org.eclipse.scout.rt.platform.context.PropertyMap) SharedVariableMap(org.eclipse.scout.rt.shared.services.common.context.SharedVariableMap)

Aggregations

EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)16 DataChangeListener (org.eclipse.scout.rt.client.ui.DataChangeListener)4 EventListener (java.util.EventListener)3 Test (org.junit.Test)3 PropertyChangeListener (java.beans.PropertyChangeListener)2 ArrayList (java.util.ArrayList)2 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)2 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)2 INotificationListener (org.eclipse.scout.rt.shared.notification.INotificationListener)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 IOException (java.io.IOException)1 List (java.util.List)1 Map (java.util.Map)1 IClientSession (org.eclipse.scout.rt.client.IClientSession)1 IPlannerContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.IPlannerContextMenu)1 IValueFieldContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.IValueFieldContextMenu)1 PlannerContextMenu (org.eclipse.scout.rt.client.ui.action.menu.root.internal.PlannerContextMenu)1 DesktopListener (org.eclipse.scout.rt.client.ui.desktop.DesktopListener)1 PropertyMap (org.eclipse.scout.rt.platform.context.PropertyMap)1 ExceptionHandler (org.eclipse.scout.rt.platform.exception.ExceptionHandler)1