Class PContactPanel

All Implemented Interfaces:
PAppComponent, PClientComponent, PCollectDataListener, PComponent, PComponentAttribute, PIASelectionListener, PViewDataChangeListener, ActionListener, ContainerListener, FocusListener, ItemListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible

A generalized panel for displaying/modifying information for an Portal contact. Since Portal supports multiple contacts it is likely that a hosting panel would create and maintain multiple instances of this panel.
See Also:
  • Constructor Details

    • PContactPanel

      public PContactPanel()
      Creates a contact panel for a new contact having no type and with an index of 1 for the associated NameInfo array entry.
    • PContactPanel

      public PContactPanel(int nameInfoIndex, boolean newContact)
      Creates a contact display panel using the passed-in type, index, and a flag to establish the type of the contact, the index of the associated NameInfo array entry, and whether the panel will host an existing or a new contact.
      Parameters:
      nameInfoIndex - The index to use for the NameInfo array entry.
      newContact - If true, this panel will hold a new contact. If false, this panel will hold a contact that exists in an account.
  • Method Details

    • setCustomData

      public void setCustomData(PIACustomizablePanel p)
      Adds the custom panel at the bottom of the contact panel.
      Note that profile panels can be added here and saved automatically with no intervention from the user since the same MODIFY_CUSTOMER opcode works with contact fields and profile objects.

      Be aware that this panel will appear for each contact added - it is the caller's job to ensure that data is saved in the appropriate array index.
      Parameters:
      The - new panel to display.
    • isNewContact

      public boolean isNewContact()
      Returns whether the contact is a new one or exists in an account.
      Returns:
      true if the contact hasn't yet been saved to the account. Returns false if it exists in the account.
    • setContactSaved

      public void setContactSaved()
      Informs this panel that its contact has been saved to the account.
    • identifyPanel

      public void identifyPanel()
    • addNotify

      public void addNotify()
      Overridden to apply style to some of the fonts
      Overrides:
      addNotify in class JComponent
    • setModelHandle

      public void setModelHandle(PModelHandle pm) throws RemoteException
      Sets the contact panel type and/or label.
      Specified by:
      setModelHandle in interface PComponent
      Overrides:
      setModelHandle in class PIACustomizablePanel
      Parameters:
      pm - Model handle for the account
      Throws:
      RemoteException - thrown for errors
    • setDeleteEnabled

      public void setDeleteEnabled(boolean b)
      Shows or hides the delete button.
      Parameters:
      b - true to enable the delete button; false otherwise
    • getNameInfoIndex

      protected int getNameInfoIndex()
      Retrieves the index into the Nameinfo array that this particular contact panel represents
      Returns:
      The Nameinfo index this panel represents
    • collectData

      public void collectData(PCollectDataEvent event)
      Collects contact data from the contained components. Three cases are handled:
      • This panel is visible (not deleted). In this case data from this panel's contained widgets is appended to the model in the passed-in collect data event.
      • This panel is hidden (deleted) and its contact is a "new" one. (That is, its contact isn't already present in the account.) In this case no data is appended to the the model in the passed-in collect data event.
      • This panel is hidden (deleted) and the panel contains an already-existing contact for this account. In this case, a "deleted" entry for the contact is appended to the the model in the passed-in collect data event.
      Specified by:
      collectData in interface PCollectDataListener
      Overrides:
      collectData in class PIACustomizablePanel
      Parameters:
      event - The collect data event
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • selectionChanged

      public void selectionChanged(PIASelectionEvent event)
      Description copied from interface: PIASelectionListener
      Handles a selection event.
      Specified by:
      selectionChanged in interface PIASelectionListener
      Parameters:
      event - the event to handle
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Specified by:
      actionPerformed in interface ActionListener
    • resetToDefault

      public void resetToDefault()
      Description copied from class: PIACustomizablePanel
      A convenience method that resets every field on this panel.
      Specified by:
      resetToDefault in interface PComponentAttribute
      Overrides:
      resetToDefault in class PIACustomizablePanel
    • setContactData

      public void setContactData(NameAddressData data)
      Establishes the contact data for this account.
      Parameters:
      data - The NameAddressData for this account
    • getContactData

      public NameAddressData getContactData()
      Retrieves the contact data for this account.
      Returns:
      Contact data
    • requestDefaultFocus

      public boolean requestDefaultFocus()
      Overrides:
      requestDefaultFocus in class JComponent
    • focusGained

      public void focusGained(FocusEvent e)
      No-op.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      e - the focus event
    • focusLost

      public void focusLost(FocusEvent e)
      Updates the contact panel's label to reflect the contact type entered by the user.
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      e - the focus event
    • updateContactLabel

      public void updateContactLabel()
      Updates the contact panel's label to reflect the contact type entered by the user.
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      Specified by:
      itemStateChanged in interface ItemListener
    • getContactTypeWidget

      public PIAStringEnum getContactTypeWidget()
    • setValidContactType

      public void setValidContactType(String[] ctypes)
    • setValidSalutations

      public void setValidSalutations(String[] salutations)
      Establishes the list of selectable values for each contact's salutation field. The list will appear as a dropdown menu in the contact panel instead of an editable textfield.
      Parameters:
      salutations - The list of selectable salutations
    • setInitialSalutation

      public void setInitialSalutation(String sal)
      Establishes the salutation that should be initially selected in the menu. Only valid if a list of countries has been specified.
      Parameters:
      sal - The salutation that is selected by default.
    • setInitialContactType

      public void setInitialContactType(String ctype)