Skip to content

Commit

Permalink
Fix problem with initially attached Commands (#9275)
Browse files Browse the repository at this point in the history
5 approvals, merged. Thanks @cajus !
  • Loading branch information
cajus authored and hkollmann committed Jun 14, 2019
1 parent 413ddb5 commit e66a073
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions framework/source/class/qx/test/ui/command/Command.js
Expand Up @@ -86,6 +86,8 @@ qx.Class.define("qx.test.ui.command.Command",

testEnabled : function()
{
this.skip("Skipped because not relevant anymore");

// set disabled
this.__cmd.setEnabled(false);
this.assertEquals(this.__cmd.getEnabled(), this.__button.getEnabled());
Expand Down
16 changes: 9 additions & 7 deletions framework/source/class/qx/ui/core/MExecutable.js
Expand Up @@ -82,7 +82,6 @@ qx.Mixin.define("qx.ui.core.MExecutable",
*/
_bindableProperties :
[
"enabled",
"label",
"icon",
"toolTipText",
Expand Down Expand Up @@ -117,13 +116,15 @@ qx.Mixin.define("qx.ui.core.MExecutable",
* @param e {qx.event.type.Event} The execute event of the command.
*/
__onCommandExecute : function(e) {
if (this.__semaphore) {
this.__semaphore = false;
return;
}
if (this.isEnabled()) {
this.__semaphore = true;
this.execute();
if (this.__semaphore) {
this.__semaphore = false;
return;
}
if (this.isEnabled()) {
this.__semaphore = true;
this.execute();
}
}
},

Expand Down Expand Up @@ -167,6 +168,7 @@ qx.Mixin.define("qx.ui.core.MExecutable",
// check also for themed values [BUG #5906]
if (selfPropertyValue == null) {
// update the appearance to make sure every themed property is up to date
this.$$resyncNeeded = true;
this.syncAppearance();
selfPropertyValue = qx.util.PropertyUtil.getThemeValue(
this, property
Expand Down
8 changes: 8 additions & 0 deletions framework/source/class/qx/ui/core/Widget.js
Expand Up @@ -3626,6 +3626,14 @@ qx.Class.define("qx.ui.core.Widget",
}
}

// If the appearance is already synced after the child control
// we need to update the appearance now, because the selector
// might be not correct in certain cases.
if (control.$$resyncNeeded) {
delete control.$$resyncNeeded;
control.updateAppearance();
}

this.fireDataEvent("createChildControl", control);

// Register control and return
Expand Down

0 comments on commit e66a073

Please sign in to comment.