Class SimpleSettingsPage

  • All Implemented Interfaces:
    SettingsPage

    public class SimpleSettingsPage
    extends Object
    implements SettingsPage
    Helper class to easily put a JPanel as a page into a SettingsPanel.

    Call notifyModified() when edits were made in your panel. (This will trigger correct "Cancel", "Apply", and "OK" behaviour by the SettingsPanel.)

    To specify what should happen on "Apply" (propagate panel edits to your data model) add a #runOnApply callback. To specify what should happen on "Cancel" (reset panel contents to your data model) add a #runOnCancel callback.

    Author:
    Tobias Pietzsch
    • Constructor Detail

      • SimpleSettingsPage

        public SimpleSettingsPage​(String treePath,
                                  JPanel panel)
    • Method Detail

      • getTreePath

        public String getTreePath()
        Description copied from interface: SettingsPage
        Get the path of this page in the settings tree.

        The path is split at ">" to get the nodes along the settings tree branch.

        Specified by:
        getTreePath in interface SettingsPage
        Returns:
        the path.
      • notifyModified

        public void notifyModified()
      • onApply

        public void onApply​(Runnable runnable)
      • onCancel

        public void onCancel​(Runnable runnable)
      • cancel

        public void cancel()
        Description copied from interface: SettingsPage
        Called by the SettingsPanel if user presses "Cancel". Should restore any modified state to the original state.
        Specified by:
        cancel in interface SettingsPage
      • apply

        public void apply()
        Description copied from interface: SettingsPage
        Called by the SettingsPanel if user presses "OK" or "Apply". Should commit any modified state.
        Specified by:
        apply in interface SettingsPage