|
JFormDesigner 5.0.4 Annotations | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value=METHOD) @Retention(value=RUNTIME) public @interface DesignCreate
This annotation can be used to mark a static method that should be invoked by JFormDesigner to create instances of the bean, which are then used in the JFormDesigner Design view. The annotated method must be static, must not have parameters and must return the instance of created bean.
Example for using a bean that requires parameters in its constructor:
public class MyBean extends JCompoment { @DesignCreate private static MyBean designCreate() { return new MyBean( "someArgValue" ); } public MyBean( String someArg ) { // ... } }Note: For the above example, you have to use the "Custom Creation Code" property to ensure that JFormDesigner generates compilable code.
Example for using this annotation to initialize the bean with test data for the Design view:
public class MyBean extends JCompoment { @DesignCreate private static MyBean designCreate() { MyBean myBean = new MyBean(); myBean.setData( new SomeDummyDataForDesigning() ); return myBean; } public MyBean() { // ... } }
|
JFormDesigner 5.0.4 Annotations | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |