Search in sources :

Example 11 with EventListenerList

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

the class VirtualDesktop method addPropertyChangeListener.

@Override
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
    EventListenerList list = m_propertyChangeListenerMap.get(propertyName);
    if (list == null) {
        list = new EventListenerList();
        m_propertyChangeListenerMap.put(propertyName, list);
    }
    list.add(PropertyChangeListener.class, listener);
}
Also used : EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList)

Example 12 with EventListenerList

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

the class VirtualDesktop method addDataChangeListener.

@Override
public void addDataChangeListener(DataChangeListener listener, Object... dataTypes) {
    if (dataTypes == null || dataTypes.length == 0) {
        EventListenerList list = m_dataChangeListenerMap.get(null);
        if (list == null) {
            list = new EventListenerList();
            m_dataChangeListenerMap.put(null, list);
        }
        list.add(DataChangeListener.class, listener);
    } else {
        for (Object dataType : dataTypes) {
            if (dataType != null) {
                EventListenerList list = m_dataChangeListenerMap.get(dataType);
                if (list == null) {
                    list = new EventListenerList();
                    m_dataChangeListenerMap.put(dataType, list);
                }
                list.add(DataChangeListener.class, listener);
            }
        }
    }
}
Also used : EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList)

Example 13 with EventListenerList

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

the class VirtualDesktop method removeDataChangeListener.

@Override
public void removeDataChangeListener(DataChangeListener listener, Object... dataTypes) {
    if (dataTypes == null || dataTypes.length == 0) {
        for (Iterator<EventListenerList> it = m_dataChangeListenerMap.values().iterator(); it.hasNext(); ) {
            EventListenerList list = it.next();
            list.removeAll(DataChangeListener.class, listener);
            if (list.getListenerCount(DataChangeListener.class) == 0) {
                it.remove();
            }
        }
    } else {
        for (Object dataType : dataTypes) {
            if (dataType != null) {
                EventListenerList list = m_dataChangeListenerMap.get(dataType);
                if (list != null) {
                    list.remove(DataChangeListener.class, listener);
                    if (list.getListenerCount(DataChangeListener.class) == 0) {
                        m_dataChangeListenerMap.remove(dataType);
                    }
                }
            }
        }
    }
}
Also used : EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList) DataChangeListener(org.eclipse.scout.rt.client.ui.DataChangeListener)

Example 14 with EventListenerList

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

the class VirtualDesktop method addPropertyChangeListener.

@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
    EventListenerList list = m_propertyChangeListenerMap.get(null);
    if (list == null) {
        list = new EventListenerList();
        m_propertyChangeListenerMap.put(null, list);
    }
    list.add(PropertyChangeListener.class, listener);
}
Also used : EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList)

Example 15 with EventListenerList

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

the class AbstractValueField method initConfig.

@Override
protected void initConfig() {
    super.initConfig();
    m_listeningSlaves = new EventListenerList();
    setAutoAddDefaultMenus(getConfiguredAutoAddDefaultMenus());
    // menus
    List<Class<? extends IMenu>> declaredMenus = getDeclaredMenus();
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    for (Class<? extends IMenu> menuClazz : declaredMenus) {
        menus.addOrdered(ConfigurationUtility.newInnerInstance(this, menuClazz));
    }
    menus.addAllOrdered(contributedMenus);
    try {
        injectMenusInternal(menus);
    } catch (Exception e) {
        LOG.error("error occured while dynamically contributing menus.", e);
    }
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    // set container on menus
    IValueFieldContextMenu contextMenu = createContextMenu(menus);
    contextMenu.setContainerInternal(this);
    setContextMenu(contextMenu);
    setStatusMenuMappings(createStatusMenuMappings());
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) IValueFieldContextMenu(org.eclipse.scout.rt.client.ui.action.menu.root.IValueFieldContextMenu) EventListenerList(org.eclipse.scout.rt.platform.util.EventListenerList) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) IOException(java.io.IOException) VetoException(org.eclipse.scout.rt.platform.exception.VetoException)

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