Adding Sections to a JSDL Editor page.

In order to add a new section to a new or existing page of the JSDL editor the following steps should be performed:

  1. Create a new class under eu.geclipse.ui.internal.pages.sections that extends the eu.geclipse.jsdl.ui.internal.page.sections.JsdlFormPageSection class.
  2. The class constructor must be defined and call the createSection() method as follows:
        public NewPageSection( final Composite parent, final FormToolkit toolkit ){
          createSection( parent, toolkit );
        }
        
  3. Implement the createSection() method.
  4. Create the section as follows:
      private void createSection( final Composite parent, final FormToolkit toolkit ) {	    
        String sectionTitle = Messages.getString( "Page_NewPageSectionTitle" );
        String sectionDescription = Messages.getString( "Page_SectionDescription" );
      
        Composite client = FormSectionFactory.createGridStaticSection( toolkit,
                                                                       parent,
                                                                       sectionTitle,
                                                                       sectionDescription,
                                                                       2 );
        ...
        toolkit.paintBordersFor( client );
      }
    		   
  5. Create the necessary widgets for the section in the createSection() method. Make sure that toolkit.paintBordersFor( client ) is the last call in the method.
  6. Implement the public setInput() method for providing input to the section. This method finally must call the fillFields() method of the section class. (See Below)
  7. Implement the private fillFields() method for filling widgets created earlier with values. Proper error handling must be ensured for fields with null values
  8. In the page of the JSDL editor where the section will be created perform the following:
    1. Create a private Composite variable for the new section composite.
    2. Create a new instance variable for the new section class.
    3. Overwrite the createFormContent() method and create the form body as follows:
      @Override
        protected void createFormContent( final IManagedForm managedForm ) {
          
          ScrolledForm form = managedForm.getForm();
          FormToolkit toolkit = managedForm.getToolkit();
          
          form.setText( Messages.getString( "Page_Title" ) );
          this.body = form.getBody();
          this.body.setLayout( FormLayoutFactory.createFormTableWrapLayout( false, 2 ) );
          
          ...    
          }
      
    4. In the createFormContent() method, after creating the body layout create the new section, set the input and register a change listener as follows:
       this.newSectionComposit = toolkit.createComposite( this.body );
       this.newSectionComposit.setLayout( FormLayoutFactory.createFormPaneTableWrapLayout( false, 1 ) );
       this.newSectionComposit.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
       this.newSection = new ApplicationSection( this.newSectionComposit, toolkit);
       this.newSection.setInput( this.jobDefinitionType );
       this.newSection.addListener( this );