Skip navigation links

Package org.simbrain.world.visionworld.filter.editor

The visionworld.filter.editor package contains classes of the different types of filter editors.

See: Description

Package org.simbrain.world.visionworld.filter.editor Description

The visionworld.filter.editor package contains classes of the different types of filter editors.

Creating a new filter editor

To create a new filter editor, perform the following steps:

  1. Implement the FilterEditor interface. It is helpful but not necessary to extend JPanel, e.g.
  2. public class MyFilterEditor
      extends JPanel
      implements FilterEditor {
    
      public MyFilterEditor() {
        super();
        // add UI components to panel
      }
    
    
      public Component getEditorComponent() {
        // reset UI components and return this
        return this;
      }
    
      public Filter createFilter() throws FilterEditorException {
        try {
          // create instance of MyFilter from values in UI components
          return new MyFilter(...);
        }
        catch (IllegalArgumentException e) {
          // rethrow instantiation exceptions as FilterEditorExceptions
          throw new FilterEditorException(e);
        }
      }
    
      //...
    }
    
  3. Return a reasonable display name for String toString().
    public String toString() {
      return "My filter";
    }
    
  4. Add a public static instance of the filter editor to FilterEditors.
  5. /** My filter editor. */
    public static final FilterEditor MY_FILTER_EDITOR = new MyFilterEditor();
    
  6. Add a reference to that public static instance to the private values array in FilterEditors.
  7. /** Private array of filter editors. */
    private static final FilterEditor[] values = new FilterEditor[] { RANDOM, UNIFORM, MY_FILTER_EDITOR };
    

Skip navigation links