Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.html.databeans
Class FindForm

java.lang.Object
  extended byoracle.jdeveloper.html.WebBeanImpl
      extended byoracle.jdeveloper.html.DataWebBeanImpl
          extended byoracle.jbo.html.DataWebBeanImpl
              extended byoracle.jbo.html.databeans.FindForm
All Implemented Interfaces:
DataWebBean, DataWebBean, WebBean, WebBean

public class FindForm
extends DataWebBeanImpl

The FindForm Data Web Bean generates a search form. The generated search form can be one of these types:

JDeveloper's JSP Element wizard instantiates the FindForm 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 a FindForm provided by the wizard includes these methods: setTargetUrl, setUseSimpleMode, setReleaseApplicationResources, initialize, and render. For example:

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

 	ffdetail.setTargetUrl("");
 	ffdetail.setUseSimpleMode("Ename");
 	ffdetail.setReleaseApplicationResources(false);
 	ffdetail.initialize(application,session, request,response,out,
                      "package3_Package3Module.EmpView");
 	ffdetail.render();
 %>
 </jsp:useBean>
 

The value assigned to the setReleaseApplicationResources method determines whether the Application Module is released after the FindForm 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.

Since the FindForm bean generates an HTML form, you need to actually make use of it in two JSP pages. One page will use the FindForm by initializing it and calling the render() method to generate the query submission UI. The target page would also make use of the FindForm and call render(), but the receiving page would be sent extra URL parameters that let the FindForm Web Bean know that it needs to execute the query instead of rendering the query screen.

For example, consider this code snippet from the file DeptView_Query.jsp generated by the Web Application Wizard. The snippet renders the FindForm, then lets you navigate through the query results one record at a time.

 <body>
 <center><h2>DeptView</h2></center>
 <br>
 <jsp:useBean id="RowQuery" class="oracle.jbo.html.databeans.FindForm"
                                     scope="request">
 <%
 	RowQuery.initialize(application, session , request, response, out,
                            "package1_Package1Module.DeptView");

 	RowQuery.setTargetUrl("DeptView_Query.jsp");
 	RowQuery.setReleaseApplicationResources(true);
 	RowQuery.render();

 %>
 </jsp:useBean>

 <%
 	if(RowQuery.queryWasExecuted())
     {
 %>
 <jsp:useBean   class="oracle.jbo.html.databeans.NavigatorBar"  id="tb"
                        scope="request" />
 <%
  tb.setTargetUrl("DeptView.jsp");
 tb.initialize(application,session, request,response,out,
                       "package1_Package1Module.DeptView");
 String sImageBase = (String)session.getValue("ImageBase");

 tb.getContainer().setImageBase(sImageBase);

      // code to define toolbar buttons

  tb.render();
 %>
 <br>
 <jsp:useBean id="RowViewer"
         class="oracle.jbo.html.databeans.ViewCurrentRecord" scope="request">
 <%
 	RowViewer.initialize(application, session , request, response, out,
                       "package1_Package1Module.DeptView");
 	RowViewer.setReleaseApplicationResources(true);
 	RowViewer.render();
 %>
 </jsp:useBean>
 <%
 	}
 %>
 </body>
 

The code snippet above initially renders the FindForm in the DeptView_Query.jsp. When the user clicks the "Add Condition" or "Clear Query" buttons, the if(RowQuery.queryWasExecuted()) test will fail and the .jsp page will continue to render the FindForm.

Since setTargetUrl() is set to DeptView_Query.jsp, the FindForm will be rendered "in-place". That is, DeptView_Query.jsp acts as its own target page.

When the user clicks "Execute Query", the FindForm query will be executed and the if(RowQuery.queryWasExecuted()) test will pass. The results of the query will be displayed by the ViewCurrentRecord Data Web Bean. In this case, the ViewCurrentRecord Data Web Bean acts as the receiving page described above. Note that although this example uses the ViewCurrentRecord Data Web Bean to display the results, any appropriate Date Web Bean, such as RowSetBrowser, can be used.


Field Summary
protected  boolean bClearWhereClause
           
protected  boolean bSimpleMode
           
protected  boolean bWasExecuted
           
protected  java.lang.String sAttribute
           
protected  int simpleEditLength
           
protected  java.lang.String sTarget
           
protected  java.lang.String sTargetUrl
           
protected  boolean useJS
           
protected  boolean useRoundedCorners
           
 
Fields inherited from class oracle.jdeveloper.html.DataWebBeanImpl
amName, bReleaseApplication, dispAttrs, ds
 
Fields inherited from class oracle.jdeveloper.html.WebBeanImpl
application, bUsedInTag, out, page, request, response, session
 
