Accessing nested UIComponents

The aim of the script is to be able to access component's
chldren, and their children, and their children, etc... by their
index.
I've tried the following:
// script
public function deployNesting():void {
var container:Canvas= new Canvas();
var chldA:Canvas = new Canvas();
var chldB:Canvas = new Canvas();
var chldC:Canvas = new Canvas();
this.addChild(this.container);
this.container.addChild(chldA);
this.container.addChild(chldB);
this.container.addChild(chldC);
return;
public function accessNesting():void {
trace(this.childAt(0).childAt(0))
// error 1119*
trace(this.childAt(0).numChildren)
// error 1119*
return;
*1119 : Access of possibly undefined property numChildren
through a reference with static type
flash.display:DisplayObject.
I'm aware that such nesting is not usually a best practice,
but in some cases it is required, and I would appreciate an advice
on this issue.
a.neko

Well... It's time to assume the therapeutical values of this
forum in my particular case : ) One more time, just after recurring
to all posiible ways to solve it, and afterwards posting a topic
here, I change my approach and find the solution...
In this case it is required to cast the return of all the
getChildAt() in the nesting structure, except the last one.
You can access a nested child to add a new child to it's
display list as follows:
Canvas(this.getChildAt(0)).addChild(chldC);
Accessing a deeply nested child's name property looks as
follows:
Canvas((Canvas(this.getChildAt(0))).getChildAt(0)).getChildAt(0).name;
etc...
Somewhat complicated, but solves the problem of accessing
nested children when, for instance, the variables used to create
them are gone, or to freely iterate through nested display lists...
(Verified with Flex 2.0 Builder mx.* components, but I
suppose it works also for flash.display.* objects.)
a.neko

Similar Messages

  • Unable to access nested managed bean property in JSF 1.2.9

    In an old version of JSF, namely 1.2-b20-FCS from April/21/2006, I could access nested properties of a managed bean. So I had a managed bean OuterBean, and in JSF I could write
    <h:inputText value="#{outerBean.innerBean1.propertyA"/>
    The Java class OuterBean has a member function
    InnerBean OuterBean.getInnerBean1();
    That is, there is a function getInnerBean1() taking no arguments, and it returns something which in my example above is the class InnerBean.
    Class InnerBean has a member function getPropertyA().
    But in the latest JSF from July/17/2008, this nested stuff is not working.
    Simple access like #{outerBean.propertyA} works, but nested access like #{outerBean.innerBean.propertyA} does not.
    The exception is something like
    org.apache.jasper.el.JspELException: /whatever/mypage.jsp(71,15) '#{outerBean.innerBean.username}' Error reading 'innerBean' on type
    mypackage.OuterBean at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:107) at javax.faces.component.UIOutput.getValue(UIOutput.java:184) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946) at javax.faces.render.Renderer.encodeChildren(Renderer.java:148) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942) at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) atThanks.

    Sorry, it looks fine to me. In my original post, I had the call stack in code and for some reasons the newlines were removed. So let me try again in text, but putting two newlines. Hope it works this time:
    org.apache.jasper.el.JspELException: /whateverr/mypage.jsp(71,15) '#{outerBean.innerBean.property}' Error reading 'innerBean' on type mypackage.OuterBean at
    org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:107) at javax.faces.component.UIOutput.getValue(UIOutput.java:184) at
    com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201) at
    com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284) at
    com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154) at
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861) at
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:946) at
    javax.faces.render.Renderer.encodeChildren(Renderer.java:148) at
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837) at
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:936) at
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:942) at
    com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271) at
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202) at
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) at
    Edited by: sn72 on Sep 21, 2008 10:21 AM
    Edited by: sn72 on Sep 21, 2008 10:22 AM

  • Accessing nested child in model to populate datafield in datagrid.

    I am using Rails + Flex and I have problems to access nested
    xml in a datagrid.datafield.
    I reproduce this in a simple mxml sample:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" width="954">
    <mx:Model id="md">
    <root>
    <e1>el1</e1>
    <e2>el2</e2>
    <child>
    <c1>c1</c1>
    <c2>c2</c2>
    </child>
    <e3>el3</e3>
    </root>
    </mx:Model>
    <mx:DataGrid id="myGrid"
    dataProvider="{md}" >
    <mx:columns>
    <mx:DataGridColumn dataField="e1"/>
    <mx:DataGridColumn dataField="e2"/>
    <mx:DataGridColumn dataField="child"/>
    <mx:DataGridColumn dataField="child.c1"/>
    <mx:DataGridColumn dataField="e3"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    Basically, at runtime the content of 3rd column is object
    (alright) and the 4th column is empty whereas it should be "c1".
    Am I doing something obviously wrong ?
    Thanks for any help.
    Romain.

    http://www.adobe.com/devnet/flex/articles/e4x_03.html
    http://www.adobe.com/devnet/flex/articles/e4x_04.html
    you can use the labelfunction

  • How can I access nested symbol details such as offset and name dynamically

    Hey friendly Edge Animate experts!
    I'm very new to Edge Animate, and appear to have run into some startup problems that I am unable to find a good way around.
    I have setup a small demo project with several levels, and am trying to get details from symbols on 2nd or 3rd level dynamically with little luck.
    To test that I fetch the correct details, and have the pathing correct, I have added a text option in each symbol.
    I can access and alter the value of the text fields - but I can't access the symbol data such as offset, position, ID, name etc.
    For simplicity, imagine a project with a symbol "FirstLevel" that has a symbol "SecondLevel" inside it.
    "SecondLevel" has three symbols that each have 2 text layers FirstTextField and SecondTextField  in addition to a symbol that has a png image.
    My code:
    // Get all the 3rd level symbols that I want to get details on (works perfectly)
    var childSymbols = sym.getComposition().getStage().getSymbol("FirstLevel").getSymbol("SecondLevel").getChild Symbols();
    // Loop through all the children (works perfectly)
    for(var i=0; i<childSymbols.length; i++){
    // Add the looping counter to a text field just to test if all is ok (works perfectly)
       childSymbols[i].$("FirstTextField").html(""+i)
    So... I can access the symbols, change a text without problems.
    Now i would like to get the symbol details such as offset().left or position().top
    and add that info to SecondTextField and I just can crack that nut!!!
      childSymbols[i].$("SecondTextField").html(""+childSymbols[i].position().left); // not working
      childSymbols[i].$("SecondTextField").html("TEST VALUE"); // working, TEST VALUE is shown
    // Not working
    var ChildPos = sym.getSymbol(childSymbols[i]).position();
    childSymbols[i].$("SecondTextField").html(""+ChildPos.left);
    // Not working
      childSymbols[i].$("SecondTextField").html(""+getVariable(childSymbols[i]).position().left ));
    I have tried this and that for hours and hours
    I feel that i have searched high and low
    I must have tried all the wrong options
    But I'm still looking for the one correct way to do thi...
    Any help, tips, tricks or read-up directions would be much apreciated.

    Hey Darrell,
    Thank you very much for taking the time to look into this.
    I have uploaded a simplified version (without any png files) at:
    http://www.lokehansen.com/blog/wp-content/uploads/2012/12/helpwanted.zip
    Best wishes
    Loke Krongaard Hansen

  • Access nested array element using this.name - is it possible?

    Hi
    I've got a nested array containing a series of 2 element arrays containing an object name, and text related to that object.
    I've set it up like this:
    public var names:Array = [["instance name 1", "text for first object"],["instance name 2", "text for second object"], ...]];
    What I'm trying to do is to have the text related to the object appear in a text box when the object is moved.
    This is all set up within a class containing code for the drag and drop functions.
    If I set the text box to show a specific element, such as:
    MovieClip(parent).text_box.text= names[2][1];
    it works fine. But I can't get it to create the value for the first bracket from the this.name attribute.
    I had it working for 2 arrays - one with the name and another with the text where the code was;
    MovieClip(parent).text_box.text= texts[names.indexOf(this.name)];  (arrays named 'names' and 'texts', text box named 'text_box')
    I'm hoping there's something similar that I can do for the nested array, but everything I try gives me the #1010 error - term undefined.
    Is there an easy way to sort this out - or am I better sticking with the 2 array version?
    (BTW this is my first go at using arrays)
    Thanks

    Why not use an Object for this, like:
    var oTexts:Object = {
                                  "clipname1":"text for clip 1",
                                  "clipname2":"text for clip 2",
                                  "clipname3":"text for clip 3",
    and then jsut use sometihing like this
    var txt:String = MovieClip(parent).oTexts[this.name];
    etc. ..

  • Access nested h:dataTable programatically in Java

    Hi everyone. I've got an h:dataTable which is nested three levels deep, but also within some other components. Does anyone have a good solution to get a handle on the rowData() of the internally nested tables? Do I need to recursively traverse all of the children searching for a table? It's hard to use UIComponent.findComponent("") because the table ID is dynamically generated... etc.
    The first level table is bound to a backing bean where I am attempting to get these references.
    Thoughts? Thanks!

    Anyway, I did a quick create and test and it just worked..
    MyBeanpublic class MyBean {
        private HtmlDataTable parent;
        private HtmlDataTable child;
        private List<MyData> list;
        public MyBean() {
            list = new ArrayList<MyData>();
            list.add(new MyData("parent1", "nested1a", "nested1b", "nested1c"));
            list.add(new MyData("parent2", "nested2a", "nested2b", "nested2c"));
            list.add(new MyData("parent3", "nested3a", "nested3b", "nested3c"));
        public void submit() {
            System.out.println(child.getRowData());
        public HtmlDataTable getParent() {
            return parent;
        public HtmlDataTable getChild() {
            return child;
        public List<MyData> getList() {
            return list;
        public void setParent(HtmlDataTable parent) {
            this.parent = parent;
        public void setChild(HtmlDataTable child) {
            this.child = child;
        public void setList(List<MyData> list) {
            this.list = list;
    }MyDatapublic class MyData {
        private String value;
        private List<MyData> list;
        public MyData() {
        public MyData(String value) {
            this.value = value;
        public MyData(String value, String... nestedValues) {
            this(value);
            this.list = new ArrayList<MyData>();
            for (String nestedValue : nestedValues) {
                this.list.add(new MyData(nestedValue));
        public String getValue() {
            return value;
        public List<MyData> getList() {
            return list;
        public void setValue(String value) {
            this.value = value;
        public void setList(List<MyData> list) {
            this.list = list;
        public String toString() {
            return value;
    }JSF<h:form>
        <h:dataTable binding="#{myBean.parent}" value="#{myBean.list}" var="parentItem">
            <h:column>
                <h:dataTable binding="#{myBean.child}" value="#{parentItem.list}" var="childItem">
                    <h:column>
                        <h:commandButton value="#{childItem.value}" action="#{myBean.submit}" />
                    </h:column>
                </h:dataTable>
            </h:column>
        </h:dataTable>
    </h:form>

  • Problem accessing nested MovieClips

    Hi I'm trying to add an event Listener to a button that is nested inside a movieclip, and that movieclip is nested inside another movieclip, but I get a null object reference error where I add the event listener:
    public function OptionsClass(model:GameModel, stage:Object) {
                                  // constructor code
                                  _gameModel = model;
                                  _stage = stage;
                                  _optionsClip = new Options();
                                  _optionsClip.gotoAndStop(1);
                                  addChild(_optionsClip);
                                  _optionsClip.optionsMC.controlsBtn.addEventListener(MouseEvent.MOUSE_DOWN, onControlsBtnDown); -->ERROR
                                  _optionsClip.optionsMC.backBtn.addEventListener(MouseEvent.MOUSE_DOWN, onBackBtnDown);
    all the instances are named correctly on the movieclips so I don't know what the problem is. If anyone knows what I'm doing wrong please let me know, thank you.

    NEVERMIND I FIXED IT, I HAD THE LABELS WRONG, SORRY

  • Retrieve attachements nested in .msg file attached to an email

    Hi All,
    question regarding retrieving nested attachments with-in email.
    Im able to retrieve an email attached to an email and also other attachemnts attached to an email.
    The problem is im not able to retrieve a mail which has an email as an attachment which in turn has a doc attachment.
    The structure is like this--Mail A -->has an attachemnt MailB.msg--->This MailB.msg has a Test.doc attachemnt in it.
    With my code im able to retrieve this MailB.msg's body but not the attachemnt Test.doc it has in it.
    I found that MailB.msg part is not an instanceof MultiPart .
    This is kind of Urgent.
    Is there any one help me resolve this??

    You're right, the nested message definitely has attachments, and it's definitely a multipart message.
    If you're not seeing it, there's something wrong with your program, or there's something wrong with
    your mail server.
    I saved the message to a file and ran "java msgshow -m -s < msg.txt", which showed this structure
    for the nested message:
          CONTENT-TYPE: message/rfc822
          This is a Nested Message
            This is the message envelope
            FROM: xxx
            REPLY TO: xxx
            TO: xxx
            SUBJECT: FW: LIC Receipt
            SendDate: Tue Feb 10 06:01:30 PST 2009
            FLAGS:
            X-Mailer NOT available
            CONTENT-TYPE: multipart/mixed;
            boundary="Boundary_(ID_p5i8pVdsdEV99SAb2KDWuw)"
            This is a Multipart
              CONTENT-TYPE: multipart/related;
            boundary="Boundary_(ID_lli6t6Aq6i1zX4YOueK9IQ)";
            type="multipart/alternative"
              This is a Multipart
                CONTENT-TYPE: multipart/alternative;
            boundary="Boundary_(ID_AQLuyew+Ue/dARR0G/h21w)"
                This is a Multipart
                  CONTENT-TYPE: text/plain; charset=us-ascii
                  This is plain text
                  CONTENT-TYPE: text/html; charset=us-ascii
                CONTENT-TYPE: image/gif; name=image002.gif
                FILENAME: image002.gif
                CONTENT-TYPE: image/jpeg; name=image001.jpg
                FILENAME: image001.jpg
              CONTENT-TYPE: application/pdf; name="xxx.pdf"
              FILENAME: xxx.pdf
              CONTENT-TYPE: application/octet-stream; name="xxx.mht"
              FILENAME: xxx.mht
              ---------------------------How are you accessing the message? Are you reading it from an IMAP mail server? If so,
    turn on session debugging and send me the protocol trace when you access the message.
    Some servers have bugs when accessing nested messages. See the JavaMail FAQ for
    details of how to work around such server bugs.
    If the problem doesn't look like a server bug, I'll need to see the code you're using to access
    the nested message and its attachments.

  • Severe Pro*C / nested table error

    I am experiencing a nasty error which involves Pro*C accessing nested table columns. I am running Oracle 9.2.0.1.0 on Solaris 2.8 and using the GNU gcc compiler.
    In my examples, I will use the sample data which comes with Pro*C ($ORACLE_HOME/precomp/demo/sql/coldemo1.sql).
    This defines the following types and table (and also populates the table with sample data):
    CREATE TYPE city_t AS OBJECT (name CHAR(30), population NUMBER);
    CREATE TYPE citytbl_t AS TABLE OF city_t;
    CREATE TABLE county_tbl (name CHAR(30), cities citytbl_t)
    NESTED TABLE cities STORE AS citytbl_t_tbl;
    I have no problems running the sample program ($ORACLE_HOME/precomp/demo/proc/coldemo1.pc). Note that you must follow the instructions included in the comments of coldemo1.pc (manually execute the Oracle Type Translator, precompile, compile and link).
    The sample, however, merely retrieves and displays existing data. I would like my program to be able to insert new rows into county_tbl, including the nested table.
    I have the following code (for simplicitys sake, everything is in the main procedure):
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <sqlca.h>                                /* SQL Communications Area */
    #include <coldemo1.h>        /* OTT-generated header with C typedefs for the */
                                          /* database types city_t and citytbl_t */
    #define CITY_NAME_LEN    30
    #define COUNTY_NAME_LEN  30
    #define MAXCITIES 5
    void PrintSQLError()
      EXEC SQL WHENEVER SQLERROR CONTINUE;
      printf("SQL error occurred...\n");
      printf("%.*s\n", (int)sqlca.sqlerrm.sqlerrml,
             (CONST char *)sqlca.sqlerrm.sqlerrmc);
      EXEC SQL ROLLBACK RELEASE;
      exit(-1);
    int main(int argc, char *argv[])
      char * uid = "scott/tiger";
      citytbl_t *cityTable;
      OCIInd cityTableInd;
      char county[COUNTY_NAME_LEN + 1];
      city_t *city[MAXCITIES];
      city_t_ind *cityInd[MAXCITIES];
      char cname[CITY_NAME_LEN + 1];
      int cpop;
      int numCities = MAXCITIES;
      int i, tableSize;
      EXEC SQL WHENEVER SQLERROR DO PrintSQLError();
      EXEC SQL CONNECT :uid;
      /* to null-terminate strings */
      EXEC ORACLE OPTION (char_map=string);
      /* Allocate the required descriptors */
      EXEC SQL ALLOCATE :cityTable;
      EXEC SQL ALLOCATE :city:cityInd;
      strcpy(county,"MYCOUNTY");
      /* Create an array of city objects */
      EXEC SQL FOR :numCities OBJECT CREATE :city:cityInd;
      for(i=0;i<numCities;i++)
        sprintf(cname,"city%d", i);
        cpop = (i * 100);
        EXEC SQL OBJECT SET NAME, POPULATION OF :city[i] TO :cname, :cpop;
        cityInd[i]->_atomic = cityInd[i]->NAME = cityInd[i]->POPULATION = OCI_IND_NOTNULL;
      cityTableInd = OCI_IND_NOTNULL;
      EXEC SQL COLLECTION APPEND :city:cityInd TO :cityTable:cityTableInd;
      EXEC SQL INSERT INTO county_tbl (NAME, CITIES) VALUES (:county, :cityTable:cityTableInd);
      EXEC SQL FREE :city;
      EXEC SQL FREE :cityTable;
      EXEC SQL COMMIT RELEASE;
      return(0);
    }This works as expected, inserting one row into COUNTY_TBL, with name=MYCOUNTY, cities being a nested table containing five city elements.
    My problem occurs when I create a trigger on COUNTY_TBL which attempts to modify elements of the nested table column. Heres the trigger (in this case, we are converting each NAME element of the cities table to upper case):
    create or replace trigger biur_county
    before insert or update on county_tbl
    for each row
    when (new.cities is not null)
    BEGIN
    IF(:NEW.cities.COUNT > 0) THEN
    FOR i IN :NEW.cities.FIRST..:NEW.cities.LAST LOOP
    :NEW.cities(i).NAME := UPPER( :NEW.cities(i).NAME );
    END LOOP;
    END IF;
    END biur_county;
    From SQL*Plus, this works as expected:
    SQL> insert into county_tbl values ('ANOTHERCOUNTY',CITYTBL_T(CITY_T('city1',1),CITY_T('city2',2)));
    1 row created.
    SQL> select * from county_tbl where name='ANOTHERCOUNTY';
    NAME
    CITIES(NAME, POPULATION)
    ANOTHERCOUNTY
    CITYTBL_T(CITY_T('CITY1 ', 1), CITY_T('CITY2 ', 2))
    1 row selected.
    Note that the city names have been converted to upper case.
    If, however, I attempt to run the Pro*C program again, with the trigger enabled, I get a severe error:
    ORA-03113: end-of-file on communication channel
    This also creates entries in the alert log:
    Errors in file /space/oracle/product/9.2.0.1.0/admin/ATDEV/udump/atdev_ora_16790.trc:
    ORA-07445: exception encountered: core dump [0000000100C8EF7C] [SIGBUS] [Invalid address alignment] [0x400000006] [] []
    The trace file includes:
    Exception signal: 10 (SIGBUS), code: 1 (Invalid address alignment), addr: 0x400000006, PC: [0x100c8e
    f7c, 0000000100C8EF7C]
    *** 2002-12-11 15:51:25.469
    ksedmp: internal or fatal error
    ORA-07445: exception encountered: core dump [0000000100C8EF7C] [SIGBUS] [Invalid address alignment]
    [0x400000006] [] []
    Current SQL statement for this session:
    insert into county_tbl (NAME,CITIES) values (:b0,:b1:b2)
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    38421f020 3 SCOTT.BIUR_COUNTY
    If I subsequently disable the trigger (or alter the trigger so that the contents of the nested table are not modified), all is well again.
    Has anyone else encountered a similar problem? I am assuming that the problem has something to do with the objects in Pro*C being transient and held in the object cache on the client. Perhaps I am doing something wrong in my program. Does anyone have any thoughts?
    Certainly there are ways around this problem (remove the trigger, for example, or perform inserts through a view / instead of trigger, etc), but I would like to have an explanation as to why my method is not working.
    Any insights would be greatly appreciated.

    HELLO!!!
    This problem reveals ONLY in DEBUG configuration (in RELEASE - all ok, but DEBUG is very important feature ;)) and operator
    new in my case have not an influence on this situation.
    I found a problem in other place when calling boxes=box.ptr();
    The boxes oracle class have a nested table. In C++ :
    class CBoxes : public oracle::occi::PObject {
    private:
    OCCI_STD_NAMESPACE::string BOXNAME;
    oracle::occi::Number BOXNUM;
    OCCI_STD_NAMESPACE::vector<CWidget*> WIDGETS;
    ptr() function calling readSQL method of CBoxes class:
    BOXNAME = streamOCCI_.getString();
    BOXNUM = streamOCCI_.getNumber();
    oracle::occi::getVector(streamOCCI_, WIDGETS);
    and getVector is:
    //cutted from occiObjects.h------------------------------
    template <class T>
    void getVector(const AnyData &any, OCCI_STD_NAMESPACE::vector<T> &vect)
    {OCCI_STD_NAMESPACE::vector< PObject *> vec_pobj;      
    getVectorOfPObjects( any,vec_pobj);//!!!!!!! :[  ]
    vect.clear();
    int size= vec_pobj.size();
    for( int i=0; i< size; i++)
    vect.push_back( (T)vec_pobj[i] );
    }//<- the destructor of vec_pobj is being called and if vec_pobj not an empty vector, the program crashes.
    I suppose that getVectorOfPObjects( any,vec_pobj) can't correctly allocate memory for vec_pobj elements in DEBUG mode.

  • Javascript - Access sub-properties of lists

    I've got a very basic problem: I want to assign a color to a
    line inside a field.
    Basically, this is all that's needed for doing this in Lingo:
    member.line [ i ] .color=color(255.128.128);
    However, a requirement for my studies is that I have to do it
    in Javascript and the dot notation doesn't work there... instead
    you use setProp... so by normal JS standards this should work:
    member.getProp("line",i).setProp("color",color(255.128.128));
    However, for some reason that I'm 100% unable to understand
    member.getProp("line",i) doesn't return an object... instead it
    returns a string!?!
    So I need a way to access nested properties directly via
    setprop... I've tried this:
    member.setProp("line["+_mouse.mouseLine+"].color",color(255,0,0));
    In the hope that Director would parse the
    "line["+_mouse.mouseLine+"].color" bit to get to the correct
    property... but sadly it doesn't.
    Any help would be VERY welcome :)

    Found the solution: You've got to use getPropRef:
    member.getProp("line",i).setPropRef("color",color(255.128.128));
    What I find really disturbing is that this is probably the
    110th method that I've found in a few forums, but not in the
    documentation... it's simply not listed and even a fulltext search
    does only provide a single half-sane result: "Choosing between
    Javascript and Lingo Syntax", the rest are functions that have
    nothing to do with properties, they just need it for their
    examples.
    I'm sorry, but you guys really have to get your act together
    documentation-wise!

  • Access ViewRoot before render response in a PhaseListener

    Hi,
    I'm trying to access UIComponents just before the render response phase to change some attributes of the UIComponents. Therefor I have created a PhaseListener, which is called before the render response phase. My idea was, to get the ViewRoot and iterate over it to access all UIComponents, but in the beforePhase, the ViewRoot has no children. How can I solve this problem?
    Here is my PhaseListener:
    public class SecurityPhaseListener implements PhaseListener {
        private static Log log = LogFactory.getLog(SecurityPhaseListener.class);
        public void afterPhase(PhaseEvent pe) {
        public PhaseId getPhaseId() {
            return PhaseId.RENDER_RESPONSE;
        public void beforePhase(PhaseEvent pe) {
            UIViewRoot viewRoot = pe.getFacesContext().getViewRoot();
            System.out.println("before render response " + viewRoot.getChildCount()); // returns 0
            // the following is just sample code for you to get an idea of what i want to do
            // change attributes according permissions
            for (Iterator iter = viewRoot.getChildren().iterator(); iter.hasNext();) {
                UIComponent comp = (UIComponent) iter.next();
                if(comp instanceof HtmlInputText) {
                    HtmlInputText htmlInputText = (HtmlInputText) comp;
                    htmlInputText.setRendered(false);
    }

    Morphy wrote:
    this means that an initial call has no real life cycle...beforePhase has no component tree, afterPhase is too late.... umpf... can i alter component tree in a specialized ViewHandler?
    the ViewHandler api is not deeply documented, which is the best point to hook to address this?You can, but I would use that as the last resort.
    A better solution would be to use the binding attribute to get access to the component. If your getter initially returns null, JSF will create the component and then invoke the setter; at that point you can manipulate the component.

  • Nested Jars

    I am currently attempting to access a jar file (child.jar) embedded within another jar file (parent.jar). Any jar files being used are all signed with the same signature. When I try execute I get a "ClassNotFoundException". All classes are archived in child.jar. The file child.jar is embedded within parent.jar and parent.jar is signed which creates sParent.jar. I do not know the correct syntax to use two archives in the html file. I am looking into nested jars to avoid multiple security warnings when signing multiple jars (multiple warnings occur even when all jars are signed with the same signature). But signing the parent.jar file, there will only be one security warning. Is accessing nested jar files possible? If not, is there an effective alternative?
    Thanks,
    rjtrues

    No, accessing jars inside jars is not possible. So any alternative would be "effective". Your comment about "the html file" implies that you might be asking about an applet, and I don't know the syntax for that either. But I'm sure documentation for that exists.

  • Javax.mail CSV file attachment corrupt?

    I'm having some trouble with attaching a file to an outgoing email, it's a CSV file and when it is uploaded/attached to the email, it becomes "corrupt". Excel will still open it but if I open it in notepad the formatting is noticeably messed up. I need it to retain all the correct return carriages and line feeds, which I believe are what are getting mingled. (Another program must read it and this formatting is messing everything up).
    Here's the code:
    MimeBodyPart messageBodyPart =
                     new MimeBodyPart();
             //fill message
             messageBodyPart.setText(outBoundMessage);
             Multipart multipart = new MimeMultipart();
             multipart.addBodyPart(messageBodyPart);
             if (fileAttachment != null) {
                // Part two is attachment
                MimeBodyPart attachment = new MimeBodyPart();
                attachment.attachFile(fileAttachment);
                attachment.setFileName(fileAttachment.getName());
                attachment.setHeader("type", "text/csv");
                multipart.addBodyPart(attachment);
             // Put parts in message
             message.setContent(multipart);The other parts of the message are being created and attached where necessary. My guess is that it's not transferring in binary? I've never really done this sort of thing so if anyone could lend a hand and show me how to properly attach files so they don't get altered in anyway I would greatly appreciate it.

    Hi,
    I am sending csv file as an attachment by using below code
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class AttchmtMail
        String finaldt;
            public  void mailAtchmt(String fname,String dt) {
                String   to="[email protected]";
               String from = "[email protected]";
              String to2="[email protected]";
                 String host = "xxx.xx.xxx.xxx";
                // Create properties, get Session
                Properties props = new Properties();
                // If using static Transport.send(),
                // need to specify which host to send it to
                props.put("mail.smtp.host", host);
                // To see what is going on behind the scene
                props.put("mail.debug", "true");
                Session session = Session.getInstance(props);
                try {
                    // Instantiatee a message
                    Transport bus = session.getTransport("smtp");
                    bus.connect();
                    Message msg = new MimeMessage(session);
                    //Set message attributes
                    msg.setFrom(new InternetAddress(from));
                    InternetAddress[] address = {new InternetAddress(to),new InternetAddress(to2)};
                    msg.setRecipients(Message.RecipientType.TO, address);
                    msg.setSubject("New OU's on "+dt+".");
                    msg.setSentDate(new Date());
                   // String filename= "C:/Feeds/"+finaldt+"/"+files;
    String file1= fname;
    File f1=new File(file1);
    if(f1.exists())
    setFileAsAttachment(msg, file1);
    else
    //setFileAsAttachment(msg,"","",info);
    msg.saveChanges();
    bus.sendMessage(msg, address);
    bus.close();
    catch (MessagingException mex) {
    // Prints all nested (chained) exceptions as well
    mex.printStackTrace();
    // How to access nested exceptions
    while (mex.getNextException() != null) {
    // Get next exception in chain
    Exception ex = mex.getNextException();
    ex.printStackTrace();
    if (!(ex instanceof MessagingException)) break;
    else mex = (MessagingException)ex;
    public void setFileAsAttachment(Message msg, String filename)
    throws MessagingException {
    // Create and fill first part
    MimeBodyPart p1 = new MimeBodyPart();
    p1.setText("Dear ,\n\nPlease check the attachment " );
    // Create second part
    MimeBodyPart p2 = new MimeBodyPart();
    // Put a file in the second part
    if(!filename.equals(""))
    FileDataSource fds = new FileDataSource(filename);
    p2.setDataHandler(new DataHandler(fds));
    p2.setFileName(fds.getName());
    // Create the Multipart. Add BodyParts to it.
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(p1);
    if(!filename.equals(""))
    mp.addBodyPart(p2);
    } // Set Multipart as the message's content
    msg.setContent(mp);
    }//End of class
    Madhu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Sending mail to yahoo using javamail

    hello,
    i have a javamail code which able to send mail within my domain (mailserver ) .
    but when i try to send mail to any yahoo id then i get following error :--
    javax.mail.SendFailedException: Invalid Addresses;
    please, anyone help me ; what should i do modification in my existing code for sending mail to yahoomail account.
    the code which is working properly for my doamin is:--
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class SendMailUsage {
    public static void main(String[] args) {
    // SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
    String to = "[email protected]";
    String from = "[email protected]";
    // SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
    String host = "172.13.2.48";
    // Create properties for the Session
    Properties props = new Properties();
    // If using static Transport.send(),
    // need to specify the mail server here
    props.put("mail.smtp.host", host);
    // To see what is going on behind the scene
    props.put("mail.debug", "false");
    // Get a session
    Session session = Session.getInstance(props);
    try {
    // Get a Transport object to send e-mail
    Transport bus = session.getTransport("smtp");
    bus.connect();
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress[] address = {new InternetAddress(to)};
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject("Test E-Mail through mojax developers");
    msg.setSentDate(new Date());
    // Set message content and send
    setTextContent(msg);
    msg.saveChanges();
    bus.sendMessage(msg, address);
    bus.close();
    catch (MessagingException mex) {
    // Prints all nested (chained) exceptions as well
    mex.printStackTrace();
    // How to access nested exceptions
    while (mex.getNextException() != null) {
    // Get next exception in chain
    Exception ex = mex.getNextException();
    ex.printStackTrace();
    if (!(ex instanceof MessagingException)) break;
    else mex = (MessagingException)ex;
    // A simple, single-part text/plain e-mail.
    public static void setTextContent(Message msg) throws MessagingException {
    // Set message content
    String mytxt = "this mail is generated by java";
    msg.setText(mytxt);
    // Alternate form
    msg.setContent(mytxt, "text/plain");
    } //End of class

    Turn on session debugging to get the protocol trace. Your mail server
    is probably saying more about why the send failed than what you've
    included here.
    Then read the FAQ for likely problems.

  • Dynamically get BPM Process ID in 7.2

    Hello,
    Anyone find a way to dynamically generate the BPM ProcessID ?

    Hi Craig,
    You can build a more user friendly tool using VC and the standard BPM realtime reporting datasources. Just model a reporting activity (with a custom datasource) in your process model that has your business object id (say customer id). Then you can build a reporting UI in VC using this reporting acitivity. However, if your primary concern is to retrieve the process id, then from that custom datasource in the VC story board you can get the process id.
    Just update the thread if in case more details are required. Have already implemented a VC based reporting UI which accesses nested sub-processes using the the process instance id.
    Br,
    Bala

Maybe you are looking for

  • PAR file import problem in NWDS

    Hello All, Some time back we had developed a custome masthead component for our portal (EP 6, SP 21). It has been deployed into the portal and its running fine. now, we need to change some thing in that and so we have downloaded the par file and impo

  • "No disk in drive... \device\Harddisk2\DR2

    Like a lot of people, I upgraded to Mountain Lion 10.8.2 (or .1 for somepeople) and had my Windows 7 Boot-camp-made partition corrupted, scrambled, messed up... i don't know the technical term. I read somewhere that after upgrading, if you looked in

  • Slow processing time, via Command line, with Reader

    I'm using Reader 9, via command line, to process PDFs in a 3rd party application and it's taking much longer to process files this way than with Acroplot or Ghostscript.  Is there a way to improve this processing time? thanks

  • Windows OS; authorized ADE in administrator; cant read as user account

    I have problems with this program, as if it does not see multi-users in the same computer. You are supposed to install programs as administrators and do regular tasks like read a book in a user account. I installed and authorized ADE in administrator

  • SQL Server 2000 to Oracle 9i -- SP_EXECUTESQL

    What is the besst way to translate the following SQL Server statements? SET @exec = 'SELECT @exist = ' + quotename(@Index_Name) + ' FROM ' + quotename(@Table_Name) +      ' WHERE ' + quotename(@Index_Name) + ' = @Record_Index ' EXEC sp_executesql @ex