Class AddressInput

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class AddressInput extends JPanel
Panel for user input of addresses. Handles case with multiple address spaces.
See Also:
  • Constructor Details

    • AddressInput

      public AddressInput(Border border)
      Constructor for AddressInput.
      Parameters:
      border - border around each subcomponent (combo/text fields).
    • AddressInput

      public AddressInput()
      Constructor for AddressInput.
  • Method Details

    • setAddress

      public void setAddress(Address addr)
      Set the field to display the given address
    • getAddress

      public Address getAddress()
      Returns the address in the field or null if the address can't be parsed.
      Throws:
      NullPointerException - if AddressFactory has not been set.
    • getAddressSpace

      public AddressSpace getAddressSpace()
      Returns the address space selected in the combobox or in the input text itself if specified (eg: "register:1"). If the address space is not specified; returns the default space.
      Throws:
      NullPointerException - if AddressFactory has not been set.
    • hasInput

      public boolean hasInput()
      Returns true if the Address input field contains text. The getAddress() method will return null if text is not a valid address.
    • setAddressFactory

      public void setAddressFactory(AddressFactory factory)
      Set the address factory to be used to parse addresses. Also used to set the combo box with the list of valid address spaces if there is more than one space.
    • getAddressFactory

      public AddressFactory getAddressFactory()
    • setAddressFactory

      public void setAddressFactory(AddressFactory factory, boolean filterOverlaySpaces, boolean allowOtherSpace)
      Set the address factory to be used to parse addresses. Also used to set the combo box with the list of valid address spaces if there is more than one space.
      Parameters:
      factory - address factory to use
      filterOverlaySpaces - true if overlay spaces should not appear in the combo box for the address spaces.
      allowOtherSpace - true if the OTHER space should appear in the combo box for the address spaces
    • selectDefaultAddressSpace

      public void selectDefaultAddressSpace()
      Sets the selected combo box item to the default address space.
    • clear

      public void clear()
      Clear the offset part of the address field.
    • select

      public void select()
      Select the text field that is the offset.
    • getValue

      public String getValue()
      Get the offset part of the address field.
      Returns:
      String
    • setValue

      public void setValue(String value)
      Set the offset part of the address field.
      Parameters:
      value - the offset value string
    • isEnabled

      public boolean isEnabled()
      Overrides:
      isEnabled in class Component
    • containsAddressSpaces

      public boolean containsAddressSpaces()
    • setAddressSpaceEditable

      public void setAddressSpaceEditable(boolean state)
      Set the address space (if it is shown) such that it is not editable. If the combo box is shown for multiple address spaces, then the combo box is replaced with a fixed uneditable text field that shows the currently selected address space.
      Parameters:
      state - false means that the combo box should not be editable
    • addChangeListener

      public void addChangeListener(ChangeListener listener)
      Adds a change listener that will be notified anytime this address value in this panel changes
      Parameters:
      listener - the change listener to be notified.
    • addActionListener

      public void addActionListener(ActionListener listener)
      Add an action listener that will be notified anytime the user presses the return key while in the text field.
      Parameters:
      listener - the action listener to be notified.
    • removeActionListener

      public void removeActionListener(ActionListener listener)
      Removes the action listener from the list to be notified.
      Parameters:
      listener -
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
      See Also:
    • setEditable

      public void setEditable(boolean state)
      Set the text field to be editable according to the state param.
    • isEditable

      public boolean isEditable()
    • showAddressSpaceCombo

      public void showAddressSpaceCombo(boolean showCombo)
    • requestFocus

      public void requestFocus()
      Overrides:
      requestFocus in class JComponent
    • getAddressTextField

      protected JTextField getAddressTextField()
    • getAddressSpaceTextField

      protected JTextField getAddressSpaceTextField()