-
13 Apr 2012 1:32 AM #1
Component should implements HasEnabled ?
Component should implements HasEnabled ?
Hello,
I think Component class would benefit for implementing HasEnabled interface (there'd be no API change, since Component already has setEnabled(boolean)/isEnabled). The benefit is that when i use the enabled/disabled feature on a view of my MVP, i would declare HasEnabled in my view, and just return the component in the view implementation. For now, i need to wrap the component in a anonymous inner class of type HasEnabled and forward the call to setEnabled/isEnabled into the component's setEnabled/isEnabled.
As an example :
My view
For the view implementation, i need to do the followingCode:public interface View { HasEnabled myOkButton(); interface Presenter { } }
If Component implemented HasEnabled interface, my view implementation would be like the following, which is much much clearer ...Code:public class ViewImpl implements View { private TextButton okButton; @Override public HasEnabled myOkButton() { return new HasEnabled() { @Override public void setEnabled(boolean enabled) { okButton.setEnabled(enabled); } @Override public boolean isEnabled() { return okButton.isEnabled(); } }; } }
ThanksCode:public class ViewImpl implements View { private TextButton okButton; @Override public HasEnabled myOkButton() { return okButton; } }
Hermann
-
13 Apr 2012 11:04 AM #2
Thanks for the report. I've filed an API review ticket and will update this thread with any decision or changes we make. Like you said, Component already implements these methods, so this change seems to make sense at first glance.
-
16 Apr 2012 9:49 AM #3
I've had a chance to review this and have committed the change to SVN as r2619.
-
3 May 2012 4:42 PM #4
The fix for this shortcoming has been included in the public release of Sencha GXT 3.0.0. You should be able to observe this change in our source. Although we're confident that this issue has been resolved, please reply here (or start a new bug thread linking to this one) if you have any issues with this change.
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTGWT-1907
in
3.0.


Reply With Quote