Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

A simple Form Options Binder plugin example for loading the month list for a DDL.

Code Block
public class OptionBinder extends FormOptionsBinder implements FormLoadBinder {


 public String getName() {
        // your plugin name
    	return "Simple Form Option Binder";
    }


    public String getVersion() {
     // Here you can add version for your plugin    
	return "1.0.0";
    }


 @Override    public String getLabel() {
    	return "Add Your Label";
    }
   
    public String getDescription() {
    	// Here you can add description for you plugin
    	return "Simple FormOptionBinder plugin used for loading Months";
    }


  public String getPropertyOptions() {
   // if you not wishing to change the default property options just use
   // else you can refer to Git hub for how to set proprtyOptions
     return super.getPropertyOptions();
  }


 public FormRowSet load(Element arg0, String arg1, FormData arg2) {
    	FormRowSet monthRowSet = new FormRowSet();
        FormRow month = null;
         // This example is sample for Loading the months
        String []months = new DateFormatSymbols().getMonths();
	for(int i = 0;i<months.length;i++){
		FormRow month = new FormRow();
		month.put(FormUtil.PROPERTY_LABEL, months[i]);
		month.put(FormUtil.PROPERTY_VALUE, i+1);
		monthRowSet.add(month);
	}
    	return monthRowSet;
    }