Business Components

oracle.jbo.html.databeans
Class EditCurrentRecord

java.lang.Object
  |
  +--oracle.jdeveloper.html.WebBeanImpl
        |
        +--oracle.jdeveloper.html.DataWebBeanImpl
              |
              +--oracle.jbo.html.databeans.EditCurrentRecord

public class EditCurrentRecord
extends DataWebBeanImpl

The EditCurrentRecord Data Web Bean edits the current record of a View Object's RowSet. This Web Bean contains two main entry points render() and execute().

JDeveloper's JSP Element wizard instantiates the EditCurrentRecord class in a jsp:useBean tag in a .JSP file. Along with the class, the wizard also includes an ID and a scope declaration set to request. If you change the scope to any other value, you will have to handle possible multithreading issues.

The definition of an EditCurrentRecord edit form provided by the wizard includes these methods: setUseRoundedCorners, setSubmitText, setDeleteText, setShowRecordNumbers, setMaximumFieldWidth, setMaximumFieldHeight, setReleaseApplicationResources, initialize, and render. For example:

 <jsp:useBean   class="oracle.jbo.html.databeans.EditCurrentRecord"
                          id="efDetail"  scope="request" >
 <%

    efDetail.setUseRoundedCorners(true);
    efDetail.setSubmitText("Save Changes");
    efDetail.setDeleteText("Delete Record");
    efDetail.setShowRecordNumbers(true);
    efDetail.setMaximumFieldWidth(40);
    efDetail.setMaximumFieldHeight(0);
    efDetail.setReleaseApplicationResources(true);
    efDetail.initialize(application,session, request,response,out,
                       "package3_Package3Module.EmpView");
    efDetail.render();
 %>
  </jsp:useBean>
 

The value assigned to the setReleaseApplicationResources method determines whether the Application Module is released after the EditCurrentRecord Data Web Bean processes it. Typically, the value should not be set to true unless this is the last Web Bean to be processed in the JSP page.

The EditCurrentRecord Data Web Bean renders the page by using field renderers. A field renderer is a technique of rendering an attribute. For example, TextAreas and Lists are field renderers. The field renderers are responsible for rendering a single attribute from the current row. The createDefaultFieldRenderers() function populates the collection of field renderes for all the visible attributes. You can retrieve an attribute's field renderer by using the getFieldRenderer() function. You can also create your own field renderers:

  1. Implement the oracle.jdeveloper.html.HTMLFieldRenderer interface.
  2. Place your field renderer class on the form and use the setFieldRenderer() function to associate it with an attribute.

For a sample usage of this Data Web Bean, see the sample application generated by the JSP Application Wizard.


Field Summary
protected  java.util.Hashtable fieldRenderers
          The location where the set of field renderers is stored.
protected  int JSlibNeeded
          Determines whether the bean has already generated the required JavaScript libraries.
protected  int maxFieldHeight
          The default display height (in characters) for an attribute.
protected  int maxFieldWidth
          Determines the threshold width (in characters) of the field.
protected  Row newRow
          Stores the new row when EditCurrentRecord is in INSERT mode.
protected  java.lang.String NLSFormat
          Determines the default date format.
protected  boolean renderNewRow
          Determines whether new rows will be inserted into the form.
protected  java.lang.String sDeleteRecord
          Text displayed on the "Delete" button.
protected  boolean showRecordNumber
          Determines whether record numbers are displayed on the form.
protected  java.lang.String sSaveChanges
          Text displayed on the "Save" button.
protected  java.lang.String sTargetUrl
          The target URL of the HTML form.
protected  boolean useJS
          Determines whether JavaScript is used for the dynamic version of EditCurrentRecord.
protected  boolean useRoundedCorners
          Determines whether rounded or squared corners are used on the HTML form.
 
Fields inherited from class oracle.jdeveloper.html.DataWebBeanImpl
attributeRenderers, bReleaseApplication, dispAttrs, qView, sApplication, sRowSetName
 
Fields inherited from class oracle.jdeveloper.html.WebBeanImpl
application, ctx, out, page, request, response, session
 
Constructor Summary
EditCurrentRecord()
           
 
Method Summary
 void createDefaultFieldRenderers()
          Populates the collection of field renderers with the defaults obtained from the View Object attributes.
 void createNewRow()
          Directs the EditCurrentRecord Web Bean to create a new row in the RowSet and to give focus to this row when generating the edit form.
 void execute()
          Reads the _ROWOPERATION parameter from the JSP page's request and performs the appropriate row operation on the record being edited.
 HTMLFieldRenderer getDefaultFieldRenderer(AttributeDef attrDef)
          Retrieves the default field renderer for a specified attribute definition (that is, the attribute metadata).
 HTMLFieldRenderer getFieldRenderer(java.lang.String sAttrName)
          Returns the current field renderer associated with the specified attribute.
 java.lang.String getNLSFormat()
          Returns the NLS date format defined by the Cabo API.
 java.lang.String getTargetUrl()
          Gets the target URL that will receive the HTML FORM parameters when the user clicks the SUBMIT button.
 void internalInitialize()
          internalInitialize
 void render()
          Renders EditCurrentRecord's edit form containing the current record of the View Object's RowSet.
 void setDeleteText(java.lang.String sText)
          Specifies the title used on the DELETE button displayed by the form.
 void setFieldRenderer(java.lang.String sAttrName, HTMLFieldRenderer rField)
          Associates the provided field renderer with the provided attribute.
 void setMaximumFieldHeight(int nHeight)
          Sets the maximum field height for a TextArea (a multi-line text region).
 void setMaximumFieldWidth(int nWidth)
          Sets the maximum field width, measured in number of characters, reserved for the attribute.
 void setNLSFormat(java.lang.String format)
          Sets the NLS format for the date as defined by the Cabo API.
 void setRowSet(RowSet aQuery)
          Internal: Applications should not use this method.
 void setShowRecordNumbers(boolean bShow)
          Determines whether the control will render the record numbers on the form.
 void setSubmitText(java.lang.String sText)
          Specifies the title used on the SUBMIT button displayed by the form.
 void setTargetUrl(java.lang.String sUrl)
          Specifies the target URL that will receive the HTML FORM parameters when the user clicks the SUBMIT button.
 void setUseJS(boolean bSet)
          Determines whether JavaScript is used for the dynamic version of EditCurrentRecord.
 void setUseRoundedCorners(boolean bSet)
          Enables or disables the use of rounded corners in the HTML table generated by this Web Bean.
 void useCheckBoxGroup(java.lang.String sAttribute, java.lang.String sQuery, java.lang.String sLabel, java.lang.String sValue)
          A shortcut method for associating a check box group with the given attribute.
 void useComboBox(java.lang.String sAttribute, java.lang.String sQuery, java.lang.String sLabel, java.lang.String sValue)
          A shortcut method for associating a combo box with the given attribute.
 void useDateField(java.lang.String sAttribute)
          Displays a calendar for the specified attribute.
 void useEditField(java.lang.String sAttribute)
          Displays a single-line edit field in the HMTL form for the specified attribute.
 void useHiddenField(java.lang.String sAttribute)
          Provides a non-viewable field in the HMTL form for the specified attribute.
 void useListBox(java.lang.String sAttribute, java.lang.String sQuery, java.lang.String sLabel, java.lang.String sValue)
          A shortcut method for associating a list box with the given attribute.
 void useListOfValues(java.lang.String sAttribute, java.lang.String voName, java.lang.String sDisplayAttributes, java.lang.String sDataAttribute)
          Enables a LOV (list of values) for the specified attribute in the UI.
 void useLOV(java.lang.String sAttribute, java.lang.String voName)
          Enables a LOV (list of values) for the specified attribute in the UI.
 void useRadioGroup(java.lang.String sAttribute, java.lang.String sQuery, java.lang.String sLabel, java.lang.String sValue)
          A shortcut method for associating a radio button group with the given attribute.
 void useStaticCheckBoxGroup(java.lang.String sAttribute, java.lang.String[] labels, java.lang.String[] values)
          Defines a check box group picklist that is populated from two arrays: one for the labels and the other for the values.
 void useStaticComboBox(java.lang.String sAttribute, java.lang.String[] labels, java.lang.String[] values)
          Defines an attribute's combo box picklist that is populated from two arrays: one for the labels and the other for the values.
 void useStaticListBox(java.lang.String sAttribute, java.lang.String[] labels, java.lang.String[] values)
          Defines an attribute's list box picklist that is populated from two arrays: one for the labels and the other for the values.
 void useStaticRadioGroup(java.lang.String sAttribute, java.lang.String[] labels, java.lang.String[] values)
          Defines a radio group picklist that is populated from two arrays: one for the labels and the other for the values.
 void useTextArea(java.lang.String sAttribute)
          Displays a multi-line edit field in the HTML form for the specified attribute.
 
