Create LinkToAction with Image by run time

Hi,
I want to create linkToAction UI's with different images by run time. But if I try the code below I get always the same image for every linkToAction UI. What is my mistake? And how can I solve this problem?
     for (int i = 0; i < wdContext.nodeGlob_Struc().size(); i++){
          IWDLinkToAction linkToAction = (IWDLinkToAction)
               view.createElement(IWDLinkToAction.class, "linkToAction"+i);
          IPrivateDocPreAppView.ILinkToActionElement nodeLink =
                  wdContext.createLinkToActionElement();                    
          wdContext.nodeLinkToAction().bind(nodeLink);     
          wdContext.currentLinkToActionElement().setImageSource(
                  wdContext.nodeGlob_Struc().getGlob_StrucElementAt(i).
                       getUrl_Thumbnail() );
          linkToAction.bindImageSource( wdContext.nodeGlob_Struc().
                   getNodeInfo().getAttribute(IGlob_StrucElement.URL__THUMBNAIL) );     
            theGroupBox.addChild(linkToAction);
regards,
Sharam

Hallo Sharam,
The Web Dynro binding model does not support "index binding". This means binding multiple image UI elments to the same attribute in a multiple context node (cardinaltiy 1..n) means, that all images are bound to the node's lead selection. That's what you implement with
linkToAction.bindImageSource( wdContext.nodeGlob_Struc(). getNodeInfo().getAttribute(IGlob_StrucElement.URL__THUMBNAIL) );
Armin's solution is based on the fact, that he breaks the data binding principle by directly setting the imageSource property values.
Sharam, when reviewing your code I find several "problems":
1. Never ever store UI elements in the context. I assume you do this in order to access UI elements outside wdDoModifyView() as it is static. There is no need to do this.
2. Then you break databinding by setting the imageSource property in the linkToAction object (stored in the context) directly, breaking databinding.
3.)  Finally you "un-do" this hard property setting by binding it to the context again. This has the effect you described.
Breaking the data binding principle for UI elements has an important drawback. It also breaks the generic Web Dynpro caching mechanisms. Read my article on
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/301d715e-0b01-0010-1a8b-f1f83d175972">Best Practices for Building Client-Independent Web Dynpro UIs</a>, section Coding Rules, rule <i>Implement Fine-Grain UI Manipulations on Context but Not on UI Element Level</i>:
To maximize the rendering performance of your Web Dynpro application, implement all fine-grain UI manipulations on context instead of UI element level. This means do not call the setter-methods of UI element objects inside wdDoModifyView()directly but bind the related properties to the context and call the corresponding setter methods outside wdDoModifyView():
<b>Not:</b> wdDoModifyView(){ … theField.setEnabled(true) … }
<b>But:</b> wdDoInit(){ … wdContext.currentFieldNode.setEnabled(true) … }.
Otherwise Web Dynpro’s caching mechanisms cannot speed up the rendering of view layouts.
The view controller’s wdDoModifyView() method is designed for a special purpose: the creation of a UI tree or UI sub-tree at runtime in case it is not possible to declare the UI at design time. The method is neither intended for fine-grain UI manipulations nor for context manipulations. Fine-grain UI manipulations are achieved via means of data binding. Context manipulations are done in wdDoInit(), action event handlers or event handlers.
Unfortunately, the name wdDoModifyView() is somewhat misleading since the purpose of it is to create (and not to modify) a UI tree dynamically. While the usage of wdDoModifyView() in order to create a UI tree initially (firstTime == true) is not performance critical, modifying an existing UI tree (firstTime == false) is: Changing only one single attribute of a single UI element within wdDoModifyView() flags the complete view containing the control as dirty and the complete view must be completely re-rendered again – depending on the size and complexity of the view this can result in significant performance hits.
But in your case databinding cannot be applied, as index binding is not supported. The only databinding solution must use multiple/n nodes of cardinatliy 1..1 instead of 1 node of cardinality 1..n with no node elements. And this would require further coding for dynamic context node creation, copy logic based on value semantic.
Best Regards, Bertram

