Class PIAFieldComponent

All Implemented Interfaces:
PAppComponent, PAppFieldComponent, PClientComponent, PComponent, PFieldBean, PViewDataChangeListener, ImageObserver, MenuContainer, Serializable, Remote, EventListener

public class PIAFieldComponent extends JComponent implements PAppFieldComponent, Serializable
PIAFieldComponent is a Swing-compatible, Portal-aware field component boilerplate code.
Version:
3
Author:
Larry Lynch-Freshner
See Also:
  • Constructor Details

    • PIAFieldComponent

      public PIAFieldComponent()
      Constructs a PIAFieldComponent and registers it with the BAS server.
  • Method Details

    • setModelHandle

      public void setModelHandle(PModelHandle data) throws RemoteException
      Establishes the PModelHandle for this component.
      Specified by:
      setModelHandle in interface PComponent
      Parameters:
      data - the new PModelHandle from which to extract information
      Throws:
      RemoteException - thrown for errors
    • getModelHandle

      public PModelHandle getModelHandle() throws RemoteException
      Retrieves the PModelHandle for this component.
      Specified by:
      getModelHandle in interface PComponent
      Returns:
      The PModelHandle associated with this component, or null if this is a lightweight component.
      Throws:
      RemoteException - thrown for errors
    • isLight

      public boolean isLight() throws RemoteException
      Determines whether this is a lightweight component. Lightweight components do not have their own model. Instead, they use the model of their container. This means that getModelHandle always returns null, setModelHandle is ignored, and no property change events are generated.
      Specified by:
      isLight in interface PComponent
      Returns:
      True if the component is lightweight; false otherwise.
      Throws:
      RemoteException - thrown for errors
    • getControllerClassName

      public String getControllerClassName() throws RemoteException
      Retrieves the class name of this component's controller.
      Specified by:
      getControllerClassName in interface PComponent
      Returns:
      A String with the controller's class name.
      Throws:
      RemoteException - thrown for errors
    • getTools

      public Vector getTools()
      Gets a list of actions supported by this component. When subclassed, the overriding class should call its super class version, then add its actions to the returned list. This preserves actions supplied by base classes. The default, supplied here, includes help for this component.
      Specified by:
      getTools in interface PClientComponent
      Returns:
      A Vector that contains Action objects.
    • setResourceName

      public void setResourceName(String name)
      Sets the base resource name used to look up resources. The resource name consists of this base, followed by a dot, followed by the local name (label).
      Specified by:
      setResourceName in interface PClientComponent
      Parameters:
      name - the new base resource name
    • getResourceName

      public String getResourceName()
      Returns the base resource name used to look up a resource.
      Specified by:
      getResourceName in interface PClientComponent
      Returns:
      A String with the resource name.
    • getRemoteComponent

      public Remote getRemoteComponent()
      Gets a reference to the remote component (controller) for this object.
      Specified by:
      getRemoteComponent in interface PAppComponent
      Returns:
      A Remote object, which is the remote controller for this View class.
    • setModelFieldDescription

      public void setModelFieldDescription(String fieldDesc) throws RemoteException
      Sets the description of the field in the data model that this component is interested in.
      Specified by:
      setModelFieldDescription in interface PFieldBean
      Parameters:
      fieldDesc - a String that describes the field used by this component
      Throws:
      RemoteException - thrown for errors
    • getModelFieldDescription

      public String getModelFieldDescription() throws RemoteException
      Gets the data field description used by this component.
      Specified by:
      getModelFieldDescription in interface PFieldBean
      Returns:
      A String description of the field used by this component.
      Throws:
      RemoteException - thrown for errors
    • setDisplayFieldDescription

      public void setDisplayFieldDescription(String fieldDisp) throws RemoteException
      Sets the description of the field(s) in the data model for this component to display.
      Specified by:
      setDisplayFieldDescription in interface PFieldBean
      Parameters:
      fieldDisp - a String that describes the field displayed by this component
      Throws:
      RemoteException - thrown for errors
    • getDisplayFieldDescription

      public String getDisplayFieldDescription() throws RemoteException
      Gets the data field description used by this component.
      Specified by:
      getDisplayFieldDescription in interface PFieldBean
      Returns:
      A String description of the field used by this component.
      Throws:
      RemoteException - thrown for errors
    • setDisplayFieldFormat

      public void setDisplayFieldFormat(String fieldForm) throws RemoteException
      Sets the java.text.MessageFormat used to display data in this component. This is typically (but not necessarily) directly tied to the displayFieldDescription. For this specific widget, the format might be similar to the following:

      "{0,choice,0#First Label|1#2nd Label|2#Third Label}"

      Specified by:
      setDisplayFieldFormat in interface PAppFieldComponent
      Parameters:
      fieldForm - the format used to display the data
      Throws:
      RemoteException - thrown for errors
    • getDisplayFieldFormat

      public String getDisplayFieldFormat() throws RemoteException
      Gets the display field format used by this component.
      Specified by:
      getDisplayFieldFormat in interface PAppFieldComponent
      Returns:
      A String representation of the display field format.
      Throws:
      RemoteException - thrown for errors
    • setAssociatedClass

      public void setAssociatedClass(String name) throws RemoteException
      Sets the associated class, if any, for this field.
      Specified by:
      setAssociatedClass in interface PFieldBean
      Parameters:
      name - a String with the class name
      Throws:
      RemoteException - thrown for errors
    • getAssociatedClass

      public String getAssociatedClass() throws RemoteException
      Gets the associated class, if any, for this field.
      Specified by:
      getAssociatedClass in interface PFieldBean
      Returns:
      A String with the associated class name.
      Throws:
      RemoteException - thrown for errors
    • setField

      public void setField(Object field) throws RemoteException
      Sets the value of the field referred to in the modelFieldDescription.
      Specified by:
      setField in interface PFieldBean
      Parameters:
      field - the field's value
      value - the field's value
      Throws:
      RemoteException - thrown for errors
    • getField

      public Object getField() throws RemoteException
      Gets the value of the field referred to in the displayFieldDescription.
      Specified by:
      getField in interface PFieldBean
      Returns:
      The field's value.
      Throws:
      RemoteException - thrown for errors
    • setHelpID

      public void setHelpID(String id)
      Sets the help ID for this component.
      Specified by:
      setHelpID in interface PAppFieldComponent
      Parameters:
      id - the new help ID to set
    • getHelpID

      public String getHelpID()
      Gets the current help ID for this component.
      Specified by:
      getHelpID in interface PAppFieldComponent
      Returns:
      A String with the current help ID.
    • viewDataChange

      public void viewDataChange(PViewDataChangeEvent event) throws RemoteException
      Overrides PViewDataChangeListener. This method is no longer called by the controller itself. To ensure backward compatibility, it is called after the model is set, by any operation that causes a change in the display data. Client code should call the appropriate get() methods on the controller to get the data, because the PViewDataChangeEvent parameter is no longer used.
      Specified by:
      viewDataChange in interface PViewDataChangeListener
      Parameters:
      event - the PViewDataChangeEvent event that describes the change. No longer used. By default, the value passed in is always set to null.
      Throws:
      RemoteException - thrown for errors
    • getDataDescriptor

      public String getDataDescriptor()
      Gets the data field description used by the component.
      Returns:
      A String description of the fields used by this component or null if there is none.
      Throws:
      RemoteException - thrown for errors
    • setLightData

      public void setLightData(Object field)
      Sets the lightweight data object; in this implementation, an empty value.
      Parameters:
      field - the lightweight component's display data
    • getLightData

      public Object getLightData()
      Gets the lightweight data object; in this implementation, an empty value.
      Returns:
      An empty display value.
    • togglePrimaryToSecondary

      public Object togglePrimaryToSecondary(int primary, int secondary) throws RemoteException
      Implement PFieldBean.togglePrimaryToSecondary. This implementation simply returns null.
      Specified by:
      togglePrimaryToSecondary in interface PFieldBean
      Parameters:
      primary - the primary currency ID
      secondary - the secondary currency ID
      Returns:
      The converted value.
      Throws:
      RemoteException
    • revertToPrimary

      public void revertToPrimary(int primary) throws RemoteException
      Implement PFieldBean.revertToPrimary. This implementation does nothing.
      Specified by:
      revertToPrimary in interface PFieldBean
      Parameters:
      primary - the primary currency ID
      Throws:
      RemoteException
    • unregister

      public void unregister() throws RemoteException
      Implement PClientComponent.unregister(). This implementation does nothing.
      Specified by:
      unregister in interface PClientComponent
      Throws:
      RemoteException