Methods inherited from class oracle.jdeveloper.html.DataWebBeanImpl
clearDisplayAttributes, getApplicationFromContext, getApplicationName, getAttributeLabel, getDisplayAttributeDefs, getDisplayAttributes, getDisplayFieldRenderer, getEditFieldRenderer, getRowFromKey, getRowKey, getRowSet, getViewObjectName, handleCommit, initialize, initialize, initialize, isAppStateful, releaseApplicationResources, releaseApplicationResources, setDisplayAttributes, setDisplayFieldRenderer, setDisplayFieldRenderer, setEditFieldRenderer, setEditFieldRenderer, setReleaseApplicationResources, shouldDisplayAttribute
 
Methods inherited from class oracle.jdeveloper.html.WebBeanImpl
generateScriptSrc, getCookie, getOut, getRenderingContext, getRequest, getRequestVariable, getUniqueName, initBeanForJS, initialize, initialize, initialize, render, setRequestVariable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sTargetUrl

protected java.lang.String sTargetUrl
The target URL of the HTML form.

sSaveChanges

protected java.lang.String sSaveChanges
Text displayed on the "Save" button. The default value is Save Changes.

sDeleteRecord

protected java.lang.String sDeleteRecord
Text displayed on the "Delete" button. The default value is Delete Record.

fieldRenderers

protected java.util.Hashtable fieldRenderers
The location where the set of field renderers is stored.

renderNewRow

protected boolean renderNewRow
Determines whether new rows will be inserted into the form. The value is true in INSERT mode. The default value is false.

newRow

protected Row newRow
Stores the new row when EditCurrentRecord is in INSERT mode.

showRecordNumber

protected boolean showRecordNumber
Determines whether record numbers are displayed on the form. The value is true to display numbers. The default value is false

maxFieldWidth

protected int maxFieldWidth
Determines the threshold width (in characters) of the field. If this number is exceeded, then the field becomes a TextArea by default. The default value is 70.

maxFieldHeight

protected int maxFieldHeight
The default display height (in characters) for an attribute. The default height is 10.

useRoundedCorners

protected boolean useRoundedCorners
Determines whether rounded or squared corners are used on the HTML form. The value is true for rounded corners.

useJS

protected boolean useJS
Determines whether JavaScript is used for the dynamic version of EditCurrentRecord.

JSlibNeeded

protected int JSlibNeeded
Determines whether the bean has already generated the required JavaScript libraries.

NLSFormat

protected java.lang.String NLSFormat
Determines the default date format. The default format is YYYY-MM-DD.
Constructor Detail

EditCurrentRecord

public EditCurrentRecord()
Method Detail

setUseRoundedCorners

public void setUseRoundedCorners(boolean bSet)
Enables or disables the use of rounded corners in the HTML table generated by this Web Bean.

