Class AddressPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, ThrottleListener

A JInternalFrame that provides a way for the user to enter a decoder address. This class also store AddressListeners and notifies them when the user enters a new address.
See Also:
  • Constructor Details

  • Method Details

    • destroy

      public void destroy()
    • addAddressListener

      Add an AddressListener. AddressListeners are notified when the user selects a new address and when a Throttle is acquired for that address
      Parameters:
      l - listener to add.
    • removeAddressListener

      Remove an AddressListener.
      Parameters:
      l - listener to remove.
    • getRosterSelectedIndex

      public int getRosterSelectedIndex()
      Gets the selected index of the roster combo box. Implemented to support xboxThrottle.py
      Returns:
      the selected index of the roster combo box
    • setRosterSelectedIndex

      public void setRosterSelectedIndex(int index)
      Sets the selected index of the roster combo box. This method temporarily disables roster box actions so it can change the selected index without triggering a cascade of events. selectRosterEntry() as to be called afterward to actually select the roster entry
      Parameters:
      index - the index to select in the combo box
    • setBackgroundPanel

    • selectRosterEntry

      public void selectRosterEntry()
      "Sets" the current roster entry. Equivalent to the user pressing the "Set" button. Implemented to support xboxThrottle.py
    • notifyThrottleFound

      Get notification that a throttle has been found as we requested.
      Specified by:
      notifyThrottleFound in interface ThrottleListener
      Parameters:
      t - An instantiation of the DccThrottle with the address requested.
    • notifyFailedThrottleRequest

      public void notifyFailedThrottleRequest(LocoAddress address, String reason)
      Description copied from interface: ThrottleListener
      Get notification that an attempt to request a throttle has failed.
      Specified by:
      notifyFailedThrottleRequest in interface ThrottleListener
      Parameters:
      address - address of the failed request
      reason - failure cause
    • notifyDecisionRequired

      A decision is required for Throttle creation to continue.

      Steal / Cancel, Share / Cancel, or Steal / Share Cancel

      Specified by:
      notifyDecisionRequired in interface ThrottleListener
      Parameters:
      address - The LocoAddress that needs the decision.
      question - The question being asked, steal / cancel, share / cancel, steal / share / cancel
    • notifyConsistThrottleFound

      Get notification that a consist throttle has been found as we requested.
      Parameters:
      t - An instantiation of the DccThrottle with the address requested.
    • notifyThrottleDisposed

      public void notifyThrottleDisposed()
      Receive notification that an address has been release or dispatched.
    • getRosterEntry

      Get the RosterEntry if there's one for this throttle.
      Returns:
      RosterEntry or null
    • getConsistEntry

      Get the selected Consist if there's one for this throttle.
      Returns:
      Consist or null
    • setRosterEntry

      public void setRosterEntry(RosterEntry entry)
      Set the RosterEntry for this throttle and initiate a throttle request
      Parameters:
      entry - roster entry to set.
    • openProgrammer

      protected void openProgrammer()
      Open a programmer for this address
    • dispatchAddress

      public void dispatchAddress()
      Dispatch the current address for use by other throttles
    • releaseAddress

      public void releaseAddress()
      Release the current address.
    • getXml

      public org.jdom2.Element getXml()
      Create an Element of this object's preferences.
      • Window Preferences
      • Address value
      Returns:
      org.jdom2.Element for this objects preferences. Defined in DTD/throttle-config
    • setXml

      public void setXml(org.jdom2.Element e)
      Use the Element passed to initialize based on user prefs.
      Parameters:
      e - The Element containing prefs as defined in DTD/throttle-config
    • getRosterEntrySelector

      Returns:
      the RosterEntrySelectorPanel
    • getThrottle

      Returns:
      the curently assigned motor throttle for regular locomotives or consist
    • getFunctionThrottle

      Returns:
      the curently assigned function throttle for regular locomotives or consist
    • getCurrentAddress

      Returns:
      the currently used decoder address
    • setCurrentAddress

      public void setCurrentAddress(DccLocoAddress currentAddress)
      set the currently used decoder address and initiate a throttle request if a consist address is already set, this address will be used only for functions
      Parameters:
      currentAddress - the address to use
    • setAddress

      public void setAddress(int number, boolean isLong)
      set the currently used decoder address and initiate a throttle request (same as setCurrentAddress) if a consist address is already set, this address will be used only for functions
      Parameters:
      number - the address
      isLong - long/short (true/false) address
    • getConsistAddress

      Returns:
      the current consist address if any
    • setConsistAddress

      public void setConsistAddress(DccLocoAddress consistAddress)
      set the currently used consist address and initiate a throttle request
      Parameters:
      consistAddress - the consist address to use
    • propertyChange

      Specified by:
      propertyChange in interface PropertyChangeListener
    • applyPreferences