[英]How to display CustomComponent using the Vaadin Navigator?
I'm using the Vaadin framework, and I'm trying to figure out how to display a CustomComponent with the Navigator.navigateTo() method. 我正在使用Vaadin框架,并且试图弄清楚如何使用Navigator.navigateTo()方法显示CustomComponent。
I have a class 我有一堂课
public class MyView extends CustomComponent implements View {
...
}
It has a Layout member. 它具有布局成员。
When I call navigator.navigateTo("view", new MyView()); 当我调用navigator.navigateTo(“ view”,new MyView()); I don't see anything.
我什么也没看到。
Any ideas on how to display a CustomComponent with the Navigator? 关于如何使用导航器显示CustomComponent的任何想法?
Thanks! 谢谢!
I think the issue here is not the CustomComponent, but the usage of "navigateTo" 我认为这里的问题不是CustomComponent,而是“ navigateTo”的用法
you need sth like this: 您需要这样的东西:
MyUiContent implements ViewDisplay {
private HorizontalLayout mainViewLayout;
public Component init() {
this.mainViewLayout = new HorizontalLayout();
return this.mainViewLayout;
}
@Override
public void showView(View view) {
//handle view display
mainViewLayout.removeAllComponents();
mainViewLayout.addComponent(view);
}
}
And: 和:
MyUi extends UI{
// the rest of the initialization....
@Override
protected void init(VaadinRequest request) {
MyUiContent myUi = new MyUiContent();
setContent(myUi.init());
setNavigator(new Navigator(this, myUi);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.