Parameters:
bSet - true to use rounded corners in the table; false to use squared corners.

setNLSFormat

public void setNLSFormat(java.lang.String format)
Sets the NLS format for the date as defined by the Cabo API.

Parameters:
format - the date format.

getNLSFormat

public java.lang.String getNLSFormat()
Returns the NLS date format defined by the Cabo API.

setUseJS

public void setUseJS(boolean bSet)
Determines whether JavaScript is used for the dynamic version of EditCurrentRecord.

Parameters:
bSet - true to use JavaScript; false otherwise.

setMaximumFieldWidth

public void setMaximumFieldWidth(int nWidth)
Sets the maximum field width, measured in number of characters, reserved for the attribute. If an attribute exceeds this width, a TextArea (a multi-line text region) will be used to edit the contents.

Parameters:
nWidth - width of the field, measured in number of characters.

setMaximumFieldHeight

public void setMaximumFieldHeight(int nHeight)
Sets the maximum field height for a TextArea (a multi-line text region).

Parameters:
nHeight - height of the TextArea, measured in characters.

setShowRecordNumbers

public void setShowRecordNumbers(boolean bShow)
Determines whether the control will render the record numbers on the form.

Parameters:
bShow - true to render record numbers on the form; false to omit record numbers.

setSubmitText

public void setSubmitText(java.lang.String sText)
Specifies the title used on the SUBMIT button displayed by the form.

Parameters:
sText - text displayed on the SUBMIT button.

setDeleteText

public void setDeleteText(java.lang.String sText)
Specifies the title used on the DELETE button displayed by the form.
Parameters:
sText - text displayed on the DELETE button.

setTargetUrl

public void setTargetUrl(java.lang.String sUrl)
Specifies the target URL that will receive the HTML FORM parameters when the user clicks the SUBMIT button.

Parameters:
sUrl - target URL for the HTML FORM parameters.

getTargetUrl

public java.lang.String getTargetUrl()
Gets the target URL that will receive the HTML FORM parameters when the user clicks the SUBMIT button.

Returns:
URL that receives the HTML FORM parameters.

setRowSet

public void setRowSet(RowSet aQuery)
Internal: Applications should not use this method.

Sets up the RowSet that contains the row to be edited. That is, it clears the field renderers if the row to be edited is null; otherwise, it populates the the row with its field renderers.

The RowSet is automatically retrieved as a side effect of the initialize() function. Call setRowSet only if you need to initialize the Web Bean with a RowSet other than the one designated by the initialize method.

Overrides:
setRowSet in class DataWebBeanImpl
Parameters:
aQuery - the RowSet to be edited.

createNewRow

public void createNewRow()
Directs the EditCurrentRecord Web Bean to create a new row in the RowSet and to give focus to this row when generating the edit form. This method also sets the control in "new row" mode so that it can encode enough information in the HTML FORM to handle the subsequent submission.

createDefaultFieldRenderers

public void createDefaultFieldRenderers()
Populates the collection of field renderers with the defaults obtained from the View Object attributes. If you want to add your own field renderer, you must add it after this call is made; otherwise, it will be removed from the list.

getDefaultFieldRenderer

public HTMLFieldRenderer getDefaultFieldRenderer(AttributeDef attrDef)
Retrieves the default field renderer for a specified attribute definition (that is, the attribute metadata).

Parameters:
attrDef - an attribute definition.
Returns:
default field renderer for the attribute definition.

setFieldRenderer

public void setFieldRenderer(java.lang.String sAttrName,
                             HTMLFieldRenderer rField)
Associates the provided field renderer with the provided attribute. Use this method if you want to associate your own field renderer with a row's attribute.

Parameters:
sAttrName - name of the attribute.
rField - name of the field renderer.

getFieldRenderer

public HTMLFieldRenderer getFieldRenderer(java.lang.String sAttrName)
Returns the current field renderer associated with the specified attribute. This function is very useful when you need to Set or Get an attribute of the field renderer to, for example, change the field prompt or width.

