English 中文(简体)
GWT 反射装载表
原标题:GWT Reflection loading Form

我有一个需要为申请创建许多表格的情况,表格都位于同一个包中。它们的名字有:A11111.java,A11112.java等。

当用户在导航Pane 中单击用户时, 我希望将窗体装入标签项目并显示窗体。 问题是我要通过将窗体名称附加到位置上来动态生成窗体的名称, 如字符串窗体Name = “ com.foo. appName. client. forms” + e. getData (“ formCode ”) ; 类似的东西, 即用户点击的事件 。

我研究了几种反省方法,但你无法向他们传递一个衍生的字符串。 如何最好地做到这一点? 几个文章提到使用发电机,但我迷失了试图理清其逻辑,与显示表无关。

请注意,我不会将任何变量传递到表格中, 也不会用 Java 文件的形式称呼任何方法,

提前感谢

最佳回答

如果您通过班级装载器重新瞄准懒惰的加载课程, 就像您在使用 < a href=" http://sourcemaking.com/ deign_patterns/comorder/java/2#" rel="nofollow" > 命令设计模式 时那样, 注意它无法在 GWT 应用程序中完成, 如 < a href=" https:// developers.google.com/web-toolkit/doc/1. 6/RefJreEmultulate" rel="no follow" > JRE 模拟框架只提供JRE < /a > 中可用的类型和/或方法的子集, 因此大多数反射 API - 如 < codection > for () forName > - 将无法使用。

而不是懒惰的加载课程, 从向 DOM 发送懒惰的部件的角度来思考。 这可以通过在模块负荷上对您所有的形式类进行即时处理来实现, 但只能通过制表符切换。 将您所有的自制相关功能都放入 onRender () 回调中, 您可以返回 :

public class FormItem extends TabItem {

    @Override
    protected void onRender(Element parent, int index) {
        super.onRender(parent, index);

        // render related functionality
    }
}
问题回答

暂无回答




相关问题
c# reflection with dynamic class

I need to execute a method "FindAll" in my page. This method returns a list of the object. This is my method that I execute "FindAll". FindAll requires an int and returns an List of these class. ...

Performance overhead of using attributes in .NET

1.. Is there any performance overhead caused by the usage of attributes? Think for a class like: public class MyClass { int Count {get;set;} } where it has 10 attibutes (...

WPF GridView, Display GetType().Name in DisplayMemberBinding

I want include the Type name of each object in my collection from my GridView. I have a collection which has four different types in it that all derive from a base class. Call them, Foo, Bar, Fizz, ...

Testing private method of an abstract class using Reflection

How can I test a private method of an abstract class using reflection (using C#)? I am specifically interested in adapting the code found in this thread. I am aware of the discussion around the ...

Adding Items to ListBox, RadioList, Combobox using reflection

I m trying to add items to a listbox,combobox, radiolist using reflection. The code I have at the moment is as follows: public static Control ConfigureControl(Control control, ControlConfig ctrlconf)...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....