public void testAddGetRemoveMenuDragMouseListener() { MenuDragMouseListener listener1 = new ConcreteMenuDragMouseListener(); MenuDragMouseListener listener2 = new ConcreteMenuDragMouseListener(); MenuDragMouseListener listener3 = new ConcreteMenuDragMouseListener(); EventListener[] listenersArray = null; listenersArray = menuItem.getMenuDragMouseListeners(); int initialValue = listenersArray.length; menuItem.addMenuDragMouseListener(listener1); menuItem.addMenuDragMouseListener(listener2); menuItem.addMenuDragMouseListener(listener2); listenersArray = menuItem.getMenuDragMouseListeners(); assertEquals(initialValue + 3, listenersArray.length); menuItem.removeMenuDragMouseListener(listener1); menuItem.addMenuDragMouseListener(listener3); menuItem.addMenuDragMouseListener(listener3); listenersArray = menuItem.getMenuDragMouseListeners(); assertEquals(initialValue + 4, listenersArray.length); menuItem.removeMenuDragMouseListener(listener3); menuItem.removeMenuDragMouseListener(listener3); listenersArray = menuItem.getMenuDragMouseListeners(); assertEquals(initialValue + 2, listenersArray.length); menuItem.removeMenuDragMouseListener(listener2); menuItem.removeMenuDragMouseListener(listener2); listenersArray = menuItem.getMenuDragMouseListeners(); assertEquals(initialValue, listenersArray.length); }
/** * Maps * {@code JMenuItem.addMenuDragMouseListener(MenuDragMouseListener)} * through queue */ public void addMenuDragMouseListener(final MenuDragMouseListener menuDragMouseListener) { runMapping(new MapVoidAction("addMenuDragMouseListener") { @Override public void map() { ((JMenuItem) getSource()).addMenuDragMouseListener(menuDragMouseListener); } }); }
/** * Maps * {@code JMenuItem.removeMenuDragMouseListener(MenuDragMouseListener)} * through queue */ public void removeMenuDragMouseListener(final MenuDragMouseListener menuDragMouseListener) { runMapping(new MapVoidAction("removeMenuDragMouseListener") { @Override public void map() { ((JMenuItem) getSource()).removeMenuDragMouseListener(menuDragMouseListener); } }); }
/** * Fires MenuDragMouseEvent to all of the menuItem's MouseInputListeners. * * @param event The event signifying that mouse entered menuItem while it was dragged */ protected void fireMenuDragMouseEntered(MenuDragMouseEvent event) { EventListener[] ll = listenerList.getListeners(MenuDragMouseListener.class); for (int i = 0; i < ll.length; i++) ((MenuDragMouseListener) ll[i]).menuDragMouseEntered(event); }
/** * Fires MenuDragMouseEvent to all of the menuItem's MouseInputListeners. * * @param event The event signifying that mouse has exited menu item, while it was dragged */ protected void fireMenuDragMouseExited(MenuDragMouseEvent event) { EventListener[] ll = listenerList.getListeners(MenuDragMouseListener.class); for (int i = 0; i < ll.length; i++) ((MenuDragMouseListener) ll[i]).menuDragMouseExited(event); }
/** * Fires MenuDragMouseEvent to all of the menuItem's MouseInputListeners. * * @param event The event signifying that mouse is being dragged over the menuItem */ protected void fireMenuDragMouseDragged(MenuDragMouseEvent event) { EventListener[] ll = listenerList.getListeners(MenuDragMouseListener.class); for (int i = 0; i < ll.length; i++) ((MenuDragMouseListener) ll[i]).menuDragMouseDragged(event); }
/** * This method fires a MenuDragMouseEvent to all the MenuItem's MouseInputListeners. * * @param event The event signifying that mouse was released while it was dragged over the menuItem */ protected void fireMenuDragMouseReleased(MenuDragMouseEvent event) { EventListener[] ll = listenerList.getListeners(MenuDragMouseListener.class); for (int i = 0; i < ll.length; i++) ((MenuDragMouseListener) ll[i]).menuDragMouseReleased(event); }
public void addMenuDragMouseListener(MenuDragMouseListener l) { }
public void removeMenuDragMouseListener(MenuDragMouseListener l) { }
public MenuDragMouseListener[] getMenuDragMouseListeners() { return list.getListeners(MenuDragMouseListener.class); }
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c){ return new MyMenuDragMouseHandler(); }
protected void fireMenuDragMouseEntered(final MenuDragMouseEvent event) { final MenuDragMouseListener[] listeners = getMenuDragMouseListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].menuDragMouseEntered(event); } }
protected void fireMenuDragMouseExited(final MenuDragMouseEvent event) { final MenuDragMouseListener[] listeners = getMenuDragMouseListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].menuDragMouseExited(event); } }
protected void fireMenuDragMouseDragged(final MenuDragMouseEvent event) { final MenuDragMouseListener[] listeners = getMenuDragMouseListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].menuDragMouseDragged(event); } }
protected void fireMenuDragMouseReleased(final MenuDragMouseEvent event) { final MenuDragMouseListener[] listeners = getMenuDragMouseListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].menuDragMouseReleased(event); } }
public void addMenuDragMouseListener(final MenuDragMouseListener listener) { listenerList.add(MenuDragMouseListener.class, listener); }
public void removeMenuDragMouseListener(final MenuDragMouseListener listener) { listenerList.remove(MenuDragMouseListener.class, listener); }
public MenuDragMouseListener[] getMenuDragMouseListeners() { return (MenuDragMouseListener[])getListeners(MenuDragMouseListener.class); }
protected MenuDragMouseListener createMenuDragMouseListener(final JComponent c) { return (menuItemHandler != null) ? menuItemHandler : (menuItemHandler = new MenuItemHandler()); }