I have a situation in which I call a method of a subclass in a superclass.
This is a native qx method, but the build version only adds methods to the
subclass it assumes to be used. So now I have implemented this trick:

###*
  @ignore(_.*)
###
qx.Class.define "informedica.controller.BaseController",
  type: 'abstract'
  extend: qx.core.Object
  include: [
    informedica.mixins.MMessageBus
  ]

  members:

    getBus : -> qx.event.message.Bus.getInstance()

    init: (ctrl) ->
      bus = ctrl.getBus()

      subscribe = (mh) ->
        msg = mh[0]
        iface = mh[1].sender

        handler = (msg) ->
          sender = msg.getSender()
          ctrl._assertInterface sender, iface
          ctrl[mh[1].handler](msg)

        bus.subscribe msg, handler, iface
        return

      _.chain _.pairs ctrl.messageHandlers
       .each subscribe

      return

The ctrl parameter is the superclass Controller class that has to be
initialized like:

qx.Class.define "genpres.lib.controller.login.Login",
  extend: informedica.controller.BaseController
  type: 'singleton'

  construct: ->
    @base arguments
    @init @
    return

  members:

    _assertInterface: -> @assertInterface

So, I create an _assertInterface method just to be able to use the
assertInterface in the base class.

Is this the only/best solution to this problem?



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Build-optimization-issue-tp7586691.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to