How to programmatically add af:setPropertyListener to CommandImageLink

Hi All,
My Requirement: programmatically add af:setPropertyListener to CommandButton
I referred this post how to programmatically add af:setPropertyListener to CommandButton and followed the following code.
Code:
// create a value expression
ValueExpression vx =
elFactory.createValueExpression(elContext, "#{pageFlowScope.clockNo}",
String.class);
// set a default value if desired
vx.setValue(elContext, clockNo);
SetPropertyListener spl =
new SetPropertyListener(ActionEvent.class.getName());
spl.setFrom(clockNo);
spl.setValueExpression("to", vx);
// add the listener to the button
newOpButton.addActionListener(spl);
My Code:
<af:commandImageLink id="editInsuraceDetLink"
icon="/resources/images/Edit.jpg"
iconPosition="trailing"
rendered="#{not row.deleted}"
action="addEndorsement"
useWindow="true"
inlineStyle="vertical-align:bottom;"
partialSubmit="true"
shortDesc="Edit"
*actionListener="#{pageFlowScope.GetEndorsementTypeListener.execute}"*
returnListener="#{GetEndorsementDetailsListener.execute}"
windowEmbedStyle="window"
windowModalityType="applicationModal"
windowHeight="650" windowWidth="740">
</af:commandImageLink>
Action Listener - .GetEndorsementTypeListener.execute code:
RichCommandImageLink a_button = (RichCommandImageLink) a_component.findComponent("editInsuraceDetLink");
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elContext = fctx.getELContext();
ExpressionFactory elFactory = application.getExpressionFactory();
ValueExpression vx = elFactory.createValueExpression(elContext, "#{pageFlowScope.controlFlowName}", String.class);
// set a default value if desired
//vx.setValue(elContext, clockNo);
SetPropertyListener spl = new SetPropertyListener(ActionEvent.class.getName());
spl.setFrom(a_target.getEndorsementFor().toString());
spl.setValueExpression("to", vx);
System.out.println("From= "+spl.getFrom());
System.out.println("To= "+spl.getValueExpression("to"));
// add the listener to the button
a_button.addActionListener(spl);
I got the following output.
From= Nominee / Appointee
To= ValueExpression[#{pageFlowScope.controlFlowName}]
Now my Problem is: the pageFlowScope variable ControlFlowName is not set.
And also I got a *link*: https://blogs.oracle.com/vijaymohan/entry/usage_of_setpropertylistener_and_setactionlistener
Whats wrong with my code. Is my problem related with above *link*.
Please suggest me how to add SetPropertyListener programmatically.
-Thanks
Mohanraj

Frank,
This works:
        // create a value expression
        ValueExpression vx =
            elFactory.createValueExpression(elContext, "#{pageFlowScope.clockNo}",
                                            String.class);
        // set a default value if desired
        vx.setValue(elContext, clockNo);
        SetPropertyListener spl =
            new SetPropertyListener(ActionEvent.class.getName());
        spl.setFrom(clockNo);
        spl.setValueExpression("to", vx);
        // add the listener to the button
        newOpButton.addActionListener(spl);But, I am thinking you would have known about it before I posted it. I don't really know how it works, but it does.
Can you help me reconcile between this, and what you said. Because what you said makes sense too.

Similar Messages

  • How to programmatically add af:setPropertyListener to CommandButton

    I just read:
    https://blogs.oracle.com/jdevotnharvest/entry/creating_adf_faces_comamnd_button
    from Frank Nimphius.
    How do I programmatically add an af:setPropertyListener to the programmatically created command button?
    I just cannot seem to figure it out.
    Thanks.
    Edited by: Arie Morgenstern on Feb 8, 2013 9:59 PM

    Frank,
    This works:
            // create a value expression
            ValueExpression vx =
                elFactory.createValueExpression(elContext, "#{pageFlowScope.clockNo}",
                                                String.class);
            // set a default value if desired
            vx.setValue(elContext, clockNo);
            SetPropertyListener spl =
                new SetPropertyListener(ActionEvent.class.getName());
            spl.setFrom(clockNo);
            spl.setValueExpression("to", vx);
            // add the listener to the button
            newOpButton.addActionListener(spl);But, I am thinking you would have known about it before I posted it. I don't really know how it works, but it does.
    Can you help me reconcile between this, and what you said. Because what you said makes sense too.

  • How to programmatically add rectangle to a pdf file ?

    How to programmatically add rectangle to a pdf file ?
    There is several page pdfs, non-vector, black and white.
    Users are color blind and have disabilities.
    To train them, one adds a rectangle at a certain lower-left point and width,height specified for a page.
    The idea is to give the script the page and coordinates and size of rectangle to be added programmatically. Green rectangles are acceptable as the cones are most sensitive there.
    Also, additional feature to add bookmarks on the left in the order these rectangle data is provided to the script.
    The script could be "hard-wired" by a list of the rectangle coodinates, and page number, pasted inside acrobat and run or entered into acrobat in some way.
    Your script would help many disabled people who are distributed through out the world.
    Feel free to contact me by email if you wish.
    Dying Vets

    P.S.
    This rectangle does not have to be a full annotation rectangle which needs user,date and a lot of info.
    Something minimal like this would suffice
    1 0 0 RG % red for stroke color
    200 300 50 75 re
    As you can see that the native unit of the pdf file is the "point" having 72 in an inch.
    The file dpi would be given. However, one could assume that pixel for the rectangle lower-left and width/height are given.
    From the pixels and dpi, the points could be calculated if desired.

  • How to programmatically add UDVs to project?

    Hi all,
    I have successfully used something like this to programatically add shared variables to an LVLIB (the code assumes that the library associated with the Container Reference contains at least one variable):
    An example output would be:
    Container Name: "MyLibrary.lvlib"
    Variable Name: "Variable1"
    Variable Path: <blank>
    Variable Type String: "Variable"
    (I notice that there is no way to specify the data type of the variable, and LabVIEW creates a DBL variable in the LVLIB by default.)
    However, if Container Reference is associated with a "User-Defined Variables" container, then I get Error 1 at the Invoke Node ("LabVIEW: An input parameter is invalid"). A example output is:
    Container Name: "User-Defined Variables"
    Variable Name: "Variable1"
    Variable Path: <blank>
    Variable Type String: "Variable"
    Questions:
    Does the error occur because LabVIEW is trying to create a DBL variable (which is not allowed with UDVs)?
    How can I programmatically add UDVs to my project?
    Thanks in advance!

    What is the scope of your project? How will you be using these UDV's?
    Mark P.
    Applications Engineer
    National Instruments
    www.ni.com/support

  • How to programmatically add timeline webpart to publishing page

    Can we add timeline webpart programmatically?
    If yes then please let me know how we can add it?

    Hi Jason,
    Thanks for your reply. It helped me lot but i want to add something to your code.
    1) Added web.AllowUnsafeUpdates to resolve error of disallow to update.
    2) Added TimelineType  and SourceSelection  properties else it shows add setup properties of webpart
    3) manager.WebParts.Count >= 0 Added condition else on every request it adds control.
    Also i want to know few line of code from your answer:
    1) What is the purpose of using storagekey? Why it is needed?
    2) Why you update page items?
    try
                    using (SPSite site = new SPSite(SPContext.Current.Site.ID))
                        using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
                            web.AllowUnsafeUpdates = true;
                            SPFile page = web.GetFile("/Pages/Home.aspx");
                            page.CheckOut();
                            using (SPLimitedWebPartManager manager = page.GetLimitedWebPartManager(PersonalizationScope.Shared))
                                if (manager.WebParts.Count <= 0)
                                    SPTimelineWebPart timelineWebPart = new SPTimelineWebPart();
                                    timelineWebPart.TimelineType = SPTimelineWebPart.TimelineTypeTaskList;
    //Task type list
                                    timelineWebPart.SourceSelection = "Tasks"; //list name
                                    manager.AddWebPart(timelineWebPart, "timelineZone", 0);
                            page.CheckIn(string.Empty);
                            page.Publish(string.Empty);
                            web.AllowUnsafeUpdates = false;
                catch (Exception ex)
                    lblError.Visible = true;
                    lblError.Text = ex.Message.ToString();
    Once again thanks for your reply. Please if you can resolve my queries then please reply it.

  • How to programmatically add Allergens & Sensitivities

    We want to ensure that the Allergens (Known to Contain and Does not contain) and Sensitivities (Known to Contain and Does not contain) on the Trade spec match the allergens and sensitivities from the formulation output. How do I programmatically add Allergens (Known to Contain and Does not contain) and Sensitivities (Known to Contain and Does not contain) to their appropriate collection in code?

    Here's my code:
    My code:
    var transContext = AppPlatformHelper.ApplicationManager.TransactionManager.GetSharedContext();
    transContext.Begin();
    try
    // Get allergens from Associated Specs that are Primary associations and not in Version History status
    var allergensContained = tradeSpec.LinkedAssociations.Values.Cast<IAssociatedSpec>()
                                      .Where(linkedSpec => linkedSpec.AssociationType.AssociationTypeML.Targetname == "Primary")
                                      .Where(linkedSpec => !linkedSpec.AssociationHost.IsVersionHistoryStatus())
                                      .SelectMany(linkedSpec => linkedSpec.AssociationHost.As<IGSMTradeSpecDO>()
                                                                  .AllergensContained.Values.Cast<IAllergenContainedDO>()
                                                                  .Select(x => new { Allergen = x.ComplianceItem.Name, Pkid =x.Allergen.PKID })
                                                                  .ToArray())
    // Get allergens not in the Trade Spec
    var allergensToAdd = allergensContained.GroupBy(x => x.Allergen)
                          .Where(x => tradeSpec.AllergensContained.Values.Cast<IAllergenContainedDO>().All(y => y.ComplianceItem.Name != x.Key))
                                          .Select(x => new { Allergen = x.Key, PKIDs = x })
                                          .ToArray();
    // Add allergens to the Trade Spec
    allergensToAdd.Each(x =>
       // Add allergen (known to contain)
       var allergenContainedDo = (IAllergenContainedDO)ServiceBase.DataManager.newObject(EnumUniversalDataObjectType.AllergenContainedDO);
       allergenContainedDo.Allergen = (IAllergen)ServiceBase.DataManager.objectFromID(x.PKIDs.First().Pkid); // pkid of allergen(2002)
       allergenContainedDo.MaxPer100g = 1.0;
       allergenContainedDo.MaxPer100gUOM = (IUOM)ServiceBase.DataManager.objectFromID(ServiceBase.UnitOfMeasureService.GetUOMByISOCode("GR").PKID);
       tradeSpec.AllergensContained.Add(allergenContainedDo);
       allergenContainedDo.Save(transContext.Connection);
    catch (Exception ex)
        transContext.SetAbort();
    finally
        transContext.Commit();

  • How to programmatically add users to WLS 7

    Is there a way to programmatically add users to Weblogic 7? I'm building up a website
    and want to give my visitors an opportunity to register with the site.
    The code samples I found until now are not working
    cheers,
    michael

    Hi Guys,
    I too am looking for an answer to this very question. I too want
    users to be able to register and also be able to control access
    to the site based on the roles being assigned. So what I would
    like to do is create users and assign them roles so that the
    roles defined within web.xml could be used to control access to
    various parts of the site.
    Regards
    Vijesh
    "Brian Pontarelli" <[email protected]> wrote:
    >
    I had the same exact question. I would like to add users programmatically
    to the
    weblogic server and also programmatically control the authorization and
    authentication policies for these new users. Is this possible in WLS
    7.0?
    Previous interfaces for this type of thing are deprecated (mostly in
    the Realm
    stuff). There do seem to be some MBeans in the weblogic.management.security
    packages, however these are not accessible MBeans because they do not
    extend
    from WeblogicMBean and therefore can not be looked up via the
    weblogic.management.Helper class. Is there another way to get at the
    current
    implementation of these interfaces?
    Ponch
    "Michael" <[email protected]> wrote in message
    news:[email protected]..
    Is there a way to programmatically add users to Weblogic 7? I'm buildingup a
    website
    and want to give my visitors an opportunity to register with the site.
    The code samples I found until now are not working
    cheers,
    michael

  • How to programmatically add webpart to publishing page

    How to add visual webpart in publishing page please let me know.
    Thanks in advance

    public void AddTaskListsWebPart()
                SPLimitedWebPartManager manager = null;
                SPFile file = null;
                try
                    SPSecurity.RunWithElevatedPrivileges(delegate()
                        using (SPSite spSite = new SPSite(site id))
                            using (SPWeb spWeb = spSite.OpenWeb())
                                spWeb.AllowUnsafeUpdates = true;
                                file = spWeb.GetFile(pageurl);
                                if (file.CheckOutStatus == SPFile.SPCheckOutStatus.None)
                                    file.CheckOut();
                                    manager = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
                                    if (manager.WebParts.Count <= 0)
                                        TaskLists objTaskLists = new TaskLists(); //Replace
    TaskLists with your webpart name
                                        manager.AddWebPart(objTaskLists, "zone1",
    0); //replace zoneid and index with yours one.
                                        manager.SaveChanges(objTaskLists);
                                        //pnlTaskLists.Controls.Add(objTaskLists);
                                        file.Update();
                                        file.CheckIn(string.Empty);
                                        file.Publish(string.Empty);
                                        spWeb.Update();
                                spWeb.AllowUnsafeUpdates = false;
                catch (Exception ex)
                    Utility.SPTraceLogError(ex); //Handle your error as per your logic
                finally
                    if (manager != null)
                        manager.Dispose();

  • How to programmatically add my own navigation panel to Adobe Acrobat UI

    Is there a way to add my own navigation panels to Adobe Acrobat UI using Acrobat SDK 9 or X? Is this planned feature?

    If you mean thinngs like Bookmarks, Tags, etc. the answer sadly seems to be no. (Can't say for plans).

  • How to programmatically add a search directory path

    Is there a way to do this from a CVI program?

    Hello,
    As stated in the previous answers there is no way using the API to do this. However, you can write some code to add a search directory programatically. What you need to do is as follows:
    1. Get a reference to the config file. You do this by calling Engine.ConfigFile. This will return to you a reference to the TestExec.ini file.
    2. Clone one of the elements of the Search Directory list. The search directories are stored in an array, in which each element is a container that has the following fields: Disabled (Boolean), SearchSubDirs (Boolean), FileExtRestrictions (string), Path (string).
    3. Insert the cloned element into the end of the Search Directories array.
    4. Once the element is in the array, you can change any one of the fie
    lds listed above.
    5. Increment the change count and save the config file.
    Note: The changes that you make to the config file will not take effect until you restart the Sequence Editor. This is due to the fact that we cache the config file when the Sequence Editor is loaded.
    I have attached a sequence file that will do this. Depeneding upon the programming environment you are using, you can mimic the actions performed in this file in your code.
    Hope this helps.
    Attachments:
    ModifySearchDir.seq ‏19 KB

  • How to programmatically add user comment using human task data control

    Hi,
    We create the task form by using “create Task flow based on Human task”. I need to programmatically create and insert the user comment for the task. I know I need to create and insert a new element to the userCommentIterator that linked to the human task data control. But I could not get it work or find any related detail sample coding. Please help.
    Thanks a lot,
    Helen

    post it in soa suite forum
    SOA Suite
    or bpel forum
    BPEL
    to get.. quick reply.

  • How do I add a page in the book, programmatically.

    I use Weblogic 10.2. We need to make when you press the button on the page, to add another page. How can I do? Help please. If possible, I would like to see an example of working code.

    So now programmatically add pages:
              BookBackingContext bookBackingContext = BookBackingContext.getBookBackingContext(this
                        .getRequest());
              PortalPath portalPath1 = this.communityDefinition.getPortalPath();
              DesktopPath desktopPath1 = this.communityDefinition.getDesktopPath();
              WebAppSearchCriteria webAppSearchCriteria = new WebAppSearchCriteria(
                        this.webApp);
              try {
                   PagedResult pagedResult = this.layoutDefinitionControl.getLayoutDefinitions(15,
                             webAppSearchCriteria, this.context);
                   Iterator<LayoutDefinition> iter = pagedResult.nextPage();
                   LayoutDefinition layout = iter.next();
                   PageDefinition newPage;
                   newPage = this.pageDefinitionControl.createPageDefinition("Test",
                             "Test add page", layout.getLayoutDefinitionId(), false, true,
                             this.webApp, this.context);
                   BookInstanceId parentBookInstanceId = BookInstanceId
                             .createBookInstanceId(new Integer(bookBackingContext
                                       .getInstanceId()));
                   this.bookInstanceControl.addNavigable(
                             newPage.getPageDefinitionId(), position,
                             parentBookInstanceId, this.webApp, portalPath1,
                             desktopPath1, this.context);
              } catch (Exception e1) {
                   e1.printStackTrace();
              }

  • How can i programmatically add a text in a combobox drop down menu ?

    How can i programmatically add a text in a combobox drop down menu ? Can it be possible using any property node?

    You've posted to the wrong forum. Please post to the LabVIEW board.

  • Very Simple: How do I programmatically add line breaks?

    Very Simple: How do I programmatically add line breaks or how do I encapsulate my RichCommandLink's within a paragraph?
    My Code is as follows:
    for (String token : userViews.getViewNames())
    // add command link
    RichCommandLink output = new RichCommandLink();
    output.setText(token);
    // set action here
    // output.setActionExpression());
    viewItem.getChildren().add(output);
    // update view
    this.menuAccordion.getChildren().clear();
    this.menuAccordion.getChildren().add(0, viewItem);
    AdfFacesContext.getCurrentInstance().addPartialTarget(getMenuAccordion());

    Sorry, I'm using Jdeveloper 11.
    Im using JSP, JSF, ADF, Fusion. The RichCommandLink is an ADF Control.
    My PanelAccordion is bound to a RichPanelAccordion in my java class. When I add RichCommandLink's to the accordion the items are added next to each other. How do I add line breaks from my java class?

  • How do I programmatically add groups to the eQs?

    How do I programmatically add groups to the ‘Additional Administrators’ collection on an eQuestionnaire?

    Something like this should do it, where request is the EQRequestDO from the Questionnaire:
    IGroup yourGroupDO = (IGroup)AppPlatformHelper.DataManager.objectFromID(<theGroupPKID>);
    if (!request.AddlAdminGroups.Contains(yourGroupDO))
    request.AddlAdminGroups.Add(yourGroupDO);

Maybe you are looking for

  • Dolby Advanced Audio Interface software missing HP Pavilion Ultrabook 14-b003sa

    I updated my HP Pavilion Ultrabook 14-boo3sa to windows 8.1 a couple months ago and since then the dolby advanced audio interface software is missing. The speakers are working and sound fine but I just want the option of the equaliser again. I have l

  • ACE load-balancing-Cookie problem

    In our other load-balancing environments the load-balancer-cookie contains the encrypted (real) servername or ip-address. We think it's the same on the cisco, for that reason it's in theory not possible, that there are two 'green'-cookies with differ

  • Field - Nimber of bags

    Hi, I am filling Number of bags field in MIgo.But i am not getting these field while i am not getting  display mode

  • Invalid Structure Template KNKK of  DataSource KNKK_DataSource

    Hello, I am trying to create a Generic DataSource in R3 for BW.  My goal is to create a Generic DataSource for table KNKK in R3.  I am following some Generic DataSource instructions which appear to be very straightforward. I have named the DataSource

  • What is a "noclass"?

    This indicates that the debuggee VM was successfully created. At this point the debuggee VM has not attempted to locate the class in question. That is, you could use the start dialog to load the "noclass" class and the debuggee VM will load without a