Use Annotation Based Editor

You are viewing an old version (v. 4) of this page.
The latest version is v. 36, last edited on Feb 18, 2016 (view differences | )
<< View previous version | view page history | view next version >>

QuickBuild uses Apache Wicket as its presentation layer. However, in most cases, plugin developer does not need to learn Wicket as QuickBuild has an editor which is able to automatically generate user interface based on annotations. The editor will generate user interfaces in below areas:

  1. Generate repository view/edit user interface when you write a repository plugin.
  2. Generate step view/edit user interface when you write a step plugin.
  3. Generate plugin setting view/edit user interface when you write a plugin

Here we use plugin setting to explain how to use the editor to generate user interface. As introduced in [Develop QuickBuild Plugin], user can provide a plugin setting class through overriding getPluginSettingClass() method in the plugin class. If provided, this class will be used by QuickBuild to generate plugin setting user interface, and the setting will be saved as an instance of this class and can be retrieved later through getPluginSetting() method when this plugin runs. Let's start with a very simple plugin setting class:

  1. A simple plugin setting class
    public class PluginSetting {
    	public enum FaithType {CHRISTIANISM, CATHOLICISM, BUDDHISM, ISLAMISM, JUDAISM}; 
    	
    	private String name;
    	
    	private FaithType faith;
    	
    	private boolean married;
    	
    	private Date birthday;
    	
    	private int workingYears;
    
    	@Editable(order=100, description="Specify the name")
    	public String getName() {
    		return name;
    	}
    
    	public void setName(String name) {
    		this.name = name;
    	}
    
    	@Editable(order=200, description="Choose your faith")
    	public FaithType getFaith() {
    		return faith;
    	}
    
    	public void setFaith(FaithType faith) {
    		this.faith = faith;
    	}
    
    	@Editable(order=300, name="Are You Married?")
    	public boolean isMarried() {
    		return married;
    	}
    
    	public void setMarried(boolean married) {
    		this.married = married;
    	}
    
    	@Editable(order=400)
    	public Date getBirthday() {
    		return birthday;
    	}
    
    	public void setBirthday(Date birthday) {
    		this.birthday = birthday;
    	}
    
    	@Editable(order=500)
    	public int getWorkingYears() {
    		return workingYears;
    	}
    
    	public void setWorkingYears(int workingYears) {
    		this.workingYears = workingYears;
    	}
    	
    }
    

By specifying the @Editable annotation for getter mthod, that property will be editable through user interface. The generated interface to edit this plugin setting is like below:

Unable to render embedded object: File (editor1.png) not found.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.