JFormDesigner 5.0.4 Annotations

com.jformdesigner.annotations
Annotation Type DesignCreate


@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() {
         // ...
     }
 }
 

Since:
5.0


JFormDesigner 5.0.4 Annotations

Copyright (C) 2004-2012 FormDev Software GmbH. All rights reserved.