Package com.portal.bas.comp
Class PIADateField
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.portal.pfc.ui.datetime.DateSelector
com.portal.bas.comp.PIADateField
- All Implemented Interfaces:
PAppComponent,PAppFieldComponent,PClientComponent,PCollectDataListener,PComponent,PComponentAttribute,PFieldBean,PLightComponent,PViewDataChangeListener,ImageObserver,MenuContainer,PropertyChangeListener,Serializable,Remote,EventListener,Accessible,ChangeListener
public class PIADateField
extends DateSelector
implements PAppFieldComponent, PComponentAttribute, ChangeListener, PCollectDataListener, PLightComponent, Serializable
PIADateField is a Swing-compatible, Portal-aware
date display class.- Version:
- $Version$
- Author:
- Larry Lynch-Freshner
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsFields inherited from class com.portal.pfc.ui.datetime.DateSelector
calPopup, dateTF, minical, normalizeYear, popupInvokerFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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(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. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears any existing data from the component and sets it to today's datevoidcollectData(PCollectDataEvent event) OverridesPCollectDataListener.protected booleanCompare date in widget to the default date if set.Gets the associated class, if any, for this field.Retrieves the class name of this component's controller.Gets the data field description used by the component.getDate()Retrieves the current date represented by this component.getDate(int type) Retrieves the date represented by this component.Gets the data field description used by the component.Gets the display field format used by this component.getField()Gets the value of the field referred to in thedisplayFieldDescription.Gets the current help ID for this component.Gets the lightweight data object.Gets the data field description used by the component.Retrieves thePModelHandlefor this component.Gets a reference to the remote component for this object.Gets the base resource name used in resource lookup.getTools()Gets a list of actions supported by this component.booleanDetermines whether the component currently displays currency data.booleanisDirty()Determines if this component is currently in a DIRTY state.booleanisError()Determines if this component is currently in an ERROR state.booleanDetermines ifinputTrackingis enabled.booleanisLight()Determines if this component defersPModelHandleknowledge to its parent container.booleanGets the value of therelativeproperty.booleanDetermines if this component is a required field in its current context.voidResets the component value to the original value (that which was established by callingsetDefault).voidrevertToPrimary(int primary) Causes previously toggled data to be reverted back to the primary currency.voidsetAssociatedClass(String name) Sets the associated class, if any, for this field.voidsetClean()Resets the component to the CLEAN state.voidsetCurrencyDisplay(boolean b) Determines whether this component currently displays currency data.voidSets the date to display in this component.voidEstablishes the current value (or element count, depending on the given component) as the default value.voidsetDirty()Sets the component to the Dirty state.voidsetDisplayFieldDescription(String fieldDisp) Sets the description of the field(s) in the data model that this component displays.voidsetDisplayFieldFormat(String fieldForm) Sets thejava.text.MessageFormat-type format used to display data in this component.voidsetError(boolean b) Marks this component as containing erroneous data in the current context, or unmarks the ERROR state, depending on the parameter.voidSets the value of the field referred to in themodelFieldDescription.voidSets the help ID for this component.voidsetInputTracking(boolean b) If theinputTrackingproperty is enabled, any changes made by the user to the component are tracked and the component is marked DIRTY.voidsetLightData(Object field) Sets the lightweight data object.voidsetModelFieldDescription(String fieldDesc) Sets the description of the field in the data model that this component is interested in.voidsetModelHandle(PModelHandle data) Establishes thePModelHandlefor this component.voidsetRelative(boolean relative) Sets therelativeproperty, which determines whether this date field has relative value.voidsetRequired(boolean b) Marks this component as required in its current context.voidsetResourceName(String name) Sets the base resource name used in resource look up.voidsetTextEditable(boolean b) Set editability of text field that displays datevoidtogglePrimaryToSecondary(int pri, int sec) Does nothing.voidUsed to disassociate this component from its delegate (controller)voidOverridesPViewDataChangeListener.Methods inherited from class com.portal.pfc.ui.datetime.DateSelector
addChangeListener, getBackground, getPattern, getSelectedDateColor, getShowPatternTip, getText, getTodayColor, hidePopup, isEditable, paintComponent, propertyChange, removeChangeListener, requestFocus, setAccessibleName, setAccessibleParent, setBackground, setEditable, setEnabled, setLayout, setPattern, setSelectedDateColor, setShowPatternTip, setTodayColorMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
ORIGINAL
public static final int ORIGINAL- See Also:
-
CLIENT_MIDNIGHT
public static final int CLIENT_MIDNIGHT- See Also:
-
-
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
Used to disassociate this component from its delegate (controller)- Specified by:
unregisterin interfacePClientComponent- Throws:
RemoteException
-
setRelative
public void setRelative(boolean relative) Sets therelativeproperty, which determines whether this date field has relative value. Setting true will prevent the date value set to billing offset while callinggetDate()The default value of therelativeproperty isfalseunless otherwise specifically set.- Parameters:
relative-trueif this date field has relative value; otherwisefalse- See Also:
-
isRelative
public boolean isRelative()Gets the value of therelativeproperty.- Returns:
- the value of the
relativeproperty - See Also:
-
getDate
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:
getDatein classDateSelector- Returns:
- the date in the widget or null
- Throws:
IllegalArgumentException- if invalid date has been entered
-
getDate
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
Establishes thePModelHandlefor this component.- Specified by:
setModelHandlein interfacePComponent- Parameters:
data- the newPModelHandlefrom which to extract information- Throws:
RemoteException- thrown for errors
-
getModelHandle
Retrieves thePModelHandlefor this component.- Specified by:
getModelHandlein interfacePComponent- Returns:
- The
PModelHandleassociated with this component. - Throws:
RemoteException- thrown for errors
-
isLight
Determines if this component defersPModelHandleknowledge to its parent container. If so, the parent container passes thePModelHandleto 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
PModelHandleis called subclass this component and override this method. Otherwise,setModelHandlewill not be called.- Specified by:
isLightin interfacePComponent- Returns:
- True if the component defers knowledge; false otherwise.
- Throws:
RemoteException- thrown for errors
-
getControllerClassName
Retrieves the class name of this component's controller.- Specified by:
getControllerClassNamein interfacePComponent- Returns:
- A
Stringwith the value "com.portal.bas.comp.PIAFieldBean". - Throws:
RemoteException- thrown for errors
-
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:
getToolsin interfacePClientComponent- Returns:
- A
Vectorthat containsActionobjects.
-
setResourceName
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:
setResourceNamein interfacePClientComponent- Parameters:
name- the new base resource name
-
getResourceName
Gets the base resource name used in resource lookup.- Specified by:
getResourceNamein interfacePClientComponent- Returns:
- A
Stringwith the base resource name.
-
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:
getRemoteComponentin interfacePAppComponent- Returns:
- A
Remotecomponent.
-
setModelFieldDescription
Sets the description of the field in the data model that this component is interested in.- Specified by:
setModelFieldDescriptionin interfacePFieldBean- Parameters:
fieldDesc- aStringthat describes the field used by this component- Throws:
RemoteException- thrown for errors
-
getModelFieldDescription
Gets the data field description used by the component.- Specified by:
getModelFieldDescriptionin interfacePFieldBean- Returns:
- A
Stringdescription of the field used by this component. - Throws:
RemoteException- thrown for errors
-
setDisplayFieldDescription
Sets the description of the field(s) in the data model that this component displays.- Specified by:
setDisplayFieldDescriptionin interfacePFieldBean- Parameters:
fieldDisp- aStringthat describes the field displayed by this component- Throws:
RemoteException- thrown for errors
-
getDisplayFieldDescription
Gets the data field description used by the component.- Specified by:
getDisplayFieldDescriptionin interfacePFieldBean- Returns:
- A
Stringdescription of the field used by this component. - Throws:
RemoteException- thrown for errors
-
setDisplayFieldFormat
Sets thejava.text.MessageFormat-type format used to display data in this component. This is typically (but not necessarily) directly tied to thedisplayFieldDescription. For example, thedisplayFieldDescriptionmight be "FldNameinfo[any].FldFirstName, FldNameinfo[any].FldLastName" and theDisplayFieldFormatfor 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:
setDisplayFieldFormatin interfacePAppFieldComponent- Parameters:
fieldForm- the format used to display the data- Throws:
RemoteException- thrown for errors
-
getDisplayFieldFormat
Gets the display field format used by this component.- Specified by:
getDisplayFieldFormatin interfacePAppFieldComponent- Returns:
- A
Stringrepresentation of the display field format. - Throws:
RemoteException- thrown for errors
-
setAssociatedClass
Sets the associated class, if any, for this field.- Specified by:
setAssociatedClassin interfacePFieldBean- Parameters:
name- aStringwith the class name- Throws:
RemoteException- thrown for errors
-
getAssociatedClass
Gets the associated class, if any, for this field.- Specified by:
getAssociatedClassin interfacePFieldBean- Returns:
- A
Stringwith the associated class name. - Throws:
RemoteException- thrown for errors
-
setField
Sets the value of the field referred to in themodelFieldDescription.- Specified by:
setFieldin interfacePFieldBean- Parameters:
field- the field's valuevalue- the field's value- Throws:
RemoteException- thrown for errors
-
getField
Gets the value of the field referred to in thedisplayFieldDescription.- Specified by:
getFieldin interfacePFieldBean- Returns:
- The field's value.
- Throws:
RemoteException- thrown for errors
-
setLightData
Sets the lightweight data object.- Specified by:
setLightDatain interfacePLightComponent- Parameters:
field- the lightweight component's display data
-
getLightData
Gets the lightweight data object.- Specified by:
getLightDatain interfacePLightComponent- Returns:
- The lightweight component's date display value.
-
getDataDescriptor
Gets the data field description used by the component.- Specified by:
getDataDescriptorin interfacePLightComponent- Returns:
- A
Stringdescription of the fields used by this component or null if there is none. - Throws:
RemoteException- thrown for errors
-
setHelpID
Sets the help ID for this component.- Specified by:
setHelpIDin interfacePAppFieldComponent- Parameters:
id- the new help ID
-
getHelpID
Gets the current help ID for this component.- Specified by:
getHelpIDin interfacePAppFieldComponent- Returns:
- A
Stringhelp ID.
-
resetToDefault
public void resetToDefault()Resets the component value to the original value (that which was established by callingsetDefault). If no default value exists, the component data is cleared.- Specified by:
resetToDefaultin interfacePComponentAttribute
-
clear
public void clear()Clears any existing data from the component and sets it to today's date- Specified by:
clearin interfacePComponentAttribute
-
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:
isRequiredin interfacePComponentAttribute- 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:
setRequiredin interfacePComponentAttribute- 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:
isErrorin interfacePComponentAttribute- 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:
setErrorin interfacePComponentAttribute- Parameters:
b- if true, puts the component in ERROR state; if false, removes the ERROR state
-
setInputTracking
public void setInputTracking(boolean b) If theinputTrackingproperty 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:
setInputTrackingin interfacePComponentAttribute- Parameters:
b- the state of theinputTrackingproperty
-
isInputTracking
public boolean isInputTracking()Determines ifinputTrackingis enabled.- Specified by:
isInputTrackingin interfacePComponentAttribute- Returns:
- True if
inputTrackingis 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:
setCleanin interfacePComponentAttribute
-
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:
isDirtyin interfacePComponentAttribute- Returns:
- True if the user has modified the data represented by this
component, false otherwise. It also returns false if
inputTrackingis 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:
setDefaultin interfacePComponentAttribute
-
isCurrencyDisplay
public boolean isCurrencyDisplay()Determines whether the component currently displays currency data.- Specified by:
isCurrencyDisplayin interfacePComponentAttribute- 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:
setCurrencyDisplayin interfacePComponentAttribute- Parameters:
b- always false, since this component never displays currency data- Since:
- Release 6.2
-
togglePrimaryToSecondary
Does nothing.- Specified by:
togglePrimaryToSecondaryin interfacePComponentAttribute- Specified by:
togglePrimaryToSecondaryin interfacePFieldBean- Parameters:
pri- the primary currency IDsec- the secondary currency ID- Returns:
- The converted value.
- Throws:
RemoteException
-
revertToPrimary
Causes previously toggled data to be reverted back to the primary currency.- Specified by:
revertToPrimaryin interfacePComponentAttribute- Specified by:
revertToPrimaryin interfacePFieldBean- Parameters:
primary- The primary currency- Throws:
RemoteException
-
setDate
Sets the date to display in this component.- Overrides:
setDatein classDateSelector- Parameters:
date- the new date
-
viewDataChange
OverridesPViewDataChangeListener. 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 appropriategetmethods on the controller to get the data, because the() PViewDataChangeEventparameter is no longer used.- Specified by:
viewDataChangein interfacePViewDataChangeListener- Parameters:
event- thePViewDataChangeEventevent that describes the change. No longer used. By default, the value passed in is always set to null.- Throws:
RemoteException- thrown for errors
-
collectData
OverridesPCollectDataListener. Causes the controller to save changes back to the data model. Done prior to committing changes to Portal.- Specified by:
collectDatain interfacePCollectDataListener- Parameters:
event- the data collection event
-
stateChanged
- Specified by:
stateChangedin interfaceChangeListener
-
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:DateSelectorSet editability of text field that displays date- Overrides:
setTextEditablein classDateSelector- Parameters:
b- If true, the date text field is editable; otherwise it is disabled.
-