Similar Messages

  • How to create transparent image at run-time?

    How to create transparent image at run-time? I mean I want to create a (new) transparent image1, then show other (loaded) transparent image2 to image1, then show image1 to a DC. The problem is - image1 has non-transparent background...

    i'm not sure, but you can set the alpha value to 0 in all pixels which are 'in' the background..
    greetz
    chris

  • [CS4 Mac] Change PictureWidget image at running time.

    Hello,
    I have a PictureWidget on a panel - by default it displays a PNG file loaded from resources.
    It can also display error icons when a query fails - etc: these icons are loaded from plugin's 'PICT' resources.
    So far so good.
    Now - when a query doesn't fail it would need to display an image stored as a 'PICT' file on a server: the query result is telling me which 'PICT' file is to be displayed in the PictureWidget.
    For QXP I was using DrawPicture() to draw the PicHandle directly in the item rectangle.
    Switching it to InDesign - I am looking for a recipe to achieve same result but following InDesign SDK means and spirit.
    In other words - how do we change a PictureWidget image at running time in order to display a PICT files from server instead of built-in default PNG or 'PICT' resources.
    Any pointer or direction to achieve this would be very much appreciated indeed.
    Best regards
    Patrick Perroud

    Hi,
    I have to add a image on a dialog, I am able to add a image on Windows by associating a image resource ID with image path in .rc file. But not able to do the same on mac. How can we associate image resource ID with image path on MAC?
    Thanks in advance.

  • Can you set an image at run time?  Does it really work?

    I have read that others have been able to set an image at run time, but I cannot seem to get it to work (the image I set does not load).
    What I do is have a page, call it page2, that has two image components on it. In the constructor for page2 I do this:
    // Additional user provided initialization code
    image1.setValue("bike1.JPG");
    image2.setValue("bike2.JPG");
    The jpg files are in the build directory:
    C:\Documents and Settings\Darrin\My Documents\Creator\Projects\ImageTest\build\images
    The odd thing is that for the first image component(image1), I set a default jpg file (nogo.JPG that is in the same directory as the other two), and that does load.
    In fact, when I I check the value of image1 in afterRenderResponse by calling image1.getValue() it still has the default image (nogo.JPG) instead of the one I set it to (bike1.JPG) in the constructor by calling image1.setValue("bike1.JPG");
    So, either the image1.setValue() has no effect, or something is overwriting it.
    What is the trick to getting an image to load at run time like this?
    THANKS!

    Well after several more hours of banging myh ead against the wall, I still cannot get this to work.<br><br>
    I read in the constructor comments that whatever is in the jsp file will override the backing bean's constructor, so that might be part of the problem, but others I thought got this to work using a similar method.<br><br>
    Here is what I tried last which still does not work, but mimics what others have said did work for them:<br><br>
    //See if the default jpg file can even be copied over
    <br> image3.setHeight(image1.getHeight());
    <br> image3.setUrl(image1.getUrl());
    <br> image3.setValue(image1.getValue());
    <br>
    <br> Integer aiw = new Integer("1");
    <br> float aar = 0;
    <br> float ar = 0;
    <br>
    <br> ImageIcon ii = new ImageIcon("C:/Documents and Settings/Darrin/My Documents/Creator/Projects/ImageTest/build/images/bike1.JPG");
    <br> ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    <br> aiw = new Integer(ii.getIconHeight());
    <br> aar = ar*aiw.intValue();
    <br> image1.setHeight(""+(int)aar);
    <br> image1.setUrl("images/bike1.JPG");
    <br> image2.setValue("C:/Documents and Settings/Darrin/My Documents/Creator/Projects/ImageTest/build/images\\bike2.JPG");
    <br> image2.setUrl("C:/Documents and Settings/Darrin/My Documents/Creator/Projects/ImageTest/build/images\\bike2.JPG");
    <br><br>Note that when I run this and look at the log that I write out to in afterRenderRepsponse, it shows that image1 (which shows up as the default image I set at design time) and image3 (which does not show up which I set at run time using image1's value) both show the nogo.JPG image from the <b>resource</b> directory while image2 (that I set at run time to be bike2.JPG) is showing up as <b>empty</b>
    <br><br>
    This is really getting frustrating, and I would greatly appreciate a small tutorial from the JSC staff on just how you need to go about doing this. given that this is so common a need, a tutorial is warranted. Heck, just clue me in on how it is done and I will write one!
    <br><br>
    THANKS!

  • Dynamic Images at run-time

    I have a report that I would like to display a different
    image/logo depending on the user who is generating the report. Is
    there a method to display a different image at run-time? Or, does
    anyone have a better way rather than cloning 10 versions of the
    report will a different image on each?
    Thanks for any help in advance,
    Kevin

    Here is a sample that shows changing an image at runtime. If you are using a different version of Crystal Reports than XI R2, let me know.
    https://boc.sdn.sap.com/node/6174
    Cheers,
    Jonathan

  • How to select a sub image in run time

    Hi ,
    how can i select sub image from an image on panel in run time ?
    OR
    how to draw a rectangle(with dashed lines) on the panel and from its dimension i'll get the sub image ?
    THANKS

    BufferedImage.getSubImage(....);

  • Problems with executing customized Run-Time menu from a sub-vi imported from the main vi.

    I am having trouble executing Run-Time menu from the sub-vi.
    Currently my main vi program, which is the first thing that I open up to acquire data from different sources (i.e. dll’s, scanners etc.) opens up a number of sub-vi’s.
    I have created several sub-vi’s, which are opened from the main vi’s customized Run-Time menu that I have created (i.e. dsp file). I am using the open panel.vi to open other sub-vi’s. I don’t have any problems opening any number of sub-vi’s through the main vi’s menu.
    I would also like to have the option to open other sub-vi’s from any sub-vi’s menu. I succeeded in exporting the Run-Time m
    enu from the main vi to the sub-vi using the property node properties however nothing happens (I hear a beeping sound) when I click on the sub-vi’s menu. I don’t know what I am doing wrong. I would really appreciate it if someone can attach a sample code using Run-Time menus on sub-vi’s imported from the main vi.
    Thanks
    Nish

    I don't actually have any VIs like this. It might be easier to take the menu and just add it to the VI during development. Then it will always be there. It might be easier than doing this with Property Nodes.
    J.R. Allen

  • Unable to create CrystalReportViewer control programatically at run time

    Hi
    I'm not sure the best place to post this, so I'm placing it in Crystal Reports and BusinessObjects Enterprise.
    I'm using Visual Studio 2010 to create a web application which will serve as a reporting portal for BOE XI 3.1.
    I first installed Crystal Reports for Visual Studio 2010 and dropped a CrystalReportViewer onto a web form at design time.
    However, when setting the ReportSource property, I was encountering memory corruption errors.
    I've since read the release note and have realised that Crystal Reports for Visual Studio 2010 isn't compatible with BOE XI 3.1.
    So, I've unistalled Crystal Reports for Visual Studio 2010.
    Now I am trying to create the CrystalReportViewer at run time. I am able to successfully set the ReportSource property without getting memory corruption errors - which is good news, but I simply do not see the CrystalReportViewer control.
    Here's my code:
    WebForm1.aspx
    <%@ Register assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
    WebForm1.aspx.cs
    protected void Page_Load(object sender, EventArgs e)
        CrystalReportViewer myCrystalReportViewer;
        myCrystalReportViewer = new CrystalReportViewer();
        myCrystalReportViewer.ID = "CrystalReportViewer1";
        myCrystalReportViewer.AutoDataBind = true;
        myCrystalReportViewer.HasRefreshButton = true;
        myCrystalReportViewer.ReportSource = @"C:\temp\myreport.rpt";
        myCrystalReportViewer.DataBind();
        Panel1.Controls.Add(myCrystalReportViewer);
    Web.config
    <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="BusinessObjects.Enterprise.Providers, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL" />
            <add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
            <add assembly="CrystalDecisions.Shared, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
            <add assembly="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=B32731D11CE58905" />
            <add assembly="CrystalDecisions.ReportSource, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
            <add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
            <add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
            <add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
            <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
        </assemblies>
    </compilation>
    <httpHandlers>
        <add verb="GET" path="CrystalImageHandler.aspx"
        type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
    </httpHandlers>
    Everything compiles and runs fine - I just don't see anything on my page.
    I've tried adding a TextBox in exactly the same way and it displays just fine.
    What am I doing wrong or not doing?
    Surely it must be possible to add a CrystalReportViewer at run time.

    You left out the snippet of code that places the viewer in the HTML in the aspx file.
    Is it there?  That should describe its placement and sizing. The tag should be named CR:CrystalReportViewer (since you've set the TagPrefix to "CR").
    Sincerely,
    Ted Ueda

  • Creating PDF with IMAGE using CFDOCUMENT TAG

    Hi Guys,
    I m facing problem while creating the PDF using CFDOCUMENT
    tag.
    Actually my clients want the IMAGEs in PDF document.
    Problem is most of the images in JPG format and while I am
    going to attach images in PDF document it takes lots of time for
    creating PDF. In most of time it cause timeout.
    I have try to convert images JPG to PNG, yes I some what
    better performance than JPG format but still it is work for 20 - 25
    images. In my case I want to attach normally 50-100 images in PDF
    (sometimes it is more 200).
    PLZ, Help me.. F1...F1...F1
    thanks in advance
    Pritesh
    Coldfusion Programmer

    I am having a similar and more serious problem. It takes a
    long time to execute, but even attaching a small image balloons the
    pdf to 6MB plus. After a few images it gets up to 20MB. These are
    100k jpeg files being attached. The resulting PDF is too large to
    email or process effectively. Does anyone know how to reduce
    size/processing?

  • Can I supply MAX with a FP2000 run time system to a client

    I find no option to download it from the NI web site. I think that this software will be useful in trying to install a FP 2000 system.

    MAX also installs with NI FieldPoint, which you will need to have on any computer you are distributing a FieldPoint application to. You will also need the LabVIEW Run-time Engine, both of which are downloads on the drivers and updates page.
    Ames

  • Can we create items dynamically or at run time?

    Hello expert,
    can we create some item dynamically at some button click?
    Thanks
    yash

    yash_08031983 wrote:
    Hello expert,
    can we create some item dynamically at some button click?Hello, yash
    You can not create items at run time. But you can manage them at run time by setting Visible property programatically.
    Hope this helps..
    Hamid

  • Help!!! create & destroy CORBA object at run time

    I am develop an program using CORBA (Java IDL and JDK 1.3 on Win 98 OS) that involved login-logout mechanism. Someone can login into my program, by access HTML file from the server machine that contained an applet, via browser (NN 6).
    (the client and server run on same machine)
    If somebody login, says Mr.X, and make mistakes by type an invalid password, my program still (can) work by opening a wrong account/record belong to other people who (login and) logout last time before Mr.X login. It is a wrong result.
    I know the reason why this could be happen, its all because Java IDL support the CORBA transient object type. This transient object has the same lifetime as the execution of the server process that creates it. And it cause a problem for me.
    According to the explanation above, i have some questions :
    1. How to create, access, and destroy (delete) any CORBA object on demand (at run time) without have to shut down the server (process), in order to release any data/record hold by the CORBA object ?
    2. If Java IDL cannot create and destroy a CORBA object on demand (at run time), how do I solve my problem above ?
    If Java IDL cannot delete any CORBA object at run time, can it just delete any value (refresh data) that the object hold so any new data can be add again ?
    3. if i run my program on 2 different machine, it result an error : COMM_FAILURE minor code 1398079490. How do I fix it ? any solution for this error ?
    i really need any help, this program is my final project
    i will appreciate any help and answers
    thanks in advance
    Marsel Hober

    I'm using the POA implementation in java 1.4, but the api docs
    aren't very helpful in terms of what all the various policy
    values really do. I've got a servant that gets created by a
    request on a different object, and needs to stay around until
    the client tells it to go away. All the material that I've found
    on how to use CORBA in Java is either pre-POA, or doesn't
    cover any kind of management policies like servant retention.
    Can someone tell me how to do this, or am I stuck trying to
    wade through the CORBA 2.3 spec and hoping that I can
    figure out how the stuff really works in Java?

  • Latest CR for ActiveX/COM with royalty free run-time?

    What is the latest version of Crystal Reports that supports ActiveX/COM and does not have any run-time licensing royalties?  I am needing to migrate away from CR 8.5 using CRPE interface and cannot as yet leave ActiveX/COM architecture.  I will need to interface to databases such as SQLServer 2000/2005 and MS Access.

    Hi Joe,
    You should be able to upgrade to CR XI R2 which is still in support life cycle, but getting close to it's end of life. Download the trial version and then read the license readme file included.
    Samples are available above.
    Go to this link: http://www.sdn.sap.com/irj/boc and download the trial version of CR XI R2.
    Direct link to the Trial version: http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
    Licensing changes from version to version and there may be other options now for you also. Call the Sales department and ask them what will fit your requirements.
    Thank you
    Don

  • Load/Import images with Lingo in "running time"

    I would like to do the following:
    When I start a Shockwave application on my website, I want to
    load an images from the server and include it in my movie.
    How can I do it? (The image is not initially on the movie).
    On the other hand (this one is more difficult): If I have a
    3D scene: Can I put such image in a wall of my 3D scene
    dynamically?
    Thank you a lot.

    To load an external image in your movie, you can set the
    .fileName property of a bitmap member. It would help to preload the
    image file, so that it is available locally before setting the
    filename. Look up preloadNetThing().
    To show an image on a wall in a 3D scene, you need to make
    the image into a texture, make the texture part of a shader, and
    use that as the shader of the wall mesh. Here's a movie that does
    something like that, using images already available in a castLib:
    http://nonlinear.openspark.com/tips/3D/zoetrope/

  • Problem to create jar with images

    Hello
    I have a project, it's a frame with a panel that contains a image, I want to create a Jar, but I have to problems, if create a Jar and execute out the project folder, I can't see the images, if I use getClass().getResource, I have other problems, I can't add panels.
    How it's difficult to say, I going to put a link from the project make with eclipse [My project|http://www.megaupload.com/?d=HBPHUWE9] , if someone wants have a look I would be grateful.
    http://www.megaupload.com/?d=HBPHUWE9
    Just look at the package com.constructor.interfaz
    To make the jar use the class InterfazFactoriaPaneles
    Thanks in advance !
    Edited by: Dav1d on Jul 10, 2009 6:11 AM
    Edited by: Dav1d on Jul 10, 2009 6:12 AM

    I explain better:
    I have a Class -> InterfazFactoriaPaneles, with this main
    public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        InterfazFactoriaPaneles application = new InterfazFactoriaPaneles();
                        application.getJFrame().setVisible(true);
    in the Frame I add a JPanel with an image, to load the image I override this method, where com.constructor.imagenes, it's the path where I've got my images :
    public void paintComponent(Graphics g){
              Dimension tamanio = getSize();                    
              ImageIcon     imagenFondo = new ImageIcon("./src/com/constructor/imagenes/patronConstructor.jpg");     
              g.drawImage(imagenFondo.getImage(),0,0,tamanio.width,tamanio.height,null);
              setOpaque(false);
              super.paintComponent(g);
    the with a menu, I remove the panel with the image I load other panel with components (JTextField, JTable, JLabel,...).
    If run the program from eclipse, everything it's ok, if I export into jar file, it works if the jar it's inside the project folder, but if I put the jar in other location, doens't load images, I google from answer and I read to put images path like that: new ImageIcon(getClass().getResource("/com/constructor/imagenes/patronConstructor.jpg")); , but if I do that, and run in eclipse, everything it's ok, but If I export into a Jar, I load the image, but when I try to change to other panel it doesn't work.
    So I do not what's the answer, if someone check my code, and try to make a jar, and the move the jar file into other location, will be able to see images doesn't appears.

Maybe you are looking for

  • Default parameters in R12

    Hi: I was asked to check parameters on an EBS version 12.1.3, database 11.1.0.7 on linux to see if it has all default parameters. If not what have be changed. But I dont know what are the default parameters? Is there a place I can have the default va

  • How can I change a title in I books

    I have a ton of PDF files in iBooks. The All have very vague titles. How can I retitle and organize? I'm on ipad2

  • [W520] How to change boot splash / logo?

    Hi all, Is there a way to change the boot logo upon starting the W520?  Currently, the default is the Thinkpad logo.  I would like to change it to contain other information upon booting.

  • Firefox has too much space between text

    Something changed in my Firefox display. It is now showing a large amount of space between text. Also, the fields for data entry have increased their size. Text size is okay. Thank you for your help.

  • Vision acquisition express stalls when i select a camera even if i click 'refresh'

    The vision acquisition express stalls when i select a camera even if i click 'refresh'. Using Labview 2010 (evaluation) on a Windows 7 laptop and tried on another computer running windows xp.