Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This guide lists the actions necessary in order to migrate the preferences system from BEAM to SNAP

Step-by-step guide for creating a primary panel

Plug into NetBeans Preferences Dialog and extend it with a primary panel. See here for a tutorial. Anyway, the necessary actions are:

  1. In the module snap-gui, create a controller class extending OptionsPanelController
  2. Annotate the class with OptionsPanelController.TopLevelRegistration and org.openide.util.NbBundle.Messages annotations.
  3. Create a class which extends or wraps JComponent. According to the tutorial, it makes sense to create the methods load(), store(), and valid(), as described in the tutorial.
  4. Implement the abstract methods in the controller class, call the load(), store(), valid()-methods appropriatly
  5. Be sure to have a dependency on the artifact org-netbeans-modules-options-api in the group org.netbeans.api
  6. Maybe you need to do a clean of the snap-gui-module in order to see the extensions in the GUI.
  7. In order to store the user preference somePreference which the user edits in the component someTextField, add a line similar to NbPreferences.forModule(YourPanel.class).put("somePreference", someTextField.getText()) to the store()-method
  8. Add a line similar to someTextField.setText(NbPreferences.forModule(YourPanel.class).get("somePreference", "") to the load()-method in order to load the user preference somePreference.

...

Plug into NetBeans Preferences Dialog and extend it with a secondary panel. See here for a tutorial. Anyway, the necessary actions are: 

  1. In the module snap-gui, create a new package, and a file package-info.java
  2. Within that file, annotate the package with OptionsPanelController.ContainerRegistration
  3. Create a class within the package that extends OptionsPanelController
  4. Annotate it with OptionsPanelController.SubRegistration
  5. As value for the annotation field location use the id you set in step 2.
  6. Do steps 4-8 of the previous section accordingly

Troubleshooting

If your code does not compile due to a Bundle.properties not found error: remove the annotations, compile again, put the annotations in again.

...

After adding a new panel, you'll need to do a mvn clean package. Make is not sufficient, nor is an easy package; clean is mandatory.

Be sure tothat you don't have duplicate display names; see http://stackoverflow.com/q/27376939/2043113.

Clarify

  1. Keep the default NetBeans options?
  2. Design. Suggestion:
    1. Add new primary panel Layer Properties that reflects Layer Properties list in VISAT preferences
    2. Move UI Behavior to new tab under General
    3. Move UI Appearance -> UI Font to Appearance -> Windows
    4. Move Module Repository to General
    5. Merge Product Settings and Geo-location Display, put under tab Geo-location under General
    6. Move Data Input/Output to new Write Options-tab under General
    7. Move RGB-Image Profiles to new tab under General
    8. Move Logging to new tab under General