/**
   * Notifies all the ComputerPartErrorEventListeners on an error that occured in the computer part
   * by creating a ComputerPartErrorEvent (with the error message) and sending it using the
   * computerPartErrorOccured method to all the listeners.
   */
  public void notifyErrorListeners(String errorMessage) {
    ComputerPartErrorEvent event = new ComputerPartErrorEvent(this, errorMessage);

    for (int i = 0; i < errorListeners.size(); i++)
      ((ComputerPartErrorEventListener) errorListeners.elementAt(i))
          .computerPartErrorOccured(event);
  }
  /** Clears all the ComputerPartErrorEventListeners from errors. */
  public void clearErrorListeners() {
    ComputerPartErrorEvent event = new ComputerPartErrorEvent(this, null);

    for (int i = 0; i < errorListeners.size(); i++)
      ((ComputerPartErrorEventListener) errorListeners.elementAt(i))
          .computerPartErrorOccured(event);
  }
Ejemplo n.º 3
0
  /**
   * Notifies all the ProgramEventListeners on a change in the ROM's program by creating a
   * ProgramEvent (with the new event type and program's file name) and sending it using the
   * programChanged method to all the listeners.
   */
  protected void notifyProgramListeners(byte eventType, String programFileName) {
    ProgramEvent event = new ProgramEvent(this, eventType, programFileName);

    for (int i = 0; i < listeners.size(); i++) {
      ((ProgramEventListener) listeners.elementAt(i)).programChanged(event);
    }
  }
 /**
  * Un-registers the given ComputerPartErrorEventListener from being a listener to this
  * ComputerPart.
  */
 public void removeErrorListener(ComputerPartErrorEventListener listener) {
   errorListeners.removeElement(listener);
 }
 /** Registers the given ComputerPartErrorEventListener as a listener to this ComputerPart. */
 public void addErrorListener(ComputerPartErrorEventListener listener) {
   errorListeners.addElement(listener);
 }
Ejemplo n.º 6
0
 /** Un-registers the given ProgramEventListener from being a listener to this GUI. */
 public void removeProgramListener(ProgramEventListener listener) {
   listeners.remove(listener);
 }
 /** Highlights the value at the given index. */
 public void highlight(int index) {
   highlightIndex.addElement(new Integer(index));
   repaint();
 }
Ejemplo n.º 8
0
 /** Registers the given ProgramEventListener as a listener to this GUI. */
 public void addProgramListener(ProgramEventListener listener) {
   listeners.add(listener);
 }
 /** Un-registers the given ErrorEventListener from being a listener to this GUI. */
 public void removeErrorListener(ErrorEventListener listener) {
   errorEventListeners.removeElement(listener);
 }
 /** Hides all highlightes. */
 public void hideHighlight() {
   highlightIndex.removeAllElements();
   repaint();
 }
 /** Registers the given ErrorEventListener as a listener to this GUI. */
 public void addErrorListener(ErrorEventListener listener) {
   errorEventListeners.addElement(listener);
 }
 public void notifyListeners() {
   ComputerPartEvent event = new ComputerPartEvent(this);
   for (int i = 0; i < listeners.size(); i++) {
     ((ComputerPartEventListener) listeners.elementAt(i)).guiGainedFocus();
   }
 }
 /**
  * Notifies all the ComputerPartEventListeners on a change in the memory by creating a MemoryEvent
  * (with the changed address and value) and sending it using the memoryChanged method to all the
  * listeners.
  */
 public void notifyListeners(int address, short value) {
   ComputerPartEvent event = new ComputerPartEvent(this, address, value);
   for (int i = 0; i < listeners.size(); i++) {
     ((ComputerPartEventListener) listeners.elementAt(i)).valueChanged(event);
   }
 }
 /** Un-registers the given ComputerPartEventListener from being a listener to this GUI. */
 public void removeListener(ComputerPartEventListener listener) {
   listeners.removeElement(listener);
 }
 /** Registers the given ComputerPartEventListener as a listener to this GUI. */
 public void addListener(ComputerPartEventListener listener) {
   listeners.addElement(listener);
 }