Finally I found a working solution. I'm not sure if I like that way but it
works and its not that much more code.

Following is the wrapper-class. It contains a new property which is set as
the formatted date-string:

qx.Class.define("mkss.data.DateWrapper", {
    extend: qx.core.Object,
    properties: {
        date: {
            check: "Date",
            apply: "_applyDate"
        },
        formattedDateString: {
            check: "String",
            event: "changeFormattedString"
        }
    },
    construct: function (date, format) {
        this.base(arguments);        
        this.dateFormat = new qx.util.format.DateFormat(format);        
        this.setDate(date);
    },
    members: {
        _applyDate : function() {
            this.setFormattedDateString(this._getFormattedDate());
        },
        _getFormattedDate: function () {
            return this.dateFormat.format(this.getDate());
        },
        addDays: function (incDays) {
            // found here: http://jsfiddle.net/sparebytes/XrWzq/            
            var tmpDate = new Date(this.getDate());
            tmpDate.setDate(this.getDate().getDate() + incDays);
            this.setDate(tmpDate);
        }
    }
});

This new property now is bound to the label which no longer needs to access
the format-method because everything is done in the wrapper.

        var lblDate = new qx.ui.basic.Label();
        this.bind("gameData.date.formattedDateString", lblDate, "value", {
            converter: function (data) {
                return "Datum: " + data;
            }
        });
        this.add(lblDate);

Now in a loop by my manager-object I did not show here, the addDays-method
is called incrementally which updates the formatted value in the bound
label.

If anybody knows a better way, please let me know.

Thank you again and have a good night
LoneSurvivor



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Is-it-possible-to-add-another-object-to-the-converter-for-a-singlevalue-binding-tp7588266p7588271.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to