Generic Attribute Access Pattern

Hi all,
I'd like to implement my BMP Beans with the Generic Attribute Access Pattern. So instead of using get/set methods I simply do get/put of the HashMap stored in the EJB.
Now my question is: how to I implement persitance of data on the DB with this pattern ?
Do I have to move the content of ejbStore into the method setAttributes(Map map) ? this way after calling setAttributes data is persited on the DB. But then what should I do with ejbStore? should I leave it empty?
thanks a lot
Francesco

The setAttributes method should set the attributes of the bean from the hashmap, not do
anything in the database itself. Your ejbStore method will take the attributes of the bean
and put them in the database. This is since you say you are using BMP. If you were using CMP
the case would be different.

Similar Messages

  • Generic attributes with NavigationMenuItem class

    hi,
    Im building a dynamic navigation using a List<NavigationMenuItem>.
    The menu is generated from a database.
    I add a ActioListener to the NavigationMenuItem which resolves its value, depending on it the next page is displayed.
    But id rather save the primary keys corresponding to the values into the NavigationMenuItems.
    Is there a way i can add generic attributes dynamically to a NavigationMenuItem object?
    Or do i have to extend NavigationMenuItem and a new property (i that possible at all?)
    besides id like some general iformation about generic attributes, i cant find much.
    thx in advance!

    no pointers? :(

  • Does BDB support an access pattern which is initially random followed by sequential?

    Hi,
    I have a very large file (millions of records) that I will need to store as a db file. We will only do look up operations on the file so far. However, I would like the following data access pattern First, I'm seeking to a specific location in the file and then reading sequentially a number of records; then, again, I may want to jump to another specific location in the file and reading sequentially a number of records. The data will be stored in the db in sorted order. I know that BDB B-trees fundamentally store keys in sorted order and a value associated with that key. However, using BTree will give me O(log N) each time when finding a specific location. Is there a way that I can combine hash and BTree to improve the performance. I.g., using hash index to find the specific location in O(1) and then do sequential reads (this can only be done by using BTree). So, I am wondering if I can accomplish this task in BDB? Thank you so much for any suggestions!!!

    You can use the heap access method.  Heap stores the data records by putting as many as it can on a given page and stores records page by page by page.   If you have 100 records, and 10 records per page then the 1st 10 pages of the database will contain the records and the rest will be blank.    The order in which the records are inserted determines the ordering of the records on the pages.    You can then use a secondary btree.   You can make your initial access via the btree then from there you can access the next X records sequentially (as physically stored in the database in this case).
    thanks
    mike

  • Does BDB support the access pattern which is initially random followed by sequential?

    Hi,
    I have a very large file (millions of records) that I will need to store as a db file. We will only do look up operations on the file so far. However, I would like the following data access pattern First, I'm seeking to a specific location in the file and then reading sequentially a number of records; then, again, I may want to jump to another specific location in the file and reading sequentially a number of records. The data will be stored in the db in sorted order. I know that BDB B-trees fundamentally store keys in sorted order and a value associated with that key. However, using BTree will give me O(log N) each time when finding a specific location. Is there a way that I can combine hash and BTree to improve the performance. I.g., using hash index to find the specific location in O(1) and then do sequential reads (this can only be done by using BTree). So, I am wondering if I can accomplish this task in BDB? Thank you so much for any suggestions!!!

    Since you mention the hash access method, I assume you're posting to the wrong forum.  This is the forum for BDB JE, which only supports the Btree access method.  The BDB product (C-based product with Java JNI API) has a hash access method, so you should probably re-post your question to the BDB forum:
    Berkeley DB
    --mark

  • Use AGENT through dynamic attribute access

    I'm working with some persistent objects, but don't know the actual persistent class until runttime.  To get the agent, I've coded this
    DATA: l_agntclass TYPE classname,
         lr_det_agent TYPE REF TO cl_os_ca_common.
    FIELD-SYMBOLS <lr_det_agent> TYPE any.
    l_agntclass = me->derive_agent_classname( ).
    ASSIGN (l_agntclass)=>agent to <lr_det_agent>.
    lr_det_agent ?= <lr_det_agent>.
    Now I can call the methods of lr_det_agent.  All well and good, and it works, but is this the right way?  I tried defining <lr_det_agent> as TYPE REF TO.  But that failed in the assign.  And I tried CASTING TYPE on the assign, but that doesn't accept classes.
    Am I missing something obvious?
    Thanks
    matt

    Hello Matt
    The solution is quite simple (see below):
    *& Report  ZUS_SDN_PERSISTENT_CLASS
    *& Thread: Use AGENT through dynamic attribute access
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1143122"></a>
    REPORT  zus_sdn_persistent_class.
    DATA: gd_clsname    TYPE classname,
          gd_method     TYPE string,
          gd_attribute  TYPE string.
    DATA: go_obj        TYPE REF TO object,  " root object
          go_os_common  TYPE REF TO cl_os_ca_common.
    DATA: go_persist    TYPE REF TO cb_alert,
          go_agent      TYPE REF TO ca_alert.
    FIELD-SYMBOLS <go_det_agent> TYPE ANY.
    START-OF-SELECTION.
      BREAK-POINT.
      gd_attribute = 'CA_ALERT=>AGENT'.
      " In your case: CONCATENATE l_agntclass '=>AGENT' ...
      ASSIGN (gd_attribute) TO <go_det_agent>.
      go_os_common ?= <go_det_agent>.
      BREAK-POINT.
    END-OF-SELECTION.
    Regards
      Uwe

  • Database access patterns

    I've been wondering for a while what techniques people use to access databases. I'm not talking about the JDBC API but how are applications designed. One obvious objective is to consolidate all database access into one package and not have SQL strewn throughout the app. This obviously helps for abstraction purposes, you could easily change the backend, but also makes for easy updates if you make a schema change. I've read about the Database Access Object pattern and like the idea of seperating database access details from the rest of the application. My question is one of implementation. Say you use something like the DAO pattern. Now you have one database access class for each business object and typically (not always) there is a 1:1 mapping of business objects to database tables. How do you actually implement the DAO class? Do you write a single method for each type of query you may perform? For example, say I have a simple schema where table A references table B and table B references tables C. I could query for Object C (from table C) in a number of ways such as:
    select * from tableC, tableB where tableC.column2=tableB.column1 and tableB.column3=1234;
    or
    select * from tableC, tableB, tableA where tableC.column2=tableB.column1 and tableB.column2=tableA.column1;
    and so on . . .
    I'm wondering if people use some kind of abstraction to dynamically genereate the sql query on the fly or do you simple have seperate method calls for each query and just drop in the values:
    ObjectC getCfromB(int tableBcolumn3Value){
    String sql="select * from tableC where tableC.column2=tableB.column1 and tableB.column3="+tableBcolumn3Value;
    //do your JDBC stuff and return ObjectC
    Is there a way of having the database access classes understand the schema of your DB so if you supply a column from tableB and ask for objectC it knows what to do?
    It seems labor intesive to have to write a method for each type of query,insert, update,delete you might do. How do people handle this? Are there any other standard/accepted methods of separating database details from the rest of the app, other than the DAO pattern?
    thanks

    I'm trying to dive into an object/relational mapping layer. I don't want to have to write and maintain DTOs for every application.
    I looked into OJB from Jakarta first. I liked the cache it had as part of the Jakarta family. It worked fine, but I was uncomfortable with the level of documentation.
    I'm diving into Hibernate now. It seems to have more traction, and there's more documentation. I like the XDoclet/Ant tie-in. Gavin King is working with JBoss now, so Hibernate will be wired into JBoss in the future.
    I hope I can make Hibernate a standard part of my repertoire.
    If you'd rather not go that way, Martin Fowler's "Patterns Of Enterprise Application Architecture" has several approaches to the problem of data mapping layers.- MOD

  • ABAP Objects-attribute accessability issue

    Hi,
    Let me introduce the problem.
    I have a class c1 which has a public attribute a1.
    a1 is of table type which refers to a class c2. c2 has an attribute a2 which is public.
    With the object o1 of class c1 I need to access a2.
    Please help me solve the problem.
    Regards,
    Ravi
    Message was edited by: Ravi Prasad Reddy L

    HI,
      Check the below code....
    Hope it solves your purpose.
    class b definition deferred.
    class a definition.
      public section.
        data : obj2 type ref to b.
        methods : write_data.
    endclass.
    class b definition.
      public section.
        data : v_num type i.
          methods : assign_value.
    endclass.
    class a implementation.
      method write_data.
        create object obj2.
        call method obj2->assign_value.
        write:/1 'Hello Everybody'.
      endmethod.
    endclass.
    class b implementation.
      method assign_value.
        v_num = 100.
      endmethod.
    endclass.
    data : obj1 type ref to a.
    start-of-selection.
    create object obj1.
    call method obj1->write_data.
    write:/1 obj1->obj2->v_num.
    Regards,
    Vara

  • Generic Data Access For All Class

    Hello
    I am doing one experiment on Data Access. In traditional system We have to write each Insert, Update, Delete code in data access for each table.
    My City Table Class:
    public class TbCitiesModel
    string _result;
    int _cityID;
    int _countryID;
    string _name;
    int _sortOrder;
    bool _enable;
    DateTime _createDate;
    string _countryName;
    public string result
    get { return _result; }
    set { _result = value; }
    public int cityID
    get { return _cityID; }
    set { _cityID = value; }
    public int countryID
    get { return _countryID; }
    set { _countryID = value; }
    public string name
    get { return _name; }
    set { _name = value; }
    public int sortOrder
    get { return _sortOrder; }
    set { _sortOrder = value; }
    public bool enable
    get { return _enable; }
    set { _enable = value; }
    public DateTime createDate
    get { return _createDate; }
    set { _createDate = value; }
    public string countryName
    get { return _countryName; }
    set { _countryName = value; }
    Traditional Code:
    public List<TbCitiesModel> DisplayCities()
    List<TbCitiesModel> lstCities = new List<TbCitiesModel>();
    using (SqlConnection connection = GetDatabaseConnection())
    using (SqlCommand command = new SqlCommand("STCitiesAll", connection))
    command.CommandType = CommandType.StoredProcedure;
    SqlDataReader reader = command.ExecuteReader();
    while (reader.Read())
    lstCities.Add(new TbCitiesModel());
    lstCities[lstCities.Count - 1].cityID = Convert.ToInt32(reader["cityID"]);
    lstCities[lstCities.Count - 1].countryID = Convert.ToInt32(reader["countryID"]);
    lstCities[lstCities.Count - 1].name = Convert.ToString(reader["name"]);
    lstCities[lstCities.Count - 1].sortOrder = Convert.ToInt32(reader["sortOrder"]);
    lstCities[lstCities.Count - 1].enable = Convert.ToBoolean(reader["enable"]);
    lstCities[lstCities.Count - 1].createDate = Convert.ToDateTime(reader["createDate"]);
    return lstCities;
    The above code is used to fetch all Cities in the table. But when There is another table e.g  "TBCountries" I have to write another method to get all countries. So each time almost same code but just table and parameters are changing.
    So decided to work on only one global Method to fetch data from Database.
    Generic Code:
    public List<T> DisplayCitiesT<T>(T TB, string spName)
    var categoryList = new List<T>();
    using (SqlConnection connection = GetDatabaseConnection())
    using (SqlCommand command = new SqlCommand(spName, connection))
    command.CommandType = CommandType.StoredProcedure;
    foreach (var prop in TB.GetType().GetProperties())
    string Key = prop.Name;
    string Value = Convert.ToString(prop.GetValue(TB, null));
    if (!string.IsNullOrEmpty(Value) && Value.Contains(DateTime.MinValue.ToShortDateString()) != true)
    command.Parameters.AddWithValue("@" + Key, prop.GetValue(TB, null));
    SqlDataReader reader = command.ExecuteReader();
    while (reader.Read())
    int i = 0;
    TB = Activator.CreateInstance<T>();
    int colCount = reader.FieldCount;
    foreach (var prop in TB.GetType().GetProperties())
    if (prop.Name != "result" && i <= (colCount - 1))
    prop.SetValue(TB, reader[prop.Name], null);
    i++;
    categoryList.Add(TB);
    return categoryList.ToList();
    Calling method:
    TbCitiesModel c = new TbCitiesModel();
    Program p = new Program();
    List<TbCitiesModel> lstCities = p.DisplayCitiesT<TbCitiesModel>(c,"STCitiesAll");
    foreach (TbCitiesModel item in lstCities)
    Console.WriteLine("ID: {0}, Name: {1}", item.cityID, item.name);
    Now Its working fine but I have tested with 10,00,000 Records in TBCities Table following are the result.
    1. The Traditional method took almost 58 - 59 -  58 - 59 - 59 seconds for 5 time
    2. The Generic Method is took 1.4 - 1.3 - 1.5 - 1.4 - 1.4  [minute.seconds]
    So by the results of test is generic method is probably slower in performance [because its have 3 foreach loops] but the data is very big almost 10,00,000 lakes records. So it might work good in lower records.
    1. So My question is can I used this method for real world applications ?? Or is there any performance optimization for this method?
    2. Also we can use this for the ASP.NET C# projects??
    Owner | Software Developer at NULLPLEX SOFTWARE SOLUTIONS http://nullplex.com

    Hi
    Mayur Lohite,
    Q1:It is not reasonable compared Generic Code with Traditional Code. The main issue not Generic.
    After take a look at your Generic Code.  Reflection code get slower in performance.
    TB = Activator.CreateInstance<T>();
    As Reflection is truly late bound approach to work with your types, the more Types you have for your single assembly the more slow you go on. Basically few people try to work everything based on Reflection. Using reflection unnecessarily will make your application
    very costly.
    Here is a good article about this issue, please take a look.
    Reflection is Slow or Fast? A Practical Demo
    Q2:Or is there any performance optimization for this method?
    The article presents some .NET techniques for using Reflection optimally and efficiently.
    optimizing object creation with reflection
    Note optimize
    reflection with Emit
    method.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.
    Hello Kristin
    Please can you tell how I optimize reflection in my code.
    public List<T> DisplayCitiesT<T>(T TB, string spName)
    var categoryList = new List<T>();
    using (SqlConnection connection = GetDatabaseConnection())
    using (SqlCommand command = new SqlCommand(spName, connection))
    command.CommandType = CommandType.StoredProcedure;
    foreach (var prop in TB.GetType().GetProperties())
    string Key = prop.Name;
    string Value = Convert.ToString(prop.GetValue(TB, null));
    if (!string.IsNullOrEmpty(Value) && Value.Contains(DateTime.MinValue.ToShortDateString()) != true)
    command.Parameters.AddWithValue("@" + Key, prop.GetValue(TB, null));
    SqlDataReader reader = command.ExecuteReader();
    while (reader.Read())
    int i = 0;
    TB = Activator.CreateInstance<T>();
    int colCount = reader.FieldCount;
    foreach (var prop in TB.GetType().GetProperties())
    if (prop.Name != "result" && i <= (colCount - 1))
    prop.SetValue(TB, reader[prop.Name], null);
    i++;
    categoryList.Add(TB);
    return categoryList.ToList();
    Thank you.
    Owner | Software Developer at NULLPLEX SOFTWARE SOLUTIONS http://nullplex.com

  • Generic Attribute in MXBean

    Hi,
    I'm trying to register an MXBean (using Java 1.6) that has a get attribute that returns a generic class with the type specified in the interface. I get a non-compliant mbean exception thrown indicating that the method in question returns a type that cannot be translated into an open type.
    Here is some code that illustrates what I am trying to do:
        public static class GenericValue<E>
            private final E val;
            GenericValue(E val) {
                this.val = val;
            public E getVal() {
                return val;
        public interface GenericHolderMXBean {
            public GenericValue<Float> getVal();
        public static class GenericHolder
                implements GenericHolderMXBean {
            @Override
            public GenericValue<Float> getVal() {
                return new GenericValue<Float>(1.0f);
        TestMbeanStuff.GenericHolder genericHolder = new GenericHolder();
        MBeanServer m = ManagementFactory.getPlatformMBeanServer();
        ObjectName name = new ObjectName("com.test:type=GenericHolder");
        m.registerMBean( genericHolder, name )Is there a way to make this work? It seems analogous to List working as an attribute in an MXBean, but perhaps support for collections is a special case made by JMX and it is not possible to use one's own generic types?
    Thanks,
    Ryan

    Thanks for your response Éamonn,
    I do have a bit of a follow-up question. My original question was a simplification of what I would like to do. What I'm really after is having my MXBean interface return a type that has a generic type nested as an attribute. eg:
        public static class GenericHolder {
            public GenericValue<Float> getVal() {
                return new GenericValue<Float>(1.0f);
        public interface NestedGenericHolderMXBean {
            public GenericHolder getVal();
        public static class NestedGenericHolder
                implements NestedGenericHolderMXBean {
            public GenericHolder getVal() {
                return new GenericHolder();
        }I would still like to make this work and can see a way to make it work. But, there are a couple of ugly things about my solution. I can probably live with them, but would like to verify that they're unavoidable before I do.
    NestedGenericHolder, as above, cannot be registered any more than my original example (for the same reason). My first thought is to make GenericHolder implement CompositeDataView and define how it should be converted to CompositeData. The modified GenericHolder looks something like:
        public static class GenericHolder implements CompositeDataView {
            public GenericValue<Float> getGenericVal() {
                return new GenericValue<Float>(1.0f);
            @Override
            public CompositeData toCompositeData(CompositeType ct) {
                try {
                    List<String> itemNames = new ArrayList<String>();
                    List<String> itemDescriptions = new ArrayList<String>();
                    List<OpenType<?>> itemTypes = new ArrayList<OpenType<?>>();
                    itemNames.add("genericVal");
                    itemTypes.add(SimpleType.FLOAT);
                    itemDescriptions.add("generic value");
                    CompositeType xct =
                            new CompositeType(
                                    ct.getTypeName(),
                                ct.getDescription(),
                                itemNames.toArray(new String[0]),
                                itemDescriptions.toArray(new String[0]),
                                itemTypes.toArray(new OpenType<?>[0]));
                    CompositeData cd = new CompositeDataSupport(
                            xct,
                            new String[] { "genericVal" },
                            new Object[] {
                                    getGenericVal().getVal()
                    assert ct.isValue(cd); // check we've done it right
                    return cd;
                } catch (Exception e) {
                    throw new RuntimeException(e);
        }This doesn't help anything though because introspection still seems to inspect this class' attributes. ie: Even though I've manually defined how to convert to CompositeData, it still seems to want to verify that it could do it automatically if it had to. Anyway, my next fix, is to change the name of the "getGenericValue" method to "genericValue" so that JMX doesn't expect that "genericVal" should be an attribute of my type. (And then I will add it to the CompositeData as an extra item - as described in the CompositeDataView JavaDoc).
    Registration now because (I believe) JMX refuses to convert an object to a CompositeData that contains no attributes. As a result, I attempt to fix this by adding another getter to my class:
        public static class GenericHolder implements CompositeDataView {
            // MXBean introspection rejects classes with no attributes.
            public Integer getOtherVal() {
                return 17;
            public GenericValue<Float> genericVal() {
                return new GenericValue<Float>(1.0f);
            @Override
            public CompositeData toCompositeData(CompositeType ct) {
                try {
                    List<String> itemNames = new ArrayList<String>(ct.keySet());
                    List<String> itemDescriptions = new ArrayList<String>();
                    List<OpenType<?>> itemTypes = new ArrayList<OpenType<?>>();
                    for (String item : itemNames) {
                        itemDescriptions.add(ct.getDescription(item));
                        itemTypes.add(ct.getType(item));
                    itemNames.add("genericVal");
                    itemTypes.add(SimpleType.FLOAT);
                    itemDescriptions.add("generic value");
                    CompositeType xct =
                            new CompositeType(
                                    ct.getTypeName(),
                                ct.getDescription(),
                                itemNames.toArray(new String[0]),
                                itemDescriptions.toArray(new String[0]),
                                itemTypes.toArray(new OpenType<?>[0]));
                    CompositeData cd = new CompositeDataSupport(
                            xct,
                            new String[] { "otherVal", "genericVal" },
                            new Object[] {
                                    getOtherVal(),
                                    genericVal().getVal()
                    assert ct.isValue(cd); // check we've done it right
                    return cd;
                } catch (Exception e) {
                    throw new RuntimeException(e);
        }It now works, but not without a few compromises:
    1. I have to implement toCompositeData(). This one isn't too big of a problem. I can certainly live with this.
    2. I have to avoid method names that JMX will interpret as attributes when the return type are ones that it doesn't know how to convert to an OpenType. (I then add them into my MXBean, by adding them into the CompositeDataView I build.)
    3. Such classes (GenericHolder) must contain at least one attribute with a type that can automatically be converted to an Open type.
    I'd just like to make sure there aren't better solutions to the problems I described above.
    Thanks and sorry for the overly long post,
    Ryan

  • Class builder - attributes access in methods

    Hi All,
    I have created a class ZZ_CL_ABC and its methods :
    ZZ_M1
    ZZ_M2
    in method ZZ_M1, one table gets filled up ITAB and I want to access this ITAB in the ZZ_M2.
    These methods are getting called from one report
      DATA I_ZZ_CL_ABC     TYPE REF TO ZZ_CL_ABC .
      CREATE OBJECT I_ZZ_CL_ABC .
    call method I_ZZ_CL_ABC->zz_M1
           exporting
                   imat = imat.
    call method I_ZZ_CL_ABC->zz_M2.
    Now I want to access the ITAB which gets filled up in method ZZ_M1 and I want to access that in ZZ_M2, when ZZ_M2 gets called through the program.
    rgds,
    Madhuri
    Edited by: Matt on Sep 9, 2011 6:11 AM - changed  tags to lower case

    I have created a class through class builder zcl_material.
    in it I have written 2 methods:
    get_material
    get_quantity
    in method get_material, the materials are getting stored in table it_material.
    in method get_quantity, the quantity for materials in it_quantiry, for materials present in the it_material table is calculated
    Now I am using this class in one report and calling its methods
    get_material : select * from mara into it_material.
    get_quantity  : select * from mard in it_quantity for all entries in it_material.
    The it_material table, I dont want to pass to the report. So what i did is, I declared this table in the attributes tab of the class builder with level instance and visibility as private.
    after calling method get_material, the data is present in the it_material.
    but when I am calling the method get_quantity, in the select query, the it_material is blank???
    So how should I define any variable/ table so that it will be present till the class object is there????
    is it possible through class builder->attribute?

  • Access patterns I made on more than one project

    Hello, real quick I would just like to know how to have patterns I made in one project appear in another project. I feel stupid for not being able to do this and all google comes up with is basic info on patters. WTH!!
    Thanks in advance

    Ok I figured it out. you have to hit the top right button on the swatches tab and save the swatch as a .ai file. Then in the other project you load a user defined swatch. After that you can just add any patterns or colors like you would for the default swaches.
    That was way more difficult then it needed to be, and the information is not easily found on the internet (read: nowhere). Thanks anyways

  • Generic Reports accessing Multiple Database Servers

    <p>Hi,</p><p>I have a report which is accessing a table present within SQL Server. This is done by creating a system DSN which points to SQL Server at report design time through the database expert from the Crystal Reports Developer. The same table is also present in another database server ie ORACLE. The requirement is that I should be able to execute the report against ORACLE database at runtime. I have seen a lot of examples to do this using ODBC and OLEDB ie changing datasources at runtime but all of these have to specify the database username and password at runtime. </p><p>Is there any way for me to achieve this without passing the username and password at runtime? If so it would be great if i could get all possible approaches to achieve this. </p><p>Thanks in advance</p><p>Joseph Samuel</p><p>&#160;</p>

    I am doing the samething.
    I found that if the report is created under OS Auth mode of Oracle, then it is OK in integrated security mode in runtime, you don't need to set any logon information in runtime, but sure, please follow the OS Auth requirement of Oracle.
    But if the report is created using stand security mode and wish it to be run under integrated security mode in runtime, then a logon error would occurs, but if the crystal report view control set to enable the database logon promot, then we can still enter something in username textbox and check the "use integrated security" checkbox, then the report is still OK.
    I wish to have the database logon prompt disable and override the logon information in program in runtime and let the report shown without any problem, but up to now, i still have no any idea.  I will come back after I got any solution for this.

  • MXML attributes accessed via AS3

    Hi,
    I have a Delphi background and am struggling to learn Flex.
    Understand that MXML and AS3 are effectively equivalent and
    that MXML is translated into AS3.
    However I do not seem to be able to access the same
    properties, events in AS3 as I can access in MXML.
    For example a Button component in MXML - I can access
    properties and events (horizontalCenter, verticalCentre, click
    event) which I do not seem to be able to access in a button object
    instantiated in AS3.
    Could anyone confirm that this difference is real or am I
    missing something OR how can I access these properties, events in
    AS3?

    "MalcolmSkels" <[email protected]> wrote in
    message
    news:gm768m$jqr$[email protected]..
    > Hi,
    >
    > Thanks for the replies ? and patience for such a basic
    query ? which has
    > helped clarify things. It was mainly the Style issue
    that was confusing
    > me. I
    > think I have got it now but would appreciate if someone
    could confirm that
    > I am
    > correct in the following:
    >
    > <mx:Button label=?Test It?
    click=?myButtonClickHandler()?
    > horizontalCenter=?0?
    > VerticalCenter=?0? />
    >
    > 1.
    > In AS3 you cannot access any events of an object other
    than by adding an
    > event
    > listener with the addEventListener method. So although
    there is a click
    > event
    > for a Button which you can access in MXML as in the
    example above there
    > is no
    > direct equivalent in AS3 ? you have to add a listener.
    In fact, this is
    > what
    > the MXML translation does - in AS3 you have to do it
    yourself.
    >
    > As you have both said a lot of properties are Styles and
    can only be
    > accessed
    > in AS3 via the SetStyle method which adds up to a lot of
    work just to set
    > a few
    > properties.
    > Overall I am concluding that AS3 is pretty labour
    intensive and that I
    > should
    > use MXML if at all possible and only drop into AS3 if
    absolutely
    > necessary. Is
    > that correct? (Not intuitive for me)
    If you're setting several properties at once, create an
    object with all the
    properties and use setStyle to set that or just set the
    styleName to a style
    you've set up in advance.
    MPO is that AS3 is more intuitive, because most of the real
    fine tuning
    you'll need to do once you get past the roughing in will only
    be documented
    in the API, and I find that to use it in MXML you often need
    to do a lot of
    translating from the API documentation into how it works in
    MXML, whereas it
    pretty much works in as like it's documented in the API (most
    of the time).

  • Generic field access and binding

    Hi,
    i try to get a attribute from a class via myClass.getClass().getField("myField"). That works fine, but if i bind that attribute anywhere in my code, i got the java.lang.NoSuchFieldException.
    Example:
    public class myClass {
        public var myAtt:Integer;
    function run() {
         var inst = new myClass;
         //var myBind = bind inst.myAtt;
         var myGetClass = inst.getClass();
         var fields;
         try {
            var field = myGetClass.getField("$myAtt");
         catch (e: Exception) {
             println(" {e} ...\n\n");
             fields = myGetClass.getFields();
             for(field in fields) println(field);
    }this gives me the following output and everything is ok:
    public static int javafxapplication1.Main$myClass.VCNT$
    public static int javafxapplication1.Main$myClass.VOFF$myAtt
    public int javafxapplication1.Main$myClass.$myAtt
    public com.sun.javafx.runtime.location.IntVariable javafxapplication1.Main$myClass.loc$myAtt
    public static final int com.sun.javafx.runtime.FXBase.VCNT$if i uncomment the bind statement, i become this:
    java.lang.NoSuchFieldException: $myAtt ...
    public static int javafxapplication1.Main$myClass.VCNT$
    public static int javafxapplication1.Main$myClass.VOFF$myAtt
    public com.sun.javafx.runtime.location.IntVariable javafxapplication1.Main$myClass.loc$myAtt
    public static final int com.sun.javafx.runtime.FXBase.VCNT$in the output with the exception, the line
    public int javafxapplication1.Main$myClass.$myAttis missing.
    But why? What makes a bind in the background?
    Edited by: toxiccrack on Aug 18, 2009 8:39 AM

    Ok, i've found a solution.. I use the "Reflect way" instead of getClass
    import javafx.reflect.FXLocal;
    import javafx.reflect.FXVarMember;
    import javafx.reflect.FXValue;
    import java.lang.Exception;
    public class myClass {
        public var myAtt:String = "Hello World";
    function run() {
         var context: FXLocal.Context = FXLocal.getContext();
         var variable:FXVarMember;
         var objVal: FXLocal.ObjectValue;
         var inst: myClass = new myClass;
         var myBind = bind inst.myAtt;
         try {
            var cls = context.findClass("javafxapplication1.Main.myClass");
            objVal = new FXLocal.ObjectValue(inst, context);
            variable = cls.getVariable("myAtt");
            variable.setValue(objVal, context.mirrorOf("Works!"));
         catch (e: Exception) {
             println(" {e} ...\n\n");
         println(myBind);
    }Prints out "Works!"
    Thanks for your answer!

  • Help Needed with XML Attribute Access (Bold/Italics)

    Hi,
    I have a form that displays data in livecycle designer. When someone imports an xml file into the form in Adobe Acrobat it should be able to display some data as bolded and some italicized based on the xml file.
    Here is the sample xml file
    <Table1>
         <Row1>
              <Cell1 style="none">1</Cell1>
              <Cell2 style="bold">2</Cell2>
              <Cell3 style="italics">3</Cell3>
         </Row1>
    </Table1>
    And the output should be:
    1 2 3 
    Can someone please help! If the xml file should be designed differently please let me know.
    Thank you!

    Paul,
    Thanks for the help! I tried it out and it worked. One last question please. According to your explanation I added to the xml file the tags
    <body xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xmlns="http://www.w3.org/1999/xhtml" xfa:APIVersion="Acroform:2.7.0.0" xfa:spec="2.1">
    <p style="font-weight:bold;">2</p>
    </body>
    do I need to place this body tag around each number or can I place it in one location in the xml file?
    Thanks again.

Maybe you are looking for

  • Develop settings are not saved

    Hello, I'm working mainly with jpeg and psd files and trying to save all settings and metadata automatically to be able to use it from other applications (e.g.Bridge). The two catalog options "Include develop settings in metadata..." and "Automatical

  • Using apple's trailers on my website??

    Hi Would it be legal for me to download apple's trailers and put them on my website???

  • Permissions problem - unable to write to external drive

    I have 2 x 2TB external drives connected to which I have been manually copying media from other drives with mixed content. The same content has been copied to both from other drives of mixed content - drives 1 and 2 are manual copies of each other. I

  • How can I use DOM to copy Nodes between different XML Document ?

    Can I copy one Node or Element from one XML Document to another Document by DOM ? Because I use the Xerces , but it is not work if I want to copy Node between different Document, or I am doing something wrong. Anyone can help me , I will deeply appre

  • Does anyone know how to turn ON push notifications on iphone 4S?

    when I originally downloaded the app, I pressed "no" when it asked if I wanted notifications when I meant to press yes. I have the app set to 'on' in my notification centre and badges enabled but it still doesn't work.