Class EventDispatcher

    • Constructor Detail

      • EventDispatcher

        public EventDispatcher()
        Creates a new dispatcher
    • Method Detail

      • getMagellanContext

        public MagellanContext getMagellanContext()
        Returns the Magellan Context. TR: This method was deprecated. But I don't know what to do if I need the magellan context.
      • setMagellanContext

        public void setMagellanContext​(MagellanContext context)
        Sets the Magellan Context.
      • addSelectionListener

        public void addSelectionListener​(SelectionListener l)
        Adds a listener for selection events.
        Parameters:
        l - the listener to add.
        See Also:
        SelectionEvent
      • addPrioritySelectionListener

        public void addPrioritySelectionListener​(SelectionListener l)
        Adds the given selection listener to the front of all registered listeners. Warning: The order will change if another listener is added with priority.
      • removeSelectionListener

        public boolean removeSelectionListener​(SelectionListener l)
        Removes the specified listener for selection events.
        Parameters:
        l - the listener to remove.
        Returns:
        true if this list contained the specified element.
        See Also:
        SelectionEvent
      • addTempUnitListener

        public void addTempUnitListener​(TempUnitListener l)
        Adds a listener for temp unit events.
        Parameters:
        l - the listener to add.
        See Also:
        TempUnitEvent
      • addPriorityTempUnitListener

        public void addPriorityTempUnitListener​(TempUnitListener l)
        Adds the given temp-unit listener to the front of all registered listeners. Warning: The order will change if another listener is added with priority.
      • removeTempUnitListener

        public boolean removeTempUnitListener​(TempUnitListener l)
        Removes the specified listener for temp unit events.
        Parameters:
        l - the listener to remove.
        Returns:
        true if this list contained the specified element.
        See Also:
        TempUnitEvent
      • addUnitOrdersListener

        public void addUnitOrdersListener​(UnitOrdersListener l)
        Adds a listener for unit orders events.
        Parameters:
        l - the listener to add.
        See Also:
        UnitOrdersEvent
      • addPriorityUnitOrdersListener

        public void addPriorityUnitOrdersListener​(UnitOrdersListener l)
        Adds the given unit-orders listener to the front of all registered listeners. Warning: The order will change if another listener is added with priority.
      • removeUnitOrdersListener

        public boolean removeUnitOrdersListener​(UnitOrdersListener l)
        Removes the specified listener for unit order events.
        Parameters:
        l - the listener to remove.
        Returns:
        true if this list contained the specified element.
        See Also:
        UnitOrdersEvent
      • removeAllListeners

        public boolean removeAllListeners​(java.lang.Object o)
        Removes the specified listener from all event queues
        Specified by:
        removeAllListeners in interface EventDispatcherInterface
        Parameters:
        o - the listener to remove.
        Returns:
        true if one of the list contained the specified element.
      • addOrderConfirmListener

        public void addOrderConfirmListener​(OrderConfirmListener l)
        Adds a listener for order confirm events.
        Parameters:
        l - the listener to add.
        See Also:
        OrderConfirmEvent
      • addPriorityOrderConfirmListener

        public void addPriorityOrderConfirmListener​(OrderConfirmListener l)
        Adds the given order-confirm listener to the front of all registered listeners. Warning: The order will change if another listener is added with priority.
      • removeOrderConfirmListener

        public boolean removeOrderConfirmListener​(OrderConfirmListener l)
        Removes the specified listener for order confirm events.
        Parameters:
        l - the listener to remove.
        Returns:
        true if this list contained the specified element.
        See Also:
        OrderConfirmEvent
      • fire

        public void fire​(java.util.EventObject e,
                         boolean synchronous)
        Forwards an event to all registered listeners for this event type.

        If synchronous is false, the forwarding is done asynchronously in a separate dispatcher thread. If the fire method is called before the dispatcher thread has finished the previous request, it is stopped and starts forwarding the new event.

        Specified by:
        fire in interface EventDispatcherInterface
      • fire

        public void fire​(java.util.EventObject e)
        Asynchronously forwards an event to all registered listeners for this event type.
        Specified by:
        fire in interface EventDispatcherInterface
      • getEventsFired

        public int getEventsFired()
        Returns the number of events that were passed to this dispatcher for forwarding.
        Specified by:
        getEventsFired in interface EventDispatcherInterface
      • getPriority

        protected int getPriority​(java.util.EventObject e)
      • quit

        public void quit()