About dynamic creating component instance

my project is a lib project , and I can not create a mxml
component using getdedinitionbyname then new the class .
because the class reference I can not received using
getdedinitionbyname! Has any body know something about it?

Why,there is so little developpers!But luckily I find the
answer,Just add a compiler parameter -include-librarirs to resoleve
it!!

Similar Messages

  • Dynamic created component, problem to set position

    hello,
    I want to create in dynamic way label component and put it on GridPanel in given position. How can I set this position(x,y) to created component?
    thanks in advance

    Hi, Jeff.
    Just don't want to cross post the same answer all over the forum. So I gave some inputs on the topic in this message: http://forums.sdn.sap.com/thread.jspa?messageID=11127647&#11127647
    Hope this will help you.

  • Dynamic create Component usage and embed it in view container

    There is a view_container_uielement VC_TEST  in view V_MAIN, in wd component ZTEST.
    I created a web dynpro component named ZWDR_TEST and add it into the wd component ZTEST.
        gr_comp_test = component->create_cmp_usage_group(
          name = 'TEST_GROUP'
          used_component = 'ZWDR_TEST' ).
        lr_comp_usage = me->gr_comp_test->add_component_usage(
          embedding_position = 'V_MAIN/VC_TEST'
          name = 'TEST'
          used_component = 'ZWDR_TEST' ).
        if lr_comp_usage->has_active_component( ) is initial.
          lr_comp_usage->create_component( component_name = 'ZWDR_TEST' ).
        endif.
        ifc_test ?= lr_comp_usage->get_interface_controller( ).
    I thought the wdr ZWDR_TEST was embeded in the view V_MAIN in the position VC_TEST by the embedding_position parameter.
    But in the result web page, there is no ZWDR_TEST in the position of VC_TEST.
    Could any one explain why?
    Thanks

    Hi,
    for dynamic comp usage.. check this..
    http://help.sap.com/saphelp_nw70/helpdata/en/bc/191a427ff6db2ce10000000a1550b0/frameset.htm
    Dynamic Component Usage
    embed view
    Dynamic View embed
    How to create a webdynpro view dynamically and embed into view container?
    Cheers,
    Kris.

  • Dynamically create component

    Same project as my last post but figured the context is different enough to merit a new thread.
    I have a flex application called app.mxml and a component called dummy.mxml, the component consists of a text area and a button.
    The application consists of 5 textInputs and a Canvas.
    Is it possible that when the user types something into one of these text fields that there is an instance of dummy created within the canvas and the text area within dummy contains the text within the input field?

    I'll try and explain it a little better,
    in my main application I have a panel that contains 5 empty textInput boxes, these are all blank, next to the panel I have a canvas, this has nothing in it at all at this point.
    there is also a component (dummyComponent.mxml) in the application that consits of a textArea and a radio button.
    this component is not used within the application prior to runtime.
    Runtime -->
    user enters the text "testing 123" into the first textInput box. ad this point an instance of dummyComponent is created within the canvas and the contents of its text area mimic that of the input box.
    The same effect could be achieved by having 5 textAreas within the canvs that each bind to the 5 textInputs, but i don't want these textAreas to exist unless they are needed.
    Cheers
    Tim

  • MethodnotFound Exception for dynamically created component(menuItem)

    Hi
    I have created menuItem component and tried to create Action Listener object and setting it to the component in the backing bean.
    but it is throwing methodnot found exception.
    javax.el.MethodNotFoundException: Method not found: [email protected]()
    javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Method not found: [email protected]()
         at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:92)
    Below is my code..
    MenuItem item1 = new MenuItem();
    item1.setValue(key);
    Application app = FacesContext.getCurrentInstance().getApplication();
    javax.faces.el.MethodBinding actionListener = app.createMethodBinding("#{breadCrumbBean.test}", null);
    item1.setActionListener(actionListener);
    Let me know whether i created actionListener object or not.
    Any suggestions...
    Thanks
    Edited by: _user on Jan 20, 2011 9:27 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    I tried this it works for me...
    Try to set as below...
    MethodExpression ee = context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(), "#{breadCrumbBean.test}", String.class, new Class[] { });
    item1.setActionExpression(ee);
    Regards,
    Suganth.G

  • Trouble accessing a property of an instance inside a dynamically created MC.

    I’m dynamically creating an instance of a movieclip, call it a game piece. This game piece has 4 frames, each with a movieclip called “base” (although one is red, one blue, one green, one yellow). When the game piece is created I set the frame to indicate player color. I’m also changing the alpha of “base” to 1.0 when it’s being dragged, 0.5 when it’s dropped.
    Using the following code, everything works fine if the game piece color is set to the base in frame 1 (red). If the game piece is created and the timeline moved to a frame other than 1, I throw an error when trying to access base.alpha (this would be the second, third, and fourth instances of base in the game piece timeline). Here’s the strange part, this is only a problem when the game piece is first created and added to the display list. Once created, even after the error has been thrown, I can access the alpha of bases 2, 3, and 4 in the drag start/stop listeners. Here’s a link to the work in progress, and the relevant sections of code (shortened for brevity, t1 is the top left piece on the pallet, others just repeat the same code):
    http://www.appliedcd.com/stormbringergrey/cw/CW_Combat_Sim.html
    var gUnitArray:Array = new Array();
    function initUnitPallet():void {
         t1.addEventListener(MouseEvent.MOUSE_DOWN,popNewUnit);
         // other pieces the same as above
         clanSelect.addEventListener(Event.CHANGE,changeClan);
    function popNewUnit(e:MouseEvent):void {
         var isBase:String = e.target.name;
         var unitType:String = e.target.parent.name;
         if (isBase=="base") {
              var classRef:Class = getDefinitionByName(unitType + "master") as Class;
              var newUnit:MovieClip = new classRef();
              gUnitArray.push(newUnit);
              var newUnitIndex:uint = gUnitArray.length-1;
              this.addChild(gUnitArray[newUnitIndex]);
              gUnitArray[newUnitIndex].gotoAndPlay(clanSelect.selectedItem.data);
              // the following line is a problem if the above gotoAndPlay is anything other than frame 1
              gUnitArray[newUnitIndex].base.alpha = 1.0;
              gUnitArray[newUnitIndex].x = e.stageX;
              gUnitArray[newUnitIndex].y = e.stageY;
              gUnitArray[newUnitIndex].addEventListener(MouseEvent.MOUSE_DOWN,startUnitDrag);
              gUnitArray[newUnitIndex].addEventListener(MouseEvent.MOUSE_UP,stopUnitDrag);
              gUnitArray[newUnitIndex].startDrag();
    function startUnitDrag(e:MouseEvent):void {
         e.currentTarget.base.alpha = 1.0;
         e.currentTarget.startDrag();
    function stopUnitDrag(e:MouseEvent):void {
         e.currentTarget.base.alpha = 0.5;
         e.currentTarget.stopDrag();
    function changeClan(e:Event):void {
         var myClanColor:String = e.target.selectedItem.data
         t1.gotoAndPlay(myClanColor);
         // other pieces the same as above

    Thanks, pointed me in the right direction. I tried implementing a RENDER listener (see commented code below), and it worked, but unreliably. In my case the RENDER event fired before the entire frame was instantiated in about 1 out of 10 tries. I found a bunch of old posts (2007 or so) implying the RENDER event is buggy in Flash at best (apparently it has a better history in Flex). I couldn’t find more recent posts indicating better behavior, but I was unable to eliminate the residual errors in my project.
    Fortunately, while reading I was reminded of the EXIT_FRAME event which seems to work perfectly (but forces me to player 10, not a big deal). Final code below along with proper Z-order control.
    (BTW: I really miss the old forum's code box)
    function initUnitPallet():void {
         t1.addEventListener(MouseEvent.MOUSE_DOWN,popNewUnit);
         clanSelect.addEventListener(Event.CHANGE,changeClan);
    function changeClan(e:Event):void {
         var myClanColor:String = e.target.selectedItem.data
         t1.gotoAndPlay(myClanColor);
    function popNewUnit(e:MouseEvent):void {
         var isBase:String = e.target.name;
         var unitType:String = e.currentTarget.name;
         if (isBase=="base") {
              var classRef:Class = getDefinitionByName(unitType + "master") as Class;
              var newUnit:MovieClip = new classRef();
              gUnitArray.push(newUnit);
              var newUnitIndex:uint = gUnitArray.length-1;
              this.addChild(gUnitArray[newUnitIndex]);
              gUnitArray[newUnitIndex].gotoAndPlay(clanSelect.selectedItem.data);
              gUnitArray[newUnitIndex].x = e.stageX;
              gUnitArray[newUnitIndex].y = e.stageY;
              gUnitArray[newUnitIndex].addEventListener(MouseEvent.MOUSE_DOWN,startUnitDrag);
              gUnitArray[newUnitIndex].addEventListener(MouseEvent.MOUSE_UP,stopUnitDrag);
              gUnitArray[newUnitIndex].addEventListener(Event.EXIT_FRAME,renderUnit);
              // gUnitArray[newUnitIndex].addEventListener(Event.RENDER,renderUnit);
              // stage.invalidate();
              gUnitArray[newUnitIndex].startDrag();
    function renderUnit(e:Event):void {
         e.currentTarget.removeEventListener(Event.EXIT_FRAME,renderUnit);
         // e.currentTarget.removeEventListener(Event.RENDER,renderUnit);
         e.currentTarget.base.alpha = 1.0;
    function startUnitDrag(e:MouseEvent):void {
         if(this.numChildren > 1){
              e.currentTarget.parent.setChildIndex(e.currentTarget,this.numChildren-1);
         e.currentTarget.base.alpha = 1.0;
         e.currentTarget.startDrag();
    function stopUnitDrag(e:MouseEvent):void {
         e.currentTarget.base.alpha = 0.5;
         e.currentTarget.stopDrag();

  • How to create multiple component instances at runtime using java

    Hi,
    I need to create component instances at runtime using java.I found ComponentSet.add method.But I am not finding a way to get handle of ComponentSet.
    I see methods with params of IRuntimeNode.But how to get ComponentSet from IRuntimeNode.
    If anybody knows or have sampel code then please share with me.
    thanks,
    ashok

    Ashok --
    This is a common challenge for those using Configurator Extensions with multiple instantiation for the first time. The problem is that the CIO's representation of the structure for multiply-instantiable Components differs slightly from what both Configurator Developer users and Configurator Runtime users see in those respective applications. Multiply-instantiable Components are not direct children of the Model in which they're defined. Internally, there is an entity that sits between the parent Model and the instantiable Components; that intermediate entity is the ComponentSet object you've found in the CIO documentation.
    If the name of your multiply-instantiable Component is "My Component", then its ComponentSet may be accessed simply by calling getChildByName("My Component") on its parent Model; a List of the instantiated Components may be accessed with the ComponentSet's getChildComponentNodes() method, and instances may be added and deleted using its add() and delete() methods.
    Hope this helps.
    Eogan

  • Dynamically created combo box

    I am using ActionScript to create component instances for use
    within the
    Accordion component. One of those ia a ComboBox where one can
    select an
    entry from a list of twenty items. The ComboBox works
    properly in the Flash
    IDE but not when uploaded to the site. All other dynamically
    created
    components work fine. I should also mention that the SWF is
    loaded into a
    maste SWF as a movie clip using the loadMovie statement. That
    doesn't seem
    to be the problem sice most components work.
    Anyone have any thoughts?

    It was done this way from the start.
    I should clarify. The combobox appears correctly but will not
    function
    (i.e., it does not open to reveal the choices.
    Thanks anyway.
    Greg

  • Updating dynamically created TextField

    The following for loop dynamically creates 4 instances of the
    same button. Each button is then populated with its own textfield.
    I have given the textfield(s) an instance name of option0, option1,
    etc, etc.
    I want to populate the text in each field with something
    different (Home, Contact, etc, etc).
    I am trying to call the textField by its created instance
    name "option0", but I get an error saying it's not recognized. Any
    ideas on how to accomplish this?
    Here is the code thus far:

    Thanks for your response Ned.
    I have been trying to use your method, but still get errors
    stating the "access of undefined property option0".
    When I use your above suggestion the for loop returns [object
    TextField] 4 times which is expected. How do i assign a property to
    the qbTF?
    Should I be trying to assign a property to "option0" or
    [object TextField]? I'm assuming it's the latter.

  • Finding Component on Dynamically Created UI

    I am having a hard time regarding finding a particular component in my managed bean if your UI is dynamically created (say using an iterator..) especially
    if you need that component during PPR.
    As of the moment, I am doing this but its really ugly and is bound to be broken if I add another layout.
    public void handleChange(ValueChangeEvent valueChangeEvent) {
         UIComponent component = valueChangeEvent.getSource().getParent().getChildren().get(0).getChildren().getFacet("end").get(0).getChildren().get(1);
         AdfFacesContext context = AdfFacesContext.getCurrentInstance();
         context.addPartialTarget(component);
    }This code wont work also, since at runtime, I wouldnt know the id of the component.
    FacesContext facesCtx = FacesContext.getCurrentInstance(); 
    facesCtx.getViewRoot().findComponent(name) ; Been thinking about this for sometime now. Help needed.

    you can use this instead
    FacesContext.getCurrentInstance().getViewRoot().findComponent("<id>);
    or
    // used to locate region. Could also find any component
    // located in the base ViewRoot()
    public static UIComponent findComponentInRoot(String id) {
    UIComponent component = null;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext != null) {
    UIComponent root = facesContext.getViewRoot();
    component = findComponent(root, id);
    return component;
    // Recursive method which finds your component within JSFF
    // regardless of facet or other UIComponents which may have children
    public static UIComponent findComponent(UIComponent base, String id) {
    if (id.equals(base.getId()))
    return base;
    UIComponent kid = null;
    UIComponent result = null;
    Iterator kids = base.getFacetsAndChildren();
    while (kids.hasNext() && (result == null)) {
    kid = (UIComponent) kids.next();
    if (id.equals(kid.getId())) {
    result = kid;
    break;
    result = findComponent(kid, id);
    if (result != null) {
    break;
    return result;
    }

  • Dynamically creating a component

    Hey,
    Does anybody know how to accomplish the following task:
    I'm getting a name of a component as a string from and XML.
    for example 'Label' or 'Textbox'. I then want to create an instance
    of that component. as the following shows
    var cType:String = data[0].component.toString();
    var myComponent:*;
    myComponent = new cType();
    Any ideas?
    Thanks
    Josh

    You can make things a bit easier. Use ApplicationDomain's
    getDefinition() function. You can pass it the name of the class
    (eg, "Label") and it will return the class definition, then you can
    use the new operator to make an instance. You just need to link in
    all of the classes you expect to use.

  • Play effect on dynamically created visual component

    Hi!
    Can someone please explain to me, how do I play effect on a visual component created in actionscript?
    Thanks, regards

    You can also set the target/targets property of the effect once you've created the instance in AS, just like you do in MXML code. So where in MXML you might have something like this:
         <mx:Button id="button" click="mover.play()"/>
          <mx:Move id="mover" target=""/>
    you would do the equivalent in actionscript like this:
         var button:Button = new Button();
         var mover:Move = new Move();
         mover.target = button;
         button.addEventListener(MouseEvent.CLICK, clickHandler);
         private function clickHandler(event:Event):void
              mover.play();
    There's no mystery here in launching effects from AS - it's the same properties and structures that you set up in MXML, just different syntactic ways of referring to the properties and events.
    Chet.

  • Web dynpro component interface, can't create a instance

    Hi guru,
    I have created a web dynpro component interface, and implemented it through some components.
    But when I use the interface in another component, there comes a runtime error. The following is the error message.
    Error when Creating Component YHREFM_OBJSEL_INTERFACE. YHREFM_OBJSEL_INTERFACE Is a Component Interface, Therefore, an Instance Cannot Be Created. Name of Component May Not Be Specified. (Using Component: YHREFM_PRINT_FORM_SE, Component Usage: USAGE1)
    Need your help!
    Best Regards,
    Guo Guo Qing

    Hi,
    I have found the cause of the problem. I have mapped some context in the component interface to componenet_A. Then I active component_A, and test it. Then the exception on the top of the Thread is raised.
    What's wrong with it? Could someone give me a solution?
    Thank you very very much.
    Best Regards,
    Guo Guo Qing

  • How to get a dynamically created symbol to delete itself on click?

    Here's the setup...
    I want to have a dynamically created symbol appear upon click of a hotspot. In this case, you click on a pulsating hotspot and a popup box appears.
    Here's the code I'm using for that.
    //Create an instance element of a symbol as a child of the given parent element
    var mySymbolObject = sym.createChildSymbol("gardern_toxins_popup","stage");
    So we have the symbol "garden_toxins_popup" from my library placed dynamically on the page. I would like to assign an action to the pop-up itself that allows you to remove the symbol from the stage upon click.
    I feel silly for not being able to figure this out. I tried iterations of this bit of code...
    //Get the stage from the composition level, get the symbol
    sym.getComposition().getStage().getSymbol("garden_toxins_popup").delete();
    ...but it doesn't work.
    So I tried thinking like I was back in Flash and tried the following...
    this.parent.removeChild(this);
    But no joy on that as well. Is there something I haven't addressed in this logic or am I going about it in the wrong way? Thanks!

    Hi, chirpieguy-
    You'll want to use the deleteSymbol() API.
    http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html
    BTW, you should use the capitalized "Stage" to add it to the Stage - the lower case stage has a special meaning with Animate and might not give you what you want..
    sym.createChildSymbol("gardentoxins", "Stage");
    In the symbol itself, create a click event on a container div, then:
    sym.deleteSymbol();
    That being said, you don't need to dynamically create and delete an object.  What you can do is to use hide() and show() on an element and use the coordinates of your click to change the CSS value of top/left of this object so that you don't have to do the object management I highlighted above.
    Hope that points you in the right direction.
    -Elaine

  • How to get the Dynamic UI component value from JSFF page to any managedbean

    HI ,
    We have list of bean objects in jSF page we are iterating the list of bean using the forEach loop and displaying the value into Input type text (UI component) value filed .
    If we try to get the UI component value in Managed bean we are not getting the dynamic values .
    The below piece of code used to retrieve the dynamic values from the JSF page doesn't have any form :
    UIComponent component = null;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext != null) {
    UIComponent root = facesContext.getViewRoot();
    component = findComponent(root, componentId);
    then component type casting to the based on UI component which we trying to access and getting the value as " NULL " ..Please let me know how to get the dynamic values form the JSF ?
    Please let me know if any other approach or any changes required on above ?
    Thanks

    Hi,
    the root problem is this
    <h:inputText id="it3" value="#{familyList.ctn}" />
    <tr:commandButton text="Save" id="cb3"Note how each row writes to the same managed bean property, thus showing the same data. Instead your managed bean should expose a HashMap property that you then apply values to using a key/value pair. The key could be the ID of the field, which then you also should dynamically define e.g. cb<rowIndx>. The command button could then have a f:attribute assigned that has the row HahMap key as a value. This way you truly create value instances for the object
    Frank

Maybe you are looking for