Ext


Go Back   Ext JS Forums > Ext General Forums > Gxt: Open Discussion

Reply
 
Thread Tools
  #1  
Old 08-07-2009, 01:01 PM
d95sld95 d95sld95 is offline
Ext User
 
Join Date: Apr 2007
Posts: 13
d95sld95 is on a distinguished road
Default Should GXT implement HasHandlers interfaces?

Are there any plans to implement the HasHandlers interfaces to GXT Button (HasClickHandler) and other GXT components like the native GWT widgets?

Example:

TestView.java

Button button = new Button("Test button");

public HasClickHandlers getTestClickHandlers() {
    return button;
}
TestPresenter.java

public TestPresenter(View view, final EventBus eventBus) {
   view.getTestClickHandlers().addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
         eventBus.fireEvent(new TestAlert());
      }
   }
}
Reply With Quote
  #2  
Old 08-25-2009, 09:40 PM
mraible mraible is offline
Ext GWT Premium Member
 
Join Date: Nov 2007
Posts: 37
mraible is on a distinguished road
Default

I'm interested in this as well. Are there plans to make GXT more MVP-friendly?
Reply With Quote
  #3  
Old 08-26-2009, 02:27 AM
sven sven is offline
Ext GWT - Development Team
 
Join Date: Sep 2007
Location: Germany
Posts: 4,599
sven is on a distinguished road
Default

Quote:
Originally Posted by mraible View Post
I'm interested in this as well. Are there plans to make GXT more MVP-friendly?
The hasHandlers interface are not making GXT anymore MVPfriendly. You can do the same with GXT since the beginning. There are no plans to add them
Reply With Quote
  #4  
Old 08-26-2009, 02:46 AM
mraible mraible is offline
Ext GWT Premium Member
 
Join Date: Nov 2007
Posts: 37
mraible is on a distinguished road
Default

Quote:
Originally Posted by sven View Post
The hasHandlers interface are not making GXT anymore MVPfriendly. You can do the same with GXT since the beginning. There are no plans to add them as that would change the hole system GXT works.
Pardon my ignorance, but how would you suggest the above code be written when using GXT's Button class?
Reply With Quote
  #5  
Old 08-26-2009, 03:31 AM
sven sven is offline
Ext GWT - Development Team
 
Join Date: Sep 2007
Location: Germany
Posts: 4,599
sven is on a distinguished road
Default

public TestPresenter(View view, final EventBus eventBus) {
   view.getComponent().addListener(Events.Select, new Listener<ComponentEvent>() {
       public void handleEvent(ComponentEventce) {  
         eventBus.fireEvent(new TestAlert());
      }
   }
}
Reply With Quote
  #6  
Old 08-26-2009, 03:33 AM
sven sven is offline
Ext GWT - Development Team
 
Join Date: Sep 2007
Location: Germany
Posts: 4,599
sven is on a distinguished road
Default

Instead of the eventbus from GWT you can even use the Dispatcher that is shipped with GXT, also since very long
Reply With Quote
  #7  
Old 08-26-2009, 09:13 AM
sandlee sandlee is offline
Ext User
 
Join Date: Oct 2008
Posts: 2
sandlee is on a distinguished road
Default

GXT should use interfaces like GWT does. Not implicitly HasClickHandlers, but there are much other which were easy to implement: e.g.
  • HasValue
  • Focusable
  • HasText
  • HasCaption
  • HasEnable
  • ...
this would allow us to mock the widgets for unit-tests.
(At the moment, this is impossible. see http://www.extjs.com/forum/showthread.php?t=76756 and http://www.extjs.com/forum/showthread.php?t=63053)
Reply With Quote
  #8  
Old 08-27-2009, 01:27 PM
mraible mraible is offline
Ext GWT Premium Member
 
Join Date: Nov 2007
Posts: 37
mraible is on a distinguished road
Default

Quote:
Originally Posted by sandlee View Post
GXT should use interfaces like GWT does. Not implicitly HasClickHandlers, but there are much other which were easy to implement: e.g.
  • HasValue
  • Focusable
  • HasText
  • HasCaption
  • HasEnable
  • ...
this would allow us to mock the widgets for unit-tests.
(At the moment, this is impossible. see http://www.extjs.com/forum/showthread.php?t=76756 and http://www.extjs.com/forum/showthread.php?t=63053)
I believe the easiest solution to solve this problem is to subclass GXT's Widgets and implement the interfaces. Has anyone done this? If not, maybe we should start an open source project that does this for everyone.

Thoughts?
Reply With Quote
  #9  
Old 09-08-2009, 04:22 PM
abickford abickford is offline
Ext User
 
Join Date: Apr 2008
Posts: 30
abickford is on a distinguished road
Default

This would go a long way towards integrating GXT with other 3rd party GWT libraries.
Reply With Quote
  #10  
Old 10-21-2009, 04:07 PM
misqu's Avatar
misqu misqu is online now
Ext GWT Premium Member
 
Join Date: Aug 2008
Location: Poland
Posts: 34
misqu is on a distinguished road
Send a message via Skype™ to misqu
Default

I also vote for implementing those GWT interfaces in GXT.

As long as MVP pattern becoming more popular in let say "GWT world", different aproach to handling events and obtaining values from GXT widgets seems to be not very practical and confusing, especially when using other widget libraries.

GXT should help us to apply good programing patterns.
__________________
Marcin Misiewicz
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 01:37 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.