Implement auto suggest behaviour with af:selectOneChoise

Hi
I'm using jdeveloper 11.1.2.3.0
I would like to know how could I Implement auto suggest behaviour with af:selectOneChoise?

Hi,
Drop a af:autoSuggestBehavior from component pallet to the SOC component and bind it to a backing bean method as below
private List<SelectItem> items = new ArrayList<SelectItem>();
public List getSuggestions(String input) {
if (input!=null && input.length()>3) {
ViewObject vo = util.getViewObject("XYZ1Iterator");
vo.setNamedWhereClauseParam("bindx]Xyz", input);
vo.executeQuery();
System.out.println("Row count is " + vo.getRowCount());
// autoSuggestItemBeanList.clear();
RowSetIterator itr = vo.createRowSetIterator(null);
while (itr.hasNext()) {
Row row = itr.next();
items.add(new SelectItem(row.getAttribute("FirstName")));
return items;
If you don't want your db to be queried for each and every character, then create a bean and set each and every attribute value of that bean from the db after your page gets rendered. So each character hit from the keyboard will look into your bean rather than hitting the db.
Thanks,
Sanjeeb

Similar Messages

  • Error implementing Auto Suggest Behaviour (JDeveloper Tutorial)

    Hi,
    I'm using JDev 11g R2 on Mac OSX. In the JDeveloper Tutorial "Developing Rich Web Applications with Oracle ADF", Part 3, Step 3, I don't get the "Insert Auto Suggest Behavior dialog box", so I used the property inspector to enter "#{bindings.JobId.suggestedItems}" in the "SuggestedItems" property.
    When I run the application, and type a value in the JobId, I get the error:
    suggestedItems="#{bindings.JobId.suggestedItems}": Method not found: 0.suggestedItems(java.lang.String)
    I checked the bindings in "query.jsf", and they're all set.
    Does anyone have an idea what could be wrong?
    Kind regards,
    Philip

    The tutorial (http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_55/jdtut_11r2_55_3.html) suggests that you can drag and drop the auto suggest behavior onto the JobId. But you cannot.
    By default, the JobId item is not created as an element that can accept an auto suggest behavior. The source for the item should resemble:
                <af:inputComboboxListOfValues id="jobId1Id"
                                              popupTitle="Search and Select: #{bindings.JobId1.hints.label}"
                                              value="#{bindings.JobId1.inputValue}"
                                              label="#{bindings.JobId1.hints.label}"
                                              model="#{bindings.JobId1.listOfValuesModel}"
                                              required="#{bindings.JobId1.hints.mandatory}"
                                              columns="#{bindings.JobId1.hints.displayWidth}"
                                              shortDesc="#{bindings.JobId1.hints.tooltip}">
                    <f:validator binding="#{bindings.JobId1.validator}"/>
                    <af:autoSuggestBehavior suggestedItems="#{bindings.JobId1.suggestedItems}"/>
                </af:inputComboboxListOfValues>However, when the form itself is dropped onto the page, the JobId is created as a selectOneChoice.
    This seems to be an error with the tutorial (http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_55/jdtut_11r2_55_2.html).
    Edited by: Dolphin on Sep 29, 2012 2:37 PM

  • Auto suggest behaviour copononent is not working

    Hi All,
    We migrated our application from JDev 11.1.1.3 to 11.1.1.5.
    we have a input text with LOV feild in a popup, and the feild has auto suggest behavior,
    <af:inputListOfValues id="inputListOfValues3"
    popupTitle="Search and Select: #{bindings.Dica.hints.label}"
    value="#{bindings.Dica.inputValue}"
    label="#{bindings.Dica.hints.label}"
    model="#{bindings.Dica.listOfValuesModel}"
    required="#{bindings.Dica.hints.mandatory}"
    columns="30"
    shortDesc="#{bindings.Dica.hints.tooltip}"
    autoSubmit="true"
    valueChangeListener="#{backingBeanScope.Bean.dIcaChangeListener}"
    searchDesc=" ">
    <f:validator binding="#{bindings.Dica.validator}"/>
    <af:autoSuggestBehavior suggestedItems="#{bindings.Dica.suggestedItems}"/>
    </af:inputListOfValues>
    it worked well in 11.1.1.3, but after moving it to 11.1.1.5, the auto suggest behaviour stopped working, but found no error in the log. LOV is working good, Value change listener is also working well.
    Please advise.
    Thanks...

    Yes, I did that, but no result. we have similar components in the same page itself with auto suggest behaviour and input LOV, for those auto suggest behaviour is working good. But this particular feild is in a popup, that might be the reason.

  • How to implement Auto Suggest Widget

    Hi there
    I have a dynamic asp classic page, where the data come from an access db.
    On this page, many documents (category and title ) are displayed for download.
    I want to implement Auto Suggest Widget in order to find the document easier and to jump to it (href="#document_xy") directly for download.
    I don't have a clue on how to implement the Auto Suggest Widget.
    The ASP sample works with XML File.
    http://labs.adobe.com/technologies/spry/samples/autosuggest/SuggestSample.html
    All replies, hints, tutorials are highly appreciated.
    kind regards
    joey00x
    I am using Win XP, Dreamweaver CS3

    Hi,
    thanks for trying to help.
    I am sorry to ask again. I am not at all familiar with xml.
    I have tried to modify the ASP script you've suggested, but I get strange XML error, which doesn't make sense to me.
    I understand that with the script the server creates an XML File on the fly. First I have to connect to my access database, then I fill the records into a recordset object. And then the server loops through the RS and creates the xml file. Is that correct?
    The error message I get, points to a complete different place in the code, to a javascript module, which is working perfectly without below code.
    Any suggestions where the bug is?
    Thanks for your time
    kind regards
    joey00x
    Here the code that I am using:
    <%
    Dim objRS
    Dim SQLxml
    SQLxml = "Select category, subcategory, title from DocumentView"
    Set objRS=Server.CreateObject("ADODB.Recordset")
    objRS.Open SQLxml , objConn, 0, 1
    ' Send the headers
    Response.ContentType = "text/xml"
    Response.AddHeader "Pragma", "public"
    Response.AddHeader "Cache-control", "private"
    Response.AddHeader "Expires", "-1"
    %>
    <?xml version="1.0" encoding="utf-8"?>
    <root>
      <% While (NOT objRS.EOF) %>
        <row>
             <%
                For each field in objRS.Fields
                column = field.name
             %>
            <<%=column%>><![CDATA[<%=(objRS.Fields.Item(column).Value)%>]]></<%=column%>>
            <%
                Next
            %>
        </row>
        <%
          objRS.MoveNext()
        Wend
        %>
    </root>
    <%
    objRS.Close()
    Set objRS = Nothing
    %>

  • Need to implement auto suggest with multiple select in a input text field

    Hi,
    Jdev Ver: 11.1.1.4
    My requirement is to create an input field where i can provide auto suggest and user can enter multiple email ids. It is similar to current "To" field while composing a mail in Gmail.
    Problem:
    I have implemented input box with auto suggest. For the first entry it works fine. when i enter 2nd value(i have used ',' (comma) as separator and handled it in 'suggestItems' bean method to take sub-string after comma for providing the suggestion) , after selection.... the first value get lost. So at a time only one value is selected in the input text.
    Input text:
    <af:inputText label="Names" id="it21" rows="2"
    columns="50" simple="true"
    valueChangeListener="#{VisitBackingBean.visitMembersInputBoxCL}"
    binding="#{VisitBackingBean.visitMembersInputBox}">
    <af:autoSuggestBehavior suggestItems="#{VisitBackingBean.onSuggest}"/>
    </af:inputText>
    Bean Method:
    public List onSuggest(FacesContext facesContext,
    AutoSuggestUIHints autoSuggestUIHints) {
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    String inputNamevalue = autoSuggestUIHints.getSubmittedValue().trim();
    if(inputNamevalue.contains(",")) {
    inputNamevalue = inputNamevalue.substring(inputNamevalue.lastIndexOf(",")+1).trim();
    //create suggestion list
    List<SelectItem> items = new ArrayList<SelectItem>();
    // if (autoSuggestUIHints.getSubmittedValue().length() > 3) {
    OperationBinding setVariable =
    (OperationBinding)bindings.get("setnameSearch");
    setVariable.getParamsMap().put("value",
    inputNamevalue);
    setVariable.execute();
    //the data in the suggest list is queried by a tree binding.
    JUCtrlHierBinding hierBinding =
    (JUCtrlHierBinding)bindings.get("AutoSuggestName_TUserROView1");
    //re-query the list based on the new bind variable values
    hierBinding.executeQuery();
    //The rangeSet, the list of queries entries, is of type //JUCtrlValueBndingRef.
    List<JUCtrlValueBindingRef> displayDataList =
    hierBinding.getRangeSet();
    for (JUCtrlValueBindingRef displayData : displayDataList) {
    Row rw = displayData.getRow();
    //populate the SelectItem list
    items.add(new SelectItem(rw.getAttribute("UsrUserName").toString().trim() +
    "<" +
    rw.getAttribute("UsrMailId").toString().trim() +
    ">",
    rw.getAttribute("UsrUserName").toString().trim() +
    "<" +
    rw.getAttribute("UsrMailId").toString().trim() +
    ">"));
    return items;
    Please suggest how can i achieve the mentioned functionality.

    Hi,
    doesn't work this way as the suggest list returns a single value. You can actually use the existing values as a prefix to the new value in which case the suggest list would look a bit odd. Beside of this all you can do is to create a user lookup field with auto suggest and once a name is selected, update another field with the value returned from this action
    Frank

  • Retain Auto Suggest behaviour on tab switch in Oracle ADF

    Hi
    We are using the <af:autoSuggestBehavior> in our application for an af:inputText component. When the user searches for a string, a context menu opens with the list of matching strings.
    Now if the user switches to a different tab and comes back again to this tab, the context menu/popup that displays the list of matching string is disappearing.
    How to retain that on the screen on returning back to the current tab?
    Thank you for your help !!
    - Vinay Polisetti

    You want that context menu (autosuggestion) with same values again on returning back ?
    I don't think that we can do that , because this autoSuggestion list disappears once user loses focus from it
    you can disable tab until user fill the inputtext
    Ashish

  • Problem using Auto Suggest Behavior

    Hi all,
    I am using Jdeveloper 11.1.1.2 and ADFBC.
    I want to implement auto suggest behavior and I am following the steps on: http://www.oracle.com/technology/products/jdev/howtos/autosuggest/explaining_autosuggestbehavior.htm
    When I am writing a partial string on the component I don't show auto suggestion and if I click on the button on the right of the component (the lens for finding records) I see a panel search with all the fields of my VO.
    It is a normal behavior I have a warning in the auto suggest component when I write #{bindings.myField.suggestedItems}?? I don't find it under bindings using the expression builder.
    Where am I wrong?Any suggestions?
    Thank you
    Andrea

    Sorry,
    after the tag validator I have:
    <af:autoSuggestBehavior suggestedItems="#{bindings.myAttribute.suggestedItems}"/>
    When I am writing something on the inputText of myAttribute I have this error:
    Target Unreachable, 'DescrizioneTecnica' returned null.
    Stack trace:
    javax.el.PropertyNotFoundException: Target Unreachable, 'myAttribute' returned null
         at com.sun.el.parser.AstValue.getTarget(AstValue.java:88)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:153)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at oracle.adfinternal.view.faces.el.InternalELObject.autoSuggest(InternalELObject.java:134)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

  • Auto suggest behavior for af:query component LOV fields.

    Hi,
    I am new to ADF development and need help on implementing auto suggest behavior to the LOV fields generated by af:query component. For inputList and inputCombo.. fields we can add af:autosuggestbehavior tag to enable this. How do we enable the same for af:query generated LOV fields.
    Regards,
    C.R

    Thanks Timo for such a quick response.
    JDev version we are using is 11.1.1.6.0
    Unfortunately, we have gone too far with the AF:Query and Everything else is working apart from Auto-Suggest on AF:Query. Now will take a lot of time to implement and test. Also, users will have to spend considerable time to test it again.
    Thanks and Regards,
    Satya

  • Auto Suggest with multiple fields?

    Hello,
    I am planning on using the autosuggest on a project I'm
    working on, and was surprised by the lack of support for multiple
    fields. Correct me if I'm wrong, but right now you can only search
    for the 'name' field or 'age' etc. I would like to be able to enter
    some text in the textinput field, and it would search both 'name'
    and 'username' in the dataset. Is this possible with the current
    widget?
    Thanks,
    Maquelly

    Hello Maquelly,
    Indeed the Auto Suggest widget do not support filtering the
    data against multiple fields simultaneously if the data is filtered
    on the client side. I will add this as an enhancement request for
    this brand new widget. We have only support for multiple fields to
    be displayed in the suggestion list which is a spry:region, you can
    insert the values of multiple fields concatenated through the
    spryLsuggest tag buy we are not able to check multiple fields,
    We have implemented also the ability to send the value typed
    on the server and expect a new XML with the filtered data. This
    method allow you to achieve your goak as you can control
    completelly the filtering algorithm that sends the data back in
    browser. We have some samples in the Spry 1.5 preview.
    Regards,
    Cristian MARIN

  • LOV with auto suggest and multiple check boxes

    Is it possible to implement LOV with auto suggest and multiple check boxes using ADF faces components?. Any alternative implementation/pointers are appreciated.
    Regards,
    Surya

    Hi,
    build it yourself as a task flow opened in a popup. see: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/69-custom-lov-with-btf-276178.pdf
    Frank

  • Ajax auto-suggest with adf

    Hi..
    I am trying to implement ajax auto-suggest using the example @ http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html
    After trying it, i realised the auto-suggest component does not work in firefox, but only in IE. Also when using IE 7, the auto-suggest pop up.screen. does not display directly under the textbox.. but rather away from it..unlike what we see in the example.
    Is there any other ways to implement autosuggest that work in both firefox and IE using ADF?
    thanks

    The limitation on browsers is a function of the ajax library used, namely https://blueprints.dev.java.net/bpcatalog/distDrops.html, not ADF. I would suggest finding a similar library that supports the browsers you wish to use.
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Auto-Suggest feature in Combo-box LOV is not displaying non-unique values

    Hi,
    I have an auto-suggest feature implementation on a combo-box lov that displays the name and email-id of a list of people. There are non-unique names in the back-end, for example :
    Abraham Mason [email protected]
    Abraham Mason [email protected]
    But when I use the auto-suggest feature and type in, say 'Ab', instead of showing both the Abraham Masons the auto-suggest displays only one of the values.
    As in the example above the email-ids of the two Abraham Masons are different and unique.
    If I use the conventional drop down menu of the combo-box then both the values are visible.
    Is the auto-suggest feature implemented in a manner so as to display only unique values?
    This is the implementation of the auto-suggest feature that I have done -
    <af:column headerText="#{bindings.RqmtAtLevel1.hints.Owner.label}"
    id="c23" sortable="true" filterable="true"
    sortProperty="Owner"
    filterFeatures="caseInsensitive">
    <af:inputComboboxListOfValues id="ownerId"
    popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.RqmtAtLevel1.hints.Owner.label}"
    value="#{row.bindings.Owner.inputValue}"
    model="#{row.bindings.Owner.listOfValuesModel}"
    required="#{bindings.RqmtAtLevel1.hints.Owner.mandatory}"
    columns="#{bindings.RqmtAtLevel1.hints.Owner.displayWidth}"
    shortDesc="#{bindings.RqmtAtLevel1.hints.Owner.tooltip}"
    autoSubmit="true">
    <f:validator binding="#{row.bindings.Owner.validator}"/>
    <af:autoSuggestBehavior suggestedItems="#{row.bindings.Owner.suggestedItems}"/>
    </af:inputComboboxListOfValues>
    </af:column>
    Thanks,
    Anirudh Acharya

    Hi,
    don't find a bug entry about this, so if this indeed is a defect then this has not been filed. Do you have a test case ? If you have please zip it up and send it in a mail to me. My mail address is in my OTN profile (just click on my name until you get to the profile). Pleas rename the "zip" extension to "unzip" and mention the JDeveloper release you work with. The test case should work against the Oracle HR schema.
    If you need to track the issue, I suggest to file a service request with customer support yourself
    Frank

  • Creating new Auto-Suggest Component

    Hi,
    I am new to ADF and looking for Auto-Suggest options. Found Franks code and it was really heplful.
    We tried to create a new component based on this but not able to use multiple components of the type on the same page/form.The problem we are thinking of is because of the popup having the same id for all the components we embed in.If we attach 3 components of this type to a form then one of the random ones work as per logic and other 2 not doing any pop ups at all.
    Could you please help us to resolve this please?
    Thanks
    Subha
    CODE
    suggestComponentModel.java
    package com.dstintl.ic.ui.component.suggestbox;
    import java.util.List;
    public interface SuggestComponentModel{
    * Method called to filter data shown in the suggest list. Initial
    * request is made with inMemory = false. If in memory sorting is
    * enabled then all subsequent calls are made passing trues as the
    * value for the inMemory parameter. Implementations may decid to
    * ignore the inMemory argument and always query the data source.
    public List<String> filteredValues(String filterCriteria,
    boolean inMemory);
    SuggestBoxTag.java+
    package com.dstintl.ic.ui.component.suggestbox;
    import javax.el.ValueExpression;
    import oracle.adf.view.rich.component.rich.fragment.RichDeclarativeComponent;
    import oracle.adfinternal.view.faces.taglib.region.RichDeclarativeComponentTag;
    import org.apache.myfaces.trinidad.bean.FacesBean;
    * ICDateComponent tag class.
    public class SuggestBoxTag extends RichDeclarativeComponentTag {
         /*input text properties*/
    private ValueExpression styleClass;
    private ValueExpression label;
    private ValueExpression required;
    private ValueExpression displayWidth;
    private ValueExpression maximumLength;
    private ValueExpression tooltip;
    private ValueExpression disabled;
    /*popup properties*/
    private ValueExpression itemList;
    * {@inheritDoc}
    @Override
    protected String getViewId() {
    return "/component/SuggestBox.jspx";
    * {@inheritDoc}
    @Override
    protected RichDeclarativeComponent createComponent() {
    return new SuggestBox();
    * {@inheritDoc}
    @Override
    public void release() {
    super.release();
    label = null;
    * {@inheritDoc}
    @Override
    protected void setProperties(final FacesBean bean) {
    super.setProperties(bean);
    /*Input text box properties*/
    if (label != null) {
    bean.setValueExpression(SuggestBox.LABEL_KEY, label);
    if (styleClass != null) {
    bean.setValueExpression(SuggestBox.STYLE_CLASS_KEY, styleClass);
    if (required != null) {
    bean.setValueExpression(SuggestBox.REQUIRED_KEY, required);
    if (displayWidth != null) {
    bean.setValueExpression(SuggestBox.DISPLAY_WIDTH_KEY, displayWidth);
    if (maximumLength != null) {
    bean.setValueExpression(SuggestBox.MAXIMUM_LENGTH_KEY, maximumLength);
    if (tooltip != null) {
    bean.setValueExpression(SuggestBox.TOOLTIP_KEY, tooltip);
    if (disabled != null) {
    bean.setValueExpression(SuggestBox.DISABLED_KEY, disabled);
    if (itemList != null) {
    bean.setValueExpression(SuggestBox.POPUP_SELECTITEMLIST_KEY, itemList);
    * @return label
    public ValueExpression getLabel() {
    return label;
    * @param label
    * label
    public void setLabel(ValueExpression label) {
    this.label = label;
    * @return style class.
    public ValueExpression getStyleClass() {
    return styleClass;
    * @param styleClass
    * style class.
    public void setStyleClass(ValueExpression styleClass) {
    this.styleClass = styleClass;
    * @param required
    * required.
         public void setrequired(ValueExpression required) {
              this.required = required;
    * @return required .
         public ValueExpression getrequired() {
              return required;
    * @param displayWidth
    * displayWidth.
         public void setDisplayWidth(ValueExpression displayWidth) {
              this.displayWidth = displayWidth;
    * @return displayWidth .
         public ValueExpression getDisplayWidth() {
              return displayWidth;
    * @param maximumLength
    * maximumLength.
         public void setmaximumLength(ValueExpression maximumLength) {
              this.maximumLength = maximumLength;
    * @return maximumLength .
         public ValueExpression getmaximumLength() {
              return maximumLength;
    * @param tooltip
    * tooltip.
         public void setTooltip(ValueExpression tooltip) {
              this.tooltip = tooltip;
    * @return tooltip .
         public ValueExpression getTooltip() {
              return tooltip;
    * @param disabled
    * disabled.
         public void setDisabled(ValueExpression disabled) {
              this.disabled = disabled;
    * @return disabled .
         public ValueExpression getDisabled() {
              return disabled;
    * @param itemList
    * itemList.
         public void setItemList(ValueExpression itemList) {
              this.itemList = itemList;
    * @return itemList .
         public ValueExpression getItemList() {
              return itemList;
    SuggestBox.java+
    package com.dstintl.ic.ui.component.suggestbox;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.UIComponent;
    import javax.faces.model.SelectItem;
    import oracle.adf.view.rich.component.rich.fragment.RichDeclarativeComponent;
    import oracle.adf.view.rich.component.rich.input.RichSelectOneListbox;
    import oracle.adf.view.rich.context.AdfFacesContext;
    import oracle.adf.view.rich.render.ClientEvent;
    import org.apache.myfaces.trinidad.bean.PropertyKey;
    * suggestBox.
    public class SuggestBox extends RichDeclarativeComponent {
    /** label. **/
    public static final PropertyKey LABEL_KEY = PropertyKey.createPropertyKey("label");
    /** styleClass **/
    public static final PropertyKey STYLE_CLASS_KEY = PropertyKey.createPropertyKey("styleClass");
    /** required **/
    public static final PropertyKey REQUIRED_KEY = PropertyKey.createPropertyKey("required");
    /** displayWidth **/
    public static final PropertyKey DISPLAY_WIDTH_KEY = PropertyKey.createPropertyKey("displayWidth");
    /** precision **/
    public static final PropertyKey MAXIMUM_LENGTH_KEY = PropertyKey.createPropertyKey("maximumLength");
    /** toolTip **/
    public static final PropertyKey TOOLTIP_KEY = PropertyKey.createPropertyKey("tooltip");
    /**disabled **/
    public static final PropertyKey DISABLED_KEY = PropertyKey.createPropertyKey("disabled");
    /** itemList **/
    public static final PropertyKey POPUP_SELECTITEMLIST_KEY = PropertyKey.createPropertyKey("itemList");
    * Constructor.
    public SuggestBox() {
    * Gets the value set to the <code>label</code> attribute.
    * @return String label.
    public String getLabel() {
    String t = (String) getAttributes().get("label");
    return t;
    * Gets the value set to the <code>styleClass</code> attribute.
    * @return String styleClass.
    public String getStyleClass() {
    String t = (String) getAttributes().get("styleClass");
    return t;
    * Gets the value set to the <code>required</code> attribute.
    * @return b.
    public boolean getrequired() {
    Boolean b = (Boolean) getAttributes().get("required");
    return b;
    * Gets the value set to the <code>displayWidth</code> attribute.
    * @return String displayWidth.
    public String getDisplayWidth() {
    String t = (String) getAttributes().get("displayWidth");
    return t;
    * Gets the value set to the <code>precision</code> attribute.
    * @return String precision.
    public String getMaximumLength() {
    String t = (String) getAttributes().get("maximumLength");
    return t;
    * Gets the value set to the <code>toolTip</code> attribute.
    * @return String styleClass.
    public String getToolTip() {
    String t = (String) getAttributes().get("tooltip");
    return t;
    * Gets the value set to the <code>disabled</code> attribute.
    * @return b.
    public boolean getDisabled() {
    Boolean b = (Boolean) getAttributes().get("disabled");
    return b;
    * Main popUp functionality.
         /**Get popUpId label */
    private String popUpLabel;
    public void setPopUpLabel(String popUpLabel) {
              this.popUpLabel = popUpLabel;
         public String getPopUpLabel() {
              this.popUpLabel =(String) getAttributes().get("label");
              return popUpLabel;
    /** fullitemList from the binding **/
    private List<SelectItem> fullitemList;
    /** suggestedList - to populate list of suggestions squeezed from the fullitemList **/
    private List<SelectItem> suggestedList = new ArrayList<SelectItem>();
    /** suggestListBox - attached to the Main popUp RichSelectOneListbox**/
    private RichSelectOneListbox suggestListBox;
    * sets suggestListBox
         public void setSuggestListBox(RichSelectOneListbox suggestListBox) {
              this.suggestListBox = suggestListBox;
    * gets suggestListBox
    * @return suggestListBox
         public RichSelectOneListbox getSuggestListBox() {
              return suggestListBox;
    * Sets suggested list on the selectOneListbox component
    * @param suggestedList
    * suggestedList.
         public void setSuggestedList(List<SelectItem> suggestedList) {
              this.suggestedList = suggestedList;
    * Retrieves the list from the bindings and
    * initialise suggestedList with the full list(only done during initialisation)
    * @return suggestedList.
         public List<SelectItem> getSuggestedList() {
              if(fullitemList == null){
                   fullitemList = new ArrayList<SelectItem>();
         List<SelectItem> result = (List<SelectItem>) getAttributes().get("itemList");
         this.fullitemList.addAll(result);
         this.suggestedList.addAll(result);
              return suggestedList;
    * doFilterList - On Every user keystroke in the suggest input field, the browser client calls
    * the doFilterList method through the af:serverListerner component
    * af:selectoneListbox (popup) is refreshed at the end of each call to the doFileterList so that
    * new list value is populated.
    * @param clientEvent
    public void doFilterList(ClientEvent clientEvent) {
         if(suggestListBox == null) {
              UIComponent uic = clientEvent.getComponent();
              suggestListBox = (RichSelectOneListbox) uic.getChildren().get(0);
    // set the content for the suggest list
    String srchString = (String)clientEvent.getParameters().get("filterString");
    this.suggestedList.clear();
    for(SelectItem item : fullitemList) {
         if( item.getLabel().contains(srchString)){
         this.suggestedList.add(item);
    AdfFacesContext.getCurrentInstance().addPartialTarget(suggestListBox);
    SuggestBox.jspx+
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
         <jsp:directive.page contentType="text/html;charset=windows-1252" />
         <af:componentDef var="attrs" componentVar="component">
    <af:document>
    <f:facet name="metaContainer">
    <af:group>
    <![CDATA[
    <script>
    function handleKeyUpOnSuggestField(evt){
    // start the popup aligned to the component that launched it
    suggestPopup = evt.getSource().findComponent("suggestPopup");
    inputField = evt.getSource();
    //don't open when user "tabs" into field
    if (suggestPopup.isShowing() == false &&
    evt.getKeyCode()!= AdfKeyStroke.TAB_KEY){
    hints = {align:AdfRichPopup.ALIGN_AFTER_START, alignId:evt.getSource().getClientId()+"::content"};
    suggestPopup.show(hints);
    //disable popup hide to avoid popup to flicker on
    //key press
    suggestPopup.hide = function(){}
    //suppress server access for the following keys
    //for better performance
    if (evt.getKeyCode() == AdfKeyStroke.ARROWLEFT_KEY ||
    evt.getKeyCode() == AdfKeyStroke.ARROWRIGHT_KEY ||
    evt.getKeyCode() == AdfKeyStroke.ARROWDOWN_KEY ||
    evt.getKeyCode() == AdfKeyStroke.SHIFT_MASK ||
    evt.getKeyCode() == AdfKeyStroke.END_KEY ||
    evt.getKeyCode() == AdfKeyStroke.ALT_KEY ||
    evt.getKeyCode() == AdfKeyStroke.HOME_KEY) {
    return false;
    if (evt.getKeyCode() == AdfKeyStroke.ESC_KEY){
    hidePopup(evt);
    return false;
    // get the user typed values
    valueStr = inputField.getSubmittedValue();
    // query suggest list on the server
    AdfCustomEvent.queue(suggestPopup,"suggestServerListener",
    // Send single parameter
    {filterString:valueStr},true);
    // put focus back to the input text field
    setTimeout("inputField.focus();",400);
    //TAB and ARROW DOWN keys navigate to the suggest popup
    //we need to handle this in the key down event as otherwise
    //the TAB doesn't work
    function handleKeyDownOnSuggestField(evt){               
    if (evt.getKeyCode() == AdfKeyStroke.ARROWDOWN_KEY) {                   
    selectList = evt.getSource().findComponent("suggestListBox");
    selectList.focus();
    return false;
    else{
    return false;
    //method called when pressing a key or a mouse button
    //on the list
    function handleListSelection(evt){
    if(evt.getKeyCode() == AdfKeyStroke.ENTER_KEY ||
    evt.getType() == AdfUIInputEvent.CLICK_EVENT_TYPE){                                          
    var list = evt.getSource();
    evt.cancel();
    var listValue = list.getProperty("value");
    hidePopup(evt);
    inputField = evt.getSource().findComponent("suggestField");
    inputField.setValue(listValue);
    //cancel dialog
    else if (evt.getKeyCode() == AdfKeyStroke.ESC_KEY){
    hidePopup(evt);
    //function that re-implements the node functionality for the
    //popup to then call it
    function hidePopup(evt){
    var suggestPopup = evt.getSource().findComponent("suggestPopup");
    //re-implement close functionality
    suggestPopup.hide = AdfRichPopup.prototype.hide;
    suggestPopup.hide();
    </script>
    ]]>
    </af:group>
    </f:facet>
    <af:messages/>
    </af:document>
         <!-- START Suggest Field -->
         <af:inputText id="suggestField"
         clientComponent="true"
         disabled="#{attrs.disabled}"
         label="#{attrs.label}"
         required="#{attrs.required}"
         columns="#{attrs.displayWidth}"
         maximumLength="#{attrs.maximumLength}"
         styleClass="#{attrs.styleClass}"
         shortDesc="#{attrs.tooltip}">
         <af:clientListener method="handleKeyUpOnSuggestField"
                             type="keyUp"/>
         <af:clientListener method="handleKeyDownOnSuggestField"
         type="keyDown"/>
         </af:inputText>
         <!-- END Suggest Field -->
         <!-- START Suggest popUp -->
    <af:popup id="suggestPopup" contentDelivery="immediate" animate="false" clientComponent="true" >
         <af:selectOneListbox id="suggestListBox" contentStyle="width: 250px;"
         size="5" valuePassThru="true">
         <f:selectItems value="#{component.suggestedList}"/>
         <af:clientListener method="handleListSelection" type="keyUp"/>
         <af:clientListener method="handleListSelection" type="click"/>
         </af:selectOneListbox>
         <af:serverListener type="suggestServerListener"
         method="#{component.doFilterList}"/>
    </af:popup>
         <!-- END Suggest popUp -->
    <af:xmlContent>
                   <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
    <display-name>suggestBox</display-name>
    <attribute>
    <attribute-name>id</attribute-name>
    </attribute>
                        <attribute>
    <attribute-name>label</attribute-name>
    </attribute>
    <component-extension>
    <component-tag-namespace>com.dstintl.ic.ui.component</component-tag-namespace>
    <component-taglib-uri>/com/dstintl/ic/ui/component</component-taglib-uri>
    </component-extension>
    </component>
    </af:xmlContent>
    </af:componentDef>
    </jsp:root>
    component.tld+
    <?xml version="1.0" encoding="windows-1252"?>
    <taglib xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1" xmlns="http://java.sun.com/xml/ns/javaee">
         <display-name>component</display-name>
         <tlib-version>1.0</tlib-version>
         <short-name>component</short-name>
         <uri>/com/dstintl/ic/ui/component</uri>
         <!--
              Component Name: SuggestBox Description: AutoSuggest or AutoComplete - shows a list of vales
              in a drop down list that is filtered by the user input in the input text field.
         -->
         <tag>
              <name>SuggestBox</name>
              <tag-class>com.dstintl.ic.ui.component.suggestbox.SuggestBoxTag</tag-class>
              <body-content>JSP</body-content>
              <attribute>
                   <name>label</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>styleClass</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>disabled</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>required</name>
                   <required>false</required>
                   <deferred-value>
                        <type>boolean</type>
                   </deferred-value>
              </attribute>
              <attribute>
                   <name>displayWidth</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>maximumLength</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>tooltip</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>itemList</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
         </tag>
    </taglib>

    Hi Subha,
    you can distinct the different components using clientAttribute tag with clientListener
    <af:inputText id="suggestField" .....>
    <af:clientListener method="handleKeyUpOnSuggestField" type="keyUp"/>
    <af:clientListener ......"/>
    <af:*clientAttribute* name="eventName" value="myCustomEvent"/>
    <af:*clientAttribute* name="popupId" value="......"/>
    </af:inputText>
    in javascript you get the eventName or PopuId from the attribute
    component = event.getSource();
    var eventName = component.*getProperty* ("eventName");
    // Call the server
    AdfCustomEvent.queue(popup, *eventName*, ......);
    var popupId = component.*getProperty* ("popuId");
    var popup = AdfPage.PAGE.findComponent(popupId);
    Hope this help,
    Maroun

  • How to implement copy paste functionality with IE

    Hi Experts,
    I am working on jdev 11.1.1.6.0, I have requirement to implement copy & paste functionality with IE Browser in ADF table. I have followed below link to implement the functionality.
    http://one-size-doesnt-fit-all.blogspot.com/2011/04/aftable-restoring-basic-browser-copy.html
    But copy&functionality is working fine, but when table loading I lost vertical/horizontal scroll bar. Can any one suggest me what is wrong here/what i am missing here.
    My logic:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:sni="/SNIDeclarativeComponentLib">
      <c:set var="tumuiBundle" value="#{adfBundle['sni.tum.view.TestUIBundle']}"/>
      <af:resource type="javascript">
        var globalLastVisitedField = null;
        function captureTableFieldName()
          return function (evt)
            evt.cancel();
            globalLastVisitedField = evt.getSource();
        function copyMenu(evt)
          if (globalLastVisitedField == null)
            alert("copyMenu() Error: No field could be
                                     identified to be in focus");
          else if (navigator.appName != "Microsoft Internet
                                     Explorer")
            alert("Copy function is only
                                     supported in Microsoft Internet Explorer");
          else
            var txt = globalLastVisitedField.getProperty("ItemValue");
            window.clipboardData.setData('Text', "" + txt);
          evt.cancel();
      </af:resource>
      <af:subform id="f1" defaultCommand="srchcb">
        <af:panelStretchLayout id="psl1" topHeight="auto" bottomHeight="auto"
                               styleClass="AFStretchWidth">
          <f:facet name="center">
            <af:panelCollection id="tab" styleClass="AFStretchWidth">
              <af:table value="#{bindings.TestVO.collectionModel}"
                        var="row"
                        rows="#{bindings.TestVO.rangeSize}"
                        emptyText="#{bindings.TestVO.viewable ? 'No data to display.' : 'Access Denied.'}"
                        fetchSize="#{bindings.TestVO.rangeSize}"
                        rowBandingInterval="1"
                        selectionListener="#{bindings.TestVO.collectionModel.makeCurrent}"
                        rowSelection="multiple"
                        id="Table" styleClass="AFStretchWidth"
                        contentDelivery="immediate">
                <f:facet name="contextMenu">
                  <af:popup id="pMenu" contentDelivery="lazyUncached">
                    <af:menu id="mMenu">
                      <af:commandMenuItem text="Copy" id="cmiCopy">
                        <af:clientListener method="copyMenu" type="action"/>
                      </af:commandMenuItem>
                    </af:menu>
                  </af:popup>
                </f:facet>
                <af:column sortProperty="Name" sortable="true"
                           headerText="#{bindings.TestVO.hints.Name.label}"
                           id="c33">
                  <af:outputText value="#{row.Name}" id="Nam">
                    <af:clientListener method="captureTableFieldName()"
                                       type="contextMenu"></af:clientListener>
                    <af:clientAttribute name="ItemValue"
                                        value="#{row.Name}"></af:clientAttribute>
                  </af:outputText>
       </af:column?
       </af:Table>
    -Thanks.

    Hi,
    I can't tell. What I can tell is that the code in the sample you reference for sure doesn't cause this - but it doesn't help you I guess.
    Btw.: Here is a solution that works on all browsers. The solution in the blog (Chris - please forgive me) is a bit awkward to be honest.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/012-copy-table-cell-values-169137.pdf
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/tablecellcopypaste-168499.zip
    Frank

  • How to implement auto complete using swings?

    Hi all ,
    i have got a new assignment where I have to implement auto complete. Please suggest me the possible ways to do so. I am working on desktop application.
    Please help.
    Thanks
    Alex

    Till now i have tried this:-
    public class AutoCompletePer extends JFrame
         private JTextField field = new JTextField(40);
         private JFrame frame1 = new JFrame();
         private boolean showAutoComplete = true;
         public AutoCompletePer()
              setSize(500,300);
              setLocation(300,50);
              setLayout(new FlowLayout());
              getContentPane().add(field);
              setVisible(true);
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              addListeners();
         private void addListeners()
               field.getDocument().addDocumentListener(new DocumentListener() {
                public void removeUpdate(DocumentEvent e)
               public void insertUpdate(DocumentEvent e)
                     if(showAutoComplete)
                          SwingUtilities.invokeLater(new Runnable() {
                        public void run()      {
                        Point p = field.getLocationOnScreen();
                           frame1.setBackground(Color.white);
                        frame1.setSize(field.getWidth(), 200);
                        frame1.setLocation(p.x ,p.y+20);
                        frame1.setVisible(true);
                        frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                        JPanel panel = new JPanel(new BorderLayout());
                        panel.setBackground(Color.WHITE);
                        panel.add(new JLabel("i am label"));
                        frame1.getContentPane().add(panel,BorderLayout.CENTER);
                        showAutoComplete = false;
                        requestFocus();
                        field.requestFocus();
                          public void changedUpdate(DocumentEvent e) {
         public static void main(String[] args) {
              new AutoCompletePer();
    }I tried this but it doesn't work atleast frame should remain infront of the main window, even I tried with dialog box but all in vain.
    Please suggest if there is any API defined for this in Java or any other wayOut.
    Please help.
    Alex

Maybe you are looking for