- java.lang.Object
-
- bdv.ui.settings.SimpleSettingsPage
-
- All Implemented Interfaces:
SettingsPage
public class SimpleSettingsPage extends Object implements SettingsPage
Helper class to easily put aJPanelas a page into aSettingsPanel.Call
notifyModified()when edits were made in your panel. (This will trigger correct "Cancel", "Apply", and "OK" behaviour by theSettingsPanel.)To specify what should happen on "Apply" (propagate panel edits to your data model) add a
#runOnApplycallback. To specify what should happen on "Cancel" (reset panel contents to your data model) add a#runOnCancelcallback.- Author:
- Tobias Pietzsch
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList<Runnable>runOnApplyprotected ArrayList<Runnable>runOnCancel
-
Constructor Summary
Constructors Constructor Description SimpleSettingsPage(String treePath, JPanel panel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply()Called by theSettingsPanelif user presses "OK" or "Apply".voidcancel()Called by theSettingsPanelif user presses "Cancel".JPanelgetJPanel()StringgetTreePath()Get the path of this page in the settings tree.org.scijava.listeners.Listeners<ModificationListener>modificationListeners()voidnotifyModified()voidonApply(Runnable runnable)voidonCancel(Runnable runnable)
-
-
-
Method Detail
-
getTreePath
public String getTreePath()
Description copied from interface:SettingsPageGet 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:
getTreePathin interfaceSettingsPage- Returns:
- the path.
-
getJPanel
public JPanel getJPanel()
- Specified by:
getJPanelin interfaceSettingsPage
-
notifyModified
public void notifyModified()
-
modificationListeners
public org.scijava.listeners.Listeners<ModificationListener> modificationListeners()
- Specified by:
modificationListenersin interfaceSettingsPage
-
onApply
public void onApply(Runnable runnable)
-
onCancel
public void onCancel(Runnable runnable)
-
cancel
public void cancel()
Description copied from interface:SettingsPageCalled by theSettingsPanelif user presses "Cancel". Should restore any modified state to the original state.- Specified by:
cancelin interfaceSettingsPage
-
apply
public void apply()
Description copied from interface:SettingsPageCalled by theSettingsPanelif user presses "OK" or "Apply". Should commit any modified state.- Specified by:
applyin interfaceSettingsPage
-
-