Fields inherited from interface oracle.jdeveloper.html.WebBean
contentFrameName, defaultCaboBase, defaultCaboImageBase, defaultImageBase, defaultJSPBase, defaultNLSFormat, JS_LIBRARIES, JS_NAMEID, JSButtonConstructorLib, JSCalendarConstructorLib, JSContainerConstructorLib, JSDataConstructLib, JSModalPageConstructorLib, JSTableConstructLib, JSToolbarConstructorLib, JSTreeConstructLib, JSUtilitiesLib
 
Constructor Summary
FindForm()
           
 
Method Summary
 void clearQueryConditions()
          Internal: Applications should not use this method.
 void clearSimpleMode()
          Disables the simple search form UI and enables the advanced search form UI.
 void execute()
          Executes the query defined by the query definition.
 QueryDefinition getQueryDefinition()
          Internal: Applications should not use this method.
 int getSimpleEditLength()
          Retrieves the length of the edit control used in the rendering of the simple query form.
 java.lang.String getTargetUrl()
          Retrieves the URL being used as the target where the results of this Web Bean are displayed.
 java.lang.String getUrlTargetWindow()
          Returns the name of the window or form in which the row target URL will be displayed.
 boolean isSimpleMode()
          Determines whether the simple search mode of the FindForm UI is enabled.
 boolean queryWasExecuted()
          Determines whether the FindForm bean has executed the query.
 void render()
          Renders the Find Form.
 void renderSimpleForm()
          Renders the simple form version of the query form.
 void saveQueryDefinition()
          Internal: Applications should not use this method.
 void setClearWhereClauseOnClearConditions(boolean bClear)
          If this option is set to true, the WHERE clause is cleared on the ViewObject when the 'clear query conditions' button is clicked.
 void setSimpleEditLength(int nLength)
          Sets the length of the edit control used in the rendering of the simple query form.
 void setTargetUrl(java.lang.String sUrl)
          Sets the URL being used as the target where the results of this Web Bean are displayed.
 void setUrlTargetWindow(java.lang.String sTarget)
          Identifies the window or frame that will display the row target URL specified by the setTargetUrl() function.
 void setUseJS(boolean bSet)
           
 void setUseSimpleMode(java.lang.String sAttribute)
          Directs the FindForm bean to use the simple mode of the FindForm UI.
 
Methods inherited from class oracle.jbo.html.DataWebBeanImpl
initialize, setUsedInTag
 
Methods inherited from class oracle.jdeveloper.html.DataWebBeanImpl
clearDisplayAttributes, getApplicationFromContext, getApplicationName, getAttributeLabel, getDisplayAttributeDefs, getDisplayAttributes, getDisplayFieldRenderer, getEditFieldRenderer, getRowKey, getRowSet, getViewObjectName, handleCommit, initialize, initialize, initialize, internalInitialize, isAppStateful, releaseApplicationResources, releaseApplicationResources, setDisplayAttributes, setDisplayFieldRenderer, setDisplayFieldRenderer, setEditFieldRenderer, setEditFieldRenderer, setReleaseApplicationResources, setRowSet, shouldDisplayAttribute
 
Methods inherited from class oracle.jdeveloper.html.WebBeanImpl
generateScriptSrc, getCookie, getOut, getRequest, getRequestVariable, getRequestVariable, getUniqueName, initBeanForJS, initBeanForJS, initBeanForJS, initialize, initialize, initialize, render, setRequestVariable, setRequestVariable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jdeveloper.html.DataWebBean
clearDisplayAttributes, getApplicationName, getDisplayAttributeDefs, getDisplayAttributes, getDisplayFieldRenderer, getEditFieldRenderer, getRowSet, getViewObjectName, handleCommit, initialize, initialize, isAppStateful, setDisplayAttributes, setDisplayFieldRenderer, setDisplayFieldRenderer, setEditFieldRenderer, setEditFieldRenderer, setReleaseApplicationResources, setRowSet, shouldDisplayAttribute
 
Methods inherited from interface oracle.jdeveloper.html.WebBean
initialize, initialize, internalInitialize, render
 

Field Detail

sTargetUrl

protected java.lang.String sTargetUrl

bWasExecuted

protected boolean bWasExecuted

bSimpleMode

protected boolean bSimpleMode

sAttribute

protected java.lang.String sAttribute

sTarget

protected java.lang.String sTarget

useRoundedCorners

protected boolean useRoundedCorners

useJS

protected boolean useJS

simpleEditLength

protected int simpleEditLength

bClearWhereClause

protected boolean bClearWhereClause
Constructor Detail

FindForm

public FindForm()
Method Detail

setSimpleEditLength

public void setSimpleEditLength(int nLength)
Sets the length of the edit control used in the rendering of the simple query form.

Parameters:
nLength - length of the edit control, measured in characters.

setClearWhereClauseOnClearConditions

public void setClearWhereClauseOnClearConditions(boolean bClear)
If this option is set to true, the WHERE clause is cleared on the ViewObject when the 'clear query conditions' button is clicked.


getSimpleEditLength

public int getSimpleEditLength()
Retrieves the length of the edit control used in the rendering of the simple query form.

Returns:
length of the edit control, measured in characters.

setUrlTargetWindow

public void setUrlTargetWindow(java.lang.String sTarget)
Identifies the window or frame that will display the row target URL specified by the setTargetUrl() function. That is, it identifies the window or form that will display the results generated by this web bean. If you did not specify a row target URL by using setTargetUrl(), then do not use this function. Also, if you are not using HTML FRAMES, there is no need to specify this function.

Parameters:
sTarget - window or form used to display the row target URL.

getUrlTargetWindow

public java.lang.String getUrlTargetWindow()
Returns the name of the window or form in which the row target URL will be displayed. That is, it returns the name of the window or form where the results of this Web Bean will be displayed.

Returns:
name of the window or form in which the HTML FORM will be displayed.

setUseSimpleMode

public void setUseSimpleMode(java.lang.String sAttribute)
Directs the FindForm bean to use the simple mode of the FindForm UI. The simple form of the UI displays a single edit control where you can enter the query criteria to be embedded in a SQL LIKE clause. The sAttribute parameter is the name of the View Object attribute to be used as part of the query. If you want to search multiple attributes with the same condition, you can use this method with a comma-delimited list. For example, setUseSimpleMode("Job,JobDesc").

If you want to use the advanced UI, follow setUseSimpleMode with clearSimpleMode. For example:

 ...
 setUseSimpleMode("Job");
 clearSimpleMode()
 ...
 

Parameters:
sAttribute - name of the View Object attribute used as part of the query.

clearSimpleMode

public void clearSimpleMode()
Disables the simple search form UI and enables the advanced search form UI. The advanced UI includes fields that let you specify:


isSimpleMode

public boolean isSimpleMode()
Determines whether the simple search mode of the FindForm UI is enabled.

Returns:
true if the simple search mode UI is enabled; false if the advanced search mode is enabled.

queryWasExecuted

public boolean queryWasExecuted()
Determines whether the FindForm bean has executed the query. This method can be executed only when the user clicks the "Execute" button in the FindForm UI or presses the "Enter" key while in the simple search mode of the UI.

Returns:
true if the FindForm bean executed the query; false otherwise.

getTargetUrl

public java.lang.String getTargetUrl()
Retrieves the URL being used as the target where the results of this Web Bean are displayed.

Returns:
target URL where this Web Bean's results are displayed.

setTargetUrl

public void setTargetUrl(java.lang.String sUrl)
Sets the URL being used as the target where the results of this Web Bean are displayed.

Parameters:
sUrl - target URL where this Web Bean's results are displayed.

saveQueryDefinition

public void saveQueryDefinition()
                         throws java.lang.Exception
Internal: Applications should not use this method.

Saves the current definition of a query while a user adds additional conditions to it. When the user clicks the "Add Condition" button in the advanced find form UI the Web Bean handles the form submission and calls saveQueryDefinition() to save the current query definition.

Throws:
java.lang.Exception

clearQueryConditions

public void clearQueryConditions()
                          throws java.lang.Exception
Internal: Applications should not use this method.

Removes the conditions entered for a query in a form submission. When the user clicks the "Clear Condition" button, the Web Bean handles the form submission and calls clearQueryConditions() to remove any conditions entered in the Find Form UI.

Throws:
java.lang.Exception

getQueryDefinition

public QueryDefinition getQueryDefinition()
Internal: Applications should not use this method.

Returns the QueryDefinition stored in the session object. There is only one query definition active within a session. After the query is executed, the query definition is cleared.

Returns:
the active QueryDefinition object for this session object.

setUseJS

public void setUseJS(boolean bSet)

execute

public void execute()
Executes the query defined by the query definition.


renderSimpleForm

public void renderSimpleForm()
                      throws java.lang.Exception
Renders the simple form version of the query form. The simple form is rendered as a single edit field in which the user enters the search pattern. The value entered by the user then becomes part of a LIKE '%%' query. Use the simple form of the find window when you want to generate a more web-like query.

If you use renderSimpleForm(), the simple Find Form UI will be rendered regardless of whether you specified clearSimpleMode().

Throws:
java.lang.Exception

render

public void render()
            throws java.lang.Exception
Renders the Find Form. This function calls the renderSimpleForm() function if the simple form UI has been enabled by using the useSimpleMode() function. If clearSimpleMode() has been specified, the advanced Find Form UI will be rendered instead.

Specified by:
render in interface WebBean
Overrides:
render in class WebBeanImpl
Throws:
java.lang.Exception

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

Copyright © 1997, 2004, Oracle. All rights reserved.