English 中文(简体)
如何在多国企业中开展活动
原标题:How are events implemented in MVP
  • 时间:2012-01-16 07:19:11
  •  标签:
  • gwt
  • mvp

I went through the link, but there it was a bit difficult for me to understand the basic reason as to why

  1. 我们应使用<代码>view.getSaveButton().addClickHandler(......)......,即说我们为什么不能在显示接口中接过? 我从录像中理解的是,在发言中保持观点不是一种良好做法,但很抱歉说,我不理解这个花角如何帮助我们?

  2. 该录像还提到,我们应当使用<条码> 英文/法文>,而不是<条码>代号>。

  3. 他说,他对于不使用<代码>HasClickHandlers()的MVP的理解有分歧,请解释为什么?

我之所以能理解这一点,原因之一是,在这一录像中,谷歌有很多。 如果他使用更通用和更简单的法典使我们理解他的观点,那么我更容易理解。

请赦免我。

最佳回答

(1) 提交者不应依靠“家庭调查”的植被,其原因有:

  • Separating of UI representation in Views and application logic in Presenter
  • Defined in interfaces behaviour of View and Presenter
  • Easy to write Unit-tests for presenter layer
  • Several views(desktop, mobile, e.t.c.) for one presenter

简单一套名为MVP的接口使我们能够将这两级分开:

 

// View interface 
interface View extends AsWidget {

    void setPresenter(Presenter presenter); // cross reference to presenter

    interface Presenter { // presenter must extends from this interface
        void onContactEditClick(); // callback from view handling in presenter without any UI code
    }
}


// View realization (part)
public class ViewImpl extends Composite implements View {

    @UiHandler( someButton ) // or  somelink , e.t.c.
    void onContactEditClick(ClickEvent event) {
        presenter.onContactEditClick();
    }
}

Presenter is isolated from controls that firing events. It can be button, can be link, e.t.c. So it is possible to create several implementations of views(for desktop and mobile platforms for example) with a different set of UI controls in each view and use this views with a one presenter.

rel=“nofollow” 页: 1

2) 名单编制者与数据交换控制有关。 我认为,通过点1样本中的接口方法,最好避免在观众和观众之间使用听众。 事实上,观点接口内的传译员接口是所有来自不同观点的活动的更好的听众。

同样。 HasClick 汉斯人与视角层有关,应当与在场者分开。

问题回答

暂无回答




相关问题
Refresh the UI in gwt

I have created some custom composite widget, which listens to an events (in my case loginEvent). Once the event is caught the state of the widget changes so as the way it should look (in my case I ...

How to create a development/debug and production setup

I recently deployed inadvertently a debug version of our game typrX (typing races at www.typrx.com - try it it s fun). It was quickly corrected but I know it may happen again. After digging on ...

GWT error at runtime: ....style_0 is null

My code works fine in IE 8, but on firefox 3.5, the javascript fails to load. I used firebug to figure out why, and the error I get is (GWT detailed mode) My suspicion is that some style is not ...

GWT s hosted mode not working

I ve been stumped for a while trying to figure out why my GWT demo app isn t working in hosted mode so I went back and downloaded the Google Web Toolkit again, unzipped it and simply went to the ...

How to disable Google Visualizations Tool Tips?

Does anyone know how to disable the tool-tip boxes that popup when a Google Visualizations chart is clicked (Selected)? Following the sample code at Getting Started with Visualizations, the "...

GWT 2 CssResource how to

I have a GWT 1.7 application and I want to upgrade it to GWT 2 Milestone 2. The application uses 2 big external CSS files. In GWT 1.7 I had a public folder and put both the CSS files in the folder and ...

热门标签