JDatePicker v4.3

com.standbysoft.component.date.swing.jclient
Class DateEditComponentBinding

java.lang.Object
  extended byjava.util.AbstractMap
      extended byoracle.jbo.common.JboAbstractMap
          extended byoracle.adf.model.binding.DCControlBinding
              extended byoracle.jbo.uicli.binding.JUControlBinding
                  extended byoracle.jbo.uicli.binding.JUCtrlValueBinding
                      extended byoracle.jbo.uicli.binding.JUCtrlAttrsBinding
                          extended bycom.standbysoft.component.date.swing.jclient.DateEditComponentBinding
All Implemented Interfaces:
oracle.adf.model.AttributeBinding, oracle.binding.AttributeBinding, oracle.adf.model.ControlBinding, oracle.binding.ControlBinding, DateListener, DateModel, java.util.EventListener, oracle.jbo.uicli.binding.JUCtrlInputValueHandler, oracle.jbo.uicli.binding.JUCtrlValueHandler, java.util.Map, oracle.jbo.StructureDef

public class DateEditComponentBinding
extends oracle.jbo.uicli.binding.JUCtrlAttrsBinding
implements DateModel, DateListener

DateEditComponentBinding is a lightweight date model that implements binding a com.standbysoft.component.date.swing.JDateEditComponent to an attribute in a row of a BC4J ViewObject.

See Also:
Row, JDateField, JDatePicker, JDateEditComponent

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class oracle.jbo.uicli.binding.JUCtrlValueBinding
ATTR_ATTRIBUTE, ATTR_ATTRIBUTE_DEF, ATTR_ATTRIBUTE_DEFS, ATTR_ATTRIBUTE_VALUE, ATTR_ATTRIBUTE_VALUES, ATTR_ATTRIBUTES, ATTR_DISPLAY_HEIGHT, ATTR_DISPLAY_HINT, ATTR_DISPLAY_WIDTH, ATTR_FORMAT, ATTR_FORMATS, ATTR_INPUT_VALUE, ATTR_LABEL, ATTR_LABELS, ATTR_LABELSET, ATTR_MANDATORY, ATTR_PATH, ATTR_TOOLTIP, ATTR_UPDATEABLE, ATTR_VIEWABLE, mHasInputVal, mInputVal, SEP_LIST_DISPLAY
 
Fields inherited from class oracle.adf.model.binding.DCControlBinding
ATTR_CURRENTROW, ATTR_DEF, ATTR_ERROR, ATTR_ERRORS, ATTR_FULLNAME, ATTR_ITER, ATTR_NAME, mAttributeListener, mInternalGet_KeyResolved, ROW_KEY_STR
 
Constructor Summary
DateEditComponentBinding(JDateEditComponent control, oracle.jbo.uicli.binding.JUIteratorBinding iterBinding, java.lang.String attrName)
          Creates an instance of this binding object that binds a JDateEditComponent with an attribute for rows in a given Iterator binding.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles the actionPerformed event generated by the associated TextControl.
 void addControlToPanel(java.lang.Object panel, java.lang.Object layoutObject, java.lang.Object layoutCons)
          *** For internal framework use only ***
 void addDateListener(DateListener listener)
          Registers a new date listener to the model.
 void clear(int field)
          Clears a specified field, meaning that it contains no value.
static DateModel createAttributeBinding(oracle.jbo.uicli.binding.JUFormBinding formBinding, JDateEditComponent control, java.lang.String voInstanceName, java.lang.String voIterName, java.lang.String voIterBindingName, java.lang.String attrName)
          This method is used by the JDeveloper designtime wizards for binding a date edit component with an attribute of rows of a ViewObject/RowIterator.
 void dateChanged(DateEvent evt)
          Handles the dateChanged event generated by the associated JDateEditComponent.
 void dateFieldChanged(DateEvent evt)
          Does nothing.
 void dateFieldCleared(DateEvent evt)
          Does nothing.
 int get(int field)
          Returns the value of a specified field.
 int getAutoCenturyYear()
          Determines the reference year used to build the long year from a short one.
 java.lang.Object getControlModel(java.lang.Object control)
          Gets the associated View's model object.
 java.util.Date getDate()
          Returns the date wrapped by this model.
 int getMaximumAllowed(int field, java.util.Date date)
          Returns the highest acceptable value for a certain field.
 int getMinimumAllowed(int field, java.util.Date date)
          Returns the lowest acceptable value for a certain field.
protected  DateModel getModelImpl(JDateEditComponent control)
          Returns the DateModel object that provides data for the given control.
 java.util.TimeZone getTimeZone()
          Returns the time zone used by this model.
 java.lang.Object getValueAt(int attrIndex)
          Fetches the date contained in the associated control.
 boolean isAutoCentury()
          Determines whether century is automatically added to the year field if its value is less than 100.
protected  boolean isControlQueriable()
          Returns true, so that JDateEditComponents can participate in a query in the Find Mode of the containing panel.
 boolean isDateValid()
          Determines whether the date represented by this model is valid or not.
 boolean isSet(int field)
          Determines whether a specified field is cleared or not.
 boolean isUsed(int field)
          Determines whether a specified field is part of the date.
 void release(int flags)
           
 void removeDateListener(DateListener listener)
          Removes a specified date listener from this model.
 void set(int field, int value)
          Modifies the value of a specified date field.
 void setAutoCentury(boolean auto)
          Specifies whether century is automatically added to the year field if its value is less than 100.
 void setAutoCenturyYear(int year)
          Specifies the year used to build the long year when short years are used.
 void setControl(java.lang.Object ctrl)
          Bind this binding to a control.
 void setDataValueAt(java.lang.Object value, int attrIndex)
          Applications should call this method to update the value of an attribute using this binding such that both the associated text control and the associated row attribute gets updated.
 void setDate(java.util.Date date)
          Specifies a new date to be represented by this model that can later be modified field by field.
 void setTimeZone(java.util.TimeZone zone)
          Specifies the time zone for this model.
 void setUsed(int field, boolean used)
          Specifies whether a certain field is used to construct the actual date represented here.
 void setValueAt(java.lang.Object value, int attrIndex)
          Sets the given Date representation of value into the associated date edit control.
 
Methods inherited from class oracle.jbo.uicli.binding.JUCtrlAttrsBinding
createAttributeBinding, refreshControl, setControlEnabled, toString, updateNavigated, updateRangeScrolled, updateValuesFromRow, updateValuesFromRows
 
Methods inherited from class oracle.jbo.uicli.binding.JUCtrlValueBinding
compareAndSetAttribute, displayInShortForm, ensureVariableManager, findAttributeDef, getAttribute, getAttribute, getAttribute, getAttributeCount, getAttributeDef, getAttributeDef, getAttributeDefs, getAttributeFromRow, getAttributeFromRow, getAttributeFromRow, getAttributeFromRow, getAttributeFromRow, getAttributeIndexOf, getAttributeNames, getAttributes, getAttributes, getAttributeUIHelper, getAttributeValidators, getAttributeValidators, getAttributeValue, getAttributeValue, getAttributeValueFromRow, getAttributeValues, getAttributeValues, getControlType, getDisplayHeight, getDisplayHint, getDisplayWidth, getError, getErrors, getFormat, getFormats, getHint, getHint, getInputErrorsForRowKey, getInputValue, getInputValue, getInputValueHandler, getInputValueInRow, getLabel, getLabel, getLabels, getLabelSet, getLocaleContext, getMergedAttributeValues, getNullValueString, getPath, getTooltip, getTooltip, hasFormatInformation, hasVariables, initResources, internalGet, internalGetRow, internalHasPermission, isArrayIteratorType, isAttributeMandatory, isAttributeUpdateable, isAttributeUpdateable, isMandatory, isNewInputValue, isUpdateable, lookupAttributeDef, processInputException, processNewInputValue, put, resetInputState, resolvePath, setArrayIteratorType, setAttribute, setAttribute, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeInRow, setAttributeValue, setError, setInputValue, setInputValue, setInputValueHandler, setInputValueInRow, setNullValueString, stopEditing, updateRowDeleted, updateRowInserted, validateInputValue
 
Methods inherited from class oracle.jbo.uicli.binding.JUControlBinding
getCurrentRow, getFormBinding, getIteratorBinding, reportException, setFormBinding
 
Methods inherited from class oracle.adf.model.binding.DCControlBinding
addToDCExceptions, executeQuery, executeQueryIfNeeded, get, getAllRowsInRange, getApplicationModule, getBindingContainer, getControl, getDCIteratorBinding, getDef, getDefFullName, getDefName, getFullName, getLayoutObject, getName, getRowAtRangeIndex, getRowIterator, getTransaction, getViewObject, hashCode, internalHasPermission, internalSetName, needsEstimatedRowCount, removeFromDCExceptions, reportException, resetAttributeExceptionInRow, setBindingContainer, setListener, setListener, setName
 
Methods inherited from class oracle.jbo.common.JboAbstractMap
entrySet, equals, internalPut
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.adf.model.AttributeBinding
getErrors, getInputValue, getLabel, isUpdateable, processNewInputValue, setInputValue, validateInputValue
 
