The GridOptionsPanel Class

You use the GridOptionsPanel class to display a plug-in’s configuration properties.

The following methods are used with the GridOptionsPanel class when creating a Grid plug-in:

  • public void setGridPlugin(GridPlugin plug-in);

    This method specifies the GridPlugin object whose configuration is displayed in this panel. If “null” is passed, the method sets the panel to show the default configuration data where possible or no configuration data. Otherwise, the method sets the panel to show the passed plug-in’s configuration properties. You should refresh the panel display afterward in either case. The passed GridPlugin object should be stored by the panel. For more information, see methods getGridPlugin() and apply() described below.

  • public GridPlugin getGridPlugin();

    This method returns a GridPlugin object. If the object passed via method setGridPlugin() is stored by the panel, the same object should be returned by getGridPlugin(). Otherwise, the method returns a new GridPlugin object if one can be configured from the data in the panel. If one cannot be configured, the method returns “null.” The associated component editor can use this method to store the configured GridPlugin object from the currently displayed GridOptionsPanel without having to identify the panel type.

  • public boolean apply();

    This method is called when the associated component editor’s OK or Apply button is clicked. First, the method must validate the configuration data entered into this panel. If the GridPlugin object passed via method setGridPlugin() is stored by the panel, after validation this object must be reconfigured from that data if the data are valid. The return value indicates whether the panel contains invalid data. In other words, the method must return “true” if the data are invalid and “false” if the data are valid. The associated component editor can incorporate this error information into its overall OK/Apply/Cancel button response.

  • public void cancel();

    This method is called when the associated component editor’s Cancel button is clicked, as well as when the OK button is clicked when that button is implemented as “Apply + Cancel.” The method should reset the panel to show no configuration data.