[英]Javaxfx: MVP (Supervising Controller) must view keep reference to presenter (controller)
I want to implement MVP (Supervising Controller) with JavaFX. 我想用JavaFX实现MVP(监督控制器)。 I've studied several examples in internet and saw that view keep reference to presenter.
我已经研究了互联网上的几个示例,并看到该视图一直与演示者保持联系。 Is this right?
这是正确的吗?
I thought that view should not know about presenter at all. 我认为这个观点完全不应该关于主持人。 There is biderectional data binding between view and model VIEW<->MODEL although view doesn't keep reference to model.
尽管视图未始终引用模型,但视图和模型VIEW <-> MODEL之间存在投标数据绑定。 And presenter (controller) which knows about view (but works with view via interface) and model and handles all events.
演示者(控制器)知道视图(但通过接口与视图一起使用)并建模并处理所有事件。 Model knows neither view nor presenter.
模型既不了解视图,也不了解演示者。
I usually explain the difference as follows: 我通常解释如下差异:
If you're using FXML, you're most likely using Passive View, as FXML cannot specify any logic (other than maybe a name of a controller class and names of event handler methods) and your controller is responsible for setting up the view and maintaining it. 如果您使用的是FXML,则最有可能使用Passive View,因为FXML无法指定任何逻辑(可能不是控制器类的名称和事件处理程序方法的名称),并且您的控制器负责设置视图和维护它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.