Parameters:
sAttrName - name of the attribute.
Returns:
current field renderer for the specified attribute.

useComboBox

public void useComboBox(java.lang.String sAttribute,
                        java.lang.String sQuery,
                        java.lang.String sLabel,
                        java.lang.String sValue)
A shortcut method for associating a combo box with the given attribute. The combo box control is populated using the provided SQL query. The query must be valid within the connection being used by the application module that contains the RowSet. The sLabel parameter specifies the name of the column to be used for the prompt. The sValue parameter specifies the name of the column to be used for the value. The sLabel and sValue columns must be part of the result set defined by the provided query.

Parameters:
sAttribute - name of the attribute to be associated with the combo box.
sQuery - string representing the query used to populate the combo box.
sLabel - name of the column used for the prompt.
sValue - name of the column used for the value.

useStaticComboBox

public void useStaticComboBox(java.lang.String sAttribute,
                              java.lang.String[] labels,
                              java.lang.String[] values)
Defines an attribute's combo box picklist that is populated from two arrays: one for the labels and the other for the values. The combo box displays the name of the attribute next to the input field. The labels and values arrays must have the same dimension.

Parameters:
sAttribute - name of attribute represented by the combo box.
labels - String array containing the labels for each value.
values - String array containing the values assoicated with each label.

useListBox

public void useListBox(java.lang.String sAttribute,
                       java.lang.String sQuery,
                       java.lang.String sLabel,
                       java.lang.String sValue)
A shortcut method for associating a list box with the given attribute. The list box control is populated using the specified SQL query. The query must be valid within the connection being used by the application module that contains the RowSet. The sLabel parameter specifies the name of the column to be used for the prompt. The sValue paramter should contain the name of the column to be used for the value. The sLabel and sValue columns must be part of the result set defined by the provided query.

Parameters:
sAttribute - name of the attribute to be associated with the list box.
sQuery - string representing the query used to populate the list box.
sLabel - name of the column used for the prompt.
sValue - name of the column used for the value.

useStaticListBox

public void useStaticListBox(java.lang.String sAttribute,
                             java.lang.String[] labels,
                             java.lang.String[] values)
Defines an attribute's list box picklist that is populated from two arrays: one for the labels and the other for the values. The list box displays the name of the attribute next to the input field. The labels and values arrays must have the same dimension.

Parameters:
sAttribute - name of attribute represented by the list box.
labels - String array containing the labels for each value.
values - String array containing the values assoicated with each label.

useRadioGroup

public void useRadioGroup(java.lang.String sAttribute,
                          java.lang.String sQuery,
                          java.lang.String sLabel,
                          java.lang.String sValue)
A shortcut method for associating a radio button group with the given attribute. The radio button group is populated using the specified SQL query. The query must be valid within the connection being used by the application module that contains the RowSet. The sLabel parameter specifies the name of the column to be used for the prompt. The sValue paramter specifies the name of the column to be used for the value. The sLabel and sValue columns must be part of the result set defined by the provided query. The radio button group displays the name of the attribute next to the input field.

Parameters:
sAttribute - name of the attribute to be associated with the radio group.
sQuery - string representing the query used to populate the radio group.
sLabel - name of the column used for the prompt.
sValue - name of the column used for the value.

useStaticRadioGroup

public void useStaticRadioGroup(java.lang.String sAttribute,
                                java.lang.String[] labels,
                                java.lang.String[] values)
Defines a radio group picklist that is populated from two arrays: one for the labels and the other for the values. The name of the attribute is displayed with the radio group. The labels and values arrays must have the same dimension.

Parameters:
sAttribute - name of attribute represented by the radio group.
labels - String array containing the labels for each value.
values - String array containing the values assoicated with each label.

useCheckBoxGroup

public void useCheckBoxGroup(java.lang.String sAttribute,
                             java.lang.String sQuery,
                             java.lang.String sLabel,
                             java.lang.String sValue)
A shortcut method for associating a check box group with the given attribute. The check box group is populated using the specified SQL query. The query must be valid within the connection being used by the application module that contains the RowSet. The sLabel parameter specifies the name of the column to be used for the prompt. The sValue paramter specifies the name of the column to be used for the value. The sLabel and sValue columns must be part of the result set defined by the provided query. The name of the attribute is displayed with the check box group.

Parameters:
sAttribute - name of the attribute to be associated with the check box group.
sQuery - string representing the query used to populate the check box group.
sLabel - name of the column used for the prompt.
sValue - name of the column used for the value.

useStaticCheckBoxGroup

public void useStaticCheckBoxGroup(java.lang.String sAttribute,
                                   java.lang.String[] labels,
                                   java.lang.String[] values)
Defines a check box group picklist that is populated from two arrays: one for the labels and the other for the values. The labels and values arrays must have the same dimension.

Parameters:
sAttribute - name of attribute represented by the check box group.
labels - string array containing the labels for each value.
values - string array containing the values assoicated with each label.

useEditField

public void useEditField(java.lang.String sAttribute)
Displays a single-line edit field in the HMTL form for the specified attribute.
Parameters:
sAttribute - the attribute for which a single-line edit field should be displayed.

useTextArea

public void useTextArea(java.lang.String sAttribute)
Displays a multi-line edit field in the HTML form for the specified attribute.

Parameters:
sAttribute - the attribute for which a single-line edit field should be displayed.

useHiddenField

public void useHiddenField(java.lang.String sAttribute)
Provides a non-viewable field in the HMTL form for the specified attribute.

Parameters:
sAttribute - name of the attrubute that should be stored in a non-viewable field.

useDateField

public void useDateField(java.lang.String sAttribute)
Displays a calendar for the specified attribute.
Parameters:
sAttribute - the attribute for which a calendar should be displayed.

useListOfValues

public void useListOfValues(java.lang.String sAttribute,
                            java.lang.String voName,
                            java.lang.String sDisplayAttributes,
                            java.lang.String sDataAttribute)
Enables a LOV (list of values) for the specified attribute in the UI. In the typical case, when an attribute is selected in an HTML form, a LOV will be displayed.

This method enables a LOV for one or more of the RowSet's attributes. To return all of the RowSet's attributes, use the useLOV method.

Parameters:
sAtttibute - name of the attribute for which an LOV should be enabled.
voName - name of the View Object to which the attribute belongs.
sDisplayAttributes - a comma-separated list of the RowSet's attributes that will be displayed when the attribute is selected.
sDataAttribute - the location from which the attributes' values are obtained.
See Also:
useLOV(String, String)

useLOV

public void useLOV(java.lang.String sAttribute,
                   java.lang.String voName)
Enables a LOV (list of values) for the specified attribute in the UI. In the typical case, when the specified attribute is selected in an HTML form, a LOV will be displayed.

This method enables a LOV for all of the RowSet's attributes. To enable a LOV for a subset of the attributes, use the useListOfValues method.

Parameters:
sAtttibute - name of the attribute for which an LOV should be enabled.
voName - name of the View Object to which the attribute belongs.
See Also:
useListOfValues(String, String, String, String)

execute

public void execute()
             throws java.lang.Exception
Reads the _ROWOPERATION parameter from the JSP page's request and performs the appropriate row operation on the record being edited. Possible values for _ROWOPERATION are:

render

public void render()
            throws java.lang.Exception
Renders EditCurrentRecord's edit form containing the current record of the View Object's RowSet.
Overrides:
render in class WebBeanImpl

internalInitialize

public void internalInitialize()
                        throws java.lang.Exception
internalInitialize
Overrides:
internalInitialize in class DataWebBeanImpl
Throws:
java.lang.Exception -  

Business Components