Methods inherited from interface oracle.binding.ControlBinding
getName, getPath, resolvePath, setListener
 
Methods inherited from interface oracle.adf.model.ControlBinding
setListener
 
Methods inherited from interface oracle.jbo.StructureDef
getDefFullName, getDefName, getFullName, getName
 

Constructor Detail

DateEditComponentBinding

public DateEditComponentBinding(JDateEditComponent control,
                                oracle.jbo.uicli.binding.JUIteratorBinding iterBinding,
                                java.lang.String attrName)
Creates an instance of this binding object that binds a JDateEditComponent with an attribute for rows in a given Iterator binding. This binding object holds on to the DateModel object behind the JDateEditComponent control, if one is found. Otherwise, it attempts to set a DefaultDateModel as the date model of the JDateEditComponent.

This binding object also registers itself as a DateModelListener so that when a date is selected into the JDateEditComponent, this binding object responds by saving the date in the control into the BC4J Row object. The same save operation occurs on focus out from the control, as it also registers a FocusAdapter that performs the set operation on the BC4J Row object for the given attribute when focus moves out of this control.

JDeveloper wizards use the createAttributeBinding() method that returns a DateModel object to bind a ViewObject and attribute to a date control. An example usage for binding to Deptno attribute of DeptView ViewObject instance is like: jDateField1.setDateModel(DateEditComponentBinding.createAttributeBinding(panelBinding, jDateField1, "PersonView", null, "PersonViewIter", "PersonDate")); More details on the arguments can be found in the javadoc for the above method.

Parameters:
control - JDateEditComponent which should be bound to an attribute of a BC4J row.
iterBinding - JUIteratorBinding object that contains a reference to the RowIterator that contains Rows to display.
attrName - Name of the attribute in the BC4J Row object to display.
Method Detail

setControl

public void setControl(java.lang.Object ctrl)
Bind this binding to a control.


getModelImpl

protected DateModel getModelImpl(JDateEditComponent control)
Returns the DateModel object that provides data for the given control. If no DateModel object is registered with the control, then this method creates an instance of DefaultDateModel and registers that as the DateModel object for the given control.


isControlQueriable

protected boolean isControlQueriable()
Returns true, so that JDateEditComponents can participate in a query in the Find Mode of the containing panel. When the containing panel Binding object is set to Find mode, it queries all control-bindings in it and disables those controls whose bindings return false for this method during the Find mode. The return value from this method indicates whether to consult an attribute definition for queriability.

An application could create a subclass of this binding object and return false from this method to prevent the associated control from participating in find mode. Additionally, a BC4J attribute itself can control whether that attribute can participate in Query or not. That property takes precedence over this method's return, if this method returns true. In other words, if this binding is bound to a CLOB attribute type and the attribute definition for that attribute indicates that it is not queriable, then the default behavior of JUPanelBinding in Find mode will be to disable this binding's control, even though this method returns true.


addControlToPanel

public void addControlToPanel(java.lang.Object panel,
                              java.lang.Object layoutObject,
                              java.lang.Object layoutCons)
*** For internal framework use only ***


getValueAt

public java.lang.Object getValueAt(int attrIndex)
Fetches the date contained in the associated control. This method is used by the framework to get the current value associated with this binding to update into the associated attribute of a BC4J Row. This method calls the JDateEditComponent#getSelectedDate() to get the value.

Parameters:
attrIndex - ignored for this control binding
See Also:
JDateComponent.getSelectedDate()

setValueAt

public void setValueAt(java.lang.Object value,
                       int attrIndex)
Sets the given Date representation of value into the associated date edit control. Calls JDateEditComponent.setSelectedDate() to set the value.

Parameters:
value - date to display in the associated date control
attrIndex - ignored for this control binding
See Also:
JDateEditComponent.setSelectedDate(Date)

setDataValueAt

public void setDataValueAt(java.lang.Object value,
                           int attrIndex)
Applications should call this method to update the value of an attribute using this binding such that both the associated text control and the associated row attribute gets updated.

Parameters:
value - Value to display in the associated text control and to set in the attribute.
attrIndex - Ignored for this control binding.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles the actionPerformed event generated by the associated TextControl. Sets the associated attribute in this binding's iterator's current Row, with the current value from the text control.


getControlModel

public java.lang.Object getControlModel(java.lang.Object control)
Gets the associated View's model object.


createAttributeBinding

public static DateModel createAttributeBinding(oracle.jbo.uicli.binding.JUFormBinding formBinding,
                                               JDateEditComponent control,
                                               java.lang.String voInstanceName,
                                               java.lang.String voIterName,
                                               java.lang.String voIterBindingName,
                                               java.lang.String attrName)
