I see some code duplication in the widget's code, but that can be easily solved:

var RuleInformationWindow = {
  show: function() {
    var ruleWindow = Ext.getCmp('RuleWindow');

    Ext.Panel.prototype.shadow = false;
    if (!ruleWindow) {
      ruleWindow = new Ext.Window({
          title: 'Rule Information'
        , id: 'RuleWindow'
        , layout: 'fit'
        , hideCollapseTool: true
        , closable: true
        , closeAction: 'hide'
        , width: '100%'
        , height: 200
        , stateEvents: ['move', 'resize', 'itemdrag']
        , items: [{
            xtype: 'panel',
            html: 'Panel with an xtype specified',
            id: 'RulePanel'}]
      });
    }

    ruleWindow.show();
    ruleWindow.alignTo(document.body, "tl");
  },

  updateText: function(text) {
    var rulePanel = Ext.get("RulePanel");
    if (rulePanel) {
      rulePanel.update(text);
    }
  }
}

I think it s clean and simple.

-- 
Poetro

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to