简体   繁体   English

如何在GWT中获取父类

[英]How to get parent class in GWT

I have a StudentDashboard.java which contains multiple Student.java panels(rows). 我有一个StudentDashboard.java ,其中包含多个Student.java面板(行)。 In each row, I have an ellipsis which pops-up OptionMenu.java (panel). 在每一行中,都有一个省略号,它弹出OptionMenu.java (面板)。

In OptionMenu.java , I have a remove link which deletes a student from the Db, so on UI, I also want to remove corresponding Student.java panel(row) from the dashboard. OptionMenu.java ,我有一个remove链接,该链接从Db中删除了一个学生,因此在UI上,我也想从仪表板上删除相应的Student.java面板(行)。

The delete logic is in OptionMenu.java . 删除逻辑在OptionMenu.java How can I get corresponding Student.java reference in OptionMenu.java ? 如何在OptionMenu.java获得相应的Student.java参考? So that I can do something like student.removeFromParent() . 这样我就可以执行诸如student.removeFromParent()

Whether delete method should be part of OptionMenu or Student class? 删除方法应属于OptionMenu还是Student类?

If your Studen.java inherit vom the GWT Panel. 如果您的Studen.java继承了VWT面板。 you can use getParent() which will return the parent Widget that your Studen is attached to. 您可以使用getParent()来返回您的Studen所附加的父窗口小部件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM