Results 1 to 5 of 5

Thread: initConfig ????????getter ??????

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    34
    Vote Rating
    0
      0  

    Default initConfig ????????getter ??????

    ?????????????????????
    ???????????????????


    ???Sencha-Ext-JS-4???????(5?????????5.5.3?????)??????
    ????????????????????????
    ?????? getter/setter ????????????????????

    ????????
    Code:
    Ext.define('Imag', {
        extend: 'Ext.Component',
    
        config : {
            fileName : '', 
            x : 0, 
            y : 0, 
            height : 0,
            width : 0
        },
    
        /**
         * ???????
         *
         * @cfg fileName ????????????
         * @cfg width ?????
         * @cfg height ??????
         */
        constructor : function(config) {
            var me = this;
            // ????????????(??????????)
            me.callParent(arguments);
            me.initConfig(config);
            me.x = 10;
        },
        // ????????????
    });
    ??????
    Code:
     tmp = new Imag({ fileName : fileName,
                         height : 600,
                         width : 200,
                         x : 30,
                         y : 50
                      });
    
    console.log(tmp);  // ????????
    console.log(tmp.x);       // 10
    console.log(tmp.getX());  // 10
    console.log(tmp.y);       // 50
    console.log(tmp.getY());  // 50
    console.log(tmp.width);        // 200
    //console.log(tmp.getWidth());   // this.el is undefined ???????????
    console.log(tmp.height);        // 600
    //console.log(tmp.getHeight());   // this.el is undefined ???????????
    
    console.log(tmp.setWidth(9999));  // 9999???
    console.log(tmp.width);           // 9999
    console.log(tmp.setHeight(8888)); // 8888
    console.log(tmp.height);          // 8888
    ?????????????????????????
    ?getWidth()????getHeight()?????????????????
    ????setWidth(9999)????setHeight(8888)?????????????

    "height" ? "heighta" ???????????????????"getter/setter"?????????


    ?????????getWidth()????getHeight()?????????????????
    ?????????????2????????????????????????

    ????????????
    (????)


    ??????ext-4.0.7/ext-all.js
    ?????FireFox(FireBug ???????)

  2. #2
    Sencha User mashiki's Avatar
    Join Date
    Oct 2007
    Location
    Japan
    Posts
    139
    Vote Rating
    0
      0  

    Default

    ?????????????????
    http://docs.sencha.com/ext-js/4-0/#!/guide/class_system
    2. Configuration
    ?
    Getter and setter, methods for every config property are automatically generated into the class' prototype during class creation if the class does not have these methods already defined.

    ??????Component?
    http://docs.sencha.com/ext-js/4-0/#!...ethod-getWidth
    ???????????
    Code:
        /**
         * Gets the current width of the component's underlying element.
         * @return {Number}
         */
        getWidth : function() {
            return this.el.getWidth();
        },

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    34
    Vote Rating
    0
      0  

    Default

    mashiki ?

    ??????????????


    ???????

    ???????????????????????
    ??????????????????????

    ?????????
    Java???????????????

    ????width???height????getter/setter ????????????
    ?????????????????
    Code:
        setWidth : function(width) {
            return this.setSize(width);
        },

    ???????????????????????getWidth()????getHeight()????????????????
    ??setter????????????

    ???Ver?4.1????????????????????


    ??????????????????????

    ???????????????



    P.S.
    ????????????????????????????????????????(?
    Opera??????

  4. #4
    Ext JS Premium Member
    Join Date
    Jun 2010
    Posts
    13
    Vote Rating
    0
      0  

    Default

    ??????????????????Ext.Compornent??????????????
    ???????????????????

    | ???Ver?4.1????????????????????


    ??????getWidth?????????
    ??????????????
    getWidth???????????
    ???????????????
    ??????????????????

  5. #5
    Sencha User
    Join Date
    Mar 2010
    Posts
    34
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by tenri-u View Post
    ??????getWidth???????????????????????
    getWidth???????????
    ???????????????
    ??????????????????

    ??????????????

    ????config ?????????getter/setter? ????????????
    ??????????????????????????

    ???????
    (????????config????????????????????)


    ????setter ????config?????????????getter ?????????????
    ?????????


    ?????????

    ?????????????????????????????????????
    (?????????????????????????????????(?))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •