/** * Causes this command to fire the 'check status' event to all of its listeners. */ public void updateState() { updateState(new CommandEvent(this, null, null, null)); fireUpdateState(); }
/** * Notify all listeners that have registered interest for notification on the 'action performed' event type. The * event instance is lazily created using the parameters passed into the fire method. */ @Override protected void fireActionPerformed(ActionEvent actionEvent, Object argument) { actionPerformed(new CommandEvent(this, actionEvent, null, argument)); if (getEventListenerList() == null) { return; } // Guaranteed to return a non-null array Object[] listeners = getEventListenerList().getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event CommandEvent commandEvent = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CommandListener.class) { // Lazily create the event: if (commandEvent == null) { commandEvent = new CommandEvent(this, actionEvent, null, argument); } ((CommandListener) listeners[i + 1]).actionPerformed(commandEvent); } } }
/** * Notify all listeners that have registered interest for notification on the 'action performed' event type. The * event instance is lazily created using the parameters passed into the fire method. */ protected void fireActionPerformed(ActionEvent actionEvent, Object argument) { actionPerformed(new CommandEvent(this, actionEvent, null, argument)); if (getEventListenerList() == null) { return; } // Guaranteed to return a non-null array Object[] listeners = getEventListenerList().getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event CommandEvent commandEvent = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CommandListener.class) { // Lazily create the event: if (commandEvent == null) { commandEvent = new CommandEvent(this, actionEvent, null, argument); } ((CommandListener) listeners[i + 1]).actionPerformed(commandEvent); } } }
/** * Notify all listeners that have registered interest for notification on the 'update status' event type. The event * instance is lazily created using the parameters passed into the fire method. */ protected void fireUpdateState() { if (getEventListenerList() == null) { return; } // Guaranteed to return a non-null array Object[] listeners = getEventListenerList().getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event CommandEvent commandEvent = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CommandListener.class || listeners[i] == CommandStateListener.class) { // Lazily create the event: if (commandEvent == null) { commandEvent = new CommandEvent(this, null, null, null); } ((CommandStateListener) listeners[i + 1]).updateState(commandEvent); } } }