Class PIADateField

All Implemented Interfaces:
PAppComponent, PAppFieldComponent, PClientComponent, PCollectDataListener, PComponent, PComponentAttribute, PFieldBean, PLightComponent, PViewDataChangeListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, Remote, EventListener, Accessible, ChangeListener

PIADateField is a Swing-compatible, Portal-aware date display class.
Version:
$Version$
Author:
Larry Lynch-Freshner
See Also:
  • Field Details

  • Constructor Details

    • PIADateField

      public PIADateField()
      Creates a component that allows the user to establish a date, either by directly entering text or by selecting a date from a popup calendar.
    • PIADateField

      public PIADateField(boolean showDate)
      Creates a component which allows the user to establish a date either by directly entering text or by selecting a date from a popup calendar.
      Parameters:
      showDate - -determines if the date should be pre-filled in
  • Method Details

    • unregister

      public void unregister() throws RemoteException
      Used to disassociate this component from its delegate (controller)
      Specified by:
      unregister in interface PClientComponent
      Throws:
      RemoteException
    • setRelative

      public void setRelative(boolean relative)
      Sets the relative property, which determines whether this date field has relative value. Setting true will prevent the date value set to billing offset while calling getDate() The default value of the relative property is false unless otherwise specifically set.
      Parameters:
      relative - true if this date field has relative value; otherwise false
      See Also:
    • isRelative

      public boolean isRelative()
      Gets the value of the relative property.
      Returns:
      the value of the relative property
      See Also:
    • getDate

      public Date getDate() throws IllegalArgumentException
      Retrieves the current date represented by this component. If the date manually entered by the user is not a valid date, an IllegalArgumentException is thrown.
      Overrides:
      getDate in class DateSelector
      Returns:
      the date in the widget or null
      Throws:
      IllegalArgumentException - if invalid date has been entered
    • getDate

      public Date getDate(int type) throws IllegalArgumentException
      Retrieves the date represented by this component. If the date manually entered by the user is not a valid date, an IllegalArgumentException is thrown.
      Parameters:
      type - the type of the returning date. ORIGINAL and CLIENT_MIDNIGHT are supported.
      Returns:
      the various date in the widget or null. If type equal to ORIGINAL the original date will be return. If type equal CLIEN_MIDNIGHT the date will be set back to client midnight before return.
      Throws:
      IllegalArgumentException - if invalid date has been entered
    • 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.
      Throws:
      RemoteException - thrown for errors
    • isLight

      public boolean isLight() throws RemoteException
      Determines if this component defers PModelHandle knowledge to its parent container. If so, the parent container passes the PModelHandle to this component on the server side (by way of the controller), which saves a client/server round trip for data exchange.

      If specific processing is required, when PModelHandle is called subclass this component and override this method. Otherwise, setModelHandle will not be called.

      Specified by:
      isLight in interface PComponent
      Returns:
      True if the component defers knowledge; 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 value "com.portal.bas.comp.PIAFieldBean".
      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 in resource look up. Basically, the resource name is 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()
      Gets the base resource name used in resource lookup.
      Specified by:
      getResourceName in interface PClientComponent
      Returns:
      A String with the base resource name.
    • getRemoteComponent

      public Remote getRemoteComponent()
      Gets a reference to the remote component for this object. The remote component is used to interface with this component's controller.
      Specified by:
      getRemoteComponent in interface PAppComponent
      Returns:
      A Remote component.
    • 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 the 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 that this component displays.
      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 the 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-type format used to display data in this component. This is typically (but not necessarily) directly tied to the displayFieldDescription. For example, the displayFieldDescription might be "FldNameinfo[any].FldFirstName, FldNameinfo[any].FldLastName" and the DisplayFieldFormat for that might be "{1}, {0}" to display the last name followed by a comma and then the first name.

      Note that the base component contains its own date-specific formats so this method is essentially ignored.

      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
    • setLightData

      public void setLightData(Object field)
      Sets the lightweight data object.
      Specified by:
      setLightData in interface PLightComponent
      Parameters:
      field - the lightweight component's display data
    • getLightData

      public Object getLightData()
      Gets the lightweight data object.
      Specified by:
      getLightData in interface PLightComponent
      Returns:
      The lightweight component's date display value.
    • getDataDescriptor

      public String getDataDescriptor()
      Gets the data field description used by the component.
      Specified by:
      getDataDescriptor in interface PLightComponent
      Returns:
      A String description of the fields used by this component or null if there is none.
      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
    • getHelpID

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

      public void resetToDefault()
      Resets the component value to the original value (that which was established by calling setDefault). If no default value exists, the component data is cleared.
      Specified by:
      resetToDefault in interface PComponentAttribute
    • clear

      public void clear()
      Clears any existing data from the component and sets it to today's date
      Specified by:
      clear in interface PComponentAttribute
    • isRequired

      public boolean isRequired()
      Determines if this component is a required field in its current context. This provides a visual indicator only; there is no mechanism to enforce that required fields be filled in.
      Specified by:
      isRequired in interface PComponentAttribute
      Returns:
      True if this field is marked REQUIRED; false otherwise.
    • setRequired

      public void setRequired(boolean b)
      Marks this component as required in its current context. This is currently a visual indicator only; there is no mechanism to enforce that required fields be filled in.
      Specified by:
      setRequired in interface PComponentAttribute
      Parameters:
      b - if true, puts the component in REQUIRED state
    • isError

      public boolean isError()
      Determines if this component is currently in an ERROR state.
      Specified by:
      isError in interface PComponentAttribute
      Returns:
      True if this component is in an ERROR state; false otherwise.
    • setError

      public void setError(boolean b)
      Marks this component as containing erroneous data in the current context, or unmarks the ERROR state, depending on the parameter.
      Specified by:
      setError in interface PComponentAttribute
      Parameters:
      b - if true, puts the component in ERROR state; if false, removes the ERROR state
    • setInputTracking

      public void setInputTracking(boolean b)
      If the inputTracking property is enabled, any changes made by the user to the component are tracked and the component is marked DIRTY. If the user modifies the data and returns it to its default or original state, the component is marked CLEAN or not DIRTY.
      Specified by:
      setInputTracking in interface PComponentAttribute
      Parameters:
      b - the state of the inputTracking property
    • isInputTracking

      public boolean isInputTracking()
      Determines if inputTracking is enabled.
      Specified by:
      isInputTracking in interface PComponentAttribute
      Returns:
      True if inputTracking is enabled; false otherwise.
    • setClean

      public void setClean()
      Resets the component to the CLEAN state. If the component was in a DIRTY or ERROR state, this method removes those attributes. A required component is still marked REQUIRED after a call to this method.
      Specified by:
      setClean in interface PComponentAttribute
    • setDirty

      public void setDirty()
      Sets the component to the Dirty state.
    • isDirty

      public boolean isDirty()
      Determines if this component is currently in a DIRTY state.
      Specified by:
      isDirty in interface PComponentAttribute
      Returns:
      True if the user has modified the data represented by this component, false otherwise. It also returns false if inputTracking is not enabled.
    • setDefault

      public void setDefault()
      Establishes the current value (or element count, depending on the given component) as the default value. Any modifications made after this method is called will result in a DIRTY component.
      Specified by:
      setDefault in interface PComponentAttribute
    • isCurrencyDisplay

      public boolean isCurrencyDisplay()
      Determines whether the component currently displays currency data.
      Specified by:
      isCurrencyDisplay in interface PComponentAttribute
      Returns:
      This component never displays currency data, so this method always returns false.
      Since:
      Release 6.2
    • setCurrencyDisplay

      public void setCurrencyDisplay(boolean b)
      Determines whether this component currently displays currency data. Widgets that display currency data are capable of automatically toggling their data between a primary and secondary Portal currency type.
      Specified by:
      setCurrencyDisplay in interface PComponentAttribute
      Parameters:
      b - always false, since this component never displays currency data
      Since:
      Release 6.2
    • togglePrimaryToSecondary

      public Object togglePrimaryToSecondary(int pri, int sec) throws RemoteException
      Does nothing.
      Specified by:
      togglePrimaryToSecondary in interface PComponentAttribute
      Specified by:
      togglePrimaryToSecondary in interface PFieldBean
      Parameters:
      pri - the primary currency ID
      sec - the secondary currency ID
      Returns:
      The converted value.
      Throws:
      RemoteException
    • revertToPrimary

      public void revertToPrimary(int primary) throws RemoteException
      Causes previously toggled data to be reverted back to the primary currency.
      Specified by:
      revertToPrimary in interface PComponentAttribute
      Specified by:
      revertToPrimary in interface PFieldBean
      Parameters:
      primary - The primary currency
      Throws:
      RemoteException
    • setDate

      public void setDate(Date date)
      Sets the date to display in this component.
      Overrides:
      setDate in class DateSelector
      Parameters:
      date - the new date
    • 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
    • collectData

      public void collectData(PCollectDataEvent event)
      Overrides PCollectDataListener. Causes the controller to save changes back to the data model. Done prior to committing changes to Portal.
      Specified by:
      collectData in interface PCollectDataListener
      Parameters:
      event - the data collection event
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Specified by:
      stateChanged in interface ChangeListener
    • equalToDefault

      protected boolean equalToDefault()
      Compare date in widget to the default date if set.
      Returns:
      true if date and default are equal, false otherwise
    • setTextEditable

      public void setTextEditable(boolean b)
      Description copied from class: DateSelector
      Set editability of text field that displays date
      Overrides:
      setTextEditable in class DateSelector
      Parameters:
      b - If true, the date text field is editable; otherwise it is disabled.