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

How to use Mixin in decorators for 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 Uncaught Error: No such property: textShadowColor

我找到了如何修补它:

您的自定义混合:

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
  }