This method is used by the JDeveloper designtime wizards for binding a date edit component with an attribute of rows of a ViewObject/RowIterator. This method calls JUFormBinding.getRowIterBinding to get the iterator binding using the given parameters and then registers a new DateEditComponentBinding with the iterator binding object so as to display/edit the current row's attribute of the given name.

Parameters:
formBinding - The containing JUPanelBinding in which the given iterator binding would be found/created.
control - The control instance to bind to a ViewObject's attribute.
voInstanceName - Name of the instance of the ViewObject in a BC4J ApplicationModule.
voIterName - Runtime instance name of the iterator in the ViewObject (optional).
voIterBindingName - Instance name of the iterator binding that uniquely identifies an iterator binding object used to read/write data in this given JUPanelBinding instance.
attrName - The name of the attribute of this ViewObject rows that contains data to display/edit in the associated date edit control.
Returns:
DateModel object bound to the given date edit control.

release

public void release(int flags)
Specified by:
release in interface oracle.binding.ControlBinding

isDateValid

public boolean isDateValid()
Description copied from interface: DateModel
Determines whether the date represented by this model is valid or not.

Specified by:
isDateValid in interface DateModel
Returns:
true if the date is valid; false otherwise

getMinimumAllowed

public int getMinimumAllowed(int field,
                             java.util.Date date)
Description copied from interface: DateModel
Returns the lowest acceptable value for a certain field. For some fields this value might depend on other date fields.

Specified by:
getMinimumAllowed in interface DateModel
Parameters:
field - field that is tested
date - context object that can offer additional information about the other date fields
Returns:
lowest acceptable value for a certain field, like 0 for the minute field
See Also:
DateModel.set(int, int)

getMaximumAllowed

public int getMaximumAllowed(int field,
                             java.util.Date date)
Description copied from interface: DateModel
Returns the highest acceptable value for a certain field. For some fields like day of month, this value might depend on other date fields. For instance, the days in a month depend on the month and in the case of February, they also depend on the year.

Specified by:
getMaximumAllowed in interface DateModel
Parameters:
field - field that is tested
date - context object that can offer additional information about the other date fields
Returns:
highest acceptable value for a certain field, like 59 for the minute field
See Also:
DateModel.set(int, int)

setDate

public void setDate(java.util.Date date)
Description copied from interface: DateModel
Specifies a new date to be represented by this model that can later be modified field by field. A null date will clear all the basic fields like Calendar.YEAR, Calendar.MONTH, Calendar.DATE, Calendar.HOUR, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND.

Specified by:
setDate in interface DateModel
Parameters:
date - date wrapped by the model
See Also:
DateModel.clear(int)

getDate

public java.util.Date getDate()
Description copied from interface: DateModel
Returns the date wrapped by this model. If there are missing fields and the date cannot be computed then a null date is returned.

Specified by:
getDate in interface DateModel
Returns:
date wrapped by this model.
See Also:
DateModel.setDate(Date), DateModel.isSet(int)

setTimeZone

public void setTimeZone(java.util.TimeZone zone)
Description copied from interface: DateModel

Specifies the time zone for this model. This parameter is very important if you need to know the values of the date fields in a certain time zone. If no time zone is specified, then the default one is used.

The dates that come in and out of this model are standard (GMT) while the values of the date fields depend on the time zone. If the time zone is changed, so do the internal date fields in order to reflect this change.

Specified by:
setTimeZone in interface DateModel
Parameters:
zone - new time zone for this model
See Also:
DateModel.get(int)

getTimeZone

public java.util.TimeZone getTimeZone()
Description copied from interface: DateModel
Returns the time zone used by this model.

Specified by:
getTimeZone in interface DateModel
Returns:
time zone used by this model.
See Also:
DateModel.setTimeZone(TimeZone)

set

public void set(int field,
                int value)
Description copied from interface: DateModel
Modifies the value of a specified date field.

Specified by:
set in interface DateModel
Parameters:
field - date field that is modified. Possible values are: Calendar.YEAR, Calendar.MONTH, Calendar.MINUTE, etc.
value - the new date field value. Various implementations could handle this value differently. Some may allow and some may not allow out of range values.
See Also:
DateModel.getMinimumAllowed(int, Date), DateModel.getMaximumAllowed(int, Date)

get

public int get(int field)
Description copied from interface: DateModel
Returns the value of a specified field.

Specified by:
get in interface DateModel
Parameters:
field - date field that is tested. Possible values are: Calendar.YEAR, Calendar.MONTH, Calendar.MINUTE, etc.
Returns:
value of the specified field.
See Also:
DateModel.setTimeZone(TimeZone)

clear

public void clear(int field)
Description copied from interface: DateModel
Clears a specified field, meaning that it contains no value.

Specified by:
clear in interface DateModel
Parameters:
field - field that is cleared. Possible values are: Calendar.YEAR, Calendar.MONTH, Calendar.MINUTE, etc.
See Also:
DateModel.isSet(int)

isSet

public boolean isSet(int field)
Description copied from interface: DateModel
Determines whether a specified field is cleared or not.

Specified by:
isSet in interface DateModel
Parameters:
field - field that is tested. Possible values are: Calendar.YEAR, Calendar.MONTH, Calendar.MINUTE, etc.
Returns:
true if the field is not cleared; false otherwise
See Also:
DateModel.clear(int)

setUsed

public void setUsed(int field,
                    boolean used)
Description copied from interface: DateModel

Specifies whether a certain field is used to construct the actual date represented here. When the date is evaluated, all the fields that it uses (marked with this method as used) must contain a value. Otherwise, the date is considered incomplete and it is in fact a null date.

This method is mainly intended for use by date editing components that restrict the represented date only to some of its fields.

Specified by:
setUsed in interface DateModel
Parameters:
field - specified field that is marked as used or unused
used - true if the field is part of the date; false otherwise
See Also:
DateModel.clear(int), DateModel.getDate()

isUsed

public boolean isUsed(int field)
Description copied from interface: DateModel
Determines whether a specified field is part of the date.

Specified by:
isUsed in interface DateModel
Parameters:
field - field that is tested
Returns:
true if the field is part of the date; false otherwise
See Also:
DateModel.setUsed(int, boolean)

setAutoCentury

public void setAutoCentury(boolean auto)
Description copied from interface: DateModel
Specifies whether century is automatically added to the year field if its value is less than 100.

Specified by:
setAutoCentury in interface DateModel
Parameters:
auto - true if century is automatically added; false otherwise
See Also:
DateModel.setAutoCenturyYear(int)

isAutoCentury

public boolean isAutoCentury()
Description copied from interface: DateModel
Determines whether century is automatically added to the year field if its value is less than 100.

Specified by:
isAutoCentury in interface DateModel
Returns:
true if century is automatically added; false otherwise.
See Also:
DateModel.setAutoCentury(boolean)

setAutoCenturyYear

public void setAutoCenturyYear(int year)
Description copied from interface: DateModel

Specifies the year used to build the long year when short years are used. One can use short years which range from 0..99 when the autoCentury property is enabled. This means that instead of typing 1980 you can just use 80.

The short year is converted into a long year after it is compared with the last two digits of the autoCenturyYear year. Here are some examples that show how this mechanism works:

shortautoCenturyYearlong
3019301930
5619301956
1119302011

Specified by:
setAutoCenturyYear in interface DateModel
Parameters:
year - reference year used to build the long year from a short one
See Also:
DateModel.setAutoCentury(boolean)

getAutoCenturyYear

public int getAutoCenturyYear()
Description copied from interface: DateModel
Determines the reference year used to build the long year from a short one. By default, this year is 1930.

Specified by:
getAutoCenturyYear in interface DateModel
Returns:
reference year used to build the long year from a short one.
See Also:
DateModel.setAutoCenturyYear(int)

addDateListener

public void addDateListener(DateListener listener)
Description copied from interface: DateModel
Registers a new date listener to the model.

Specified by:
addDateListener in interface DateModel
Parameters:
listener - listener to be registered

removeDateListener

public void removeDateListener(DateListener listener)
Description copied from interface: DateModel
Removes a specified date listener from this model.

Specified by:
removeDateListener in interface DateModel
Parameters:
listener - listener to be removed

dateChanged

public void dateChanged(DateEvent evt)
Handles the dateChanged event generated by the associated JDateEditComponent. Sets the associated attribute in this binding's iterator's current Row, with the current value from the date edit component.

Specified by:
dateChanged in interface DateListener
Parameters:
evt - event that describes the date change

dateFieldChanged

public void dateFieldChanged(DateEvent evt)
Does nothing. It exists because the interface had to be implemented.

Specified by:
dateFieldChanged in interface DateListener
Parameters:
evt - event that describes the field change

dateFieldCleared

public void dateFieldCleared(DateEvent evt)
Does nothing. It exists because the interface had to be implemented.

Specified by:
dateFieldCleared in interface DateListener
Parameters:
evt - event that describes the field change

JDatePicker v4.3

Visit www.jdatepicker.com for further information or send us your suggestions.

Copyright © 2003-2007 Stand By Soft Ltd. All Rights Reserved.