Class PIASpinnerField

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

Swing compatible, Portal aware Integer field display class with an increase/decrease spinner.
Version:
$Version$
Author:
Kapono Carter
See Also:
  • Field Details

    • mPrimaryData

      protected Object mPrimaryData
    • mPrimaryCur

      protected int mPrimaryCur
    • mSecondaryCur

      protected int mSecondaryCur
  • Constructor Details

    • PIASpinnerField

      public PIASpinnerField()
      Creates a textfield that accepts only integers. There is a spinner (up/down arrow) on the right which the user can use to modify the value in the textfield if desired.
    • PIASpinnerField

      public PIASpinnerField(IntegerTextField itf)
      Creates a textfield that accepts only integers. There is a spinner (up/down arrow) on the right which the user can use to modify the value in the textfield if desired.
      Parameters:
      The - IntegerTextField component to use
  • Method Details

    • setLayout

      public void setLayout(LayoutManager lm)
      Overridden to do nothing. The base class establishes a layout which subclasses shouldn't override
      Overrides:
      setLayout in class SpinnerField
    • unregister

      public void unregister() throws RemoteException
      Used to disassociate this component from its delegate (controller)
      Specified by:
      unregister in interface PClientComponent
      Throws:
      RemoteException
    • 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 information will be extracted.
      Throws:
      RemoteException
    • 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
    • isLight

      public boolean isLight() throws RemoteException
      Determines if this is component defers PModelHandle knowledge to its parent container. If so, the parent container will pass the PModelHandle to this component on the server side (via the controller) saving a client/server roundtrip for data exchange. If you need to do specific processing of some kind when PModelHandle is called you'll need to subclass this component and override this method. Otherwise setModelHandle() will not be called.
      Specified by:
      isLight in interface PComponent
      Returns:
      true
      Throws:
      RemoteException
    • getControllerClassName

      public String getControllerClassName() throws RemoteException
      Retrieves the class name of this component's controller
      Specified by:
      getControllerClassName in interface PComponent
      Returns:
      "com.portal.bas.comp.PIAFieldController", the default controller for most PFieldComponents
      Throws:
      RemoteException
    • getTools

      public Vector getTools()
      Get 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 retuned list. This preserves actions supplied by base classes. The default, supplied here, include Help for this component.
      Specified by:
      getTools in interface PClientComponent
      Returns:
      a Vector containing Action objects
    • setResourceName

      public void setResourceName(String name)
      Set the base resource name used in resource lookup. Basically, the resource name will be this base, followed by a dot, flowwed by the local name (label).
      Specified by:
      setResourceName in interface PClientComponent
      Parameters:
      name - The new base resource name.
    • getResourceName

      public String getResourceName()
      Get the base resource name used in resource lookup.
      Specified by:
      getResourceName in interface PClientComponent
      Returns:
      The base resource name
      Throws:
      RemoteException
    • getRemoteComponent

      public Remote getRemoteComponent()
      Get a reference to the remote component for this object. The remote component is used when interfacing with this component's controller.
      Specified by:
      getRemoteComponent in interface PAppComponent
      Returns:
      a RemoteComponent
    • setModelFieldDescription

      public void setModelFieldDescription(String fieldDesc) throws RemoteException
      Set 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 describing the field used by this component.
      Throws:
      RemoteException
    • getModelFieldDescription

      public String getModelFieldDescription() throws RemoteException
      Get 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
    • setDisplayFieldDescription

      public void setDisplayFieldDescription(String fieldDisp) throws RemoteException
      Set the description of the field(s) in the data model that this component will display
      Specified by:
      setDisplayFieldDescription in interface PFieldBean
      Parameters:
      fieldDisp - a String that describes the field
      fieldDesc - A String describing the field displayed by this component.
      Throws:
      RemoteException
    • getDisplayFieldDescription

      public String getDisplayFieldDescription() throws RemoteException
      Get 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
    • 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 currency-specific formats so this method is essentially ignored.
      Specified by:
      setDisplayFieldFormat in interface PAppFieldComponent
      Parameters:
      fieldForm - the format used when displaying the data
      Throws:
      RemoteException
    • 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
    • setAssociatedClass

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

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

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

      public Object getField() throws RemoteException
      Description copied from interface: PFieldBean
      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
    • getDataDescriptor

      public String getDataDescriptor()
      Description copied from interface: PLightComponent
      Returns a string guaranteed to be unique among the lightweight components that can be used to describe the data, and acts as a key for it. For field components, this can be the model description.
      Specified by:
      getDataDescriptor in interface PLightComponent
      Returns:
      A String data description.
    • setLightData

      public void setLightData(Object field)
      Description copied from interface: PLightComponent
      Sets the lightweight data object. This is usually called by framework support as part of the lightweight component implementation.
      Specified by:
      setLightData in interface PLightComponent
      Parameters:
      field - the lightweight component's display data
    • getLightData

      public Object getLightData()
      Description copied from interface: PLightComponent
      Gets the lightweight data object itself. Lightweight components are allowed only one data item. This is likely to be a duplicate of another method of the component, and can be delegated to it.
      Specified by:
      getLightData in interface PLightComponent
      Returns:
      An Object that represents a component's display data.
    • setHelpID

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

      public String getHelpID()
      Get 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 will be cleared.
      Specified by:
      resetToDefault in interface PComponentAttribute
    • clear

      public void clear()
      sets the value to the minimum value
      Specified by:
      clear in interface PComponentAttribute
    • isRequired

      public boolean isRequired()
      Determines if this component is required in its current context. This is currently a visual indicator only - there is no policy to enforce that required fields get filled in.
      Specified by:
      isRequired in interface PComponentAttribute
      Returns:
      true if this field is required
    • 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 policy to enforce that required fields get filled in.
      Specified by:
      setRequired in interface PComponentAttribute
      Parameters:
      b - The value of the required attribute
    • isError

      public boolean isError()
      Used to determine if this component is currently in error state
      Specified by:
      isError in interface PComponentAttribute
      Returns:
      the error state of this component
    • 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.
    • setInputTracking

      public void setInputTracking(boolean b)
      If input tracking is turned on, any changes made by the user to the component will be tracked and the component will be marked "dirty". If the user modifies the data and returns it to its default/original state, the component will be marked "clean", or not "dirty".
      Specified by:
      setInputTracking in interface PComponentAttribute
      Parameters:
      b - the state of the inputTracking property
    • isInputTracking

      public boolean isInputTracking()
      Description copied from interface: PComponentAttribute
      Determines if input tracking is enabled.
      Specified by:
      isInputTracking in interface PComponentAttribute
      Returns:
      the state of the input tracking flag
    • setClean

      public void setClean()
      Used to reset the component to the 'clean' state. If the component was in dirty or error state, this method will remove those attributes. A required component will still be marked required after a call to this method.
      Specified by:
      setClean in interface PComponentAttribute
    • isDirty

      public boolean isDirty()
      Description copied from interface: PComponentAttribute
      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 input tracking is off.
    • setDefault

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

      public boolean isCurrencyDisplay()
      Determines if the component is displaying currency data.
      Specified by:
      isCurrencyDisplay in interface PComponentAttribute
      Returns:
      true if the widget is displaying currency data; false otherwise
    • setCurrencyDisplay

      public void setCurrencyDisplay(boolean b)
      Used to determine if this component is displaying currency data. Widgets displaying currency data are capable of automatically toggling their data between 2 Portal currency types (primary invalid input: '&' secondary).
      Specified by:
      setCurrencyDisplay in interface PComponentAttribute
      Parameters:
      b - If true, indicates the widget is displaying currency data.
    • togglePrimaryToSecondary

      public Object togglePrimaryToSecondary(int primary, int secondary) throws RemoteException
      Causes the widget to convert its data using the BEIDManager.
      Specified by:
      togglePrimaryToSecondary in interface PComponentAttribute
      Specified by:
      togglePrimaryToSecondary in interface PFieldBean
      Parameters:
      primary -
      secondary -
      Returns:
      The converted value.
      Throws:
      RemoteException
    • revertToPrimary

      public void revertToPrimary(int primary) throws RemoteException
      Causes the widget to display its data in the primary currency
      Specified by:
      revertToPrimary in interface PComponentAttribute
      Specified by:
      revertToPrimary in interface PFieldBean
      Parameters:
      primary - The primary currency ID for an account
      Throws:
      RemoteException
    • setValue

      public void setValue(BigDecimal val)
      Sets the (default) value for the decimal textfield
      Parameters:
      the - new value for this component
    • setValue

      public void setValue(Integer val)
      Sets the (default) value for the decimal textfield
      Parameters:
      the - new value for this component
    • setValue

      public void setValue(String val)
      Sets the (default) value for the decimal textfield
      Parameters:
      the - new value for this component
    • viewDataChange

      public void viewDataChange(PViewDataChangeEvent event) throws RemoteException
      ViewDataChangeListener override. Called by the controller to update the field data.
      Specified by:
      viewDataChange in interface PViewDataChangeListener
      Parameters:
      event - The ViewDataChange event describing the change
      Throws:
      RemoteException - thrown for errors
    • collectData

      public void collectData(PCollectDataEvent event)
      CollectDataListener override. Causes control to save chanes back to data model. Done prior to commiting changes to Portal
      Specified by:
      collectData in interface PCollectDataListener
      Parameters:
      event - The collect data event
    • stateChanged

      public void stateChanged(ChangeEvent e)
      The event handler that listens for changes to this component
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - The ChangeEvent indicating a value change