Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    94
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default Answered: How to use ModelData with GXT3

    Answered: How to use ModelData with GXT3


    Dear all;

    I dont want to use AutoBean with Grids. I want to JSON and ModelData as GXT 2.5. but i dont want migration mode.

    How do make a solutions?

  2. Take a look at the blog post from back in July on presenting data: http://www.sencha.com/blog/building-gxt-charts/ . Much of it about charts, but under the heading ValueProvider there is a discussion on how model objects can be built that don't follow the standard 'beak-like' format, and how ValueProvider can allow you to refer to the data within those objects.

    The data model discussed there is essentially a Map<String, Double>, and values can be read and written by the Grid (in the article Brendan uses Chart, but it is the same idea, the same interface is used throughout) using the specialized ValueProviders.

    If your model might support String -> Double/Integer/String/Enum, you could build several ValueProviders that describe how to read and write all the possible values. This is what is done in the gxt-legacy.jar in the BaseModelData and ModelDataValueProvider classes.

  3. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    One of the fundamental difference between 2.5 and 3.x is that 3.x makes heavy use of Java generics. Grid was one of the things changed such that grid records are just Java beans. IMO this is actually a VERY good thing because now the model is not tightly coupled to the view framework and thus makes for great code reuse without sucking in unnecessary dependencies.

    If you want to use JSON instead of RPC, there is a JsonReader class, but AFAIK, there is no way to use JSON without an auto bean factory, or in fact, converting from JSON to Java beans without one.

  4. #3
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    94
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    Thanx for reply. Icfantv.

    I very like Java Bean System but as you know, more than one table in the real world. I like Java Bean for insert or update with method but Java bean need per grid by per bean.

    Example.

    SELECT
    x.col1,
    x.col2,
    x.col3,
    .....
    y.col1,
    y.col2,
    y.col3,
    y.col4,
    ........
    FROM x INNER JOIN y ON (x.col5=y.col5)

    This Query have Two Table. And Two Bean;

    I want to JSON and ModelData for this condition. Java bean need XBean and YBean Merge.

    What do you recommend for use in this kind of. With bean or Without bean on GWT,GXT

  5. #4
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    If I understand you correctly, what you are talking about is beyond the scope of GXT. Current ORM frameworks can easily map multiple table data into one Java bean with no additional steps from the user. We are currently doing this in one of our web applications.

    What I suspect you're saying is that your server side-code is already serving up JSON and you don't want to modify it. This is fine, but you will need someway to marshall that JSON into another object form and the way this is done in GXT 3.x is with the JsonReader object and auto beans.

    I can understand and appreciate not wanting to do a code migration, but GXT 3.x was over a year of development work and a significant portion of the API was a ground up rewrite.

    The answer to your question depends on several factors:
    1. What is your time frame? If short, you may want to reuse existing code as much as possible.
    2. What does your server-side interface look like? If it returns JSON, you don't have to change it, but you will need to marshall that back into Java form and the easiest way to do this is via auto beans.

  6. #5
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    94
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    First thanks for this brain strom and Sorry for my English.
    I have been using GXT 2 since 2 years ago and i developed two project with that.

    as you know GXT 2 is ModelData base for data connection. I developed my custom library for database comunication process. This library has Java Bean Support and JSON support. I think insert and update method with JavaBean; select method with JSON. GXT 3 will be my new UI Framework.

    I will add multiple table support in my database library's java bean mode.

    My bean is now Structure

    Code:
    public class ModulesModel implements Model {
    
        public static final List<Index> PrimaryKeys;
        public static final List<Index> ForeginKeys;
        public static final List<Index> Indexes;
        public static final List<Column> Columns;
        public static final String Database;
        public static final String Table;
    
        static {
            Database = "";
            Table = "modules";
            PrimaryKeys = new ArrayList<Index>();
            Index pkmodule_guid = new Index();
            pkmodule_guid.setTable("modules");
            pkmodule_guid.setField("module_guid");
            pkmodule_guid.setName("null");
            pkmodule_guid.setAutoIncrement(false);
            pkmodule_guid.setNullable(false);
            pkmodule_guid.setType(IndexType.PK);
            PrimaryKeys.add(pkmodule_guid);
            ForeginKeys = new ArrayList<Index>();
            Index fkprogram_guid = new Index();
            fkprogram_guid.setTable("program_guid");
            fkprogram_guid.setField("program_guid");
            fkprogram_guid.setName("fk_modules_program_guid");
            fkprogram_guid.setAutoIncrement(false);
            fkprogram_guid.setNullable(false);
            fkprogram_guid.setType(IndexType.FK);
            fkprogram_guid.setForeginTable("program");
            fkprogram_guid.setForeginField("program_guid");
            fkprogram_guid
                    .setUpdateRule(IndexRule.NO_ACTION);
            fkprogram_guid
                    .setDeleteRule(IndexRule.NO_ACTION);
            ForeginKeys.add(fkprogram_guid);
            Indexes = new ArrayList<Index>();
            Columns = new ArrayList<Column>();
            Column colmodule_key = new Column();
            colmodule_key.setDecimalDigits(0);
            colmodule_key.setDefault("null");
            colmodule_key.setName("module_key");
            colmodule_key.setTable("modules");
            colmodule_key.setSize(250);
            colmodule_key.setType(12);
            Columns.add(colmodule_key);
            Column colmodule_adi = new Column();
            colmodule_adi.setDecimalDigits(0);
            colmodule_adi.setDefault("null");
            colmodule_adi.setName("module_adi");
            colmodule_adi.setTable("modules");
            colmodule_adi.setSize(250);
            colmodule_adi.setType(12);
            Columns.add(colmodule_adi);
            Column colprogram_guid = new Column();
            colprogram_guid.setDecimalDigits(0);
            colprogram_guid.setDefault("null");
            colprogram_guid.setName("program_guid");
            colprogram_guid.setTable("modules");
            colprogram_guid.setSize(100);
            colprogram_guid.setType(12);
            Columns.add(colprogram_guid);
            Column colmodule_guid = new Column();
            colmodule_guid.setDecimalDigits(0);
            colmodule_guid.setDefault("null");
            colmodule_guid.setName("module_guid");
            colmodule_guid.setTable("modules");
            colmodule_guid.setSize(100);
            colmodule_guid.setType(12);
            Columns.add(colmodule_guid);
            Column colmodule_type = new Column();
            colmodule_type.setDecimalDigits(0);
            colmodule_type.setDefault("null");
            colmodule_type.setName("module_type");
            colmodule_type.setTable("modules");
            colmodule_type.setSize(10);
            colmodule_type.setType(4);
            Columns.add(colmodule_type);
        }
    
        public ModulesModel() {
        }
        private String module_key;
    
        public void setModule_key(String module_key) {
            this.module_key = module_key;
        }
    
        public String getModule_key() {
            return this.module_key;
        }
        private String module_adi;
    
        public void setModule_adi(String module_adi) {
            this.module_adi = module_adi;
        }
    
        public String getModule_adi() {
            return this.module_adi;
        }
        private String program_guid;
    
        public void setProgram_guid(String program_guid) {
            this.program_guid = program_guid;
        }
    
        public String getProgram_guid() {
            return this.program_guid;
        }
        private String module_guid;
    
        public void setModule_guid(String module_guid) {
            this.module_guid = module_guid;
        }
    
        public String getModule_guid() {
            return this.module_guid;
        }
        private int module_type = -1;
    
        public void setModule_type(int module_type) {
            this.module_type = module_type;
        }
    
        public int getModule_type() {
            return this.module_type;
        }
    
        @Override
        public List<Index> getPrimaryKeys() {
            return ModulesModel.PrimaryKeys;
        }
    
        @Override
        public List<Index> getForeginKeys() {
            return ModulesModel.ForeginKeys;
        }
    
        @Override
        public List<Index> getIndexes() {
            return ModulesModel.Indexes;
        }
    
        @Override
        public List<Column> getColumns() {
            return ModulesModel.Columns;
        }
    
        @Override
        public String getDatabase() {
            return ModulesModel.Database;
        }
    
        @Override
        public String getTable() {
            return ModulesModel.Table;
        }
    }
    I think add a field that model structure. (Map<String,Model> Relations. then My QueryManager will fill relational table on this field.

    What do you think about and how can i use this model with GXT PropertyAccess? or do you have another offer.

    Best Regards

  7. #6
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    I'm not sure I follow completely, but to answer your question about property access, as long as your model object adheres to the JavaBean contract then you're fine - you can call any getXXX or isXXX property methods on your bean.

    Just a heads up however, that bean is referenced from the client-side which means the GWT compiler will need the source code for EVERYTHING in that class whether or not you actually need or use it.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi