如何在qooxdoo的装饰器中使用Mixin?

时间:2015-08-05 12:31:54

标签: javascript css3 styling qooxdoo

qooxdoo文档中,有如何编写装饰器但是没有明确的方法可以使用它。

所以,如果有任何qooxdoo大师存在,请赐教。

我试过这个:

qx.Mixin.define("phwabe.theme.MTextShadow", {
  properties : {
    textShadowColor : {
      nullable : true,
      check : "Color"
    }
  },

  members : {
    _styleTextShadow : function(styles) {
      var color = this.getTextShadowColor();
      if (color === null) {
        return;
      }
      color = qx.theme.manager.Color.getInstance().resolve(color);
      styles["text-shadow"] = color + " 1px 1px";
    }
  }
});

// patch the original decorator class
qx.Class.patch(qx.ui.decoration.Decorator, phwabe.theme.MTextShadow);

和此:

//in Decoration.js of theme
    "chatitem": {
      style: {
        // width: 1,
        color: "rgba(200,200,200,0.2)",
        textShadowColor: red
      }

仅以此未知属性错误结束

  

phwabe.js?v = e7a4ce2e449b91add3c65027e524a0c7:210未捕获错误:否   这样的属性:textShadowColor

1 个答案:

答案 0 :(得分:0)

我找到了如何修补它:

您的自定义混音:

qx.Mixin.define("phwabe.theme.MTextShadow", {
  properties : {
    textShadowColor : {
      nullable : true,
      check : "Color"
    }
  },

  members : {
    _styleTextShadow : function(styles) {
      var color = this.getTextShadowColor();
      if (color === null) {
        return;
      }
      color = qx.theme.manager.Color.getInstance().resolve(color);
      styles["text-shadow"] = color + " 1px 1px";
    }
  }
});

//在主题

的Decoration.js中
qx.Class.patch(qx.ui.decoration.Decorator, phwabe.mixins.MTextShadow);
"chatitem": {
  style: {
    // width: 1,
    color: "rgba(200,200,200,0.2)",
    textShadowColor: red
  }