Building the Operator Dialog Box

We use the operatorDialog object to define parameters for our operator. These parameters can be text boxes, radio buttons, or any other basic form element.

For all parameters, we always define the ID of the parameter (a string that you will use to refer to the parameter in the code) and the label. The label is what appears to the user on the operator's configuration options. The rest of the options vary depending on the parameter.

For our Column Filter example, we build a checklist of the columns by which the user can filter. To do this, we utilize the addTabularDatasetColumnCheckboxes method.

Prerequisites

You must have created the onPlacement method.

Procedure

  • Add the following code:
    operatorDialog.addTabularDatasetColumnCheckboxes(
     OperatorConstants.parameterID,      // the ID of the operator
     "Columns to keep",                   // the label of the operator 
                                          // (user-visible)
     ColumnFilter.All,                       // this means users can select 
                                          // all of the columns but this
                                          // can also be changed to allow 
                                          // for only numeric/categorical
     "main"                               // this is the selectionGroupID, 
                                          // which is used for validating 
                                          // groups of parameters
    )
    Because we are using the SparkDataFrame template, we can take advantage of their storage configuration by calling:
    super.onPlacement(operatorDialog, operatorDataSourceManager, operatorSchemaManager)

    after the operatorDialog customizations. This calls the superclass (SparkDataFrameGUINode) and applies some default storage and parameter configurations.