Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Should GXT implement HasHandlers interfaces?

  1. #1

    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

    Code:
    Button button = new Button("Test button");
    
    public HasClickHandlers getTestClickHandlers() {
        return button;
    }
    TestPresenter.java

    Code:
    public TestPresenter(View view, final EventBus eventBus) {
       view.getTestClickHandlers().addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
             eventBus.fireEvent(new TestAlert());
          }
       }
    }

  2. #2
    Sencha User
    Join Date
    Nov 2007
    Posts
    38

    Default

    I'm interested in this as well. Are there plans to make GXT more MVP-friendly?

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    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

  4. #4
    Sencha User
    Join Date
    Nov 2007
    Posts
    38

    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?

  5. #5
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Code:
    public TestPresenter(View view, final EventBus eventBus) {
       view.getComponent().addListener(Events.Select, new Listener<ComponentEvent>() {
           public void handleEvent(ComponentEventce) {  
             eventBus.fireEvent(new TestAlert());
          }
       }
    }

  6. #6
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Instead of the eventbus from GWT you can even use the Dispatcher that is shipped with GXT, also since very long

  7. #7
    Ext User
    Join Date
    Oct 2008
    Posts
    2

    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)

  8. #8
    Sencha User
    Join Date
    Nov 2007
    Posts
    38

    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?

  9. #9

    Default

    This would go a long way towards integrating GXT with other 3rd party GWT libraries.

  10. #10
    Ext GWT Premium Member misqu's Avatar
    Join Date
    Aug 2008
    Location
    Poland
    Posts
    42

    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

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •